(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/scan_code/index/index"],{"0a29":function(t,e,i){"use strict";i.r(e);var n=i("9b48"),a=i.n(n);for(var o in n)"default"!==o&&function(t){i.d(e,t,(function(){return n[t]}))}(o);e["default"]=a.a},"4b7b":function(t,e,i){"use strict";var n;i.d(e,"b",(function(){return a})),i.d(e,"c",(function(){return o})),i.d(e,"a",(function(){return n}));var a=function(){var t=this,e=t.$createElement;t._self._c},o=[]},6565:function(t,e,i){},"93e0":function(t,e,i){"use strict";(function(t){i("b8bc");n(i("66fd"));var e=n(i("d8ac"));function n(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,i("543d")["createPage"])},"9b48":function(t,e,i){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i={name:"index",components:{},data:function(){return{page_loading:!0,tmp_price:"",edit_status:!0,price_modal:!1,activity:null,remark:"",integral:{user_integral_num:"0"},list:{price:"",pay_price:0,use_integral:0,activity_id:0,coupon_id:0,can_coupon_num:0,integral_explain:[]},clear:!1}},onShow:function(){var t=this,e=t.$store.state.scanCode.userCoupon;if(e?(t.list.coupon_id=-1==e?0:e.id,t.calcPrice()):t.list.coupon_id=0,t.clear){var i=[!0,!1,"","",{price:"",pay_price:0,use_integral:0,activity_id:0,coupon_id:0,can_coupon_num:0,integral_explain:[]}];t.edit_status=i[0],t.clear=i[1],t.remark=i[2],t.tmp_price=i[3],t.list=i[4]}},onLoad:function(t){var e=this;if(e.$store.commit("scanCode/mutSetUserCoupon",0),e.clear=!0,t.price){var i=[!1,t.price];e.edit_status=i[0],e.tmp_price=i[1],e.calcPrice()}e.$showLoading({text:"加载中"}),e.$request({url:e.$api.scan_code_pay.index}).then((function(t){if(e.$hideLoading(),0===t.code){var i=[t.data.activity,t.data.goods,t.data.integral,t.data.setting];e.activity=i[0],e.goods=i[1],e.integral=i[2],e.setting=i[3]}})).catch((function(t){e.$hideLoading()}))},methods:{openPriceModel:function(){this.edit_status&&(this.price_modal=!0)},closePriceModel:function(){this.price_modal=!1},setTempInput:function(t){this.tmp_price=t.detail.value},calcPrice:function(){var e=this;e.price_modal=!1,e.$showLoading({text:"加载中"}),e.$request({url:e.$api.scan_code_pay.preview,data:{price:e.tmp_price,coupon_id:e.list.coupon_id,use_integral:e.list.use_integral},method:"POST"}).then((function(i){if(e.$hideLoading(),0===i.code){var n=[i.data,i.data.price];e.list=n[0],e.tmp_price=n[1]}else t.showToast({icon:"none",title:i.msg})})).catch((function(t){e.$hideLoading()}))},handleUseIntegral:function(){var t=this,e=t.list;e.use_integral=1==e.use_integral?0:1,t.calcPrice()},bindTextBlur:function(t){this.remark=t.detail.value},getIntegralInfo:function(e){var i="";this.list.integral_explain.map((function(t){i+="消费满"+t.consume_money+"元，",i+="积分最多可抵"+t.integral_deduction+"元",i+="\r\n"})),t.showModal({title:"积分抵扣说明",content:i.trim(),showCancel:!1})},setCoupon:function(e){this.clear=!1,t.navigateTo({url:"/plugins/scan_code/index/coupon?price="+this.list.price+"&coupon_id="+this.list.coupon_id})},submit:function(e){var i=this;i.list.price&&(i.$showLoading({text:"正在提交"}),i.$request({url:i.$api.scan_code_pay.submit,method:"post",data:{price:i.list.price,coupon_id:i.list.coupon_id,use_integral:i.list.use_integral,remark:i.remark}}).then((function(e){i.$hideLoading(),0===e.code?i.$payment.pay(e.data.pay_id).then((function(n){i.$store.commit("scanCode/mutSetUserCoupon",""),t.showModal({title:"提示",content:"支付成功",showCancel:!1,success:function(){t.navigateTo({url:"/pages/order-submit/pay-result?payment_order_union_id="+e.data.pay_id+"&plugin=scan_code_pay"}),i.clear=!0}})})).catch((function(n){i.$showLoading({text:"取消中"}),i.$request({url:i.$api.scan_code_pay.cancel,data:{pay_id:e.data.pay_id},method:"POST"}).then((function(t){i.$hideLoading()})).catch((function(e){i.$hideLoading(),t.showModal({title:"提示",content:e.msg})}))})):t.showModal({title:"提示",content:info.msg})})).catch((function(t){i.$hideLoading()})))}}};e.default=i}).call(this,i("543d")["default"])},d8ac:function(t,e,i){"use strict";i.r(e);var n=i("4b7b"),a=i("0a29");for(var o in a)"default"!==o&&function(t){i.d(e,t,(function(){return a[t]}))}(o);i("ed8e");var c,r=i("f0c5"),u=Object(r["a"])(a["default"],n["b"],n["c"],!1,null,"5eb58740",null,!1,n["a"],c);e["default"]=u.exports},ed8e:function(t,e,i){"use strict";var n=i("6565"),a=i.n(n);a.a}},[["93e0","common/runtime","common/vendor"]]]);