Kaynağa Gözat

付费优化

shish 6 ay önce
ebeveyn
işleme
e1bc64c841
1 değiştirilmiş dosya ile 16 ekleme ve 5 silme
  1. 16 5
      ghsApp/src/admin/shop/renew.vue

+ 16 - 5
ghsApp/src/admin/shop/renew.vue

@@ -80,8 +80,9 @@
     </view>
 </template>
 <script>
-import wexinPay from "@/utils/pay/wxPay";
+import wexinPay from "@/utils/pay/wxPay"
 import { renewShop,needRemind } from "@/api/renew"
+import { postWxCode } from '@/api/mini'
 export default {
     name: "renew",
     data(){
@@ -130,10 +131,20 @@ export default {
                 }
             }
             this.renewType = type
-            renewShop({price:price,type:type,remark:this.remark}).then(res=>{
-                uni.hideLoading()
-                if(res.code == 1){
-                    wexinPay(res.data, this.getSuccess, this.getError)
+            uni.login({
+                provider: 'weixin',
+                success: res => {
+                    postWxCode({ code: res.code }).then(subRes => {
+                        if(subRes.data.currentMiniOpenId){
+                            let currentMiniOpenId = subRes.data.currentMiniOpenId
+                            renewShop({price:price,type:type,remark:this.remark,currentMiniOpenId:currentMiniOpenId}).then(res=>{
+                                uni.hideLoading()
+                                if(res.code == 1){
+                                    wexinPay(res.data, this.getSuccess, this.getError)
+                                }
+                            })
+                        }
+                    })
                 }
             })
             // #endif