affirmGhs.js 9.5 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["admin/billing/affirmGhs"],{"0191":function(t,e,n){"use strict";var o;n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return r})),n.d(e,"a",(function(){return o}));var i=function(){var t=this,e=t.$createElement,n=(t._self._c,parseFloat(t.allPrice.toFixed(2)));t.$mp.data=Object.assign({},{$root:{m0:n}})},r=[]},"0ee9":function(t,e,n){"use strict";n.r(e);var o=n("15a7"),i=n.n(o);for(var r in o)["default"].indexOf(r)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(r);e["default"]=i.a},"15a7":function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=u(n("644f")),i=u(n("e350")),r=n("8f31"),c=n("a075"),s=n("7736"),a=n("34f9");function u(t){return t&&t.__esModule?t:{default:t}}function l(t,e,n,o,i,r,c){try{var s=t[r](c),a=s.value}catch(u){return void n(u)}s.done?e(a):Promise.resolve(a).then(o,i)}function f(t){return function(){var e=this,n=arguments;return new Promise((function(o,i){var r=t.apply(e,n);function c(t){l(r,o,i,c,s,"next",t)}function s(t){l(r,o,i,c,s,"throw",t)}c(void 0)}))}}function d(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function h(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?d(Object(n),!0).forEach((function(e){p(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function p(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var m=function(){n.e("components/plugin/list-cell").then(function(){return resolve(n("1861"))}.bind(null,n)).catch(n.oe)},g=function(){Promise.all([n.e("common/vendor"),n.e("components/module/app-avatar")]).then(function(){return resolve(n("d84d"))}.bind(null,n)).catch(n.oe)},v=function(){Promise.all([n.e("common/vendor"),n.e("components/plugin/simple-address")]).then(function(){return resolve(n("618a"))}.bind(null,n)).catch(n.oe)},b=function(){n.e("components/app-area-sel").then(function(){return resolve(n("62ec"))}.bind(null,n)).catch(n.oe)},y=function(){Promise.all([n.e("common/vendor"),n.e("components/app-customer-sel")]).then(function(){return resolve(n("a51e"))}.bind(null,n)).catch(n.oe)},I=function(){n.e("components/app-timer").then(function(){return resolve(n("b0c1"))}.bind(null,n)).catch(n.oe)},S=function(){n.e("components/app-formRadio-btn").then(function(){return resolve(n("c6ee"))}.bind(null,n)).catch(n.oe)},P=function(){Promise.all([n.e("common/vendor"),n.e("components/app-address-group")]).then(function(){return resolve(n("cdfa"))}.bind(null,n)).catch(n.oe)},C=function(){Promise.all([n.e("common/vendor"),n.e("components/app-form-send")]).then(function(){return resolve(n("a5ce"))}.bind(null,n)).catch(n.oe)},T=function(){n.e("components/app-send-time").then(function(){return resolve(n("0a72"))}.bind(null,n)).catch(n.oe)},O=n("90f4"),x=function(){n.e("components/app-date-picker").then(function(){return resolve(n("2f8d"))}.bind(null,n)).catch(n.oe)},N={name:"BillingAffirm",components:{TuiListCell:m,AppAvatarModule:g,SimpleAddress:v,AppAreaSel:b,appSendTime:T,AppCustomerSel:y,appFormRadioBtn:S,appAddressGroup:P,appFormSend:C,appTimer:I,AppDatePicker:x},mixins:[i.default],data:function(){return{list:[],autoLoad:!1,ghsInfo:"",sendTimeWant:"",remark:"",form:{debt:1,shopId:"",shopName:"",receiveProvince:"",receiveCity:"",receiveFloor:"",receiveAddress:"",receiveLong:"",receiveLat:"",sendType:2,sendSide:"2",sendDate:"",sendTimeWant:"",sendCost:"",customId:"",product:"",couponId:"0"},showCustomer:!1,couponSumText:"",couponText:"",today:"",monthLater:"",modifyPrice:0,discountAmount:0}},onLoad:function(e){this.getMerchantInfo?t.setNavigationBarTitle({title:this.getMerchantInfo.name}):this.initMerchantInfo().then((function(e){t.setNavigationBarTitle({title:e.name})})),this.getGhsData(e.id)},onShow:function(){for(var e=this.$util.copyObject(this.selectList),n=[],o=function(t){if(""==n)n.push(e[t]);else{var o=!1;n.map((function(n){n.id==e[t].id&&(n.bigCount=n.bigCount+e[t].bigCount,n.smallCount=n.smallCount+e[t].smallCount,o=!0)})),0==o&&n.push(e[t])}},i=0;i<e.length;i++)o(i);this.list=n,t.getStorageSync("selectCouponInfo").couponSum?(this.couponSumText=t.getStorageSync("selectCouponInfo").couponSum,this.couponText="-¥"+this.couponSumText,this.form.couponId=t.getStorageSync("selectCouponInfo").couponId):(this.couponSumText="0",this.form.couponId="0",this.hasCoupon())},computed:h({},(0,s.mapGetters)(["getMerchantInfo","getLoginInfo"])),methods:h(h({},(0,s.mapActions)(["initMerchantInfo"])),{},{calcPrice:function(){var t=this.allPrice.toFixed(2);this.ghsInfo.giveDiscount&&this.ghsInfo.giveDiscount<1&&(this.discountAmount=((1-Number(this.ghsInfo.giveDiscount))*t).toFixed(2),this.discountAmount=parseFloat(this.discountAmount)),this.modifyPrice=(Number(t)-Number(this.discountAmount)).toFixed(2),this.modifyPrice=parseFloat(this.modifyPrice)},init:function(){this._getDet()},bindDateChange:function(t){var e=t.detail.value;this.sendTimeWant=e},toPhone:function(e){1==this.form.sendType?(this.allPrice,Number(this.form.sendCost)):this.allPrice;t.makePhoneCall({phoneNumber:e})},toCoupon:function(){var t=1==this.form.sendType?this.numberAdd(this.allPrice,Number(this.form.sendCost)):this.allPrice;console.log(t),this.pageTo({url:"/admin/coupon/selectCouponList?price="+t})},hasCoupon:function(){var t=this,e=1==this.form.sendType?this.numberAdd(this.allPrice,Number(this.form.sendCost)):this.allPrice;(0,a.shopHouponHas)({amount:e}).then((function(e){t.couponText=e.data.has?"有红包可用":"",console.log(t.couponText)})).catch((function(t){}))},getGhsData:function(t){var e=this;(0,r.getGhsDataApi)({id:t}).then((function(t){e.ghsInfo=t.data,e.purchaseFreight(e.ghsInfo),e.calcPrice()}))},countAllPrices:function(t){this.allPrices=this.allPrices+Number(this.form.sendCost)},_getDet:function(){var e=this,n=t.getStorageSync("modifyShopB");this.$util.isEmpty(n)||Object.keys(this.form).forEach((function(t,o){e.form[t]=n[t]}))},purchaseFreight:function(t){var e=this,n=this.selectList.map((function(t){return{productId:t.id,bigNum:t.bigCount,smallNum:t.smallCount,classId:t.classId,itemId:t.itemId}})),o={ghsId:this.options.id,product:JSON.stringify(n),province:t.province,city:t.city,address:t.address,floor:t.floor,long:t.long,lat:t.lat,sendTimeWant:this.sendTimeWant};(0,c.freight)(o).then((function(t){e.form.sendCost=t.data.sedCost}))},confirmFn:function(e){var n=this;(0,c.createOrder)(e).then((function(e){n.resetSelectInfoByType(n.pageType);var o=e.data,i=o.id,r=o.orderSn,c="/admin/billing/result?orderId=".concat(i,"&orderSn=").concat(r);t.redirectTo({url:c,success:function(t){},fail:function(){},complete:function(){}})}))},affirmFormSubmit:function(){var e=this.list.map((function(t){return{productId:t.id,bigNum:t.bigCount,smallNum:t.smallCount,classId:t.classId,itemId:t.itemId}})),n=t.getStorageSync("ghsXj"+this.ghsInfo.id),o={getType:this.form.sendType,sendTimeWant:this.sendTimeWant,sendCost:2==this.form.sendType?"":this.form.sendCost,remark:this.remark,product:JSON.stringify(e),ghsId:this.ghsInfo.id,couponId:this.form.couponId,xj:JSON.stringify(n)},i=this;t.showModal({title:"提示",content:"确认提交?",success:function(e){e.confirm&&(0,c.createOrder)(o).then((function(e){var n=e.data,r=n.orderSn,c=n.realPrice,s=n.count,a=n.hasDebtPay;i.pageTo({url:"/pagesPurchase/wechatPay?type=2&orderSn=".concat(r,"&realPrice=").concat(c,"&count=").concat(s,"&hasDebtPay=").concat(a),type:2}),setTimeout((function(){t.removeStorageSync("selectCouponInfo"),i.resetSelectInfoByType(i.pageType),t.removeStorageSync("ghsXj"+o.ghsId)}),600)}))}})},numberAdd:function(t,e){var n,o,i,r;try{n=t.toString().split(".")[1].length}catch(c){n=0}try{o=e.toString().split(".")[1].length}catch(c){o=0}return i=Math.pow(10,Math.max(n,o)),r=n>=o?n:o,((t*i+e*i)/i).toFixed(r)},NumberSub:function(t,e){var n,o,i,r;try{n=t.toString().split(".")[1].length}catch(c){n=0}try{o=e.toString().split(".")[1].length}catch(c){o=0}return i=Math.pow(10,Math.max(n,o)),r=n>=o?n:o,((t*i-e*i)/i).toFixed(r)},formSubmit:function(){var t=f(o.default.mark((function t(e){var n,i,r;return o.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(t.prev=0,n=this.form,i=this.selectList.map((function(t){return{productId:t.id,bigNum:t.bigCount,smallNum:t.smallCount}})),n.product=JSON.stringify(i),this.getMerchantInfo){t.next=7;break}return t.next=7,this.initMerchantInfo();case 7:n.shopId=this.getMerchantInfo.id,r=O.validation(n,[]),r?this.$msg(r):this.confirmFn(n),t.next=15;break;case 12:t.prev=12,t.t0=t["catch"](0),console.log(999999,t.t0);case 15:case"end":return t.stop()}}),t,this,[[0,12]])})));function e(e){return t.apply(this,arguments)}return e}(),gobackEvent:function(){t.navigateBack({delta:1})}})};e.default=N}).call(this,n("934e")["default"])},"35f2":function(t,e,n){"use strict";var o=n("569a"),i=n.n(o);i.a},"569a":function(t,e,n){},6335:function(t,e,n){"use strict";n.r(e);var o=n("0191"),i=n("0ee9");for(var r in i)["default"].indexOf(r)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(r);n("35f2");var c,s=n("8261"),a=Object(s["a"])(i["default"],o["b"],o["c"],!1,null,"4cf17429",null,!1,o["a"],c);e["default"]=a.exports},"9bdc":function(t,e,n){"use strict";(function(t){n("6cdc");o(n("b5e3"));var e=o(n("6335"));function o(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,n("934e")["createPage"])}},[["9bdc","common/runtime","common/vendor"]]]);