Merge branch 'dev' of https://e.coding.net/g-cphe0354/xiaochengxusaomadiancan/cashier_weapp into gaohao
This commit is contained in:
@@ -41,7 +41,8 @@
|
||||
this.switchdata = false
|
||||
uni.cache.set('userInfo', resdata .data);
|
||||
uni.pro.redirectTo('/pages/member/index', {
|
||||
shopId: uni.cache.get('shopUser')
|
||||
shopId: this.shopId,
|
||||
type: 'index'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -67,17 +67,94 @@
|
||||
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.shopId = e.shopId
|
||||
if (e.type == 'list') { //从列表进来的
|
||||
this.paygetShopByMember(e.shopId)
|
||||
} else {
|
||||
this.paygetShopByMember(e.shopId)
|
||||
async onLoad(e) {
|
||||
console.log(e)
|
||||
// if ( e.type == 'list' || e.type == 'index') {
|
||||
// this.shopId = e.shopId;
|
||||
// this.init();
|
||||
// }
|
||||
if (e.q) {
|
||||
this.shopId = this.getQueryString(decodeURIComponent(e.q), 'shopId')
|
||||
this.tokenShow = false;
|
||||
// 等待登录结果返回
|
||||
if (!uni.cache.get('token')) {
|
||||
await this.$onLaunched;
|
||||
}
|
||||
this.init();
|
||||
} else{
|
||||
this.shopId = e.shopId;
|
||||
this.init();
|
||||
}
|
||||
this.paygetActive(e.shopId) //列表
|
||||
|
||||
console.log(this.shopId)
|
||||
},
|
||||
methods: {
|
||||
async init() {
|
||||
let res = await this.api.shopUserInfo({
|
||||
"shopId": this.shopId,
|
||||
"userId": uni.cache.get('userInfo').id,
|
||||
})
|
||||
if (res.code == 0) {
|
||||
this.usershopUserinfo = res.data
|
||||
}
|
||||
if ( this.usershopUserinfo.isVip == 0 ) {
|
||||
this.memberOpen = true;
|
||||
return;
|
||||
}
|
||||
this.paygetShopByMember(this.shopId)
|
||||
this.paygetActive()
|
||||
},
|
||||
memberCancel () {
|
||||
let pages = getCurrentPages()
|
||||
if ( pages.length > 1) {
|
||||
uni.navigateBack()
|
||||
} else {
|
||||
uni.exitMiniProgram({
|
||||
success: function () {
|
||||
console.log('退出成功');
|
||||
},
|
||||
fail: function () {
|
||||
console.log('退出失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
sumbit(d) {
|
||||
if (d.detail.iv) {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: async (data) => {
|
||||
let res = await this.api.userwxlogins({
|
||||
code: data.code,
|
||||
encryptedData: d.detail.encryptedData,
|
||||
iv: d.detail.iv,
|
||||
shopId: this.shopId
|
||||
})
|
||||
if (res.code == 0) {
|
||||
let resdata = await this.api.loginwxuserInfo({
|
||||
userId: uni.cache.get('userInfo').id
|
||||
})
|
||||
if (resdata.code == 0) {
|
||||
uni.cache.set('userInfo', resdata .data);
|
||||
this.memberOpen = false
|
||||
this.paygetShopByMember(this.shopId)
|
||||
this.paygetActive()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
getQueryString(url, name) { //解码
|
||||
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
|
||||
var r = url.substr(1).match(reg)
|
||||
if (r != null) {
|
||||
return r[2]
|
||||
}
|
||||
return null;
|
||||
},
|
||||
async paygetShopByMember(w) {
|
||||
let res = await this.api.paygetShopByMember({
|
||||
page: 1,
|
||||
@@ -93,6 +170,7 @@
|
||||
page: 1,
|
||||
pageSize: 10
|
||||
})
|
||||
|
||||
try {
|
||||
this.listdata = res.data.list
|
||||
this.amount = res.data.list[0].minNum
|
||||
@@ -138,9 +216,19 @@
|
||||
title: "支付成功"
|
||||
})
|
||||
uni.hideLoading()
|
||||
setTimeout(res => {
|
||||
uni.navigateBack()
|
||||
}, 500)
|
||||
let pages = getCurrentPages()
|
||||
if ( pages.length > 1) {
|
||||
setTimeout(res => {
|
||||
uni.navigateBack()
|
||||
}, 500)
|
||||
} else {
|
||||
setTimeout(res => {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}, 500)
|
||||
}
|
||||
|
||||
},
|
||||
fail: (res) => {
|
||||
uni.hideLoading()
|
||||
|
||||
Reference in New Issue
Block a user