(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/scan_code/index/index"],{"257b":function(e,t,i){},"4a4d":function(e,t,i){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i={name:"index",components:{},data:function(){return{page_loading:!0,tmp_price:"",clerk_user_id:0,edit_status:!0,price_modal:!1,activity:{},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 e=this,t=e.$store.state.scanCode.userCoupon;if(t?(e.list.coupon_id=-1==t?0:t.id,e.calcPrice()):e.list.coupon_id=0,e.clear){var i=[!0,!1,"","",{price:"",pay_price:0,use_integral:0,activity_id:0,coupon_id:0,can_coupon_num:0,integral_explain:[]}];e.edit_status=i[0],e.clear=i[1],e.remark=i[2],e.tmp_price=i[3],e.list=i[4]}},onLoad:function(e){this.$commonLoad.onload(e);var t=this;if(t.$store.commit("scanCode/mutSetUserCoupon",0),t.clear=!0,e.clerk_user_id&&(t.clerk_user_id=e.clerk_user_id),e.price){var i=[!1,e.price];t.edit_status=i[0],t.tmp_price=i[1],t.calcPrice()}t.$showLoading({text:"加载中"}),t.$request({url:t.$api.scan_code_pay.index}).then((function(e){if(t.$hideLoading(),0===e.code){var i=[e.data.activity?e.data.activity:{},e.data.goods,e.data.integral,e.data.setting];t.activity=i[0],t.goods=i[1],t.integral=i[2],t.setting=i[3]}})).catch((function(e){t.$hideLoading()}))},methods:{openPriceModel:function(){this.edit_status&&(this.price_modal=!0)},closePriceModel:function(){this.price_modal=!1},setTempInput:function(e){this.tmp_price=this.money(e.detail.value)},money:function(e){var t=e.toString();return 0==t.indexOf(".")&&(t="0"+t),t=t.replace(/[^\d.]/g,""),t=t.replace(/\.{2,}/g,"."),t=t.replace(".","$#$").replace(/\./g,"").replace("$#$","."),t=t.replace(/^(\-)*(\d+)\.(\d\d).*$/,"$1$2.$3"),t.indexOf(".")<0&&""!=t&&(t=parseFloat(t)),+t},priceChange:function(){this.tmp_price>1e5&&(this.tmp_price=1e5)},calcPrice:function(){var t=this;t.priceChange(),t.price_modal=!1,t.$showLoading({text:"加载中"}),t.$request({url:t.$api.scan_code_pay.preview,data:{price:t.tmp_price,coupon_id:t.list.coupon_id,use_integral:t.list.use_integral,clerk_user_id:t.clerk_user_id},method:"POST"}).then((function(i){if(t.$hideLoading(),0===i.code){var n=[i.data,i.data.price];t.list=n[0],t.tmp_price=n[1]}else e.showToast({icon:"none",title:i.msg})})).catch((function(e){t.$hideLoading()}))},handleUseIntegral:function(){var e=this,t=e.list;t.use_integral=1==t.use_integral?0:1,e.calcPrice()},bindTextBlur:function(e){this.remark=e.detail.value},getIntegralInfo:function(t){var i="";this.list.integral_explain.map((function(e){i+="消费满"+e.consume_money+"元，",i+="积分最多可抵"+e.integral_deduction+"元",i+="\r\n"})),e.showModal({title:"积分抵扣说明",content:i.trim(),showCancel:!1})},setCoupon:function(t){this.clear=!1,e.navigateTo({url:"/plugins/scan_code/index/coupon?price="+this.list.price+"&coupon_id="+this.list.coupon_id})},submit:function(t){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,clerk_user_id:i.clerk_user_id}}).then((function(t){i.$hideLoading(),0===t.code?i.$payment.pay(t.data.pay_id).then((function(n){i.$store.commit("scanCode/mutSetUserCoupon",""),e.showModal({title:"提示",content:"支付成功",showCancel:!1,success:function(){e.navigateTo({url:"/pages/order-submit/pay-result?payment_order_union_id="+t.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:t.data.pay_id},method:"POST"}).then((function(e){i.$hideLoading()})).catch((function(t){i.$hideLoading(),e.showModal({title:"提示",content:t.msg})}))})):e.showModal({title:"提示",content:info.msg})})).catch((function(e){i.$hideLoading()})))}}};t.default=i}).call(this,i("543d")["default"])},"66ca":function(e,t,i){"use strict";i.r(t);var n=i("4a4d"),a=i.n(n);for(var c in n)"default"!==c&&function(e){i.d(t,e,(function(){return n[e]}))}(c);t["default"]=a.a},9326:function(e,t,i){"use strict";var n;i.d(t,"b",(function(){return a})),i.d(t,"c",(function(){return c})),i.d(t,"a",(function(){return n}));var a=function(){var e=this,t=e.$createElement;e._self._c},c=[]},e9a0:function(e,t,i){"use strict";var n=i("257b"),a=i.n(n);a.a},ede3:function(e,t,i){"use strict";i.r(t);var n=i("9326"),a=i("66ca");for(var c in a)"default"!==c&&function(e){i.d(t,e,(function(){return a[e]}))}(c);i("e9a0");var o,r=i("f0c5"),d=Object(r["a"])(a["default"],n["b"],n["c"],!1,null,"95780a02",null,!1,n["a"],o);t["default"]=d.exports},f2d2:function(e,t,i){"use strict";(function(e){i("2d0a");n(i("66fd"));var t=n(i("ede3"));function n(e){return e&&e.__esModule?e:{default:e}}e(t.default)}).call(this,i("543d")["createPage"])}},[["f2d2","common/runtime","common/vendor"]]]);