index.js 4.3 KB

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