|
@@ -42,12 +42,13 @@
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import { purchaseBalancePay, purchaseDebtPay, purchaseWxPay,getDetail } from "@/api/purchase";
|
|
import { purchaseBalancePay, purchaseDebtPay, purchaseWxPay,getDetail } from "@/api/purchase";
|
|
|
-import { getCgPayWay } from "@/api/shop/index";
|
|
|
|
|
import keyboardModule from './components/keyboard'
|
|
import keyboardModule from './components/keyboard'
|
|
|
import { mapGetters } from "vuex";
|
|
import { mapGetters } from "vuex";
|
|
|
import wexinPay from "@/utils/pay/wxPay";
|
|
import wexinPay from "@/utils/pay/wxPay";
|
|
|
|
|
+import { postWxCode } from '@/api/mini'
|
|
|
|
|
+import { updateMiniOpenId } from '@/api/admin'
|
|
|
export default {
|
|
export default {
|
|
|
- name: "callback",
|
|
|
|
|
|
|
+ name: "wechatPay",
|
|
|
components: {
|
|
components: {
|
|
|
keyboardModule
|
|
keyboardModule
|
|
|
},
|
|
},
|
|
@@ -132,15 +133,36 @@ export default {
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
wxPayFn () {
|
|
wxPayFn () {
|
|
|
|
|
+ let that = this
|
|
|
uni.showLoading({title: '加载中',mask:true})
|
|
uni.showLoading({title: '加载中',mask:true})
|
|
|
purchaseWxPay({ orderSn: this.orderSn }).then(res => {
|
|
purchaseWxPay({ orderSn: this.orderSn }).then(res => {
|
|
|
uni.hideLoading()
|
|
uni.hideLoading()
|
|
|
if(res.code == 1){
|
|
if(res.code == 1){
|
|
|
- this.pageId = res.data.id
|
|
|
|
|
- wexinPay(res.data, this.getSuccess, this.getError)
|
|
|
|
|
|
|
+ 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()
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.pageId = res.data.id
|
|
|
|
|
+ wexinPay(res.data, this.getSuccess, this.getError)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }).catch(err => {
|
|
|
|
|
-
|
|
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
getSuccess () {
|
|
getSuccess () {
|