Commit 37156ead authored by 肖健's avatar 肖健

绑定京东账号

parent 599ff6e1
...@@ -69,7 +69,14 @@ ...@@ -69,7 +69,14 @@
}; };
}, },
methods: { methods: {
goJdLogin(){
let returnPage= '/pages/main';
uni.navigateTo({
url:"/pages/login/index/index"
})
},
getPrice() { getPrice() {
let that = this
let token = uni.getStorageSync('userToken'); let token = uni.getStorageSync('userToken');
if (!token) { if (!token) {
uni.navigateTo({ uni.navigateTo({
...@@ -81,20 +88,36 @@ ...@@ -81,20 +88,36 @@
url: '/app/user/info', url: '/app/user/info',
method: 'get' method: 'get'
} }
this.http.httpTokenRequest(opts, {}).then(res => { that.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
let freeMoveFlag = res.data.data.freeMoveFlag let freeMoveFlag = res.data.data.freeMoveFlag
if (freeMoveFlag) { let bindPin = res.data.data.bindPin
uni.showToast({
title: "您的免费领取次数已用完", if(!bindPin) {
icon: 'none', uni.showModal({
duration: 2000, title: "未绑定账号",
}); content: "您没有绑定京东账号,请绑定后再领取",
} else { success:function(res){
//跳转到领取优惠卷页面 if (res.confirm) {
uni.navigateTo({ that.goJdLogin()
url: '/pagesA/pages/index/getPrice?orderId=' + this.freeCode.id }
}
}); });
// if (freeMoveFlag) {
// uni.showToast({
// title: "您的免费领取次数已用完",
// icon: 'none',
// duration: 2000,
// success:function(){
// }
// });
// } else {
// //跳转到领取优惠卷页面
// uni.navigateTo({
// url: '/pagesA/pages/index/getPrice?orderId=' + this.freeCode.id
// });
// }
} }
} }
}) })
......
export let config = { export let config = {
appid: 1814, appid: 1814,
returnPage: undefined, returnPage: '/pages/main',
pageType: undefined, pageType: undefined,
isLogout: 1, isLogout: 1,
noWXinfo: 1, noWXinfo: 1,
......
...@@ -44,7 +44,6 @@ export default { ...@@ -44,7 +44,6 @@ export default {
}) })
}, },
onShow: function () { onShow: function () {
console.log(plugin.getPtKey(),1111111)
uni.hideHomeButton() uni.hideHomeButton()
if(this.tab == 'personal'){ if(this.tab == 'personal'){
this.$refs.personal.getUserInfo(); this.$refs.personal.getUserInfo();
...@@ -59,18 +58,11 @@ export default { ...@@ -59,18 +58,11 @@ export default {
} }
}, },
methods: { methods: {
goLogin(){
let returnPage= '/pages/main';
uni.navigateTo({
url:"/pages/login/index/index?returnPage="+returnPage
})
},
tabChange(index) { tabChange(index) {
let that = this let that = this
switch (index) { switch (index) {
case 0: case 0:
this.tab = 'index' this.tab = 'index'
this.goLogin()
break; break;
case 1: case 1:
this.tab = 'moveCar' this.tab = 'moveCar'
...@@ -153,17 +145,49 @@ export default { ...@@ -153,17 +145,49 @@ export default {
} }
}, },
onLoad(option) { onLoad(option) {
let that = this
if(option && option.index){ if(option && option.index){
this.$nextTick(() => { that.$nextTick(() => {
let i = parseInt(option.index); let i = parseInt(option.index);
if(!i){ if(!i){
i= 0; i= 0;
} }
this.tabChange(i) that.tabChange(i)
this.$refs.myTab.current = i; that.$refs.myTab.current = i;
}); });
} }
let ptKey = plugin.getPtKey();
if(ptKey) {
plugin.isvObfuscator({url:'https://wxapplogin2.m.jd.com/cgi-bin/login/isv/isvObfuscator'}).then(res=>{
let { token, message } = res;
if(!token) {
uni.showToast({
title: `京东登录失败:${message}`,
icon: 'none',
duration: 2000
});
} else {
let opts = {
url: '/app/user/bind/jd',
method: 'post'
}
that.http.httpTokenRequest(opts, {'token' : token}).then(res => {
if (res.data.code == 200) {
uni.showToast({
title: "京东账号绑定成功",
icon: 'none',
duration: 1000
});
}
})
}
}).catch(err=>{
console.log('err',err)
})
}
}, },
} }
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment