会员码与分销码

version/0412
shuxiaoquan 9 months ago
parent db6fff0996
commit 2cada37803
  1. 11
      api/user.js
  2. 70
      pages/user/index.vue

@ -9,6 +9,17 @@ const api = {
todoCounts: "order/todoCounts",
delUser: "user/delete",
}
// 邀请码
export const getDealerInviteQrcode = (param) => {
return request.post('user/getDealerInviteQrcode', param)
}
// 会员码
export const getMembershipInviteQrcode = (param) => {
return request.post('user/getMembershipInviteQrcode', param)
}
// 注销
export const delUser = (param) => {
return request.post(api.delUser, param)

@ -29,12 +29,13 @@
<text lines="1" class="text_2">客服</text>
<button open-type="contact" v-if="isLogin"></button>
</view>
<!-- / -->
<view class="group_4" @click="lookMemberCode('2')" v-if="userInfo.user_type == 20">
<image :src="$picUrl+'/static/user/code.png'" class="thumbnail_2"></image>
<text lines="1" class="text_3">会员码</text>
</view>
<!-- -->
<view class="group_5" @click="lookMemberCode('3')" v-if="userInfo.user_type == 30">
<view class="group_5" @click="lookMemberCode('3')" v-if="userInfo.user_type == 30">
<image :src="$picUrl+'/static/user/code.png'" class="thumbnail_3"></image>
<text lines="1" class="text_4">分销码</text>
</view>
@ -553,8 +554,8 @@
<text v-if="lookMemberType == 3">我的专属分销识别码</text>
</view>
<view class="codeImg">
<image v-if="lookMemberType == 2" :src="userInfo.qrcode" class="img"></image>
<image v-if="lookMemberType == 3" :src="userInfo.qrcode" class="img"></image>
<image v-if="lookMemberType == 2" :src="qrcode" class="img"></image>
<image v-if="lookMemberType == 3" :src="qrcode" class="img"></image>
</view>
<view class="codeName">
{{userInfo.user_id}}
@ -575,6 +576,9 @@
export default {
data() {
return {
dealerInviteQrcode: "",
qrcode: "",
inviteQrcode: "",
lookMemberType: 2,
isTop: false,
background: {
@ -654,14 +658,22 @@
.then(result => {
let data = result.data.userInfo
console.log("data.user_id",data.user_id)
data.qrcode = createQrCodeImg(data.user_id.toString(), {
'size': 500
});
// data.qrcode = createQrCodeImg(data.user_id.toString(), {
// 'size': 500
// });
console.log(data)
that.userInfo = data
that.getOrderInfo();
that.getActionCountsInfo();
uni.setStorageSync('userInfo', that.userInfo)
if(data.user_type == 20){
that.getMembershipInviteQrcode()
}else if(data.user_type == 30){
that.getDealerInviteQrcode()
}
// that.getMembershipInviteQrcode()
// that.getDealerInviteQrcode()
resolve(that.userInfo)
})
.catch(err => {
@ -674,7 +686,50 @@
})
})
},
//
getMembershipInviteQrcode() {
const that = this
return new Promise((resolve, reject) => {
!that.isLogin ? resolve(null) : UserApi.getMembershipInviteQrcode({}, {
load: that.isFirstload
})
.then(result => {
that.inviteQrcode = result.message;
console.log(this.inviteQrcode)
resolve(that.inviteQrcode)
})
.catch(err => {
if (err.result && err.result.status == 401) {
that.isLogin = false
resolve(null)
} else {
reject(err)
}
})
})
},
//
getDealerInviteQrcode() {
const that = this
return new Promise((resolve, reject) => {
!that.isLogin ? resolve(null) : UserApi.getDealerInviteQrcode({}, {
load: that.isFirstload
})
.then(result => {
that.dealerInviteQrcode = result.message
console.log(this.dealerInviteQrcode)
resolve(that.dealerInviteQrcode)
})
.catch(err => {
if (err.result && err.result.status == 401) {
that.isLogin = false
resolve(null)
} else {
reject(err)
}
})
})
},
//
getOrderInfo() {
const that = this
@ -790,6 +845,7 @@
return;
}
this.lookMemberType = val;
this.qrcode = val ==2?this.inviteQrcode:this.dealerInviteQrcode;
this.memberCode = true;
},

Loading…
Cancel
Save