MrShi
10 小时以前 b806c4ad52a661a1e5f0695650ec1a7e42f01633
small-program/unpackage/dist/dev/mp-weixin/pages/luggage-storage/luggage-storage.js
@@ -1,2 +1,2 @@
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/luggage-storage/luggage-storage"],{222:function(e,t,o){"use strict";(function(e,t){var n=o(4);o(30);n(o(25));var r=n(o(223));e.__webpack_require_UNI_MP_PLUGIN__=o,t(r.default)}).call(this,o(1)["default"],o(2)["createPage"])},223:function(e,t,o){"use strict";o.r(t);var n=o(224),r=o(226);for(var a in r)["default"].indexOf(a)<0&&function(e){o.d(t,e,(function(){return r[e]}))}(a);o(228);var i,c=o(41),u=Object(c["default"])(r["default"],n["render"],n["staticRenderFns"],!1,null,"c13e4c60",null,!1,n["components"],i);u.options.__file="pages/luggage-storage/luggage-storage.vue",t["default"]=u.exports},224:function(e,t,o){"use strict";o.r(t);var n=o(225);o.d(t,"render",(function(){return n["render"]})),o.d(t,"staticRenderFns",(function(){return n["staticRenderFns"]})),o.d(t,"recyclableRender",(function(){return n["recyclableRender"]})),o.d(t,"components",(function(){return n["components"]}))},225:function(e,t,o){"use strict";var n;o.r(t),o.d(t,"render",(function(){return r})),o.d(t,"staticRenderFns",(function(){return i})),o.d(t,"recyclableRender",(function(){return a})),o.d(t,"components",(function(){return n}));try{n={uIcon:function(){return Promise.all([o.e("common/vendor"),o.e("node-modules/uview-ui/components/u-icon/u-icon")]).then(o.bind(null,561))},uDatetimePicker:function(){return Promise.all([o.e("common/vendor"),o.e("node-modules/uview-ui/components/u-datetime-picker/u-datetime-picker")]).then(o.bind(null,578))},uPopup:function(){return Promise.all([o.e("common/vendor"),o.e("node-modules/uview-ui/components/u-popup/u-popup")]).then(o.bind(null,570))},uActionSheet:function(){return Promise.all([o.e("common/vendor"),o.e("node-modules/uview-ui/components/u-action-sheet/u-action-sheet")]).then(o.bind(null,587))}}}catch(c){if(-1===c.message.indexOf("Cannot find module")||-1===c.message.indexOf(".vue"))throw c;console.error(c.message),console.error("1. 排查组件名称拼写是否正确"),console.error("2. 排查组件是否符合 easycom 规范,文档:https://uniapp.dcloud.net.cn/collocation/pages?id=easycom"),console.error("3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件")}var r=function(){var e=this,t=e.$createElement,o=(e._self._c,Date.now()),n=e.selectedCoupon&&e.selectedCoupon.value>0?e.selectedCoupon.value.toFixed(2):null,r=e.__map(e.couponList,(function(t,o){var n=e.__get_orig(t),r=((t.price||0)/100).toFixed(2),a=((t.limitPrice||0)/100).toFixed(2);return{$orig:n,g2:r,g3:a}})),a=e.amountData?(e.amountData.totalPrice-(e.selectedCoupon&&e.selectedCoupon.value||0)).toFixed(2):null;e._isMounted||(e.e0=function(t){e.showArriveTimePicker=!0},e.e1=function(t){e.showArriveTimePicker=!1},e.e2=function(t){e.showArriveTimePicker=!1},e.e3=function(t){e.showPickupTimePicker=!1},e.e4=function(t){e.showPickupTimePicker=!1},e.e5=function(t){e.showGoodsPopup=!0},e.e6=function(t,o){var n=arguments[arguments.length-1].currentTarget.dataset,r=n.eventParams||n["event-params"];o=r.item;e.isUrgent=o.id},e.e7=function(t){e.showCouponPopup=!1},e.e8=function(t){e.showCouponPopup=!1},e.e9=function(t){e.showStorePopup=!1},e.e10=function(t){e.showStorePopup=!1},e.e11=function(t,o){var n=arguments[arguments.length-1].currentTarget.dataset,r=n.eventParams||n["event-params"];o=r.index;e.storeList.forEach((function(e,t){return e.active=o===t}))},e.e12=function(t){e.showGoodsPopup=!1},e.e13=function(t){e.showGoodsPopup=!1},e.e14=function(t,o){var n=arguments[arguments.length-1].currentTarget.dataset,r=n.eventParams||n["event-params"];o=r.index;e.goodsOptions.forEach((function(e,t){return e.active=t===o}))},e.e15=function(t){e.showAmountPopup=!1},e.e16=function(t){e.showAmountPopup=!1},e.e17=function(t){e.showAmountPopup=!1},e.e18=function(t){e.showReceiveAddress=!1}),e.$mp.data=Object.assign({},{$root:{g0:o,g1:n,l0:r,g4:a}})},a=!1,i=[];r._withStripped=!0},226:function(e,t,o){"use strict";o.r(t);var n=o(227),r=o.n(n);for(var a in n)["default"].indexOf(a)<0&&function(e){o.d(t,e,(function(){return n[e]}))}(a);t["default"]=r.a},227:function(e,t,o){"use strict";(function(e){var n=o(4);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=n(o(34)),a=n(o(18)),i=n(o(36)),c=n(o(11)),u=o(37);function s(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function d(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?s(Object(o),!0).forEach((function(t){(0,c.default)(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):s(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}var l={data:function(){return{showStorePopup:!1,showGoodsPopup:!1,showAmountPopup:!1,showArriveTimePicker:!1,showPickupTimePicker:!1,arriveTimeValue:Number(new Date),pickupTimeValue:Number(new Date),activeMode:"local",modeTabs:[{label:"就地寄存",value:"local"},{label:"同城寄送",value:"city"}],agreementChecked:!1,tempSelectedStoreId:2,selectedStoreId:2,tempSelectedGoodsIds:[1],selectedGoodsIds:[1],selectedLuggageId:1,isUrgent:0,form:{receiver:"",mobile:"",arriveTime:"",pickupTime:"",goodType:"",goodTypeName:"",insurance:"",remark:"",goodsImages:[]},amountData:null,showInsuranceTip:!1,showInsuranceTipText:"",luggageTypes:[],serviceTimes:[],storeList:[],selectedStore:null,sendStore:null,receiveStore:null,receiveAddr:null,storePopupType:"send",storeForm:{keyword:"",page:1,isSearch:!0},goodsOptions:[],uploadedImages:[],showReceiveAddress:!1,actions:[{name:"选择服务点"},{name:"选择地址簿"}],selectedCoupon:null,showCouponPopup:!1,couponList:[],selectedCouponIndex:-1,showUsageIndex:-1}},watch:{"form.insurance":{handler:function(){this.calculateLocalPrice()}},isUrgent:{handler:function(){"city"===this.activeMode&&this.calculateRemotePrice()}}},computed:d(d({},(0,u.mapState)(["latitude","longitude","cityId"])),{},{servicePointPlaceholder:function(){return"city"===this.activeMode?"选择寄送服务点":"选择寄存服务点"},selectedGoodsText:function(){var e=this;if(!this.selectedGoodsIds.length)return"必选,请选择";var t=this.goodsOptions.filter((function(t){return e.selectedGoodsIds.includes(t.id)})).map((function(e){return e.name}));return t.join("、")},totalPriceText:function(){return"¥150.00"},pickupMinDate:function(){return this.form.arriveTime?new Date(this.form.arriveTime).getTime():Date.now()}}),onLoad:function(){var t=this;this.getNearbyShopList(),this.getCategoryList(),this.getCitySizeList(),this.agreementChecked=!1,this.getContactInfo(),e.getStorageSync("selectedStore")&&(this.selectedStore=e.getStorageSync("selectedStore"),e.removeStorageSync("selectedStore")),e.$on("updateAddress",(function(e){t.form.receiver=e.name,t.form.mobile=e.phone,t.receiveAddr=e,t.receiveAddr.addr=e.provinceName+e.cityName+e.districtName+e.addr})),e.$on("selectCoupon",(function(e){t.selectedCoupon=e,"city"===t.activeMode?t.calculateRemotePrice():t.calculateLocalPrice()}))},onUnload:function(){e.$off("updateAddress"),e.$off("selectCoupon")},methods:{getCouponId:function(){return this.selectedCoupon&&this.selectedCoupon.id&&this.selectedCoupon.id>0?this.selectedCoupon.id:this.selectedCoupon&&0===this.selectedCoupon.id?null:-1},selectCoupon:function(){this.showCouponPopup=!0},toggleUsage:function(e){this.showUsageIndex===e?this.showUsageIndex=-1:this.showUsageIndex=e},toggleCoupon:function(e){this.selectedCouponIndex===e?this.selectedCouponIndex=-1:this.selectedCouponIndex=e},confirmCoupon:function(){if(this.selectedCouponIndex>=0&&this.selectedCouponIndex<this.couponList.length){var e=this.couponList[this.selectedCouponIndex];this.selectedCoupon={id:e.id,name:e.name,value:e.value||e.amount/100,price:e.amount},this.showCouponPopup=!1,"city"===this.activeMode?this.calculateRemotePrice():this.calculateLocalPrice()}else-1===this.selectedCouponIndex&&(this.selectedCoupon={id:0,name:"不使用优惠券",value:0},this.showCouponPopup=!1,"city"===this.activeMode?this.calculateRemotePrice():this.calculateLocalPrice())},caozuo:function(t){var o=this;this.receiveStore=null,this.receiveAddr=null,"选择服务点"===t.name?(o.storePopupType="receive",o.showStorePopup=!0):"选择地址簿"===t.name&&e.navigateTo({url:"/pages/address/address?type=1"}),this.showReceiveAddress=!1},uploadFiles:function(t){var o=arguments,n=this;return(0,i.default)(r.default.mark((function a(){var i,c,u,s;return r.default.wrap((function(r){while(1)switch(r.prev=r.next){case 0:if(i=o.length>1&&void 0!==o[1]?o[1]:9,t&&0!==t.length){r.next=3;break}return r.abrupt("return",[]);case 3:return c=t.slice(0,i),u=c.map((function(t){return new Promise((function(o,r){e.uploadFile({url:n.$baseUrl+"/web/public/upload",filePath:t,name:"file",formData:{folder:"orders"},success:function(e){if(200===e.statusCode){var t=JSON.parse(e.data);200===t.code?o(t.data):r(new Error(t.msg||"上传失败"))}else r(new Error("上传失败"))},fail:function(e){r(e)}})}))})),r.prev=5,r.next=8,Promise.all(u);case 8:return s=r.sent,r.abrupt("return",s);case 12:throw r.prev=12,r.t0=r["catch"](5),e.showToast({title:"上传失败",icon:"none"}),r.t0;case 16:case"end":return r.stop()}}),a,null,[[5,12]])})))()},deleteImage:function(e){this.uploadedImages.splice(e,1),this.form.goodsImages.splice(e,1)},chooseAndUploadImage:function(){var t=arguments,o=this;return(0,i.default)(r.default.mark((function n(){var c,u,s;return r.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(c=t.length>0&&void 0!==t[0]?t[0]:9,u=o.form.goodsImages.length,s=c-u,!(s<=0)){n.next=6;break}return e.showToast({title:"最多上传".concat(c,"张图片"),icon:"none"}),n.abrupt("return");case 6:e.chooseImage({count:s,sizeType:["compressed"],sourceType:["album","camera"],success:function(){var t=(0,i.default)(r.default.mark((function t(n){var i,u,s,d;return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return i=n.tempFilePaths,e.showLoading({title:"上传中...",mask:!0}),t.prev=2,t.next=5,o.uploadFiles(i,c);case 5:u=t.sent,s=u.map((function(e){return e.imgaddr})),d=u.map((function(e){return e.url||e.path||e})),o.uploadedImages=[].concat((0,a.default)(o.uploadedImages),(0,a.default)(d.map((function(e){return{url:e}})))),o.form.goodsImages=[].concat((0,a.default)(o.form.goodsImages),(0,a.default)(s)),e.hideLoading(),e.showToast({title:"上传成功",icon:"success"}),t.next=17;break;case 14:t.prev=14,t.t0=t["catch"](2),e.hideLoading();case 17:case"end":return t.stop()}}),t,null,[[2,14]])})));function n(e){return t.apply(this,arguments)}return n}()});case 7:case"end":return n.stop()}}),n)})))()},searchStore:function(){this.storeList=[],this.storeForm.page=1,this.storeForm.isSearch=!0,this.getNearbyShopList()},switchMode:function(e){this.activeMode=e,this.selectedStore=null,this.sendStore=null,this.receiveStore=null,this.receiveAddr=null,this.form.receiver="",this.form.mobile="",this.form.arriveTime="",this.form.pickupTime="",this.form.goodType="",this.form.goodTypeName="",this.form.insurance="",this.form.remark="",this.form.goodsImages=[],this.amountData=null,this.uploadedImages=[],this.luggageTypes.forEach((function(e){e.count=0}))},toggleAgreement:function(){this.agreementChecked=!this.agreementChecked},goRichText:function(t){e.navigateTo({url:"/pages/rich-text/rich-text?type="+t})},openReceiveAddress:function(){this.showReceiveAddress=!0},openAmountPopup:function(){this.showAmountPopup=!0},openStorePopup:function(){this.storePopupType="send",this.tempSelectedStoreId=null,this.showStorePopup=!0},openStorePopup0:function(){this.storePopupType="send0",this.tempSelectedStoreId=null,this.showStorePopup=!0},confirmStore:function(){console.log("=========================");var e=this.storeList.find((function(e){return e.active}));console.log(e),"send"===this.storePopupType?this.sendStore=e:"receive"===this.storePopupType?(this.receiveStore=e,this.receiveAddr=null,this.calculateRemotePrice()):(this.selectedStore=e,this.calculateLocalPrice()),this.showStorePopup=!1},confirmGoods:function(){var t,o,n,r;this.goodsOptions.find((function(e){return e.active}))?(this.form.goodTypeName=(null===(t=this.goodsOptions.find((function(e){return e.active})))||void 0===t?void 0:t.name)||"",this.form.goodType=(null===(o=this.goodsOptions.find((function(e){return e.active})))||void 0===o?void 0:o.id)||"",this.showInsuranceTip="1"===(null===(n=this.goodsOptions.find((function(e){return e.active})))||void 0===n?void 0:n.relationOtherField),this.showInsuranceTipText=null===(r=this.goodsOptions.find((function(e){return e.active})))||void 0===r?void 0:r.relationRemark,this.showGoodsPopup=!1):e.showToast({title:"请选择物品信息",icon:"none"})},confirmArriveTime:function(e){var t=new Date(e.value),o=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),a=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0");this.form.arriveTime="".concat(o,"-").concat(n,"-").concat(r," ").concat(a,":").concat(i),this.form.pickupTime="",this.pickupTimeValue=e.value+36e5,this.showArriveTimePicker=!1,this.calculateLocalPrice()},openPickupTimePicker:function(){this.form.arriveTime?this.showPickupTimePicker=!0:e.showToast({title:"请先选择到店寄存时间",icon:"none"})},confirmPickupTime:function(t){var o=new Date(t.value),n=o.getFullYear(),r=String(o.getMonth()+1).padStart(2,"0"),a=String(o.getDate()).padStart(2,"0"),i=String(o.getHours()).padStart(2,"0"),c=String(o.getMinutes()).padStart(2,"0"),u="".concat(n,"-").concat(r,"-").concat(a," ").concat(i,":").concat(c);this.form.arriveTime&&new Date(u)<=new Date(this.form.arriveTime)?e.showToast({title:"预计取件时间必须大于到店寄存时间",icon:"none"}):(this.form.pickupTime=u,this.showPickupTimePicker=!1,this.calculateLocalPrice())},getCategoryList:function(){var e=this;return(0,i.default)(r.default.mark((function t(){var o;return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,e.$u.api.getCategoryList({type:2});case 2:o=t.sent,200===o.code&&(o.data.forEach((function(e){e.active=!1})),e.goodsOptions=o.data||[]);case 4:case"end":return t.stop()}}),t)})))()},getCitySizeList:function(){var e=this;return(0,i.default)(r.default.mark((function t(){var o;return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,e.$u.api.getCitySizeList({cityId:e.cityId});case 2:o=t.sent,200===o.code&&(o.data.forEach((function(e){e.count=0})),e.luggageTypes=o.data||[]);case 4:case"end":return t.stop()}}),t)})))()},getContactInfo:function(){var e=this;return(0,i.default)(r.default.mark((function t(){var o;return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,e.$u.api.getContactInfo({});case 2:o=t.sent,200===o.code&&o.data&&(o.data.name&&(e.form.receiver=o.data.name),o.data.phone&&(e.form.mobile=o.data.phone));case 4:case"end":return t.stop()}}),t)})))()},getNearbyShopList:function(){var e=this;return(0,i.default)(r.default.mark((function t(){var o;return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(e.storeForm.isSearch){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,e.$u.api.getNearbyShopList({capacity:10,page:e.storeForm.page,model:{latitude:e.latitude,longitude:e.longitude,cityId:e.cityId,name:e.storeForm.keyword,sortType:1}});case 4:o=t.sent,200===o.code&&(o.data.records.forEach((function(e){e.active=!1})),e.storeList=[].concat((0,a.default)(e.storeList),(0,a.default)(o.data.records||[])),e.storeForm.page++,e.storeForm.isSearch=e.storeList.length<=o.data.total);case 6:case"end":return t.stop()}}),t)})))()},increaseCount:function(e){this.luggageTypes[e].count++,this.calculateLocalPrice()},decreaseCount:function(e){this.luggageTypes[e].count>0&&this.luggageTypes[e].count--,this.calculateLocalPrice()},calculateLocalPrice:function(){var e=this;return(0,i.default)(r.default.mark((function t(){return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:"city"===e.activeMode?e.calculateRemotePrice():e.calculateLocalPriceOnly();case 1:case"end":return t.stop()}}),t)})))()},calculateLocalPriceOnly:function(){var e=this;return(0,i.default)(r.default.mark((function t(){var o,n,a;return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(e.form.arriveTime&&e.form.pickupTime){t.next=3;break}return e.amountData=null,t.abrupt("return");case 3:if(o=e.luggageTypes.filter((function(e){return e.count>0})).map((function(e){return{categoryId:e.id,quantity:e.count}})),0!==o.length){t.next=7;break}return e.amountData=null,t.abrupt("return");case 7:return t.next=9,e.$u.api.calculateLocalPrice({cityId:e.cityId,depositStartTime:e.form.arriveTime+":00",depositEndTime:e.form.pickupTime+":00",items:o,declaredAmount:e.form.insurance||0,couponId:e.getCouponId()});case 9:n=t.sent,200===n.code&&(n.data.itemList.forEach((function(e){e.unitPrice=e.unitPrice/100})),n.data.totalPrice=n.data.totalPrice/100,n.data.insuranceFee=n.data.insuranceFee/100,n.data.selectedCoupon&&(n.data.selectedCoupon.value=n.data.selectedCoupon.price/100),n.data.availableCoupons&&(n.data.availableCoupons.forEach((function(e){e.value=e.price/100})),e.couponList=n.data.availableCoupons),e.amountData=n.data,n.data.selectedCoupon&&(e.selectedCoupon=n.data.selectedCoupon,n.data.availableCoupons&&(a=n.data.availableCoupons.findIndex((function(e){return e.id===n.data.selectedCoupon.id})),-1!==a&&(e.selectedCouponIndex=a))));case 11:case"end":return t.stop()}}),t)})))()},calculateRemotePrice:function(){var e=this;return(0,i.default)(r.default.mark((function t(){var o,n,a,i,c,u,s;return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(e.sendStore){t.next=3;break}return e.amountData=null,t.abrupt("return");case 3:if(e.receiveStore||e.receiveAddr){t.next=6;break}return e.amountData=null,t.abrupt("return");case 6:if(o=e.luggageTypes.filter((function(e){return e.count>0})).map((function(e){return{categoryId:e.id,quantity:e.count}})),0!==o.length){t.next=10;break}return e.amountData=null,t.abrupt("return");case 10:return n="",a="",i="",c="",e.sendStore&&(n=e.sendStore.latitude,a=e.sendStore.longitude),e.receiveStore?(i=e.receiveStore.latitude,c=e.receiveStore.longitude):e.receiveAddr&&(i=e.receiveAddr.latitude,c=e.receiveAddr.longitude),t.next=18,e.$u.api.calculateRemotePrice({cityId:e.cityId,fromLat:n,fromLgt:a,toLat:i,toLgt:c,urgent:e.isUrgent,items:o,declaredAmount:e.form.insurance||0,couponId:e.getCouponId()});case 18:u=t.sent,200===u.code&&(u.data.itemList.forEach((function(e){e.unitPrice=e.unitPrice/100})),u.data.totalPrice=u.data.totalPrice/100,u.data.insuranceFee=u.data.insuranceFee/100,u.data.selectedCoupon&&(u.data.selectedCoupon.value=u.data.selectedCoupon.price/100),u.data.availableCoupons&&(u.data.availableCoupons.forEach((function(e){e.value=e.price/100})),e.couponList=u.data.availableCoupons),e.serviceTimes=[{id:0,name:"标准达",serviceTime:u.data.standardHours,price:u.data.itemPrice/100},{id:1,name:"急速达",serviceTime:u.data.urgentHours,price:(u.data.urgentFee+u.data.itemPrice)/100}],e.amountData=u.data,u.data.selectedCoupon&&(e.selectedCoupon=u.data.selectedCoupon,u.data.availableCoupons&&(s=u.data.availableCoupons.findIndex((function(e){return e.id===u.data.selectedCoupon.id})),-1!==s&&(e.selectedCouponIndex=s))));case 20:case"end":return t.stop()}}),t)})))()},createOrder:function(){var t=this;return(0,i.default)(r.default.mark((function o(){var n,a,i,c,u,s;return r.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:if("local"!==t.activeMode){o.next=6;break}if(t.selectedStore){o.next=4;break}return e.showToast({title:"请选择门店",icon:"none"}),o.abrupt("return");case 4:o.next=12;break;case 6:if(t.sendStore){o.next=9;break}return e.showToast({title:"请选择寄件服务点",icon:"none"}),o.abrupt("return");case 9:if(t.receiveStore||t.receiveAddr){o.next=12;break}return e.showToast({title:"请选择取件地址",icon:"none"}),o.abrupt("return");case 12:if(t.form.receiver){o.next=15;break}return e.showToast({title:"请输入收件人姓名",icon:"none"}),o.abrupt("return");case 15:if(t.form.mobile){o.next=18;break}return e.showToast({title:"请输入收件人电话",icon:"none"}),o.abrupt("return");case 18:if(n=/^1\d{10}$/,a=/^\d{3,4}-?\d{7,8}$/,n.test(t.form.mobile)||a.test(t.form.mobile)){o.next=23;break}return e.showToast({title:"请输入正确的手机号或固定电话",icon:"none"}),o.abrupt("return");case 23:if(t.form.arriveTime){o.next=26;break}return e.showToast({title:"请选择到店寄存时间",icon:"none"}),o.abrupt("return");case 26:if(t.form.pickupTime){o.next=29;break}return e.showToast({title:"请选择预计取件时间",icon:"none"}),o.abrupt("return");case 29:if(!(new Date(t.form.pickupTime)<=new Date(t.form.arriveTime))){o.next=32;break}return e.showToast({title:"预计取件时间必须大于到店寄存时间",icon:"none"}),o.abrupt("return");case 32:if(i=t.luggageTypes.filter((function(e){return e.count>0})).map((function(e){return{categoryId:e.id,quantity:e.count}})),0!==i.length){o.next=36;break}return e.showToast({title:"请选择行李类型",icon:"none"}),o.abrupt("return");case 36:if(t.form.goodType){o.next=39;break}return e.showToast({title:"请选择物品信息",icon:"none"}),o.abrupt("return");case 39:if(t.form.goodsImages&&t.form.goodsImages.length){o.next=42;break}return e.showToast({title:"请上传物品照片",icon:"none"}),o.abrupt("return");case 42:if(t.form.goodsImages&&t.form.goodsImages.length){o.next=45;break}return e.showToast({title:"请上传物品照片",icon:"none"}),o.abrupt("return");case 45:if(!(""===t.form.insurance||t.form.insurance<=0)){o.next=48;break}return e.showToast({title:"请输入保价费",icon:"none"}),o.abrupt("return");case 48:if(t.agreementChecked){o.next=51;break}return e.showToast({title:"请先阅读并同意用户服务协议及隐私政策",icon:"none"}),o.abrupt("return");case 51:return c=i.map((function(e){return{categoryId:e.categoryId,quantity:e.quantity}})),u={cityId:t.cityId,declaredAmount:t.form.insurance||0,expectedDepositTime:t.form.arriveTime+":00",expectedTakeTime:t.form.pickupTime+":00",goodType:t.form.goodType,goodsImages:t.form.goodsImages,items:c,remark:t.form.remark,takePhone:t.form.mobile,takeUser:t.form.receiver,type:"local"===t.activeMode?0:1,isUrgent:t.isUrgent,couponId:t.getCouponId()},"local"===t.activeMode?u.depositShopId=t.selectedStore.id:(u.depositShopId=t.sendStore.id,u.fromShopId=t.sendStore.id,t.receiveStore?(u.toType=0,u.takeShopId=t.receiveStore.id,u.takeLat=t.receiveStore.latitude,u.takeLgt=t.receiveStore.longitude,u.takeLocation=t.receiveStore.address):t.receiveAddr&&(u.toType=1,u.toAddrId=t.receiveAddr.id,u.takeLat=t.receiveAddr.latitude,u.takeLgt=t.receiveAddr.longitude,u.takeLocation=t.receiveAddr.addr)),o.next=56,t.$u.api.createOrder(u);case 56:s=o.sent,200===s.code&&s.data&&t.processPayment(s.data.response,s.data.orderId);case 58:case"end":return o.stop()}}),o)})))()},processPayment:function(t,o){e.requestPayment({provider:"wxpay",timeStamp:t.timeStamp||"",nonceStr:t.nonceStr||"",package:t.package||"",signType:t.signType||"MD5",paySign:t.paySign||"",success:function(t){e.redirectTo({url:"/pages/payment-success/payment-success?orderId="+o})},fail:function(t){t.errMsg.includes("cancel")?e.showToast({title:"已取消支付",icon:"none"}):e.showToast({title:"支付失败",icon:"none"}),e.setStorageSync("orderStatus",-2),e.switchTab({url:"/pages/itinerary/itinerary"})}})}}};t.default=l}).call(this,o(2)["default"])},228:function(e,t,o){"use strict";o.r(t);var n=o(229),r=o.n(n);for(var a in n)["default"].indexOf(a)<0&&function(e){o.d(t,e,(function(){return n[e]}))}(a);t["default"]=r.a},229:function(e,t,o){}},[[222,"common/runtime","common/vendor"]]]);
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/luggage-storage/luggage-storage"],{222:function(e,t,o){"use strict";(function(e,t){var n=o(4);o(30);n(o(25));var r=n(o(223));e.__webpack_require_UNI_MP_PLUGIN__=o,t(r.default)}).call(this,o(1)["default"],o(2)["createPage"])},223:function(e,t,o){"use strict";o.r(t);var n=o(224),r=o(226);for(var a in r)["default"].indexOf(a)<0&&function(e){o.d(t,e,(function(){return r[e]}))}(a);o(228);var i,c=o(41),s=Object(c["default"])(r["default"],n["render"],n["staticRenderFns"],!1,null,"c13e4c60",null,!1,n["components"],i);s.options.__file="pages/luggage-storage/luggage-storage.vue",t["default"]=s.exports},224:function(e,t,o){"use strict";o.r(t);var n=o(225);o.d(t,"render",(function(){return n["render"]})),o.d(t,"staticRenderFns",(function(){return n["staticRenderFns"]})),o.d(t,"recyclableRender",(function(){return n["recyclableRender"]})),o.d(t,"components",(function(){return n["components"]}))},225:function(e,t,o){"use strict";var n;o.r(t),o.d(t,"render",(function(){return r})),o.d(t,"staticRenderFns",(function(){return i})),o.d(t,"recyclableRender",(function(){return a})),o.d(t,"components",(function(){return n}));try{n={uIcon:function(){return Promise.all([o.e("common/vendor"),o.e("node-modules/uview-ui/components/u-icon/u-icon")]).then(o.bind(null,561))},uDatetimePicker:function(){return Promise.all([o.e("common/vendor"),o.e("node-modules/uview-ui/components/u-datetime-picker/u-datetime-picker")]).then(o.bind(null,578))},uPopup:function(){return Promise.all([o.e("common/vendor"),o.e("node-modules/uview-ui/components/u-popup/u-popup")]).then(o.bind(null,570))},uActionSheet:function(){return Promise.all([o.e("common/vendor"),o.e("node-modules/uview-ui/components/u-action-sheet/u-action-sheet")]).then(o.bind(null,587))}}}catch(c){if(-1===c.message.indexOf("Cannot find module")||-1===c.message.indexOf(".vue"))throw c;console.error(c.message),console.error("1. 排查组件名称拼写是否正确"),console.error("2. 排查组件是否符合 easycom 规范,文档:https://uniapp.dcloud.net.cn/collocation/pages?id=easycom"),console.error("3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件")}var r=function(){var e=this,t=e.$createElement,o=(e._self._c,Date.now()),n=e.selectedCoupon&&e.selectedCoupon.value>0?e.selectedCoupon.value.toFixed(2):null,r=e.couponList.length,a=r>0?e.__map(e.couponList,(function(t,o){var n=e.__get_orig(t),r=e.formatDate(t.startDate),a=e.formatDate(t.endDate),i=((t.price||0)/100).toFixed(2),c=((t.limitPrice||0)/100).toFixed(2);return{$orig:n,m0:r,m1:a,g3:i,g4:c}})):null,i=e.amountData?(e.amountData.totalPrice-(e.selectedCoupon&&(e.selectedCoupon.value||e.selectedCoupon.amount)||0)).toFixed(2):null,c=e.amountData?(e.amountData.totalPrice-(e.selectedCoupon&&e.selectedCoupon.value||0)).toFixed(2):null;e._isMounted||(e.e0=function(t){e.showArriveTimePicker=!0},e.e1=function(t){e.showArriveTimePicker=!1},e.e2=function(t){e.showArriveTimePicker=!1},e.e3=function(t){e.showPickupTimePicker=!1},e.e4=function(t){e.showPickupTimePicker=!1},e.e5=function(t){e.showGoodsPopup=!0},e.e6=function(t,o){var n=arguments[arguments.length-1].currentTarget.dataset,r=n.eventParams||n["event-params"];o=r.item;e.isUrgent=o.id},e.e7=function(t){e.showCouponPopup=!1},e.e8=function(t){e.showCouponPopup=!1},e.e9=function(t){e.showStorePopup=!1},e.e10=function(t){e.showStorePopup=!1},e.e11=function(t,o){var n=arguments[arguments.length-1].currentTarget.dataset,r=n.eventParams||n["event-params"];o=r.index;e.storeList.forEach((function(e,t){return e.active=o===t}))},e.e12=function(t){e.showGoodsPopup=!1},e.e13=function(t){e.showGoodsPopup=!1},e.e14=function(t,o){var n=arguments[arguments.length-1].currentTarget.dataset,r=n.eventParams||n["event-params"];o=r.index;e.goodsOptions.forEach((function(e,t){return e.active=t===o}))},e.e15=function(t){e.showAmountPopup=!1},e.e16=function(t){e.showAmountPopup=!1},e.e17=function(t){e.showAmountPopup=!1},e.e18=function(t){e.showReceiveAddress=!1}),e.$mp.data=Object.assign({},{$root:{g0:o,g1:n,g2:r,l0:a,g5:i,g6:c}})},a=!1,i=[];r._withStripped=!0},226:function(e,t,o){"use strict";o.r(t);var n=o(227),r=o.n(n);for(var a in n)["default"].indexOf(a)<0&&function(e){o.d(t,e,(function(){return n[e]}))}(a);t["default"]=r.a},227:function(e,t,o){"use strict";(function(e){var n=o(4);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=n(o(34)),a=n(o(18)),i=n(o(36)),c=n(o(11)),s=o(37);function u(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function d(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?u(Object(o),!0).forEach((function(t){(0,c.default)(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):u(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}var l={data:function(){return{showStorePopup:!1,showGoodsPopup:!1,showAmountPopup:!1,showArriveTimePicker:!1,showPickupTimePicker:!1,arriveTimeValue:Number(new Date),pickupTimeValue:Number(new Date),activeMode:"local",modeTabs:[{label:"就地寄存",value:"local"},{label:"同城寄送",value:"city"}],agreementChecked:!1,tempSelectedStoreId:2,selectedStoreId:2,tempSelectedGoodsIds:[1],selectedGoodsIds:[1],selectedLuggageId:1,isUrgent:0,form:{receiver:"",mobile:"",arriveTime:"",pickupTime:"",goodType:"",goodTypeName:"",insurance:"",remark:"",goodsImages:[]},amountData:null,showInsuranceTip:!1,showInsuranceTipText:"",luggageTypes:[],serviceTimes:[],storeList:[],selectedStore:null,sendStore:null,receiveStore:null,receiveAddr:null,storePopupType:"send",storeForm:{keyword:"",page:1,isSearch:!0},goodsOptions:[],uploadedImages:[],showReceiveAddress:!1,actions:[{name:"选择服务点"},{name:"选择地址簿"}],selectedCoupon:null,showCouponPopup:!1,couponList:[],selectedCouponIndex:-1,showUsageIndex:-1}},watch:{"form.insurance":{handler:function(){this.calculateLocalPrice()}},isUrgent:{handler:function(){"city"===this.activeMode&&this.calculateRemotePrice()}}},computed:d(d({},(0,s.mapState)(["latitude","longitude","cityId","statusbarHeight","navHeight","userInfo"])),{},{servicePointPlaceholder:function(){return"city"===this.activeMode?"选择寄送服务点":"选择寄存服务点"},selectedGoodsText:function(){var e=this;if(!this.selectedGoodsIds.length)return"必选,请选择";var t=this.goodsOptions.filter((function(t){return e.selectedGoodsIds.includes(t.id)})).map((function(e){return e.name}));return t.join("、")},totalPriceText:function(){return"¥150.00"},pickupMinDate:function(){return this.form.arriveTime?new Date(this.form.arriveTime).getTime():Date.now()}}),onLoad:function(){var t=this;if(this.getNearbyShopList(),this.getCategoryList(),this.getCitySizeList(),this.agreementChecked=!1,this.getContactInfo(),e.getStorageSync("selectedStore")){var o=e.getStorageSync("selectedStore");this.selectedStore=o,this.sendStore=o,e.removeStorageSync("selectedStore")}e.$on("updateAddress",(function(e){t.form.receiver=e.name,t.form.mobile=e.phone,t.receiveAddr=e,t.receiveAddr.addr=e.provinceName+e.cityName+e.districtName+e.addr})),e.$on("selectCoupon",(function(e){t.selectedCoupon=e,"city"===t.activeMode?t.calculateRemotePrice():t.calculateLocalPrice()}))},onUnload:function(){e.$off("updateAddress"),e.$off("selectCoupon")},methods:{formatDate:function(e){if(!e)return"";var t=new Date(e),o=String(t.getFullYear()).slice(2),n=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),a=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0");return"".concat(o,".").concat(n,".").concat(r," ").concat(a,":").concat(i)},hasFormData:function(){return!!(this.form.receiver||this.form.mobile||this.form.arriveTime||this.form.pickupTime||this.form.goodType||this.form.insurance||this.form.remark||this.form.goodsImages.length>0||this.selectedStore||this.sendStore||this.receiveStore||this.receiveAddr||this.amountData)||!!this.luggageTypes.some((function(e){return e.count>0}))},goBack:function(){this.hasFormData()?e.showModal({title:"提示",content:"离开后当前页面内容失效,是否确认离开?",confirmText:"确认离开",cancelText:"取消",success:function(t){t.confirm&&e.navigateBack()}}):e.navigateBack()},getCouponId:function(){return this.selectedCoupon&&this.selectedCoupon.id&&this.selectedCoupon.id>0?this.selectedCoupon.id:this.selectedCoupon&&0===this.selectedCoupon.id?null:-1},selectCoupon:function(){this.showCouponPopup=!0},toggleUsage:function(e){this.showUsageIndex===e?this.showUsageIndex=-1:this.showUsageIndex=e},toggleCoupon:function(e){this.selectedCouponIndex===e?this.selectedCouponIndex=-1:this.selectedCouponIndex=e},confirmCoupon:function(){if(this.selectedCouponIndex>=0&&this.selectedCouponIndex<this.couponList.length){var e=this.couponList[this.selectedCouponIndex];this.selectedCoupon={id:e.id,name:e.name,value:e.value||e.amount/100,price:e.amount},this.showCouponPopup=!1,"city"===this.activeMode?this.calculateRemotePrice():this.calculateLocalPrice()}else-1===this.selectedCouponIndex&&(this.selectedCoupon={id:0,name:"不使用优惠券",value:0},this.showCouponPopup=!1,"city"===this.activeMode?this.calculateRemotePrice():this.calculateLocalPrice())},caozuo:function(t){var o=this;"选择服务点"===t.name?(o.storePopupType="receive",o.showStorePopup=!0):"选择地址簿"===t.name&&e.navigateTo({url:"/pages/address/address?type=1"}),this.showReceiveAddress=!1},uploadFiles:function(t){var o=arguments,n=this;return(0,i.default)(r.default.mark((function a(){var i,c,s,u;return r.default.wrap((function(r){while(1)switch(r.prev=r.next){case 0:if(i=o.length>1&&void 0!==o[1]?o[1]:9,t&&0!==t.length){r.next=3;break}return r.abrupt("return",[]);case 3:return c=t.slice(0,i),s=c.map((function(t){return new Promise((function(o,r){e.uploadFile({url:n.$baseUrl+"/web/public/upload",filePath:t,name:"file",formData:{folder:"orders"},success:function(e){if(200===e.statusCode){var t=JSON.parse(e.data);200===t.code?o(t.data):r(new Error(t.msg||"上传失败"))}else r(new Error("上传失败"))},fail:function(e){r(e)}})}))})),r.prev=5,r.next=8,Promise.all(s);case 8:return u=r.sent,r.abrupt("return",u);case 12:throw r.prev=12,r.t0=r["catch"](5),e.showToast({title:"上传失败",icon:"none"}),r.t0;case 16:case"end":return r.stop()}}),a,null,[[5,12]])})))()},deleteImage:function(e){this.uploadedImages.splice(e,1),this.form.goodsImages.splice(e,1)},chooseAndUploadImage:function(){var t=arguments,o=this;return(0,i.default)(r.default.mark((function n(){var c,s,u;return r.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(c=t.length>0&&void 0!==t[0]?t[0]:9,s=o.form.goodsImages.length,u=c-s,!(u<=0)){n.next=6;break}return e.showToast({title:"最多上传".concat(c,"张图片"),icon:"none"}),n.abrupt("return");case 6:e.chooseImage({count:u,sizeType:["compressed"],sourceType:["album","camera"],success:function(){var t=(0,i.default)(r.default.mark((function t(n){var i,s,u,d;return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return i=n.tempFilePaths,e.showLoading({title:"上传中...",mask:!0}),t.prev=2,t.next=5,o.uploadFiles(i,c);case 5:s=t.sent,u=s.map((function(e){return e.imgaddr})),d=s.map((function(e){return e.url||e.path||e})),o.uploadedImages=[].concat((0,a.default)(o.uploadedImages),(0,a.default)(d.map((function(e){return{url:e}})))),o.form.goodsImages=[].concat((0,a.default)(o.form.goodsImages),(0,a.default)(u)),e.hideLoading(),e.showToast({title:"上传成功",icon:"success"}),t.next=17;break;case 14:t.prev=14,t.t0=t["catch"](2),e.hideLoading();case 17:case"end":return t.stop()}}),t,null,[[2,14]])})));function n(e){return t.apply(this,arguments)}return n}()});case 7:case"end":return n.stop()}}),n)})))()},searchStore:function(){this.storeList=[],this.storeForm.page=1,this.storeForm.isSearch=!0,this.getNearbyShopList()},switchMode:function(e){this.activeMode=e,this.receiveStore=null,this.receiveAddr=null,this.form.arriveTime="",this.form.pickupTime="",this.form.goodType="",this.form.goodTypeName="",this.form.insurance="",this.form.remark="",this.form.goodsImages=[],this.amountData=null,this.uploadedImages=[],this.luggageTypes.forEach((function(e){e.count=0}))},toggleAgreement:function(){this.agreementChecked=!this.agreementChecked},goRichText:function(t){e.navigateTo({url:"/pages/rich-text/rich-text?type="+t})},openReceiveAddress:function(){this.showReceiveAddress=!0},openAmountPopup:function(){this.showAmountPopup=!0},openStorePopup:function(){this.storePopupType="send",this.tempSelectedStoreId=null,this.showStorePopup=!0},openStorePopup0:function(){this.storePopupType="send0",this.tempSelectedStoreId=null,this.showStorePopup=!0},confirmStore:function(){console.log("=========================");var e=this.storeList.find((function(e){return e.active}));console.log(e),"send"===this.storePopupType?this.sendStore=e:"receive"===this.storePopupType?(this.receiveStore=e,this.receiveAddr=null,this.calculateRemotePrice()):(this.selectedStore=e,this.calculateLocalPrice()),this.showStorePopup=!1},confirmGoods:function(){var t,o,n,r;this.goodsOptions.find((function(e){return e.active}))?(this.form.goodTypeName=(null===(t=this.goodsOptions.find((function(e){return e.active})))||void 0===t?void 0:t.name)||"",this.form.goodType=(null===(o=this.goodsOptions.find((function(e){return e.active})))||void 0===o?void 0:o.id)||"",this.showInsuranceTip="1"===(null===(n=this.goodsOptions.find((function(e){return e.active})))||void 0===n?void 0:n.relationOtherField),this.showInsuranceTipText=null===(r=this.goodsOptions.find((function(e){return e.active})))||void 0===r?void 0:r.relationRemark,this.showGoodsPopup=!1):e.showToast({title:"请选择物品信息",icon:"none"})},confirmArriveTime:function(e){var t=new Date(e.value),o=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),a=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0");this.form.arriveTime="".concat(o,"-").concat(n,"-").concat(r," ").concat(a,":").concat(i),this.form.pickupTime="",this.pickupTimeValue=e.value+36e5,this.showArriveTimePicker=!1,this.calculateLocalPrice()},openPickupTimePicker:function(){this.form.arriveTime?this.showPickupTimePicker=!0:e.showToast({title:"请先选择到店寄存时间",icon:"none"})},confirmPickupTime:function(t){var o=new Date(t.value),n=o.getFullYear(),r=String(o.getMonth()+1).padStart(2,"0"),a=String(o.getDate()).padStart(2,"0"),i=String(o.getHours()).padStart(2,"0"),c=String(o.getMinutes()).padStart(2,"0"),s="".concat(n,"-").concat(r,"-").concat(a," ").concat(i,":").concat(c);this.form.arriveTime&&new Date(s)<=new Date(this.form.arriveTime)?e.showToast({title:"预计取件时间必须大于到店寄存时间",icon:"none"}):(this.form.pickupTime=s,this.showPickupTimePicker=!1,this.calculateLocalPrice())},getCategoryList:function(){var e=this;return(0,i.default)(r.default.mark((function t(){var o;return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,e.$u.api.getCategoryList({type:2});case 2:o=t.sent,200===o.code&&(o.data.forEach((function(e){e.active=!1})),e.goodsOptions=o.data||[]);case 4:case"end":return t.stop()}}),t)})))()},getCitySizeList:function(){var e=this;return(0,i.default)(r.default.mark((function t(){var o;return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,e.$u.api.getCitySizeList({cityId:e.cityId});case 2:o=t.sent,200===o.code&&(o.data.forEach((function(e){e.count=0})),e.luggageTypes=o.data||[]);case 4:case"end":return t.stop()}}),t)})))()},getContactInfo:function(){var e=this;return(0,i.default)(r.default.mark((function t(){var o;return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,e.$u.api.getContactInfo({});case 2:o=t.sent,200===o.code&&o.data?(e.form.receiver=o.data.name||e.userInfo.name||"",e.form.mobile=o.data.phone||e.userInfo.telephone||""):(e.form.receiver=e.userInfo.name||"",e.form.mobile=e.userInfo.telephone||"");case 4:case"end":return t.stop()}}),t)})))()},getNearbyShopList:function(){var e=this;return(0,i.default)(r.default.mark((function t(){var o;return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(e.storeForm.isSearch){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,e.$u.api.getNearbyShopList({capacity:10,page:e.storeForm.page,model:{latitude:e.latitude,longitude:e.longitude,cityId:e.cityId,name:e.storeForm.keyword,sortType:1}});case 4:o=t.sent,200===o.code&&(o.data.records.forEach((function(e){e.active=!1})),e.storeList=[].concat((0,a.default)(e.storeList),(0,a.default)(o.data.records||[])),e.storeForm.page++,e.storeForm.isSearch=e.storeList.length<=o.data.total);case 6:case"end":return t.stop()}}),t)})))()},increaseCount:function(e){this.luggageTypes[e].count++,this.calculateLocalPrice()},decreaseCount:function(e){this.luggageTypes[e].count>0&&this.luggageTypes[e].count--,this.calculateLocalPrice()},calculateLocalPrice:function(){var e=this;return(0,i.default)(r.default.mark((function t(){return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:"city"===e.activeMode?e.calculateRemotePrice():e.calculateLocalPriceOnly();case 1:case"end":return t.stop()}}),t)})))()},calculateLocalPriceOnly:function(){var e=this;return(0,i.default)(r.default.mark((function t(){var o,n,a;return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(e.form.arriveTime&&e.form.pickupTime){t.next=3;break}return e.amountData=null,t.abrupt("return");case 3:if(o=e.luggageTypes.filter((function(e){return e.count>0})).map((function(e){return{categoryId:e.id,quantity:e.count}})),0!==o.length){t.next=7;break}return e.amountData=null,t.abrupt("return");case 7:return t.next=9,e.$u.api.calculateLocalPrice({cityId:e.cityId,depositStartTime:e.form.arriveTime+":00",depositEndTime:e.form.pickupTime+":00",items:o,declaredAmount:e.form.insurance||0,couponId:e.getCouponId()});case 9:n=t.sent,200===n.code&&(n.data.itemList.forEach((function(e){e.unitPrice=e.unitPrice/100})),n.data.totalPrice=n.data.totalPrice/100,n.data.insuranceFee=n.data.insuranceFee/100,n.data.selectedCoupon&&(n.data.selectedCoupon.value=n.data.selectedCoupon.price/100),n.data.availableCoupons&&(n.data.availableCoupons.forEach((function(e){e.value=e.price/100})),e.couponList=n.data.availableCoupons),e.amountData=n.data,n.data.selectedCoupon&&(e.selectedCoupon=n.data.selectedCoupon,n.data.availableCoupons&&(a=n.data.availableCoupons.findIndex((function(e){return e.id===n.data.selectedCoupon.id})),-1!==a&&(e.selectedCouponIndex=a))));case 11:case"end":return t.stop()}}),t)})))()},calculateRemotePrice:function(){var e=this;return(0,i.default)(r.default.mark((function t(){var o,n,a,i,c,s,u;return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(e.sendStore){t.next=3;break}return e.amountData=null,t.abrupt("return");case 3:if(e.receiveStore||e.receiveAddr){t.next=6;break}return e.amountData=null,t.abrupt("return");case 6:if(o=e.luggageTypes.filter((function(e){return e.count>0})).map((function(e){return{categoryId:e.id,quantity:e.count}})),0!==o.length){t.next=10;break}return e.amountData=null,t.abrupt("return");case 10:return n="",a="",i="",c="",e.sendStore&&(n=e.sendStore.latitude,a=e.sendStore.longitude),e.receiveStore?(i=e.receiveStore.latitude,c=e.receiveStore.longitude):e.receiveAddr&&(i=e.receiveAddr.latitude,c=e.receiveAddr.longitude),t.next=18,e.$u.api.calculateRemotePrice({cityId:e.cityId,fromLat:n,fromLgt:a,toLat:i,toLgt:c,urgent:e.isUrgent,items:o,declaredAmount:e.form.insurance||0,couponId:e.getCouponId()});case 18:s=t.sent,200===s.code&&(s.data.itemList.forEach((function(e){e.unitPrice=e.unitPrice/100})),s.data.totalPrice=s.data.totalPrice/100,s.data.insuranceFee=s.data.insuranceFee/100,s.data.selectedCoupon&&(s.data.selectedCoupon.value=s.data.selectedCoupon.price/100),s.data.availableCoupons&&(s.data.availableCoupons.forEach((function(e){e.value=e.price/100})),e.couponList=s.data.availableCoupons),e.serviceTimes=[{id:0,name:"标准达",serviceTime:s.data.standardHours,price:s.data.itemPrice/100},{id:1,name:"急速达",serviceTime:s.data.urgentHours,price:(s.data.urgentFee+s.data.itemPrice)/100}],e.amountData=s.data,s.data.selectedCoupon&&(e.selectedCoupon=s.data.selectedCoupon,s.data.availableCoupons&&(u=s.data.availableCoupons.findIndex((function(e){return e.id===s.data.selectedCoupon.id})),-1!==u&&(e.selectedCouponIndex=u))));case 20:case"end":return t.stop()}}),t)})))()},createOrder:function(){var t=this;return(0,i.default)(r.default.mark((function o(){var n,a,i,c,s,u;return r.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:if("local"!==t.activeMode){o.next=6;break}if(t.selectedStore){o.next=4;break}return e.showToast({title:"请选择门店",icon:"none"}),o.abrupt("return");case 4:o.next=12;break;case 6:if(t.sendStore){o.next=9;break}return e.showToast({title:"请选择寄件服务点",icon:"none"}),o.abrupt("return");case 9:if(t.receiveStore||t.receiveAddr){o.next=12;break}return e.showToast({title:"请选择取件地址",icon:"none"}),o.abrupt("return");case 12:if(t.form.receiver){o.next=15;break}return e.showToast({title:"请输入收件人姓名",icon:"none"}),o.abrupt("return");case 15:if(t.form.mobile){o.next=18;break}return e.showToast({title:"请输入收件人电话",icon:"none"}),o.abrupt("return");case 18:if(n=/^1\d{10}$/,a=/^\d{3,4}-?\d{7,8}$/,n.test(t.form.mobile)||a.test(t.form.mobile)){o.next=23;break}return e.showToast({title:"请输入正确的手机号或固定电话",icon:"none"}),o.abrupt("return");case 23:if(t.form.arriveTime){o.next=26;break}return e.showToast({title:"请选择到店寄存时间",icon:"none"}),o.abrupt("return");case 26:if(t.form.pickupTime){o.next=29;break}return e.showToast({title:"请选择预计取件时间",icon:"none"}),o.abrupt("return");case 29:if(!(new Date(t.form.pickupTime)<=new Date(t.form.arriveTime))){o.next=32;break}return e.showToast({title:"预计取件时间必须大于到店寄存时间",icon:"none"}),o.abrupt("return");case 32:if(i=t.luggageTypes.filter((function(e){return e.count>0})).map((function(e){return{categoryId:e.id,quantity:e.count}})),0!==i.length){o.next=36;break}return e.showToast({title:"请选择行李类型",icon:"none"}),o.abrupt("return");case 36:if(t.form.goodType){o.next=39;break}return e.showToast({title:"请选择物品信息",icon:"none"}),o.abrupt("return");case 39:if(t.form.goodsImages&&t.form.goodsImages.length){o.next=42;break}return e.showToast({title:"请上传物品照片",icon:"none"}),o.abrupt("return");case 42:if(t.form.goodsImages&&t.form.goodsImages.length){o.next=45;break}return e.showToast({title:"请上传物品照片",icon:"none"}),o.abrupt("return");case 45:if(!(""===t.form.insurance||t.form.insurance<=0)){o.next=48;break}return e.showToast({title:"请输入保价费",icon:"none"}),o.abrupt("return");case 48:if(t.agreementChecked){o.next=51;break}return e.showToast({title:"请先阅读并同意用户服务协议及隐私政策",icon:"none"}),o.abrupt("return");case 51:return c=i.map((function(e){return{categoryId:e.categoryId,quantity:e.quantity}})),s={cityId:t.cityId,declaredAmount:t.form.insurance||0,expectedDepositTime:t.form.arriveTime+":00",expectedTakeTime:t.form.pickupTime+":00",goodType:t.form.goodType,goodsImages:t.form.goodsImages,items:c,remark:t.form.remark,takePhone:t.form.mobile,takeUser:t.form.receiver,type:"local"===t.activeMode?0:1,isUrgent:t.isUrgent,couponId:t.getCouponId()},"local"===t.activeMode?s.depositShopId=t.selectedStore.id:(s.depositShopId=t.sendStore.id,s.fromShopId=t.sendStore.id,t.receiveStore?(s.toType=0,s.takeShopId=t.receiveStore.id,s.takeLat=t.receiveStore.latitude,s.takeLgt=t.receiveStore.longitude,s.takeLocation=t.receiveStore.address):t.receiveAddr&&(s.toType=1,s.toAddrId=t.receiveAddr.id,s.takeLat=t.receiveAddr.latitude,s.takeLgt=t.receiveAddr.longitude,s.takeLocation=t.receiveAddr.addr)),o.next=56,t.$u.api.createOrder(s);case 56:u=o.sent,200===u.code&&u.data&&t.processPayment(u.data.response,u.data.orderId);case 58:case"end":return o.stop()}}),o)})))()},processPayment:function(t,o){e.requestPayment({provider:"wxpay",timeStamp:t.timeStamp||"",nonceStr:t.nonceStr||"",package:t.package||"",signType:t.signType||"MD5",paySign:t.paySign||"",success:function(t){e.redirectTo({url:"/pages/payment-success/payment-success?orderId="+o})},fail:function(t){t.errMsg.includes("cancel")?e.showToast({title:"已取消支付",icon:"none"}):e.showToast({title:"支付失败",icon:"none"}),e.setStorageSync("orderStatus",-2),e.switchTab({url:"/pages/itinerary/itinerary"})}})}}};t.default=l}).call(this,o(2)["default"])},228:function(e,t,o){"use strict";o.r(t);var n=o(229),r=o.n(n);for(var a in n)["default"].indexOf(a)<0&&function(e){o.d(t,e,(function(){return n[e]}))}(a);t["default"]=r.a},229:function(e,t,o){}},[[222,"common/runtime","common/vendor"]]]);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/luggage-storage/luggage-storage.js.map