修复支付提示取消的问题,修改用户中心无法自动登录的问题
This commit is contained in:
@ -98,10 +98,12 @@ export function payOrderHandle(orderId, type, from) {
|
|||||||
weappPay(data.result.jsConfig).then(res => {
|
weappPay(data.result.jsConfig).then(res => {
|
||||||
resolve(data);
|
resolve(data);
|
||||||
});
|
});
|
||||||
|
break;
|
||||||
case "WECHAT_APP_PAY":
|
case "WECHAT_APP_PAY":
|
||||||
weappPay(data.result.jsConfig).then(res => {
|
weappPay(data.result.jsConfig).then(res => {
|
||||||
resolve(data);
|
resolve(data);
|
||||||
});
|
});
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
@ -14,7 +14,7 @@ export const weappPay = (option) => {
|
|||||||
sign: option.sign,
|
sign: option.sign,
|
||||||
timestamp: option.timestamp + '',
|
timestamp: option.timestamp + '',
|
||||||
}
|
}
|
||||||
// 调用登录接口
|
// 调用只接口
|
||||||
uni.requestPayment({
|
uni.requestPayment({
|
||||||
provider: 'wxpay',
|
provider: 'wxpay',
|
||||||
...option,
|
...option,
|
||||||
@ -23,9 +23,12 @@ export const weappPay = (option) => {
|
|||||||
success: (success) => {
|
success: (success) => {
|
||||||
console.log(success)
|
console.log(success)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '支付成功', icon: 'success', duration: 5000
|
title: '支付成功', icon: 'success', duration: 5000,
|
||||||
});
|
});
|
||||||
resolve(success)
|
let time = setTimeout(() => {
|
||||||
|
clearTimeout(time)
|
||||||
|
resolve(success)
|
||||||
|
}, 3000)
|
||||||
},
|
},
|
||||||
fail: (error) => {
|
fail: (error) => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<view class="container">
|
<view class="container">
|
||||||
<view v-if="!token">
|
<view v-if="!token">
|
||||||
<!-- 小程序 -->
|
<!-- 小程序 -->
|
||||||
<view v-if="$deviceType == 'routine'&&authorize">
|
<view v-if="$deviceType == 'routine'">
|
||||||
<view class="getUserInfo">
|
<view class="getUserInfo">
|
||||||
<text>您还未允许微信登录授权,请点击下方按钮允许微信授权登录。</text>
|
<text>您还未允许微信登录授权,请点击下方按钮允许微信授权登录。</text>
|
||||||
<button type="primary" open-type="getUserInfo" @getuserinfo="getUserInfo">允许微信登录授权</button>
|
<button type="primary" open-type="getUserInfo" @getuserinfo="getUserInfo">允许微信登录授权</button>
|
||||||
@ -11,17 +11,12 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- app -->
|
<!-- app -->
|
||||||
<view v-if="$deviceType == 'app'&&authorize">
|
<view v-if="$deviceType == 'app'">
|
||||||
<view class="getUserInfo">
|
<view class="getUserInfo">
|
||||||
<text>请先登录</text>
|
<text>请先登录</text>
|
||||||
<button type="primary" @click="this.toLogin">去登录</button>
|
<button type="primary" @click="this.toLogin">去登录</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="!authorize">
|
|
||||||
<view class="getUserInfo">
|
|
||||||
<text>登录中</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -45,26 +40,13 @@ export default {
|
|||||||
...mapState(["isAuthorization", "$deviceType", "token"])
|
...mapState(["isAuthorization", "$deviceType", "token"])
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.UPDATE_AUTHORIZATIONPAGE(true);
|
|
||||||
// // 先校验用户是否授权,如果没有授权,显示授权按钮
|
// // 先校验用户是否授权,如果没有授权,显示授权按钮
|
||||||
console.log("先校验用户是否授权,如果没有授权,显示授权按钮");
|
|
||||||
authorize("userInfo")
|
|
||||||
.then(res => {
|
|
||||||
console.log(res);
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.log(error);
|
|
||||||
// 用户未授权,显示授权按钮
|
|
||||||
this.authorize = true;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
onHide() {
|
onHide() {
|
||||||
console.log("离开授权页面,11111");
|
|
||||||
this.UPDATE_AUTHORIZATIONPAGE(false);
|
this.UPDATE_AUTHORIZATIONPAGE(false);
|
||||||
this.changeAuthorization(false);
|
this.changeAuthorization(false);
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
console.log("离开授权页面,11111");
|
|
||||||
this.UPDATE_AUTHORIZATIONPAGE(false);
|
this.UPDATE_AUTHORIZATIONPAGE(false);
|
||||||
this.changeAuthorization(false);
|
this.changeAuthorization(false);
|
||||||
},
|
},
|
||||||
@ -109,24 +91,8 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUnload() {
|
|
||||||
console.log("离开授权页面,11111");
|
|
||||||
this.UPDATE_AUTHORIZATIONPAGE(false);
|
|
||||||
this.changeAuthorization(false);
|
|
||||||
},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.UPDATE_AUTHORIZATIONPAGE(true);
|
|
||||||
// // 先校验用户是否授权,如果没有授权,显示授权按钮
|
|
||||||
console.log("先校验用户是否授权,如果没有授权,显示授权按钮");
|
|
||||||
authorize("userInfo")
|
|
||||||
.then(res => {
|
|
||||||
console.log(res);
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.log(error);
|
|
||||||
// 用户未授权,显示授权按钮
|
|
||||||
this.authorize = true;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -660,6 +660,6 @@ export default {
|
|||||||
await payOrderHandle(this.orderInfo.orderId, type, that.from);
|
await payOrderHandle(this.orderInfo.orderId, type, that.from);
|
||||||
that.getDetail();
|
that.getDetail();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -521,6 +521,8 @@
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "PAY_DEFICIENCY":
|
case "PAY_DEFICIENCY":
|
||||||
|
break;
|
||||||
|
|
||||||
case "PAY_ERROR":
|
case "PAY_ERROR":
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
@ -569,6 +571,8 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
break;
|
||||||
|
|
||||||
case "WECHAT_APP_PAY":
|
case "WECHAT_APP_PAY":
|
||||||
// APP支付
|
// APP支付
|
||||||
weappPay(data.result.jsConfig).finally(()=>{
|
weappPay(data.result.jsConfig).finally(()=>{
|
||||||
@ -579,7 +583,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
break;
|
||||||
// 下面为原先微信支付方式,
|
// 下面为原先微信支付方式,
|
||||||
// pay(data.result.jsConfig).finally(() => {
|
// pay(data.result.jsConfig).finally(() => {
|
||||||
// this.$yrouter.replace({
|
// this.$yrouter.replace({
|
||||||
|
Reference in New Issue
Block a user