From a987eccb27891bbfaae334b7fa0e892ee2640271 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期一, 20 四月 2026 17:20:13 +0800
Subject: [PATCH] 调接口加页面
---
small-program/unpackage/dist/dev/mp-weixin/pages/luggage-storage/luggage-storage.js | 579 +++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 417 insertions(+), 162 deletions(-)
diff --git a/small-program/unpackage/dist/dev/mp-weixin/pages/luggage-storage/luggage-storage.js b/small-program/unpackage/dist/dev/mp-weixin/pages/luggage-storage/luggage-storage.js
index 0ae1fd0..69fe68f 100644
--- a/small-program/unpackage/dist/dev/mp-weixin/pages/luggage-storage/luggage-storage.js
+++ b/small-program/unpackage/dist/dev/mp-weixin/pages/luggage-storage/luggage-storage.js
@@ -101,13 +101,16 @@
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) {
@@ -158,7 +161,7 @@
_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
@@ -195,6 +198,12 @@
}
_vm.e15 = function ($event) {
_vm.showAmountPopup = false
+ }
+ _vm.e16 = function ($event) {
+ _vm.showAmountPopup = false
+ }
+ _vm.e17 = function ($event) {
+ _vm.showReceiveAddress = false
}
}
}
@@ -268,7 +277,7 @@
tempSelectedGoodsIds: [1],
selectedGoodsIds: [1],
selectedLuggageId: 1,
- selectedServiceTime: 1,
+ isUrgent: 0,
form: {
receiver: '',
mobile: '',
@@ -282,30 +291,39 @@
},
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();
+ }
}
}
},
@@ -325,25 +343,38 @@
});
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) {
@@ -361,7 +392,7 @@
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: {
@@ -413,7 +444,7 @@
},
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) {
@@ -421,7 +452,7 @@
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;
@@ -451,18 +482,18 @@
});
_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: '涓婁紶鎴愬姛',
@@ -503,29 +534,71 @@
},
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) || '';
@@ -552,13 +625,21 @@
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) {
@@ -566,7 +647,7 @@
switch (_context4.prev = _context4.next) {
case 0:
_context4.next = 2;
- return _this4.$u.api.getCategoryList({
+ return _this5.$u.api.getCategoryList({
type: 2
});
case 2:
@@ -575,7 +656,7 @@
res.data.forEach(function (item) {
item.active = false;
});
- _this4.goodsOptions = res.data || [];
+ _this5.goodsOptions = res.data || [];
}
case 4:
case "end":
@@ -586,7 +667,7 @@
}))();
},
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) {
@@ -594,8 +675,8 @@
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;
@@ -603,7 +684,7 @@
res.data.forEach(function (item) {
item.count = 0;
});
- _this5.luggageTypes = res.data || [];
+ _this6.luggageTypes = res.data || [];
}
case 4:
case "end":
@@ -614,27 +695,27 @@
}))();
},
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
}
});
@@ -644,9 +725,9 @@
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":
@@ -667,52 +748,18 @@
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();
}
@@ -720,45 +767,21 @@
}, _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 {
@@ -767,48 +790,31 @@
};
});
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();
}
@@ -816,18 +822,267 @@
}, _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) {
--
Gitblit v1.9.3