(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/money/pay"],{2412:function(e,n,t){"use strict";(function(e){t("7154");a(t("66fd"));var n=a(t("e26c"));function a(e){return e&&e.__esModule?e:{default:e}}wx.__webpack_require_UNI_MP_PLUGIN__=t,e(n.default)}).call(this,t("543d")["createPage"])},"33fe":function(e,n,t){"use strict";t.r(n);var a=t("b6da"),o=t.n(a);for(var r in a)"default"!==r&&function(e){t.d(n,e,(function(){return a[e]}))}(r);n["default"]=o.a},"9e0a":function(e,n,t){},a91e:function(e,n,t){"use strict";var a=t("9e0a"),o=t.n(a);o.a},b6da:function(e,n,t){"use strict";(function(e){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var a=i(t("a34a")),o=t("7ab5"),r=t("2fbd");t("26cb");function i(e){return e&&e.__esModule?e:{default:e}}function u(e,n,t,a,o,r,i){try{var u=e[r](i),d=u.value}catch(c){return void t(c)}u.done?n(d):Promise.resolve(d).then(a,o)}function d(e){return function(){var n=this,t=arguments;return new Promise((function(a,o){var r=e.apply(n,t);function i(e){u(r,a,o,i,d,"next",e)}function d(e){u(r,a,o,i,d,"throw",e)}i(void 0)}))}}var c={data:function(){return{payType:1,payName:"weixin",orderInfo:{},money:0,now_money:0,orderKey:"",orderId:"",payLoding:!1,type:"",pinkid:""}},computed:{},onLoad:function(e){var n=this;if(1==e.type)this.type=1,this.orderId=e.ordid,this.money=e.money;else{this.orderKey=e.key;var t=this.$api.prePage();(0,r.computedOrderkey)({orderkey:this.orderKey,couponId:t.couponChecked.id,addressId:t.addressData.id,useIntegral:t.checkedPoints?1:0}).then((function(e){var t=e.data;n.money=t.result.pay_price}))}e.pinkid&&(this.pinkid=e.pinkid),(0,o.balance)({}).then((function(e){var t=e.data;n.now_money=t.now_money}))},methods:{changePayType:function(e){this.payType=e,1==this.payType&&(this.payName="weixin"),2==this.payType&&(this.payName="ali"),3==this.payType&&(this.payName="yue")},orderMoneyPay:function(){var n=this;(0,r.orderPay)({uni:n.orderId,from:"routine",paytype:n.payName}).then((function(t){if("yue"==n.payName&&"SUCCESS"==t.data.status&&(200==t.status?n.paySuccessTo():n.$api.msg(msg)),"weixin"==n.payName||"routine"==n.payName){var a=t.data.result.jsConfig,o={timeStamp:a.timestamp,nonceStr:a.nonceStr,package:a.package,signType:a.signType,paySign:a.paySign,success:function(e){n.paySuccessTo()},fail:function(){e.navigateTo({url:"/pages/order/order?state=0"})}};"routine"==n.payName&&wx.requestPayment(o)}e.hideLoading(),n.payLoding=!1})).catch((function(t){e.hideLoading(),n.payLoding=!1,console.log(t)}))},paySuccessTo:function(){e.hideLoading(),e.redirectTo({url:"/pages/money/paySuccess?orderid="+this.orderId})},confirm:function(){var n=d(a.default.mark((function n(){var t;return a.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(t=this,e.showLoading({title:"支付中",mask:!0}),!("yue"==t.payName&&+t.now_money<t.money)){n.next=5;break}return e.showModal({title:"提示",content:"账户余额不足！",showCancel:!1,success:function(e){},fail:function(){},complete:function(){}}),n.abrupt("return");case 5:t.payLoding=!0,1!=t.type?t.firstCreateOrder():t.orderMoneyPay();case 7:case"end":return n.stop()}}),n,this)})));function t(){return n.apply(this,arguments)}return t}(),firstCreateOrder:function(){var n=this,t=n.$api.prePage(),a={real_name:t.addressData.real_name,phone:t.addressData.phone,couponId:t.couponChecked.id,addressId:t.addressData.id,useIntegral:t.checkedPoints?1:0,payType:n.payName,mark:t.desc,from:"routine",shipping_type:1};n.pinkid&&(a.pinkId=n.pinkid),(0,r.createOrderkey)(a,n.orderKey).then((function(t){var a=t.data,o=t.status,r=t.msg;if("ORDER_EXIST"==a.status)return e.showModal({title:"提示",content:r,showCancel:!1}),e.hideLoading(),void(n.payLoding=!1);n.orderId=a.result.orderId,"yue"==n.payName?200==o&&"SUCCESS"==a.status?n.paySuccessTo():n.$api.msg(r):n.orderMoneyPay()})).catch((function(t){e.hideLoading(),n.payLoding=!1,console.log(t)}))}}};n.default=c}).call(this,t("543d")["default"])},e26c:function(e,n,t){"use strict";t.r(n);var a=t("efcf"),o=t("33fe");for(var r in o)"default"!==r&&function(e){t.d(n,e,(function(){return o[e]}))}(r);t("a91e");var i,u=t("f0c5"),d=Object(u["a"])(o["default"],a["b"],a["c"],!1,null,null,null,!1,a["a"],i);n["default"]=d.exports},efcf:function(e,n,t){"use strict";var a;t.d(n,"b",(function(){return o})),t.d(n,"c",(function(){return r})),t.d(n,"a",(function(){return a}));var o=function(){var e=this,n=e.$createElement;e._self._c;e._isMounted||(e.e0=function(n){!e.payLoding&&e.confirm()})},r=[]}},[["2412","common/runtime","common/vendor"]]]);