'use strict'; var mhPayMixin = function () {// 米花支付渠道 return { methods: { mh_PayOrderTransferUnion:function () {// 正常订单大额网银转账 var _this = this; var params = { payAmount:Math.round(_this.payAmount*100), orderId:_this.payInfo.payOrderId } _this.isSubMitStatus=true; PayApi.PayOrderTransferUnion(params,function(response){ if(response.code == 0){ _this.isPayBigAlert = true; _this.isSubMitStatus=false; _this.mbOrderId = response.data.data.mbOrderId; _this.bigPayInfo = JSON.parse(response.data.data.payInfo) console.log('bigPayInfo',_this.bigPayInfo) }else{ _this.isSubMitStatus=false; CAIMEI.Alert(response.msg,'确定',false); } }) }, mh_PayOrderPcMallPay:function(){// 正常订单网银支付 var _this = this; var params = {//正常订单 payAmount:Math.round(_this.payAmount*100), bankCode:_this.payInfo.payBankNum, returnUrl:'https://www.caimei365.com/pay/success.html?pageType=www&type=success&payAmount='+_this.payAmount, orderId:_this.payInfo.payOrderId, userType:_this.payInfo.payUserType }; _this.isSubMitStatus=true; console.log('正常订单米花网银支付通道',params) PayApi.PayOrderPcMallPay(params,function(response){ if(response.code == 0){ _this.isPayAlert = true; _this.isSubMitStatus=false; _this.mbOrderId = response.data.data.mbOrderId; window.open(response.data.data.payUrl); }else{ _this.isSubMitStatus=false; CAIMEI.Alert(response.msg,'确定',false); } }) }, mh_PayOrderPcMallAlipay:function (){// 正常订单支付宝支付 var _this = this; var params = {//正常订单 payAmount:Math.round(_this.payAmount*100), returnUrl:'https://www.caimei365.com/', orderId:_this.payInfo.payOrderId }; _this.isSubMitStatus=true; PayApi.PayOrderPcMallAlipay(params,function(response){ if(response.code == 0){ _this.isPayAlert = true; _this.isSubMitStatus=false; _this.mbOrderId = response.data.data.mbOrderId; _this.payInfo.payMobileUrl = response.data.data.payUrl; _this.payInfo.payData = { mbOrderId:_this.mbOrderId, type:_this.payInfo.payBankNum, orderid:_this.payInfo.payOrderId, amount:_this.payAmount, url:_this.payInfo.payMobileUrl }; CAIMEI.Storage.setItem('payData',JSON.stringify(_this.payInfo.payData)); if(!isPC){ location.href = _this.payInfo.payMobileUrl; }else{ window.open("/pay/caimei-paymobile.html?pageType=1"); } }else{ CAIMEI.Alert(response.msg,'确定',false); _this.isSubMitStatus=false; } }) }, mh_PayOrderMiniWxPay:function () {// 正常订单微信支付 var _this = this; if(!isPC){ var orderInfo = {//普通订单微信二维码参数 pageType:0, orderID:_this.payInfo.payOrderId, payAmount:_this.payAmount }; _this.payInfo.payMobileUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx91c4152b60ca91a3&redirect_uri=https://www.caimei365.com/pay/wechatpay.html&response_type=code&scope=snsapi_base&state="+JSON.stringify(orderInfo)+"#wechat_redirect"; location.href = _this.payInfo.payMobileUrl; }else{ _this.payInfo.payData = {//正常订单 type:_this.payInfo.payBankNum, orderid:_this.payInfo.payOrderId, amount:_this.payAmount, url:_this.payInfo.payMobileUrl }; CAIMEI.Storage.setItem('payData',JSON.stringify(_this.payInfo.payData)); window.open("/pay/caimei-paymobile.html?pageType=0"); _this.isPayAlert = true; } }, mh_PayCouponUnionPayFn:function () { // 网银支付购买优惠券 console.log('网银支付购买优惠券'); var _this = this; var params = { bankCode: this.payInfo.payBankNum, returnUrl: 'https://www.caimei365.com/pay/success.html?pageType=www&type=success&payAmount='+_this.couponInfo.moneyCouponPrice, userType: _this.payInfo.payUserType, couponId: _this.couponId, couponRecordId:_this.couponRecordId, userId:_this.userId, source:2 //支付来源 1 小程序 2 WWW }; PayApi.PayCouponUnionPay(params, function (response) { if (response.code == 0) { _this.isPayAlert = true; _this.isSubMitStatus = false; _this.mbOrderId = response.data.data.mbOrderId; window.open(response.data.data.payUrl); } else { _this.isSubMitStatus = false; CAIMEI.Alert(response.msg, '确定', false); } }); }, mh_PayCouponAliPay: function(){// 支付宝支付优惠券 var _this = this; console.log('支付宝支付优惠券'); var params = { returnUrl: 'https://www.caimei365.com/', couponId: _this.couponInfo.couponId, userId:_this.userId, couponRecordId:_this.couponRecordId, source:2 //支付来源 1 小程序 2 WWW }; PayApi.PayCouponMiniAliPay(params, function(response){ console.log(response); if (response.code === 0) { _this.isPayAlert = true; _this.mbOrderId = response.data.data.mbOrderId; _this.payInfo.payMobileUrl = response.data.data.payUrl; _this.payInfo.payData = { type: _this.payInfo.payBankNum, mbOrderId: _this.mbOrderId, amount: _this.couponInfo.moneyCouponPrice, url: _this.payInfo.payMobileUrl, couponId:_this.couponId, userId:_this.userId }; CAIMEI.Storage.setItem('payData', JSON.stringify(_this.payInfo.payData)); if (!isPC) { location.href = _this.payInfo.payMobileUrl; } else { window.open("/pay/caimei-paymobile.html?pageType=3"); } } else { CAIMEI.Alert(response.msg, '确定', false); _this.isSubMitStatus = false; } }); }, mh_PayCouponMiniWxPay: function(){// 微信支付优惠券 console.log('微信支付优惠券'); if (!isPC) { var orderInfo = {//普通订单微信二维码参数 pageType: 3, payAmount: this.couponInfo.moneyCouponPrice, couponRecordId:this.couponRecordId, couponId: this.couponId, userId : this.userId }; this.payInfo.payMobileUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx91c4152b60ca91a3&redirect_uri=https://www.caimei365.com/pay/wechatpay.html&response_type=code&scope=snsapi_base&state=" + JSON.stringify(orderInfo) + "#wechat_redirect"; location.href = this.payInfo.payMobileUrl; } else { this.payInfo.payData = { type: this.payInfo.payBankNum, amount: this.couponInfo.moneyCouponPrice, url: this.payInfo.payMobileUrl, couponId:this.couponId, couponRecordId:this.couponRecordId, userId:this.userId }; CAIMEI.Storage.setItem('payData', JSON.stringify(this.payInfo.payData)); window.open("/pay/caimei-paymobile.html?pageType=3"); this.isPayAlert = true; } }, mh_PayVipPcMallPay: function(){ // 网银支付会员 console.log('网银支付会员'); var _this = this; var params = { bankCode: this.payInfo.payBankNum, returnUrl: 'https://www.caimei365.com/pay/success.html?pageType=www&type=success&payAmount='+_this.payAmount, userType: _this.payInfo.payUserType, vipRecordId: _this.vipRecordId }; PayApi.PayVipPcMallPay(params, function (response) { if (response.code == 0) { _this.isPayAlert = true; _this.isSubMitStatus = false; _this.mbOrderId = response.data.data.mbOrderId; window.open(response.data.data.payUrl); } else { _this.isSubMitStatus = false; CAIMEI.Alert(response.msg, '确定', false); } }); }, mh_PayVipAliPay: function(){ // 支付宝支付会员 console.log('支付宝支付会员'); var _this = this; var params = { bankCode: _this.payInfo.payBankNum, returnUrl: 'https://www.caimei365.com/', userType: _this.payInfo.payUserType, vipRecordId: _this.vipRecordId }; console.log(params); PayApi.PayVipAliPay(params, function(response){ console.log(response); if (response.code === 0) { _this.isPayAlert = true; _this.mbOrderId = response.data.data.mbOrderId; _this.payInfo.payMobileUrl = response.data.data.payUrl; _this.payInfo.payData = { mbOrderId: _this.mbOrderId, type: _this.payInfo.payBankNum, amount: _this.payAmount, url: _this.payInfo.payMobileUrl, }; CAIMEI.Storage.setItem('payData', JSON.stringify(_this.payInfo.payData)); if (!isPC) { location.href = _this.payInfo.payMobileUrl; } else { window.open("/pay/caimei-paymobile.html?pageType=2&duration=" + _this.comboInfo.duration); } } else { CAIMEI.Alert(response.msg, '确定', false); _this.isSubMitStatus = false; } }); }, mh_PayVipMiniWxPay: function(){ // 微信支付会员 if (!isPC) { var orderInfo = {//普通订单微信二维码参数 couponId: 2, vipId: this.comboInfo.id, vipRecordId: this.vipRecordId, payAmount: this.payAmount }; this.payInfo.payMobileUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx91c4152b60ca91a3&redirect_uri=https://www.caimei365.com/pay/wechatpay.html&response_type=code&scope=snsapi_base&state=" + JSON.stringify(orderInfo) + "#wechat_redirect"; location.href = this.payInfo.payMobileUrl; } else { this.payInfo.payData = { type: this.payInfo.payBankNum, vipId: this.comboInfo.id, vipRecordId: this.vipRecordId, amount: this.payAmount, duration: this.comboInfo.duration, }; CAIMEI.Storage.setItem('payData', JSON.stringify(this.payInfo.payData)); window.open("/pay/caimei-paymobile.html?pageType=2"); this.isPayAlert = true; } }, mh_PayOrdersecondUnion:function (){// 二手网银支付 var _this = this; var params = {//二手 payWay:_this.payInfo.payBankNum, returnUrl:'https://www.caimei365.com/', productId:_this.productID, }; _this.isSubMitStatus=true; PayApi.PayOrdersecondUnion(params,function(response){ if(response.code == 0){ _this.isPayAlert = true; _this.isSubMitStatus=false; _this.mbOrderId = response.data.data.mbOrderId; window.open(response.data.data.payUrl); }else{ CAIMEI.Alert(response.msg,'确定',false); _this.isSubMitStatus=false; } }) }, mh_PayOrdersecondAliPay:function (){// 二手支付宝支付 var _this = this; var params = {//二手 returnUrl:'https://www.caimei365.com/', productId:_this.productID, }; _this.isSubMitStatus=true; PayApi.PayOrdersecondAliPay(params,function(response){ if(response.code == 0){ _this.isPayAlert = true; _this.isSubMitStatus=false; _this.mbOrderId = response.data.data.mbOrderId; _this.payInfo.payMobileUrl = response.data.data.payUrl; _this.payInfo.payData = { mbOrderId:_this.mbOrderId, type:_this.payInfo.payBankNum, productId:_this.productID, amount:_this.payAmount, url:_this.payInfo.payMobileUrl }; CAIMEI.Storage.setItem('payData',JSON.stringify(_this.payInfo.payData)); window.open("/pay/caimei-paymobile.html?pageType=1"); }else{ CAIMEI.Alert(response.msg,'确定',false); _this.isSubMitStatus=false; } }) }, mh_PaySecondMiniWxPay:function () {// 二手发布微信支付 var _this = this; if(!isPC){ var orderInfo = {//二手微信二维码参数 pageType:1, productId:_this.productID, payAmount:_this.payAmount }; _this.payInfo.payMobileUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx91c4152b60ca91a3&redirect_uri=https://www.caimei365.com/pay/wechatpay.html&response_type=code&scope=snsapi_base&state="+JSON.stringify(orderInfo)+"#wechat_redirect"; location.href = _this.payInfo.payMobileUrl; }else{ _this.payInfo.payData = {//二手 type:_this.payInfo.payBankNum, productId:_this.productID, amount:_this.payAmount, url:_this.payInfo.payMobileUrl }; CAIMEI.Storage.setItem('payData',JSON.stringify(_this.payInfo.payData)); window.open("/pay/caimei-paymobile.html?pageType=1"); _this.isPayAlert = true; } }, mh_CopyLinkPaySubmitFn:function (params) { var _this = this; console.log('米花支付链接'); PayApi.PayOrderPayLink(params,function(response){ _this.bankPayLink_url = response.data; var oInput = document.createElement("textarea"); oInput.value = _this.bankPayLink_url; document.body.appendChild(oInput); oInput.select(); // 选择对象 document.execCommand("Copy"); // 执行浏览器复制命令 document.body.removeChild(oInput); CAIMEI.dialog('复制成功'); } ) } } }; }();