|
|
@@ -132,34 +132,23 @@ export default {
|
|
|
wxPayFn () {
|
|
|
let that = this
|
|
|
uni.showLoading({title: '加载中',mask:true})
|
|
|
- purchaseWxPay({ orderSn: this.orderSn }).then(res => {
|
|
|
- uni.hideLoading()
|
|
|
- if(res.code == 1){
|
|
|
- if(res.data.hasNoMiniOpenId && res.data.hasNoMiniOpenId == 1){
|
|
|
- //没有miniOpenId,补miniOpenId
|
|
|
- uni.login({
|
|
|
- provider: 'weixin',
|
|
|
- success: res => {
|
|
|
- uni.setStorageSync('code', res.code)
|
|
|
- postWxCode({ code: res.code }).then(subRes => {
|
|
|
- if(subRes.data.currentMiniOpenId){
|
|
|
- let currentMiniOpenId = subRes.data.currentMiniOpenId
|
|
|
- updateMiniOpenId({miniOpenId:currentMiniOpenId}).then(subRes=>{
|
|
|
- if(subRes.code == 1){
|
|
|
- that.$util.confirmModal({content:'网络开小差了,请继续',okText:'确认',singer:true},() => {
|
|
|
- that.wxPayFn()
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
+ uni.login({
|
|
|
+ provider: 'weixin',
|
|
|
+ success: res => {
|
|
|
+ uni.setStorageSync('code', res.code)
|
|
|
+ postWxCode({ code: res.code }).then(subRes => {
|
|
|
+ if(subRes.data.currentMiniOpenId){
|
|
|
+ let currentMiniOpenId = subRes.data.currentMiniOpenId
|
|
|
+ purchaseWxPay({ orderSn: this.orderSn,currentMiniOpenId:currentMiniOpenId }).then(res => {
|
|
|
+ uni.hideLoading()
|
|
|
+ if(res.code == 1){
|
|
|
+ this.pageId = res.data.id
|
|
|
+ this.orderSn = res.data.orderSn
|
|
|
+ wexinPay(res.data, this.getSuccess, this.getError)
|
|
|
}
|
|
|
})
|
|
|
- }else{
|
|
|
- this.pageId = res.data.id
|
|
|
- this.orderSn = res.data.orderSn
|
|
|
- wexinPay(res.data, this.getSuccess, this.getError)
|
|
|
- }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
},
|