Browse Source

认证通微信支付

喻文俊 3 năm trước cách đây
mục cha
commit
2498735bcb

+ 14 - 1
src/main/resources/static/js/common/serviceapi/pay.service.js

@@ -260,5 +260,18 @@ var PayApi = {
                 .then(function(res){
                     callback(res);
                 });
-        }
+        },
+        // 微信支付认证通会员
+        PayAuthVipMiniWxPay: function(params, callback){ // 微信支付认证通会员
+            Http.AjaxService({
+                url:'/order/pay/auth/vip/wechat',
+                type:'POST',
+                data:params,
+                json:false,
+                isHost:true
+            })
+            .then(function(res){
+                callback(res);
+            });
+        },
 };

+ 34 - 2
src/main/resources/static/js/pay/caimei-wechatpay.js

@@ -30,7 +30,7 @@ var payContainer = new Vue({
             _this.isRequest = true;
             if( _this.pageType == 1){
                 _this.productId = _this.state.productId;
-            }else if(_this.pageType == 2){
+            }else if(_this.pageType == 2 || _this.pageType == 4){
                 _this.vipId = _this.state.vipId;
                 _this.vipRecordId = _this.state.vipRecordId;
             }else if(_this.pageType == 3){
@@ -46,8 +46,10 @@ var payContainer = new Vue({
                 this.WxRequestsecondHandPay();
             } else if (this.pageType == 2) {
                 this.WxRequestPaymentVipFn();
-            } if (this.pageType == 3) {
+            } else if (this.pageType == 3) {
                 this.WxRequestPaymentCouponFn();
+            } else if (this.pageType === 4){
+                this.WxRequestPaymentAuthVipFn();
             } else {
                 this.WxRequestPaymentFn();
             }
@@ -83,6 +85,36 @@ var payContainer = new Vue({
                 }
             });
         },
+        WxRequestPaymentAuthVipFn: function(){
+            var _this = this;
+            var params = {
+                code: _this.wechatcode,
+                state: _this.rand(1000, 9999),
+                vipId: _this.vipId,
+                vipRecordId: _this.vipRecordId,
+                returnUrl: 'https://www.caimei365.com/',
+            };
+            PayApi.PayAuthVipMiniWxPay(params,function(response){
+                if(response.code == 0){
+                    var PayInfo = JSON.parse(response.data.data.payInfo);
+                    if (typeof WeixinJSBridge == "undefined"){
+                        if( document.addEventListener ){
+                            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
+                        }else if (document.attachEvent){
+                            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
+                            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
+                        }
+                    }else{
+                        _this.onBridgeReady(PayInfo);
+                    }
+                }else{
+                     CAIMEI.dialog("支付链接已失效,请重新扫码支付");
+                    setTimeout(function(){
+                        WeixinJSBridge.call('closeWindow');
+                    },3000);
+                }
+            });
+        },
         // 优惠券支付
         WxRequestPaymentCouponFn: function(){
             var _this = this;