1、新增旧货市场
2、新增用户等级
This commit is contained in:
+246
-178
@@ -1,189 +1,257 @@
|
||||
<template>
|
||||
<view class="yaoqing">
|
||||
<view class="title">邀请新用户免费兑换会员</view>
|
||||
<view class="p2">
|
||||
<view class="item">
|
||||
<view class="text">共邀请<text class="red">7</text>人</view>
|
||||
<view class="btn">邀请列表</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="text">我的邀请码</view>
|
||||
<text class="red">12456</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="p3">
|
||||
<view class="item" v-for="item in huiyuan">
|
||||
<view class="t">{{item.title}}</view>
|
||||
<view class="b">{{item.subtitle}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="p4">
|
||||
<view class="wrapper">
|
||||
<view class="bg" :style="`width: ${p}%;`"></view>
|
||||
</view>
|
||||
<view class="tip" :style="`left: ${p}%;`">已邀请7人</view>
|
||||
</view>
|
||||
<view class="btns">
|
||||
<view class="btn">复制邀请码</view>
|
||||
<view class="btn red" @click="openDuihuan">兑换会员</view>
|
||||
</view>
|
||||
|
||||
<el-dialog
|
||||
title="请选择要兑换的会员"
|
||||
:visible.sync="dialogVisible"
|
||||
width="30%"
|
||||
:before-close="handleClose">
|
||||
<view class="p3">
|
||||
<view class="item" v-for="(item,index) in huiyuan" :key="index" :class="index == current ? 'active' : ''" @click="onSelect(index)">
|
||||
<view class="t">{{item.title}}</view>
|
||||
<view class="b">{{item.subtitle}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<view class="yaoqing">
|
||||
<view class="title">邀请新用户免费兑换会员</view>
|
||||
<view class="p2">
|
||||
<view class="item">
|
||||
<view class="text">共邀请
|
||||
<text class="red">{{ user.inviteNum }}</text>
|
||||
人
|
||||
</view>
|
||||
<view class="btn">邀请列表</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="text">我的邀请码</view>
|
||||
<text class="red">{{ user.my_invite_code }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="p3">
|
||||
<view v-for="(item, index) in userLevelList" :key="index">
|
||||
<view class="item" v-if="item.recommendUpgrade && parseInt(item.recommendUpgrade) > 0">
|
||||
<view class="t">{{ item.name }}</view>
|
||||
<view class="b">{{ item.upgradeDesc }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="p4">
|
||||
<view class="wrapper">
|
||||
<view class="bg" :style="`width: ${progress}%;`"></view>
|
||||
</view>
|
||||
<view class="tip" :style="`left: ${progress}%;`">已邀请{{ user.inviteNum }}人</view>
|
||||
</view>
|
||||
<view class="btns">
|
||||
<view class="btn pointer" @click="copy">复制邀请码</view>
|
||||
<view class="btn red pointer" @click="openDuihuan">兑换会员</view>
|
||||
</view>
|
||||
|
||||
<el-dialog
|
||||
title="请选择要兑换的会员"
|
||||
:visible.sync="dialogVisible"
|
||||
width="30%"
|
||||
:before-close="handleClose">
|
||||
<view class="p3">
|
||||
<view v-for="(item, index) in userLevelList" :key="index">
|
||||
<view class="item pointer"
|
||||
v-if="item.recommendUpgrade && parseInt(item.recommendUpgrade) > 0"
|
||||
:class="index == current ? 'active' : ''" @click="onSelect(item, index)">
|
||||
<view class="t">{{ item.name }}</view>
|
||||
<view class="b">{{ item.upgradeDesc }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="dialogVisible = false">确定兑换</el-button>
|
||||
<el-button type="primary" @click="exchangeUpgrade">确定兑换</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</view>
|
||||
</el-dialog>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
huiyuan:[
|
||||
{title:'黄金vip LV1',subtitle:'邀请4人可兑换'},
|
||||
{title:'铂金vip LV1',subtitle:'邀请6人可兑换'},
|
||||
{title:'钻石vip LV1',subtitle:'邀请9人可兑换'},
|
||||
],
|
||||
p:45,
|
||||
current: 0,
|
||||
dialogVisible: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openDuihuan(){
|
||||
this.dialogVisible = true
|
||||
},
|
||||
handleClose(){
|
||||
this.dialogVisible = false
|
||||
},
|
||||
onSelect(index){
|
||||
this.current = index
|
||||
}
|
||||
}
|
||||
}
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
progress: 0,
|
||||
current: 0,
|
||||
dialogVisible: false,
|
||||
user: this.vk.getVuex('$user.userInfo'),
|
||||
userLevelList: [],
|
||||
maxUpgradeNum: 100
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openDuihuan() {
|
||||
this.dialogVisible = true
|
||||
},
|
||||
handleClose() {
|
||||
this.dialogVisible = false
|
||||
},
|
||||
onSelect(item, index) {
|
||||
if (parseInt(this.user.inviteNum) >= item.recommendUpgrade && item.level > parseInt(this.user.userLevel)) this.current = index
|
||||
},
|
||||
copy() {
|
||||
const url = window.location.origin + `/#/pages/auth/register/register?code=${this.user.my_invite_code}`
|
||||
document.oncopy = function (e) {
|
||||
e.clipboardData.setData('text', url);
|
||||
e.preventDefault();
|
||||
document.oncopy = null;
|
||||
}
|
||||
document.execCommand('Copy');
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '邀请码已复制'
|
||||
})
|
||||
},
|
||||
getUserLevelList() {
|
||||
vk.callFunction({
|
||||
url: 'client/userLevel/pub/getList',
|
||||
data: {
|
||||
pageIndex: 1,
|
||||
pageSize: 200
|
||||
},
|
||||
success: (data) => {
|
||||
this.userLevelList = data.rows
|
||||
this.userLevelList.forEach(item => {
|
||||
if (item.recommendUpgrade && parseInt(item.recommendUpgrade) > 0)
|
||||
this.maxUpgradeNum = Math.max(this.maxUpgradeNum, item.recommendUpgrade)
|
||||
})
|
||||
this.progress = parseInt(this.vk.getVuex('$user.userInfo').inviteNum) / this.maxUpgradeNum * 100
|
||||
}
|
||||
});
|
||||
},
|
||||
async exchangeUpgrade(){
|
||||
await vk.callFunction({
|
||||
url: 'client/user/kh/exchangeUpgrade',
|
||||
data: {
|
||||
id: this.userLevelList[this.current]._id
|
||||
}
|
||||
});
|
||||
this.$message({
|
||||
type:'success',
|
||||
message: '兑换成功'
|
||||
})
|
||||
this.dialogVisible = false
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getUserLevelList()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.yaoqing{
|
||||
padding: 100upx;
|
||||
background-color: #fff;
|
||||
.title{
|
||||
font-size: 50upx;
|
||||
color: #A92924;
|
||||
}
|
||||
.p2{
|
||||
margin-top: 80upx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.item{
|
||||
display: flex;align-items: center;
|
||||
font-size: 30upx;
|
||||
margin-right: 100upx;
|
||||
text.red{
|
||||
color: #A92924;
|
||||
}
|
||||
.btn{
|
||||
margin-left:10upx;
|
||||
padding: 4upx 10upx;
|
||||
border-radius: 10upx;
|
||||
color: #fff;
|
||||
background-color: #ff8100;
|
||||
font-size: 24upx;
|
||||
.yaoqing {
|
||||
padding: 100upx;
|
||||
background-color: #fff;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.p3{
|
||||
margin-top: 80upx;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
.item{
|
||||
width: 250upx;
|
||||
height: 180upx;
|
||||
border-radius: 10upx;
|
||||
box-shadow: 1px 1px 5px 1px #A92924;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 24upx;
|
||||
color: #A92924;
|
||||
.t{
|
||||
font-size: 30upx;
|
||||
}
|
||||
}
|
||||
.active{
|
||||
background-color: #A92924;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
.p4{
|
||||
margin-top: 80upx;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
.wrapper{
|
||||
position: relative;
|
||||
height: 30upx;
|
||||
border-radius: 15upx;
|
||||
overflow: hidden;
|
||||
background-color: #ddd;
|
||||
}
|
||||
.bg{
|
||||
position: absolute;
|
||||
// width: 50%;
|
||||
height: 100%;
|
||||
background-color: #A92924;
|
||||
}
|
||||
.tip{
|
||||
position: absolute;
|
||||
// left: 45%;
|
||||
top: -15upx;
|
||||
transform: translateX(-5%);
|
||||
padding: 0 20upx;
|
||||
height: 60upx;
|
||||
line-height: 60upx;
|
||||
border-radius: 30upx;
|
||||
background-color: #A92924;
|
||||
color: #fff;
|
||||
font-size: 26upx;
|
||||
}
|
||||
}
|
||||
|
||||
.btns{
|
||||
margin-top: 80upx;
|
||||
display: flex;
|
||||
.btn{
|
||||
width: 360upx;
|
||||
height: 80upx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 30upx;
|
||||
border: 1px solid #A92924;
|
||||
}
|
||||
.btn.red{
|
||||
margin-left: 200upx;
|
||||
color: #fff;
|
||||
background-color: #A92924;
|
||||
}
|
||||
}
|
||||
}
|
||||
.dialog-select{
|
||||
.item{
|
||||
}
|
||||
}
|
||||
.title {
|
||||
font-size: 50upx;
|
||||
color: #A92924;
|
||||
}
|
||||
|
||||
.p2 {
|
||||
margin-top: 80upx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 30upx;
|
||||
margin-right: 100upx;
|
||||
|
||||
text.red {
|
||||
color: #A92924;
|
||||
}
|
||||
|
||||
.btn {
|
||||
margin-left: 10upx;
|
||||
padding: 4upx 10upx;
|
||||
border-radius: 10upx;
|
||||
color: #fff;
|
||||
background-color: #ff8100;
|
||||
font-size: 24upx;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.p3 {
|
||||
margin-top: 80upx;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
|
||||
.item {
|
||||
width: 250upx;
|
||||
height: 180upx;
|
||||
border-radius: 10upx;
|
||||
box-shadow: 1px 1px 5px 1px #A92924;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 24upx;
|
||||
color: #A92924;
|
||||
|
||||
.t {
|
||||
font-size: 30upx;
|
||||
}
|
||||
}
|
||||
|
||||
.active {
|
||||
background-color: #A92924;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
.p4 {
|
||||
margin-top: 80upx;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
|
||||
.wrapper {
|
||||
position: relative;
|
||||
height: 30upx;
|
||||
border-radius: 15upx;
|
||||
overflow: hidden;
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
.bg {
|
||||
position: absolute;
|
||||
// width: 50%;
|
||||
height: 100%;
|
||||
background-color: #A92924;
|
||||
}
|
||||
|
||||
.tip {
|
||||
position: absolute;
|
||||
// left: 45%;
|
||||
top: -15upx;
|
||||
transform: translateX(-5%);
|
||||
padding: 0 20upx;
|
||||
height: 60upx;
|
||||
line-height: 60upx;
|
||||
border-radius: 30upx;
|
||||
background-color: #A92924;
|
||||
color: #fff;
|
||||
font-size: 26upx;
|
||||
}
|
||||
}
|
||||
|
||||
.btns {
|
||||
margin-top: 80upx;
|
||||
display: flex;
|
||||
|
||||
.btn {
|
||||
width: 360upx;
|
||||
height: 80upx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 30upx;
|
||||
border: 1px solid #A92924;
|
||||
}
|
||||
|
||||
.btn.red {
|
||||
margin-left: 200upx;
|
||||
color: #fff;
|
||||
background-color: #A92924;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dialog-select {
|
||||
.item {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user