船员公众号
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gzh_chuanyuan/unpackage/dist/build/web/static/js/pages-question-buyTwo.44c74...

1 line
9.5 KiB

2 months ago
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-question-buyTwo"],{"178b":function(e,n,t){"use strict";t("6a54");var i=t("f5bd").default;Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var a=i(t("2634")),o=i(t("2fdc")),r={data:function(){return{tabIndex:0,range:["微信支付","余额支付"],info:{type:1,children:[]},userInfo:{},isClick:!0}},onReady:function(){this.info=uni.getStorageSync("teamInfo"),this.userInfo=uni.getStorageSync("userInfo"),console.log(this.info)},methods:{toSubmit:function(){var e=this;return(0,o.default)((0,a.default)().mark((function n(){var t,i,o,r,c;return(0,a.default)().wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(-1!=e.tabIndex){n.next=3;break}return uni.showToast({icon:"none",title:"请选择支付方式"}),n.abrupt("return");case 3:if(1==e.tabIndex&&(1==e.info.type?e.info.price:2==e.info.type?e.info.children[e.info.idx].price:e.info.children[e.info.idx1].price),0!=e.isClick){n.next=6;break}return n.abrupt("return");case 6:return e.isClick=!1,t=1==e.info.type?e.info.id:2==e.info.type?e.info.children[e.info.idx].id:e.info.children[e.info.idx1].id,n.next=10,e.$api.createOrder({category_id:t});case 10:i=n.sent,o=i.code,r=i.data,c=i.msg,console.log(t,e.info,o),200==o?(e.isClick=!0,e.toPay1(r.order_sn)):(e.isClick=!0,uni.showToast({icon:"none",title:c}));case 16:case"end":return n.stop()}}),n)})))()},toPay:function(e){var n=this;return(0,o.default)((0,a.default)().mark((function t(){var i,o,r,c;return(0,a.default)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,n.$api.payOrder({is_balance:1==n.tabIndex?1:"",order_sn:e});case 2:i=t.sent,o=i.code,r=i.data,c=i.msg,200==o?1==r.is_pay?(uni.removeStorageSync("teamInfo"),wx.redirectTo({url:"/pages/question/buyThree"})):uni.requestPayment({provider:"wxpay",timeStamp:r.pay_data.timeStamp,nonceStr:r.pay_data.nonceStr,package:r.pay_data.package,signType:r.pay_data.signType,paySign:r.pay_data.paySign,success:function(e){uni.removeStorageSync("teamInfo"),uni.redirectTo({url:"/pages/question/buyThree"})},fail:function(e){uni.showToast({icon:"none",title:"支付失败"}),uni.removeStorageSync("teamInfo"),setTimeout((function(){uni.redirectTo({url:"/pages/question/list"})}),2e3)}}):uni.showToast({icon:"none",title:c});case 7:case"end":return t.stop()}}),t)})))()},toPay1:function(e){var n=this;return(0,o.default)((0,a.default)().mark((function t(){var i,o,r,c,s;return(0,a.default)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,n.$api.payOrder({is_balance:1==n.tabIndex?1:"",order_sn:e,is_public:1});case 2:i=t.sent,o=i.code,r=i.data,c=i.msg,200==o?1==r.is_pay?(uni.removeStorageSync("teamInfo"),wx.redirectTo({url:"/pages/question/buyThree"})):(s=function(){console.log(r.pay_data),WeixinJSBridge.invoke("getBrandWCPayRequest",{appId:r.pay_data.appId,timeStamp:r.pay_data.timeStamp,nonceStr:r.pay_data.nonceStr,package:r.pay_data.package,signType:r.pay_data.signType,paySign:r.pay_data.paySign},(function(e){console.log(e),"get_brand_wcpay_request:ok"==e.err_msg&&(uni.showToast({icon:"none",title:"支付成功"}),setTimeout((function(){uni.removeStorageSync("teamInfo"),uni.redirectTo({url:"/pages/question/buyThree"})}),2e3)),"get_brand_wcpay_request:cancel"==e.err_msg&&(uni.showToast({icon:"none",title:"支付失败"}),uni.removeStorageSync("teamInfo"),setTimeout((function(){uni.redirectTo({url:"/pages/question/list"})}),2e3)),"get_brand_wcpay_request:fail"==e.err_msg&&(uni.showToast({icon:"none",title:"支付失败"}),uni.removeStorageSync("teamInfo"),setTimeout((function(){uni.redirectTo({url:"/pages/question/list"})}),2e3)),"调用支付JSAPI缺少参数:total_fee"==e.err_msg&&(uni.showToast({icon:"none",title:e.err_msg}),uni.removeStorageSync("teamInfo"),setTimeout((function(){uni.redirectTo({url:"/pages/question/list"})}),2e3))}))},console.log(22333),"undefined"==typeof WeixinJSBridge?document.addEventListener?document.addEventListener("WeixinJSBridgeReady",s,!1):document.attachEvent&&(document.attachEvent("WeixinJSBridgeReady",s),document.attachEvent("onWeixinJSBrid