| | |
| | | try { |
| | | components = { |
| | | uIcon: function () { |
| | | return Promise.all(/*! import() | node-modules/uview-ui/components/u-icon/u-icon */[__webpack_require__.e("common/vendor"), __webpack_require__.e("node-modules/uview-ui/components/u-icon/u-icon")]).then(__webpack_require__.bind(null, /*! uview-ui/components/u-icon/u-icon.vue */ 297)) |
| | | return Promise.all(/*! import() | node-modules/uview-ui/components/u-icon/u-icon */[__webpack_require__.e("common/vendor"), __webpack_require__.e("node-modules/uview-ui/components/u-icon/u-icon")]).then(__webpack_require__.bind(null, /*! uview-ui/components/u-icon/u-icon.vue */ 326)) |
| | | }, |
| | | uDatetimePicker: function () { |
| | | return Promise.all(/*! import() | node-modules/uview-ui/components/u-datetime-picker/u-datetime-picker */[__webpack_require__.e("common/vendor"), __webpack_require__.e("node-modules/uview-ui/components/u-datetime-picker/u-datetime-picker")]).then(__webpack_require__.bind(null, /*! uview-ui/components/u-datetime-picker/u-datetime-picker.vue */ 390)) |
| | | return Promise.all(/*! import() | node-modules/uview-ui/components/u-datetime-picker/u-datetime-picker */[__webpack_require__.e("common/vendor"), __webpack_require__.e("node-modules/uview-ui/components/u-datetime-picker/u-datetime-picker")]).then(__webpack_require__.bind(null, /*! uview-ui/components/u-datetime-picker/u-datetime-picker.vue */ 335)) |
| | | }, |
| | | uPopup: function () { |
| | | return Promise.all(/*! import() | node-modules/uview-ui/components/u-popup/u-popup */[__webpack_require__.e("common/vendor"), __webpack_require__.e("node-modules/uview-ui/components/u-popup/u-popup")]).then(__webpack_require__.bind(null, /*! uview-ui/components/u-popup/u-popup.vue */ 306)) |
| | | return Promise.all(/*! import() | node-modules/uview-ui/components/u-popup/u-popup */[__webpack_require__.e("common/vendor"), __webpack_require__.e("node-modules/uview-ui/components/u-popup/u-popup")]).then(__webpack_require__.bind(null, /*! uview-ui/components/u-popup/u-popup.vue */ 344)) |
| | | }, |
| | | uActionSheet: function () { |
| | | return Promise.all(/*! import() | node-modules/uview-ui/components/u-action-sheet/u-action-sheet */[__webpack_require__.e("common/vendor"), __webpack_require__.e("node-modules/uview-ui/components/u-action-sheet/u-action-sheet")]).then(__webpack_require__.bind(null, /*! uview-ui/components/u-action-sheet/u-action-sheet.vue */ 352)) |
| | | }, |
| | | } |
| | | } catch (e) { |
| | |
| | | _temp2 = _temp.eventParams || _temp["event-params"], |
| | | item = _temp2.item |
| | | var _temp, _temp2 |
| | | _vm.selectedServiceTime = item.id |
| | | _vm.isUrgent = item.id |
| | | } |
| | | _vm.e8 = function ($event) { |
| | | _vm.showStorePopup = false |
| | |
| | | } |
| | | _vm.e15 = function ($event) { |
| | | _vm.showAmountPopup = false |
| | | } |
| | | _vm.e16 = function ($event) { |
| | | _vm.showAmountPopup = false |
| | | } |
| | | _vm.e17 = function ($event) { |
| | | _vm.showReceiveAddress = false |
| | | } |
| | | } |
| | | } |
| | |
| | | tempSelectedGoodsIds: [1], |
| | | selectedGoodsIds: [1], |
| | | selectedLuggageId: 1, |
| | | selectedServiceTime: 1, |
| | | isUrgent: 0, |
| | | form: { |
| | | receiver: '', |
| | | mobile: '', |
| | |
| | | }, |
| | | amountData: null, |
| | | luggageTypes: [], |
| | | serviceTimes: [{ |
| | | id: 1, |
| | | name: '标准达(预计6小时内送达)', |
| | | price: '¥50' |
| | | }, { |
| | | id: 2, |
| | | name: '急速达(预计4小时内送达)', |
| | | price: '¥70' |
| | | }], |
| | | serviceTimes: [], |
| | | storeList: [], |
| | | selectedStore: null, |
| | | sendStore: null, |
| | | receiveStore: null, |
| | | receiveAddr: null, |
| | | storePopupType: 'send', |
| | | storeForm: { |
| | | keyword: '', |
| | | page: 1, |
| | | isSearch: true |
| | | }, |
| | | goodsOptions: [], |
| | | uploadedImages: [] |
| | | uploadedImages: [], |
| | | showReceiveAddress: false, |
| | | actions: [{ |
| | | name: '选择服务点' |
| | | }, { |
| | | name: '选择地址簿' |
| | | }] |
| | | }; |
| | | }, |
| | | watch: { |
| | | 'form.insurance': { |
| | | handler: function handler() { |
| | | this.calculateLocalPrice(); |
| | | } |
| | | }, |
| | | isUrgent: { |
| | | handler: function handler() { |
| | | if (this.activeMode === 'city') { |
| | | this.calculateRemotePrice(); |
| | | } |
| | | } |
| | | } |
| | | }, |
| | |
| | | }); |
| | | return labels.join('、'); |
| | | }, |
| | | insuranceFeeText: function insuranceFeeText() { |
| | | if (!this.form.insurance) { |
| | | return ''; |
| | | } |
| | | return '+10'; |
| | | }, |
| | | totalPriceText: function totalPriceText() { |
| | | return '¥150.00'; |
| | | } |
| | | }), |
| | | onLoad: function onLoad() { |
| | | var _this2 = this; |
| | | this.getNearbyShopList(); |
| | | this.getCategoryList(); |
| | | this.getCitySizeList(); |
| | | uni.$on('updateAddress', function (data) { |
| | | console.log(data); |
| | | _this2.receiveAddr = data; |
| | | }); |
| | | }, |
| | | methods: { |
| | | caozuo: function caozuo(e) { |
| | | var that = this; |
| | | if (e.name === '选择服务点') { |
| | | that.storePopupType = 'receive'; |
| | | that.receiveStore = null; |
| | | that.showStorePopup = true; |
| | | } else if (e.name === '选择地址簿') { |
| | | that.receiveAddr = null; |
| | | uni.navigateTo({ |
| | | url: '/pages/address/address?type=1' |
| | | }); |
| | | } |
| | | that.showReceiveAddress = false; |
| | | }, |
| | | uploadFiles: function uploadFiles(filePaths) { |
| | | var _arguments = arguments, |
| | | _this2 = this; |
| | | _this3 = this; |
| | | return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() { |
| | | var maxCount, limitedPaths, uploadTasks, results; |
| | | return _regenerator.default.wrap(function _callee$(_context) { |
| | |
| | | uploadTasks = limitedPaths.map(function (filePath) { |
| | | return new Promise(function (resolve, reject) { |
| | | uni.uploadFile({ |
| | | url: _this2.$baseUrl + '/web/public/upload', |
| | | url: _this3.$baseUrl + '/web/public/upload', |
| | | filePath: filePath, |
| | | name: 'file', |
| | | formData: { |
| | |
| | | }, |
| | | chooseAndUploadImage: function chooseAndUploadImage() { |
| | | var _arguments2 = arguments, |
| | | _this3 = this; |
| | | _this4 = this; |
| | | return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() { |
| | | var maxCount, currentCount, remainingCount; |
| | | return _regenerator.default.wrap(function _callee3$(_context3) { |
| | |
| | | switch (_context3.prev = _context3.next) { |
| | | case 0: |
| | | maxCount = _arguments2.length > 0 && _arguments2[0] !== undefined ? _arguments2[0] : 9; |
| | | currentCount = _this3.form.goodsImages.length; |
| | | currentCount = _this4.form.goodsImages.length; |
| | | remainingCount = maxCount - currentCount; |
| | | if (!(remainingCount <= 0)) { |
| | | _context3.next = 6; |
| | |
| | | }); |
| | | _context2.prev = 2; |
| | | _context2.next = 5; |
| | | return _this3.uploadFiles(tempFilePaths, maxCount); |
| | | return _this4.uploadFiles(tempFilePaths, maxCount); |
| | | case 5: |
| | | uploadResults = _context2.sent; |
| | | fullPaths = uploadResults.map(function (item) { |
| | | return item.url || item.path || item; |
| | | }); |
| | | _this3.uploadedImages = [].concat((0, _toConsumableArray2.default)(_this3.uploadedImages), (0, _toConsumableArray2.default)(fullPaths.map(function (url) { |
| | | _this4.uploadedImages = [].concat((0, _toConsumableArray2.default)(_this4.uploadedImages), (0, _toConsumableArray2.default)(fullPaths.map(function (url) { |
| | | return { |
| | | url: url |
| | | }; |
| | | }))); |
| | | _this3.form.goodsImages = [].concat((0, _toConsumableArray2.default)(_this3.form.goodsImages), (0, _toConsumableArray2.default)(fullPaths)); |
| | | _this4.form.goodsImages = [].concat((0, _toConsumableArray2.default)(_this4.form.goodsImages), (0, _toConsumableArray2.default)(fullPaths)); |
| | | uni.hideLoading(); |
| | | uni.showToast({ |
| | | title: '上传成功', |
| | |
| | | }, |
| | | switchMode: function switchMode(mode) { |
| | | this.activeMode = mode; |
| | | 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 (item) { |
| | | item.count = 0; |
| | | }); |
| | | }, |
| | | toggleAgreement: function toggleAgreement() { |
| | | this.agreementChecked = !this.agreementChecked; |
| | | }, |
| | | goRichText: function goRichText(type) { |
| | | uni.navigateTo({ |
| | | url: '/pages/rich-text/rich-text?type=' + type |
| | | }); |
| | | }, |
| | | openReceiveAddress: function openReceiveAddress() { |
| | | uni.showToast({ |
| | | title: '取件地址待接入', |
| | | icon: 'none' |
| | | }); |
| | | this.showReceiveAddress = true; |
| | | }, |
| | | openAmountPopup: function openAmountPopup() { |
| | | this.showAmountPopup = true; |
| | | }, |
| | | openStorePopup: function openStorePopup() { |
| | | this.storePopupType = 'send'; |
| | | this.tempSelectedStoreId = null; |
| | | this.showStorePopup = true; |
| | | }, |
| | | confirmStore: function confirmStore() { |
| | | this.selectedStore = this.storeList.find(function (item) { |
| | | var selected = this.storeList.find(function (item) { |
| | | return item.active; |
| | | }); |
| | | if (this.storePopupType === 'send') { |
| | | this.sendStore = selected; |
| | | } else if (this.storePopupType === 'receive') { |
| | | this.receiveStore = selected; |
| | | this.receiveAddr = null; |
| | | this.calculateRemotePrice(); |
| | | } else { |
| | | this.selectedStore = selected; |
| | | this.calculateLocalPrice(); |
| | | } |
| | | this.showStorePopup = false; |
| | | this.calculateLocalPrice(); |
| | | }, |
| | | confirmGoods: function confirmGoods() { |
| | | var _this$goodsOptions$fi, _this$goodsOptions$fi2; |
| | | if (!this.goodsOptions.find(function (item) { |
| | | return item.active; |
| | | })) { |
| | | uni.showToast({ |
| | | title: '请选择物品信息', |
| | | icon: 'none' |
| | | }); |
| | | return; |
| | | } |
| | | this.form.goodTypeName = ((_this$goodsOptions$fi = this.goodsOptions.find(function (item) { |
| | | return item.active; |
| | | })) === null || _this$goodsOptions$fi === void 0 ? void 0 : _this$goodsOptions$fi.name) || ''; |
| | |
| | | var day = String(date.getDate()).padStart(2, '0'); |
| | | var hour = String(date.getHours()).padStart(2, '0'); |
| | | var minute = String(date.getMinutes()).padStart(2, '0'); |
| | | this.form.pickupTime = "".concat(year, "-").concat(month, "-").concat(day, " ").concat(hour, ":").concat(minute); |
| | | var pickupTime = "".concat(year, "-").concat(month, "-").concat(day, " ").concat(hour, ":").concat(minute); |
| | | if (this.form.arriveTime && new Date(pickupTime) <= new Date(this.form.arriveTime)) { |
| | | uni.showToast({ |
| | | title: '预计取件时间必须大于预计到店时间', |
| | | icon: 'none' |
| | | }); |
| | | return; |
| | | } |
| | | this.form.pickupTime = pickupTime; |
| | | this.showPickupTimePicker = false; |
| | | this.calculateLocalPrice(); |
| | | }, |
| | | // 物品分类 |
| | | getCategoryList: function getCategoryList() { |
| | | var _this4 = this; |
| | | var _this5 = this; |
| | | return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() { |
| | | var res; |
| | | return _regenerator.default.wrap(function _callee4$(_context4) { |
| | |
| | | switch (_context4.prev = _context4.next) { |
| | | case 0: |
| | | _context4.next = 2; |
| | | return _this4.$u.api.getCategoryList({ |
| | | return _this5.$u.api.getCategoryList({ |
| | | type: 2 |
| | | }); |
| | | case 2: |
| | |
| | | res.data.forEach(function (item) { |
| | | item.active = false; |
| | | }); |
| | | _this4.goodsOptions = res.data || []; |
| | | _this5.goodsOptions = res.data || []; |
| | | } |
| | | case 4: |
| | | case "end": |
| | |
| | | }))(); |
| | | }, |
| | | getCitySizeList: function getCitySizeList() { |
| | | var _this5 = this; |
| | | var _this6 = this; |
| | | return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() { |
| | | var res; |
| | | return _regenerator.default.wrap(function _callee5$(_context5) { |
| | |
| | | switch (_context5.prev = _context5.next) { |
| | | case 0: |
| | | _context5.next = 2; |
| | | return _this5.$u.api.getCitySizeList({ |
| | | cityId: _this5.cityId |
| | | return _this6.$u.api.getCitySizeList({ |
| | | cityId: _this6.cityId |
| | | }); |
| | | case 2: |
| | | res = _context5.sent; |
| | |
| | | res.data.forEach(function (item) { |
| | | item.count = 0; |
| | | }); |
| | | _this5.luggageTypes = res.data || []; |
| | | _this6.luggageTypes = res.data || []; |
| | | } |
| | | case 4: |
| | | case "end": |
| | |
| | | }))(); |
| | | }, |
| | | getNearbyShopList: function getNearbyShopList() { |
| | | var _this6 = this; |
| | | var _this7 = this; |
| | | return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() { |
| | | var res; |
| | | return _regenerator.default.wrap(function _callee6$(_context6) { |
| | | while (1) { |
| | | switch (_context6.prev = _context6.next) { |
| | | case 0: |
| | | if (_this6.storeForm.isSearch) { |
| | | if (_this7.storeForm.isSearch) { |
| | | _context6.next = 2; |
| | | break; |
| | | } |
| | | return _context6.abrupt("return"); |
| | | case 2: |
| | | _context6.next = 4; |
| | | return _this6.$u.api.getNearbyShopList({ |
| | | return _this7.$u.api.getNearbyShopList({ |
| | | capacity: 10, |
| | | page: _this6.storeForm.page, |
| | | page: _this7.storeForm.page, |
| | | model: { |
| | | latitude: _this6.latitude, |
| | | longitude: _this6.longitude, |
| | | cityId: _this6.cityId, |
| | | latitude: _this7.latitude, |
| | | longitude: _this7.longitude, |
| | | cityId: _this7.cityId, |
| | | sortType: 1 |
| | | } |
| | | }); |
| | |
| | | res.data.records.forEach(function (item) { |
| | | item.active = false; |
| | | }); |
| | | _this6.storeList = [].concat((0, _toConsumableArray2.default)(_this6.storeList), (0, _toConsumableArray2.default)(res.data.records || [])); |
| | | _this6.storeForm.page++; |
| | | _this6.storeForm.isSearch = _this6.storeList.length <= res.data.total; |
| | | _this7.storeList = [].concat((0, _toConsumableArray2.default)(_this7.storeList), (0, _toConsumableArray2.default)(res.data.records || [])); |
| | | _this7.storeForm.page++; |
| | | _this7.storeForm.isSearch = _this7.storeList.length <= res.data.total; |
| | | } |
| | | case 6: |
| | | case "end": |
| | |
| | | this.calculateLocalPrice(); |
| | | }, |
| | | calculateLocalPrice: function calculateLocalPrice() { |
| | | var _this7 = this; |
| | | var _this8 = this; |
| | | return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() { |
| | | var luggageList, res; |
| | | return _regenerator.default.wrap(function _callee7$(_context7) { |
| | | while (1) { |
| | | switch (_context7.prev = _context7.next) { |
| | | case 0: |
| | | if (!(!_this7.selectedStore || !_this7.form.arriveTime || !_this7.form.pickupTime)) { |
| | | _context7.next = 2; |
| | | break; |
| | | if (_this8.activeMode === 'city') { |
| | | _this8.calculateRemotePrice(); |
| | | } else { |
| | | _this8.calculateLocalPriceOnly(); |
| | | } |
| | | return _context7.abrupt("return"); |
| | | case 2: |
| | | luggageList = _this7.luggageTypes.filter(function (item) { |
| | | return item.count > 0; |
| | | }).map(function (item) { |
| | | return { |
| | | categoryId: item.id, |
| | | quantity: item.count |
| | | }; |
| | | }); |
| | | if (!(luggageList.length === 0)) { |
| | | _context7.next = 5; |
| | | break; |
| | | } |
| | | return _context7.abrupt("return"); |
| | | case 5: |
| | | _context7.next = 7; |
| | | return _this7.$u.api.calculateLocalPrice({ |
| | | cityId: _this7.cityId, |
| | | shopId: _this7.selectedStore.id, |
| | | depositStartTime: _this7.form.arriveTime + ':00', |
| | | depositEndTime: _this7.form.pickupTime + ':00', |
| | | items: luggageList, |
| | | declaredAmount: _this7.form.insurance || 0 |
| | | }); |
| | | case 7: |
| | | res = _context7.sent; |
| | | if (res.code === 200) { |
| | | res.data.itemList.forEach(function (item) { |
| | | item.unitPrice = item.unitPrice / 100; |
| | | }); |
| | | res.data.totalPrice = res.data.totalPrice / 100; |
| | | _this7.amountData = res.data; |
| | | } |
| | | case 9: |
| | | case 1: |
| | | case "end": |
| | | return _context7.stop(); |
| | | } |
| | |
| | | }, _callee7); |
| | | }))(); |
| | | }, |
| | | createOrder: function createOrder() { |
| | | var _this8 = this; |
| | | calculateLocalPriceOnly: function calculateLocalPriceOnly() { |
| | | var _this9 = this; |
| | | return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() { |
| | | var luggageList, items, res; |
| | | var luggageList, res; |
| | | return _regenerator.default.wrap(function _callee8$(_context8) { |
| | | while (1) { |
| | | switch (_context8.prev = _context8.next) { |
| | | case 0: |
| | | if (_this8.selectedStore) { |
| | | _context8.next = 3; |
| | | if (!(!_this9.selectedStore || !_this9.form.arriveTime || !_this9.form.pickupTime)) { |
| | | _context8.next = 2; |
| | | break; |
| | | } |
| | | uni.showToast({ |
| | | title: '请选择门店', |
| | | icon: 'none' |
| | | }); |
| | | return _context8.abrupt("return"); |
| | | case 3: |
| | | if (_this8.form.arriveTime) { |
| | | _context8.next = 6; |
| | | break; |
| | | } |
| | | uni.showToast({ |
| | | title: '请选择预计到店时间', |
| | | icon: 'none' |
| | | }); |
| | | return _context8.abrupt("return"); |
| | | case 6: |
| | | if (_this8.form.pickupTime) { |
| | | _context8.next = 9; |
| | | break; |
| | | } |
| | | uni.showToast({ |
| | | title: '请选择预计取件时间', |
| | | icon: 'none' |
| | | }); |
| | | return _context8.abrupt("return"); |
| | | case 9: |
| | | luggageList = _this8.luggageTypes.filter(function (item) { |
| | | case 2: |
| | | luggageList = _this9.luggageTypes.filter(function (item) { |
| | | return item.count > 0; |
| | | }).map(function (item) { |
| | | return { |
| | |
| | | }; |
| | | }); |
| | | if (!(luggageList.length === 0)) { |
| | | _context8.next = 13; |
| | | _context8.next = 5; |
| | | break; |
| | | } |
| | | uni.showToast({ |
| | | title: '请选择行李类型', |
| | | icon: 'none' |
| | | }); |
| | | return _context8.abrupt("return"); |
| | | case 13: |
| | | items = luggageList.map(function (item) { |
| | | return { |
| | | categoryId: item.categoryId, |
| | | quantity: item.quantity |
| | | }; |
| | | case 5: |
| | | _context8.next = 7; |
| | | return _this9.$u.api.calculateLocalPrice({ |
| | | cityId: _this9.cityId, |
| | | shopId: _this9.selectedStore.id, |
| | | depositStartTime: _this9.form.arriveTime + ':00', |
| | | depositEndTime: _this9.form.pickupTime + ':00', |
| | | items: luggageList, |
| | | declaredAmount: _this9.form.insurance || 0 |
| | | }); |
| | | _context8.next = 16; |
| | | return _this8.$u.api.createOrder({ |
| | | cityId: _this8.cityId, |
| | | declaredAmount: _this8.form.insurance || 0, |
| | | depositShopId: _this8.selectedStore.id, |
| | | expectedDepositTime: _this8.form.arriveTime + ':00', |
| | | expectedTakeTime: _this8.form.pickupTime + ':00', |
| | | goodType: _this8.form.goodType, |
| | | goodsImages: _this8.form.goodsImages, |
| | | items: items, |
| | | remark: _this8.form.remark, |
| | | takePhone: _this8.form.mobile, |
| | | takeUser: _this8.form.receiver, |
| | | type: _this8.activeMode === 'local' ? 0 : 1 |
| | | }); |
| | | case 16: |
| | | case 7: |
| | | res = _context8.sent; |
| | | if (res.code === 200) { |
| | | uni.showToast({ |
| | | title: '下单成功', |
| | | icon: 'success' |
| | | res.data.itemList.forEach(function (item) { |
| | | item.unitPrice = item.unitPrice / 100; |
| | | }); |
| | | if (res.data) { |
| | | _this8.processPayment(res.data.response); |
| | | } |
| | | res.data.totalPrice = res.data.totalPrice / 100; |
| | | res.data.insuranceFee = res.data.insuranceFee / 100; |
| | | _this9.amountData = res.data; |
| | | } |
| | | case 18: |
| | | case 9: |
| | | case "end": |
| | | return _context8.stop(); |
| | | } |
| | |
| | | }, _callee8); |
| | | }))(); |
| | | }, |
| | | processPayment: function processPayment(paymentData) { |
| | | calculateRemotePrice: function calculateRemotePrice() { |
| | | var _this10 = this; |
| | | return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() { |
| | | var luggageList, fromLat, fromLgt, toLat, toLgt, res; |
| | | return _regenerator.default.wrap(function _callee9$(_context9) { |
| | | while (1) { |
| | | switch (_context9.prev = _context9.next) { |
| | | case 0: |
| | | if (!(!_this10.sendStore || !_this10.form.arriveTime || !_this10.form.pickupTime)) { |
| | | _context9.next = 2; |
| | | break; |
| | | } |
| | | return _context9.abrupt("return"); |
| | | case 2: |
| | | if (!(!_this10.receiveStore && !_this10.receiveAddr)) { |
| | | _context9.next = 4; |
| | | break; |
| | | } |
| | | return _context9.abrupt("return"); |
| | | case 4: |
| | | luggageList = _this10.luggageTypes.filter(function (item) { |
| | | return item.count > 0; |
| | | }).map(function (item) { |
| | | return { |
| | | categoryId: item.id, |
| | | quantity: item.count |
| | | }; |
| | | }); |
| | | if (!(luggageList.length === 0)) { |
| | | _context9.next = 7; |
| | | break; |
| | | } |
| | | return _context9.abrupt("return"); |
| | | case 7: |
| | | fromLat = ''; |
| | | fromLgt = ''; |
| | | toLat = ''; |
| | | toLgt = ''; |
| | | if (_this10.sendStore) { |
| | | fromLat = _this10.sendStore.latitude; |
| | | fromLgt = _this10.sendStore.longitude; |
| | | } |
| | | if (_this10.receiveStore) { |
| | | toLat = _this10.receiveStore.latitude; |
| | | toLgt = _this10.receiveStore.longitude; |
| | | } else if (_this10.receiveAddr) { |
| | | toLat = _this10.receiveAddr.latitude; |
| | | toLgt = _this10.receiveAddr.longitude; |
| | | } |
| | | _context9.next = 15; |
| | | return _this10.$u.api.calculateRemotePrice({ |
| | | cityId: _this10.cityId, |
| | | fromLat: fromLat, |
| | | fromLgt: fromLgt, |
| | | toLat: toLat, |
| | | toLgt: toLgt, |
| | | urgent: _this10.isUrgent, |
| | | depositStartTime: _this10.form.arriveTime + ':00', |
| | | depositEndTime: _this10.form.pickupTime + ':00', |
| | | items: luggageList, |
| | | declaredAmount: _this10.form.insurance || 0 |
| | | }); |
| | | case 15: |
| | | res = _context9.sent; |
| | | if (res.code === 200) { |
| | | res.data.itemList.forEach(function (item) { |
| | | item.unitPrice = item.unitPrice / 100; |
| | | }); |
| | | res.data.totalPrice = res.data.totalPrice / 100; |
| | | res.data.insuranceFee = res.data.insuranceFee / 100; |
| | | _this10.serviceTimes = [{ |
| | | id: 0, |
| | | name: '标准达', |
| | | serviceTime: res.data.standardHours, |
| | | price: res.data.itemPrice / 100 |
| | | }, { |
| | | id: 1, |
| | | name: '急速达', |
| | | serviceTime: res.data.urgentHours, |
| | | price: (res.data.urgentFee + res.data.itemPrice) / 100 |
| | | }]; |
| | | _this10.amountData = res.data; |
| | | } |
| | | case 17: |
| | | case "end": |
| | | return _context9.stop(); |
| | | } |
| | | } |
| | | }, _callee9); |
| | | }))(); |
| | | }, |
| | | createOrder: function createOrder() { |
| | | var _this11 = this; |
| | | return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() { |
| | | var luggageList, items, orderParams, res; |
| | | return _regenerator.default.wrap(function _callee10$(_context10) { |
| | | while (1) { |
| | | switch (_context10.prev = _context10.next) { |
| | | case 0: |
| | | if (_this11.agreementChecked) { |
| | | _context10.next = 3; |
| | | break; |
| | | } |
| | | uni.showToast({ |
| | | title: '请先阅读并同意用户服务协议及隐私政策', |
| | | icon: 'none' |
| | | }); |
| | | return _context10.abrupt("return"); |
| | | case 3: |
| | | if (!(_this11.activeMode === 'local')) { |
| | | _context10.next = 9; |
| | | break; |
| | | } |
| | | if (_this11.selectedStore) { |
| | | _context10.next = 7; |
| | | break; |
| | | } |
| | | uni.showToast({ |
| | | title: '请选择门店', |
| | | icon: 'none' |
| | | }); |
| | | return _context10.abrupt("return"); |
| | | case 7: |
| | | _context10.next = 15; |
| | | break; |
| | | case 9: |
| | | if (_this11.sendStore) { |
| | | _context10.next = 12; |
| | | break; |
| | | } |
| | | uni.showToast({ |
| | | title: '请选择寄件服务点', |
| | | icon: 'none' |
| | | }); |
| | | return _context10.abrupt("return"); |
| | | case 12: |
| | | if (!(!_this11.receiveStore && !_this11.receiveAddr)) { |
| | | _context10.next = 15; |
| | | break; |
| | | } |
| | | uni.showToast({ |
| | | title: '请选择取件地址', |
| | | icon: 'none' |
| | | }); |
| | | return _context10.abrupt("return"); |
| | | case 15: |
| | | if (_this11.form.arriveTime) { |
| | | _context10.next = 18; |
| | | break; |
| | | } |
| | | uni.showToast({ |
| | | title: '请选择预计到店时间', |
| | | icon: 'none' |
| | | }); |
| | | return _context10.abrupt("return"); |
| | | case 18: |
| | | if (_this11.form.pickupTime) { |
| | | _context10.next = 21; |
| | | break; |
| | | } |
| | | uni.showToast({ |
| | | title: '请选择预计取件时间', |
| | | icon: 'none' |
| | | }); |
| | | return _context10.abrupt("return"); |
| | | case 21: |
| | | if (!(new Date(_this11.form.pickupTime) <= new Date(_this11.form.arriveTime))) { |
| | | _context10.next = 24; |
| | | break; |
| | | } |
| | | uni.showToast({ |
| | | title: '预计取件时间必须大于预计到店时间', |
| | | icon: 'none' |
| | | }); |
| | | return _context10.abrupt("return"); |
| | | case 24: |
| | | luggageList = _this11.luggageTypes.filter(function (item) { |
| | | return item.count > 0; |
| | | }).map(function (item) { |
| | | return { |
| | | categoryId: item.id, |
| | | quantity: item.count |
| | | }; |
| | | }); |
| | | if (!(luggageList.length === 0)) { |
| | | _context10.next = 28; |
| | | break; |
| | | } |
| | | uni.showToast({ |
| | | title: '请选择行李类型', |
| | | icon: 'none' |
| | | }); |
| | | return _context10.abrupt("return"); |
| | | case 28: |
| | | items = luggageList.map(function (item) { |
| | | return { |
| | | categoryId: item.categoryId, |
| | | quantity: item.quantity |
| | | }; |
| | | }); |
| | | orderParams = { |
| | | cityId: _this11.cityId, |
| | | declaredAmount: _this11.form.insurance || 0, |
| | | expectedDepositTime: _this11.form.arriveTime + ':00', |
| | | expectedTakeTime: _this11.form.pickupTime + ':00', |
| | | goodType: _this11.form.goodType, |
| | | goodsImages: _this11.form.goodsImages, |
| | | items: items, |
| | | remark: _this11.form.remark, |
| | | takePhone: _this11.form.mobile, |
| | | takeUser: _this11.form.receiver, |
| | | type: _this11.activeMode === 'local' ? 0 : 1, |
| | | isUrgent: _this11.isUrgent |
| | | }; |
| | | if (_this11.activeMode === 'local') { |
| | | orderParams.depositShopId = _this11.selectedStore.id; |
| | | } else { |
| | | orderParams.depositShopId = _this11.sendStore.id; |
| | | orderParams.fromShopId = _this11.sendStore.id; |
| | | if (_this11.receiveStore) { |
| | | orderParams.toType = 0; |
| | | orderParams.toShopId = _this11.receiveStore.id; |
| | | orderParams.takeLat = _this11.receiveStore.latitude; |
| | | orderParams.takeLgt = _this11.receiveStore.longitude; |
| | | orderParams.takeLocation = _this11.receiveStore.address; |
| | | } else if (_this11.receiveAddr) { |
| | | orderParams.toType = 1; |
| | | orderParams.toAddrId = _this11.receiveAddr.id; |
| | | orderParams.takeLat = _this11.receiveAddr.latitude; |
| | | orderParams.takeLgt = _this11.receiveAddr.longitude; |
| | | orderParams.takeLocation = _this11.receiveAddr.addr; |
| | | } |
| | | } |
| | | _context10.next = 33; |
| | | return _this11.$u.api.createOrder(orderParams); |
| | | case 33: |
| | | res = _context10.sent; |
| | | if (res.code === 200) { |
| | | if (res.data) { |
| | | _this11.processPayment(res.data.response, res.data.orderId); |
| | | } |
| | | } |
| | | case 35: |
| | | case "end": |
| | | return _context10.stop(); |
| | | } |
| | | } |
| | | }, _callee10); |
| | | }))(); |
| | | }, |
| | | processPayment: function processPayment(paymentData, orderId) { |
| | | uni.requestPayment({ |
| | | provider: 'wxpay', |
| | | timeStamp: paymentData.timeStamp || '', |
| | | nonceStr: paymentData.nonceStr || '', |
| | | package: paymentData.packageValue || '', |
| | | package: paymentData.package || '', |
| | | signType: paymentData.signType || 'MD5', |
| | | paySign: paymentData.paySign || '', |
| | | success: function success(res) { |
| | | uni.showToast({ |
| | | title: '支付成功', |
| | | icon: 'success' |
| | | uni.navigateTo({ |
| | | url: '/pages/payment-success/payment-success?orderId=' + orderId |
| | | }); |
| | | }, |
| | | fail: function fail(err) { |