shish 8 месяцев назад
Родитель
Сommit
48701aa3f3
1 измененных файлов с 37 добавлено и 0 удалено
  1. 37 0
      hdApp/src/pagesPurchase/wechatPay.vue

+ 37 - 0
hdApp/src/pagesPurchase/wechatPay.vue

@@ -50,6 +50,7 @@
           </view>
           <button class="button-com pay-wx" :class="[remainPayTime >0 ? 'ali-btn':'default']" :disabled="remainPayTime >0 ? false : true" @click="appAliPayFn(1)">支付宝支付</button>
           <button class="button-com pay-wx" :class="[remainPayTime >0 ? 'green':'default']" :disabled="remainPayTime >0 ? false : true" @click="debtPay" v-if="hasDebtPay === '1'">赊账</button>
+          <view style="color:#CCCCCC;font-size:26upx;text-align: center;margin-top:50upx;" @click="beginOpenMini()">小程序</view>
         </div>
         <!-- #endif -->
         </block>
@@ -163,6 +164,42 @@ export default {
         }
       })
     },
+    beginOpenMini(){
+      this.$util.confirmModal({content:'确认打开小程序'},() => {
+        this.openBuyMini()
+      })
+    },
+    openBuyMini(){
+        // #ifdef APP-PLUS
+        let that = this
+        if(plus.runtime.isApplicationExist({pname:'com.tencent.mm',action:'weixin://'})){
+          plus.share.getServices(function(s){
+            var sweixin
+            for (var i = 0; i < s.length; i++) {
+              var t = s[i];
+              if (t.id == 'weixin') {
+                  sweixin = t;
+              }
+            }
+            let miniOriginalId = that.dictInfo.miniOriginalId && that.dictInfo.miniOriginalId.current && that.dictInfo.miniOriginalId.current.hd ? that.dictInfo.miniOriginalId.current.hd : ''
+            if (sweixin && sweixin.nativeClient) {
+              sweixin.launchMiniProgram({
+                id: miniOriginalId,
+                path: '/pagesPurchase/order',
+                type: 0
+              });
+            } else {
+              that.$msg("没有找到微信服务")
+            }
+          }, function(e){
+              that.$msg("没有找到微信服务哦")
+          });
+        } else {
+          that.$msg("请安装微信,再打开小程序")
+          return false
+        }
+        // #endif
+    },
     useAliPay(){
       let id = this.option.id ? this.option.id : 0
       let realPrice = this.option.realPrice ? this.option.realPrice : 0