Merge branch 'wwz_d' of https://e.coding.net/g-cphe0354/xiaochengxusaomadiancan/cashier_weapp into dev
This commit is contained in:
commit
16fa1dae73
31
App.vue
31
App.vue
|
|
@ -19,32 +19,11 @@
|
|||
// console.log('App Hide');
|
||||
},
|
||||
methods: {
|
||||
async userlogin() {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (data) => {
|
||||
uni.getUserInfo({
|
||||
provider: 'weixin',
|
||||
success: async (infoRes) => {
|
||||
uni.cache.set('weixincode', data.code);
|
||||
let res = await this.api.userwxlogin({
|
||||
code: uni.cache.get('weixincode'), //临时登录凭证
|
||||
rawData: infoRes.rawData,
|
||||
})
|
||||
if (res.code == 0) {
|
||||
uni.cache.set('token', res.data.token);
|
||||
uni.cache.set('miniAppOpenId', res.data.userInfo
|
||||
.miniAppOpenId)
|
||||
uni.cache.set('userInfo', res.data.userInfo);
|
||||
}
|
||||
},
|
||||
fail: (err) => {}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
userlogin() {
|
||||
if (!uni.cache.get('token')) {
|
||||
this.$store.dispatch("loginEvent"); //获取shapid
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import {
|
||||
fill
|
||||
} from "lodash"
|
||||
|
||||
import store from "../store"
|
||||
const preCacheKeyClearFetch = 'storage:clear:fetch:'
|
||||
|
||||
uni.pro.interceptor('request', {
|
||||
|
|
@ -104,17 +104,14 @@ async function request(options) {
|
|||
if (res.code != 0) {
|
||||
if (res.code == -4) {
|
||||
uni.showToast({
|
||||
title: res.message || res.msg,
|
||||
icon: "none"
|
||||
// success: () => {
|
||||
// setTimeout(res => {
|
||||
// uni.cache.set('token', '');
|
||||
// uni.redirectTo({
|
||||
// url: '/pages/login/login'
|
||||
// });
|
||||
// }, 1000)
|
||||
|
||||
// }
|
||||
title: '',
|
||||
// title: res.message || res.msg,
|
||||
icon: "none",
|
||||
success: () => {
|
||||
setTimeout(res => {
|
||||
store.dispatch("loginEvent"); //获取shapid
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
} else if (res.code == 482) {
|
||||
let nowTime = new Date() / 1000 | 0
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
</image>
|
||||
<view class="contentboxitemright_itembox flex-colum">
|
||||
<text>会员</text>
|
||||
<text>入会项权益</text>
|
||||
<text>入会享权益</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="contentboxitemright_item flex-between" @click="memberindex(0)">
|
||||
|
|
@ -67,9 +67,16 @@
|
|||
}
|
||||
})
|
||||
} else {
|
||||
uni.pro.navigateTo('member/memberdetails', {
|
||||
shopId_id: uni.cache.get('shopUser'),
|
||||
})
|
||||
if (this.usershopUserinfo.isVip == 0) {
|
||||
// 跳转到开通页面
|
||||
uni.navigateTo({
|
||||
url: '/pages/member/activatedmemberone?shopId=' + uni.cache.get('shopUser')
|
||||
})
|
||||
} else {
|
||||
uni.pro.navigateTo('member/memberdetails', {
|
||||
shopId_id: uni.cache.get('shopUser'),
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
memberindex(i) {
|
||||
|
|
|
|||
|
|
@ -381,8 +381,8 @@
|
|||
},
|
||||
goRecharge() { // 去充值
|
||||
// 判断是否绑定手机,只有下单时候有,会员列表肯定有
|
||||
console.log(uni.cache.get('userInfo').telephone, '调试1')
|
||||
if (uni.cache.get('userInfo').telephone == '') {
|
||||
// console.log(this.amountVIP.isVip, '调试1')
|
||||
if (this.amountVIP.isVip == 0) {
|
||||
// 跳转到开通页面
|
||||
uni.navigateTo({
|
||||
url: '/pages/member/activatedmemberone?shopId=' + uni.cache.get('shopUser')
|
||||
|
|
@ -480,7 +480,7 @@
|
|||
let res = await this.api.accountPay({
|
||||
orderId: this.listinfoid,
|
||||
memberId: this.amountVIP.id,
|
||||
pwd:pwd
|
||||
pwd: pwd
|
||||
})
|
||||
if (res.code == 0) {
|
||||
// data ->1 支付成功
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@
|
|||
let res = await this.api.upUserInfo({
|
||||
headImg: this.userHeadImg,
|
||||
nickName: this.nickName,
|
||||
telephone: this.phonetitle
|
||||
telephone: this.phonetitle == '请授权手机号' ? '' : this.phonetitle
|
||||
})
|
||||
if (res.code == 0) {
|
||||
uni.navigateBack()
|
||||
|
|
|
|||
|
|
@ -61,6 +61,31 @@ const store = new Vuex.Store({
|
|||
},
|
||||
},
|
||||
actions: {
|
||||
loginEvent: () => {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (data) => {
|
||||
uni.getUserInfo({
|
||||
provider: 'weixin',
|
||||
success: async (infoRes) => {
|
||||
uni.cache.set('weixincode', data.code);
|
||||
let res = await Api.userwxlogin({
|
||||
code: uni.cache.get('weixincode'), //临时登录凭证
|
||||
rawData: infoRes.rawData,
|
||||
})
|
||||
if (res.code == 0) {
|
||||
uni.cache.set('token', res.data.token);
|
||||
uni.cache.set('miniAppOpenId', res.data.userInfo
|
||||
.miniAppOpenId)
|
||||
uni.cache.set('userInfo', res.data.userInfo);
|
||||
}
|
||||
},
|
||||
fail: (err) => {}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
set_shopid: async ({
|
||||
commit
|
||||
}, data) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue