require('../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages_tool/pay/cashier"],{5341:function(t,e,n){"use strict";n.r(e);var a=n("ac49"),o=n.n(a);for(var i in a)["default"].indexOf(i)<0&&function(t){n.d(e,t,(function(){return a[t]}))}(i);e["default"]=o.a},5514:function(t,e,n){"use strict";var a=n("9d36"),o=n.n(a);o.a},"766e":function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"c",(function(){return i})),n.d(e,"a",(function(){return a}));var a={nsEmpty:function(){return n.e("components/ns-empty/ns-empty").then(n.bind(null,"a84f"))},nsLogin:function(){return Promise.all([n.e("common/vendor"),n.e("components/ns-login/ns-login")]).then(n.bind(null,"17d0"))}},o=function(){var t=this,e=t.$createElement,n=(t._self._c,t.payInfo&&0==t.payInfo.pay_status?t._f("moneyFormat")(t.payInfo.pay_money):null),a=t.payInfo&&0==t.payInfo.pay_status?t.payTypeList.length:null;t._isMounted||(t.e0=function(e,n){var a=arguments[arguments.length-1].currentTarget.dataset,o=a.eventParams||a["event-params"];n=o.index;t.payIndex=n}),t.$mp.data=Object.assign({},{$root:{f0:n,g0:a}})},i=[]},"7ba3":function(t,e,n){"use strict";(function(t,e){var a=n("47a9");n("1dee");a(n("3240"));var o=a(n("e327"));t.__webpack_require_UNI_MP_PLUGIN__=n,e(o.default)}).call(this,n("3223")["default"],n("df3c")["createPage"])},"9d36":function(t,e,n){},ac49:function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;n("cc1e");var a={data:function(){return{payIndex:0,payTypeList:[{name:"微信支付",provider:"wxpay",icon:"icon-weixin1",type:"wechatpay"}],payInfo:null,outTradeNo:""}},onLoad:function(t){this.getPayType(),this.outTradeNo=t.out_trade_no||"",this.getPayInfo()},methods:{getPayInfo:function(){var t=this;this.$api.sendRequest({url:"/api/pay/info",data:{out_trade_no:this.outTradeNo},success:function(e){e.code>=0&&e.data&&(t.payInfo=e.data,0==t.payInfo.pay_status&&setTimeout((function(){t.autoPay()}),500))}})},getPayType:function(){var t=this;this.$api.sendRequest({url:"/api/pay/type",success:function(e){""==e.data.pay_type?t.payTypeList=[]:t.payTypeList.forEach((function(n,a){-1==e.data.pay_type.indexOf(n.type)&&t.payTypeList.splice(a,1)}))}})},autoPay:function(){var t=this;this.payTypeList.length&&(this.$util.isWeiXin()?this.payTypeList.forEach((function(e,n){"wechatpay"==e.type&&(t.payIndex=n,t.confirm())})):/AlipayClient/.test(window.navigator.userAgent)&&this.payTypeList.forEach((function(e,n){"alipay"==e.type&&(t.payIndex=n,t.confirm())})))},confirm:function(){var e=this;this.storeToken?0==this.payTypeList.length&&this.payInfo.pay_money>0?this.$util.showToast({title:"请选择支付方式！"}):(t.showLoading({title:"支付中...",mask:!0}),this.pay()):this.$nextTick((function(){e.$refs.login.open("/pages_tool/pay/cashier?out_trade_no="+e.outTradeNo)}))},pay:function(){var e=this,n=this.payTypeList[this.payIndex];n&&this.$api.sendRequest({url:"/api/pay/pay",data:{out_trade_no:this.payInfo.out_trade_no,pay_type:n.type},success:function(a){if(t.hideLoading(),a.code>=0){var o=a.data.data;t.requestPayment({provider:n.provider,timeStamp:o.timeStamp,nonceStr:o.nonceStr,package:o.package,signType:o.signType,paySign:o.paySign,success:function(t){e.$util.redirectTo("/pages_tool/pay/result",{code:e.payInfo.out_trade_no},"redirectTo")},fail:function(n){e.flag=!1,"requestPayment:fail cancel"==n.errMsg?e.$util.showToast({title:"您已取消支付"}):t.showModal({content:"支付失败,失败原因: "+n.errMsg,showCancel:!1})}})}else e.$util.showToast({title:a.message})},fail:function(n){t.hideLoading(),e.$util.showToast({title:"request:fail"})}})}},watch:{storeToken:function(t,e){t&&this.getPayInfo()}},filters:{moneyFormat:function(t){return parseFloat(t).toFixed(2)}}};e.default=a}).call(this,n("df3c")["default"])},e327:function(t,e,n){"use strict";n.r(e);var a=n("766e"),o=n("5341");for(var i in o)["default"].indexOf(i)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(i);n("5514");var s=n("828b"),u=Object(s["a"])(o["default"],a["b"],a["c"],!1,null,"17724a08",null,!1,a["a"],void 0);e["default"]=u.exports}},[["7ba3","common/runtime","common/vendor"]]]);