shish %!s(int64=3) %!d(string=hai) anos
pai
achega
fbc7384383
Modificáronse 1 ficheiros con 22 adicións e 0 borrados
  1. 22 0
      hdApp/src/pagesPurchase/gatherPay.vue

+ 22 - 0
hdApp/src/pagesPurchase/gatherPay.vue

@@ -32,6 +32,7 @@
 import { purchaseClearWxPay } from "@/api/purchase/index";
 import wexinPay from "@/utils/pay/wxPay";
 import { mapGetters } from "vuex";
+import { postWxCode } from '@/api/mini'
 export default {
   name: "callback",
   data () {
@@ -66,6 +67,27 @@ export default {
 				},1000)
 			},
     _wxPay () {
+      let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
+      let that = this
+      if(!this.$util.isEmpty(currentMiniOpenId)){
+        that.weixinPay()
+      }else{
+        //没有miniOpenId补miniOpenId
+        uni.login({
+          provider: 'weixin',
+          success: res => {
+            postWxCode({ code: res.code }).then(subRes => {
+              if(subRes.data.currentMiniOpenId){
+                let thisMiniOpenId = subRes.data.currentMiniOpenId
+                uni.setStorageSync('currentMiniOpenId',thisMiniOpenId)
+                that.weixinPay()
+              }
+            })
+          }
+        })
+      }
+    },
+    weixinPay(){
       let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
       purchaseClearWxPay({ orderSn: this.orderSn,currentMiniOpenId:currentMiniOpenId }).then(res => {
         wexinPay(res.data, this.getSuccess, this.getError)