diff --git a/api/user.js b/api/user.js
index a81879d..e9b5db0 100644
--- a/api/user.js
+++ b/api/user.js
@@ -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)
diff --git a/pages/user/index.vue b/pages/user/index.vue
index bf29f68..2cea6a9 100644
--- a/pages/user/index.vue
+++ b/pages/user/index.vue
@@ -29,12 +29,13 @@
客服
+
会员码
-
+
分销码
@@ -553,8 +554,8 @@
我的专属分销识别码
-
-
+
+
{{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;
},