修改:兑换码和邀请码扫码后的处理方式
This commit is contained in:
parent
f5d9288bf5
commit
99f678e3f4
|
|
@ -468,9 +468,12 @@
|
||||||
identityCurrent:{},
|
identityCurrent:{},
|
||||||
identityCurrentName: '',
|
identityCurrentName: '',
|
||||||
integral_surplus: '',
|
integral_surplus: '',
|
||||||
|
// 页面参数
|
||||||
|
options: {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
this.options = options || {};
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.setSwiperHeight(); // 动态设置 swiper 的高度
|
this.setSwiperHeight(); // 动态设置 swiper 的高度
|
||||||
});
|
});
|
||||||
|
|
@ -490,24 +493,31 @@
|
||||||
this.activeRouter = '/' + curRoute
|
this.activeRouter = '/' + curRoute
|
||||||
this.getNav();
|
this.getNav();
|
||||||
if (that.isLogin) {
|
if (that.isLogin) {
|
||||||
this.getUserInfo();
|
this.init();
|
||||||
this.orderNum();
|
|
||||||
this.getIdentityList();
|
|
||||||
this.shareholdersIntegralInfo();
|
|
||||||
} else {
|
} else {
|
||||||
// this.userInfo = {
|
|
||||||
// is_svip: 0
|
|
||||||
// }
|
|
||||||
this.orderMenu.forEach(v=>{
|
this.orderMenu.forEach(v=>{
|
||||||
v.num = 0
|
v.num = 0
|
||||||
})
|
})
|
||||||
this.getMyMenus();
|
this.getMyMenus();
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.showSkeleton = false
|
this.showSkeleton = false
|
||||||
}, 500)
|
}, 500)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
init(){
|
||||||
|
this.getUserInfo();
|
||||||
|
this.orderNum();
|
||||||
|
this.getIdentityList();
|
||||||
|
this.shareholdersIntegralInfo();
|
||||||
|
this.getMyMenus();
|
||||||
|
// 参数处理
|
||||||
|
let q = this.options.q || '';
|
||||||
|
if (q) {
|
||||||
|
let params = this.$util.getUrlParams(decodeURIComponent(q));
|
||||||
|
this.scanCodeResultHandle(params);
|
||||||
|
}
|
||||||
|
},
|
||||||
authTo(url){
|
authTo(url){
|
||||||
if(this.isLogin){
|
if(this.isLogin){
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
|
@ -634,11 +644,7 @@
|
||||||
},
|
},
|
||||||
// 授权回调
|
// 授权回调
|
||||||
onLoadFun(data) {
|
onLoadFun(data) {
|
||||||
this.getUserInfo();
|
this.init();
|
||||||
this.getMyMenus();
|
|
||||||
this.orderNum();
|
|
||||||
this.getIdentityList();
|
|
||||||
this.shareholdersIntegralInfo();
|
|
||||||
this.isShowAuth = false;
|
this.isShowAuth = false;
|
||||||
},
|
},
|
||||||
Setting: function() {
|
Setting: function() {
|
||||||
|
|
@ -855,90 +861,97 @@
|
||||||
success(res) {
|
success(res) {
|
||||||
let result = res.result || '';
|
let result = res.result || '';
|
||||||
let params = result ? _this.$util.getUrlParams(result) : {};
|
let params = result ? _this.$util.getUrlParams(result) : {};
|
||||||
let type = params.type || '';
|
_this.scanCodeResultHandle(params);
|
||||||
// console.log("二维码内容", {result: result, params: params})
|
|
||||||
// 根据类型进行对应的处理
|
|
||||||
switch (type) {
|
|
||||||
// 邀请码
|
|
||||||
case 'invite':
|
|
||||||
inviteCodeInfo({
|
|
||||||
exchange_code: params.code
|
|
||||||
}).then(res => {
|
|
||||||
if (res.status == 200) {
|
|
||||||
let data = res.data || {};
|
|
||||||
let status = Number(data.status);
|
|
||||||
// 状态:0=未激活,1=已激活,2=已使用,3=作废
|
|
||||||
switch (status){
|
|
||||||
case 0:
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/users/invitation_code/activation?code=' + params.code
|
|
||||||
})
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/users/invitation_code/use?code=' + params.code
|
|
||||||
})
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
_this.$util.Tips({title: '邀请码已使用'});
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
_this.$util.Tips({title: '邀请码已作废'});
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
_this.$util.Tips({title: '无效的邀请码'});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).catch(err => {
|
|
||||||
_this.$util.Tips({title: err});
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
// 兑换码
|
|
||||||
case 'exchange':
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/users/invitation_code/exchange?code=' + params.code
|
|
||||||
})
|
|
||||||
/*
|
|
||||||
// 线下缴费 这里直接免费开通 已于2024-6-19 弃用
|
|
||||||
|
|
||||||
uni.showModal({
|
|
||||||
title: '确认使用!',
|
|
||||||
content: '使用后当前兑换码将立即生效!是否确认使用?',
|
|
||||||
showCancel: true, // 是否显示取消按钮
|
|
||||||
cancelText: '取消', // 取消按钮文字
|
|
||||||
confirmText: '立即使用', // 确认按钮文字
|
|
||||||
success: (res) => {
|
|
||||||
if (res.confirm) {
|
|
||||||
vipExchangeCode({
|
|
||||||
exchange_code: result
|
|
||||||
}).then(res => {
|
|
||||||
if (res.status == 200) {
|
|
||||||
uni.showModal({
|
|
||||||
title: '开通成功',
|
|
||||||
success: (res) => {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/annex/vip_center/index'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}).catch(err => {
|
|
||||||
_this.$util.Tips({title: err});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (res.cancel) {
|
|
||||||
console.log("取消")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
fail(res) {
|
fail(res) {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 扫码 - 结果出来
|
||||||
|
scanCodeResultHandle(params){
|
||||||
|
let _this = this;
|
||||||
|
// console.log("二维码内容", {result: result, params: params})
|
||||||
|
let type = params.type || '';
|
||||||
|
// 根据类型进行对应的处理
|
||||||
|
switch (type) {
|
||||||
|
// 邀请码
|
||||||
|
case 'invite':
|
||||||
|
inviteCodeInfo({
|
||||||
|
exchange_code: params.code
|
||||||
|
}).then(res => {
|
||||||
|
if (res.status == 200) {
|
||||||
|
let data = res.data || {};
|
||||||
|
let status = Number(data.status);
|
||||||
|
// 状态:0=未激活,1=已激活,2=已使用,3=作废
|
||||||
|
switch (status){
|
||||||
|
case 0:
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/users/invitation_code/activation?code=' + params.code
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/users/invitation_code/use?code=' + params.code
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
_this.$util.Tips({title: '邀请码已使用'});
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
_this.$util.Tips({title: '邀请码已作废'});
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
_this.$util.Tips({title: '无效的邀请码'});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
_this.$util.Tips({title: err});
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
// 兑换码
|
||||||
|
case 'exchange':
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/users/invitation_code/exchange?code=' + params.code
|
||||||
|
})
|
||||||
|
/*
|
||||||
|
// 线下缴费 这里直接免费开通 已于2024-6-19 弃用
|
||||||
|
|
||||||
|
uni.showModal({
|
||||||
|
title: '确认使用!',
|
||||||
|
content: '使用后当前兑换码将立即生效!是否确认使用?',
|
||||||
|
showCancel: true, // 是否显示取消按钮
|
||||||
|
cancelText: '取消', // 取消按钮文字
|
||||||
|
confirmText: '立即使用', // 确认按钮文字
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
vipExchangeCode({
|
||||||
|
exchange_code: result
|
||||||
|
}).then(res => {
|
||||||
|
if (res.status == 200) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '开通成功',
|
||||||
|
success: (res) => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/annex/vip_center/index'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
_this.$util.Tips({title: err});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (res.cancel) {
|
||||||
|
console.log("取消")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});*/
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
_this.$util.tips({ content: '无法识别!'});
|
||||||
|
}
|
||||||
|
},
|
||||||
// 餐费积分 - 获取当前用户可用餐费积分
|
// 餐费积分 - 获取当前用户可用餐费积分
|
||||||
shareholdersIntegralInfo(){
|
shareholdersIntegralInfo(){
|
||||||
let _this = this;
|
let _this = this;
|
||||||
|
|
@ -950,7 +963,6 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
onPullDownRefresh: function(){
|
onPullDownRefresh: function(){
|
||||||
this.getNav();
|
this.getNav();
|
||||||
|
|
|
||||||
|
|
@ -751,6 +751,10 @@ export default {
|
||||||
*/
|
*/
|
||||||
// #ifdef MP
|
// #ifdef MP
|
||||||
getUrlParams: function(param, k, p) {
|
getUrlParams: function(param, k, p) {
|
||||||
|
// 清除问号前的内容
|
||||||
|
const index = param.indexOf('?');
|
||||||
|
if (index >= 0) param = param.substring(index + 1);
|
||||||
|
|
||||||
if (typeof param != 'string') return {};
|
if (typeof param != 'string') return {};
|
||||||
k = k ? k : '&'; //整体参数分隔符
|
k = k ? k : '&'; //整体参数分隔符
|
||||||
p = p ? p : '='; //单个参数分隔符
|
p = p ? p : '='; //单个参数分隔符
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue