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