(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/money/pay"],{"0d9c":function(e,n,a){"use strict";(function(e){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var t=i(a("a34a")),o=a("367e"),r=a("d222");a("26cb");function i(e){return e&&e.__esModule?e:{default:e}}function c(e,n,a,t,o,r,i){try{var c=e[r](i),d=c.value}catch(u){return void a(u)}c.done?n(d):Promise.resolve(d).then(t,o)}function d(e){return function(){var n=this,a=arguments;return new Promise((function(t,o){var r=e.apply(n,a);function i(e){c(r,t,o,i,d,"next",e)}function d(e){c(r,t,o,i,d,"throw",e)}i(void 0)}))}}var u={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 a=this.$api.prePage();(0,r.computedOrderkey)({orderkey:this.orderKey,couponId:a.couponChecked.id,addressId:a.addressData.id,useIntegral:a.checkedPoints?1:0}).then((function(e){var a=e.data;n.money=a.result.pay_price}))}e.pinkid&&(this.pinkid=e.pinkid),(0,o.balance)({}).then((function(e){var a=e.data;n.now_money=a.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(a){if("yue"==n.payName&&"SUCCESS"==a.data.status&&(200==a.status?n.paySuccessTo():n.$api.msg(msg)),"weixin"==n.payName||"routine"==n.payName){var t=a.data.result.jsConfig;console.log(t,"数据");var o={timeStamp:t.timestamp,nonceStr:t.nonceStr,package:t.package,signType:t.signType,paySign:t.paySign,success:function(e){n.paySuccessTo()},fail:function(n){console.log(n,"失败"),e.navigateTo({url:"/pages/order/order?state=0"})}};"weixin"==n.payName&&wx.requestPayment(o)}e.hideLoading(),n.payLoding=!1})).catch((function(a){e.hideLoading(),n.payLoding=!1,console.log(a)}))},paySuccessTo:function(){e.hideLoading(),e.redirectTo({url:"/pages/money/paySuccess?orderid="+this.orderId})},confirm:function(){var n=d(t.default.mark((function n(){var a;return t.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(a=this,e.showLoading({title:"支付中",mask:!0}),!("yue"==a.payName&&+a.now_money<a.money)){n.next=5;break}return e.showModal({title:"提示",content:"账户余额不足！",showCancel:!1,success:function(e){},fail:function(){},complete:function(){}}),n.abrupt("return");case 5:a.payLoding=!0,1!=a.type?a.firstCreateOrder():a.orderMoneyPay();case 7:case"end":return n.stop()}}),n,this)})));function a(){return n.apply(this,arguments)}return a}(),firstCreateOrder:function(){var n=this,a=n.$api.prePage(),t={real_name:a.addressData.real_name,phone:a.addressData.phone,couponId:a.couponChecked.id,addressId:a.addressData.id,useIntegral:a.checkedPoints?1:0,payType:n.payName,mark:a.desc,from:"routine",shipping_type:1};n.pinkid&&(t.pinkId=n.pinkid),(0,r.createOrderkey)(t,n.orderKey).then((function(a){var t=a.data,o=a.status,r=a.msg;if("ORDER_EXIST"==t.status)return e.showModal({title:"提示",content:r,showCancel:!1}),e.hideLoading(),void(n.payLoding=!1);n.orderId=t.result.orderId,"yue"==n.payName?200==o&&"SUCCESS"==t.status?n.paySuccessTo():n.$api.msg(r):n.orderMoneyPay()})).catch((function(a){e.hideLoading(),n.payLoding=!1,console.log(a)}))}}};n.default=u}).call(this,a("543d")["default"])},"46ce":function(e,n,a){"use strict";a.r(n);var t=a("c56f"),o=a("ae7b");for(var r in o)"default"!==r&&function(e){a.d(n,e,(function(){return o[e]}))}(r);a("ed1a");var i,c=a("f0c5"),d=Object(c["a"])(o["default"],t["b"],t["c"],!1,null,null,null,!1,t["a"],i);n["default"]=d.exports},"86a0":function(e,n,a){"use strict";(function(e){a("e27b");t(a("66fd"));var n=t(a("46ce"));function t(e){return e&&e.__esModule?e:{default:e}}wx.__webpack_require_UNI_MP_PLUGIN__=a,e(n.default)}).call(this,a("543d")["createPage"])},"94a3":function(e,n,a){},ae7b:function(e,n,a){"use strict";a.r(n);var t=a("0d9c"),o=a.n(t);for(var r in t)"default"!==r&&function(e){a.d(n,e,(function(){return t[e]}))}(r);n["default"]=o.a},c56f:function(e,n,a){"use strict";var t;a.d(n,"b",(function(){return o})),a.d(n,"c",(function(){return r})),a.d(n,"a",(function(){return t}));var o=function(){var e=this,n=e.$createElement;e._self._c;e._isMounted||(e.e0=function(n){!e.payLoding&&e.confirm()})},r=[]},ed1a:function(e,n,a){"use strict";var t=a("94a3"),o=a.n(t);o.a}},[["86a0","common/runtime","common/vendor"]]]);