会员码与分销码

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", todoCounts: "order/todoCounts",
delUser: "user/delete", 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) => { export const delUser = (param) => {
return request.post(api.delUser, param) return request.post(api.delUser, param)

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

Loading…
Cancel
Save