From f39ca3c49d26abd10f76fc67506b9c603a13547c Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期五, 17 四月 2026 20:20:30 +0800
Subject: [PATCH] 调接口加页面
---
small-program/unpackage/dist/dev/mp-weixin/pages/luggage-storage/luggage-storage.js | 1096 ++++++++++++++++++++++++++++++---------------------------
1 files changed, 572 insertions(+), 524 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 729c3f0..0ae1fd0 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
@@ -34,7 +34,7 @@
/* harmony import */ var _luggage_storage_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./luggage-storage.vue?vue&type=script&lang=js& */ 207);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _luggage_storage_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _luggage_storage_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__[key]; }) }(__WEBPACK_IMPORT_KEY__));
/* harmony import */ var _luggage_storage_vue_vue_type_style_index_0_id_c13e4c60_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./luggage-storage.vue?vue&type=style&index=0&id=c13e4c60&lang=scss&scoped=true& */ 209);
-/* harmony import */ var _HBuilderX_3_8_12_20230817_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../../鍔炲叕/HBuilderX.3.8.12.20230817/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js */ 38);
+/* harmony import */ var _HBuilderX_3_8_12_20230817_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../../鍔炲叕/HBuilderX.3.8.12.20230817/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js */ 41);
var renderjs
@@ -101,10 +101,13 @@
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 */ 233))
+ 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))
+ },
+ 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))
},
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 */ 242))
+ 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))
},
}
} catch (e) {
@@ -128,56 +131,72 @@
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
- var l0 = _vm.__map(_vm.goodsOptions, function (item, __i4__) {
- var $orig = _vm.__get_orig(item)
- var g0 = _vm.tempSelectedGoodsIds.includes(item.id)
- return {
- $orig: $orig,
- g0: g0,
- }
- })
if (!_vm._isMounted) {
- _vm.e0 = function ($event, item) {
+ _vm.e0 = function ($event) {
+ _vm.showArriveTimePicker = true
+ }
+ _vm.e1 = function ($event) {
+ _vm.showPickupTimePicker = true
+ }
+ _vm.e2 = function ($event) {
+ _vm.showArriveTimePicker = false
+ }
+ _vm.e3 = function ($event) {
+ _vm.showArriveTimePicker = false
+ }
+ _vm.e4 = function ($event) {
+ _vm.showPickupTimePicker = false
+ }
+ _vm.e5 = function ($event) {
+ _vm.showPickupTimePicker = false
+ }
+ _vm.e6 = function ($event) {
+ _vm.showGoodsPopup = true
+ }
+ _vm.e7 = function ($event, item) {
var _temp = arguments[arguments.length - 1].currentTarget.dataset,
_temp2 = _temp.eventParams || _temp["event-params"],
item = _temp2.item
var _temp, _temp2
_vm.selectedServiceTime = item.id
}
- _vm.e1 = function ($event) {
+ _vm.e8 = function ($event) {
_vm.showStorePopup = false
}
- _vm.e2 = function ($event) {
+ _vm.e9 = function ($event) {
_vm.showStorePopup = false
}
- _vm.e3 = function ($event, item) {
+ _vm.e10 = function ($event, index) {
var _temp3 = arguments[arguments.length - 1].currentTarget.dataset,
_temp4 = _temp3.eventParams || _temp3["event-params"],
- item = _temp4.item
+ index = _temp4.index
var _temp3, _temp4
- _vm.tempSelectedStoreId = item.id
+ _vm.storeList.forEach(function (row, i) {
+ return (row.active = index === i)
+ })
}
- _vm.e4 = function ($event) {
+ _vm.e11 = function ($event) {
_vm.showGoodsPopup = false
}
- _vm.e5 = function ($event) {
+ _vm.e12 = function ($event) {
_vm.showGoodsPopup = false
}
- _vm.e6 = function ($event) {
+ _vm.e13 = function ($event, index) {
+ var _temp5 = arguments[arguments.length - 1].currentTarget.dataset,
+ _temp6 = _temp5.eventParams || _temp5["event-params"],
+ index = _temp6.index
+ var _temp5, _temp6
+ _vm.goodsOptions.forEach(function (row, i) {
+ return (row.active = i === index)
+ })
+ }
+ _vm.e14 = function ($event) {
_vm.showAmountPopup = false
}
- _vm.e7 = function ($event) {
+ _vm.e15 = function ($event) {
_vm.showAmountPopup = false
}
}
- _vm.$mp.data = Object.assign(
- {},
- {
- $root: {
- l0: l0,
- },
- }
- )
}
var recyclableRender = false
var staticRenderFns = []
@@ -218,340 +237,23 @@
value: true
});
exports.default = void 0;
+var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 34));
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
+var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 36));
+var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
+var _vuex = __webpack_require__(/*! vuex */ 37);
+function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
+function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var _default = {
data: function data() {
return {
showStorePopup: false,
showGoodsPopup: false,
showAmountPopup: false,
+ showArriveTimePicker: false,
+ showPickupTimePicker: false,
+ arriveTimeValue: Number(new Date()),
+ pickupTimeValue: Number(new Date()),
activeMode: 'local',
modeTabs: [{
label: '灏卞湴瀵勫瓨',
@@ -561,39 +263,25 @@
value: 'city'
}],
agreementChecked: true,
- storeKeyword: '',
tempSelectedStoreId: 2,
selectedStoreId: 2,
tempSelectedGoodsIds: [1],
selectedGoodsIds: [1],
selectedLuggageId: 1,
selectedServiceTime: 1,
- luggageCountMap: {
- 1: 1,
- 2: 1,
- 3: 0
- },
form: {
- receiver: '钄″瓙鐟�',
- mobile: '18166525368',
- arriveTime: '2026-04-15 16:30',
- pickupTime: '2026-04-17 16:30',
- insurance: '200',
- remark: ''
+ receiver: '',
+ mobile: '',
+ arriveTime: '',
+ pickupTime: '',
+ goodType: '',
+ goodTypeName: '',
+ insurance: '',
+ remark: '',
+ goodsImages: []
},
- luggageTypes: [{
- id: 1,
- name: '澶т欢琛屾潕绠�',
- size: '24-28瀵�'
- }, {
- id: 2,
- name: '涓欢琛屾潕绠�',
- size: '24-28瀵�'
- }, {
- id: 3,
- name: '灏忎欢琛屾潕绠�',
- size: '24-28瀵�'
- }],
+ amountData: null,
+ luggageTypes: [],
serviceTimes: [{
id: 1,
name: '鏍囧噯杈�(棰勮6灏忔椂鍐呴�佽揪)',
@@ -603,133 +291,35 @@
name: '鎬ラ�熻揪(棰勮4灏忔椂鍐呴�佽揪)',
price: '锟�70'
}],
- storeList: [{
- id: 1,
- name: '涓搧蹇繍鍗楃珯鏃楄埌搴�',
- address: '鍚堣偉鍗楃珯璐熶竴灞�100鍙�',
- time: '鍛ㄤ竴鑷冲懆鏃� 7:00~23:00',
- distance: '239m'
- }, {
- id: 2,
- name: '涓搧蹇繍鍚堣偉鐏溅绔�',
- address: '鍚堣偉鐏溅绔欎竴灞�12鍙�',
- time: '鍛ㄤ竴鑷冲懆鏃� 7:00~23:00',
- distance: '12.8km'
- }, {
- id: 3,
- name: '鍚堣偉鐏溅绔欏寳骞垮満',
- address: '鍚堣偉鐏溅绔欎竴灞�12鍙�',
- time: '鍛ㄤ竴鑷冲懆鏃� 7:00~23:00',
- distance: '13.1km'
- }, {
- id: 4,
- name: '灏忛搧鏃犲咖瀛�',
- address: '鍚堣偉鐏溅绔欎竴灞�12鍙�',
- time: '鍛ㄤ竴鑷冲懆鏃� 7:00~23:00',
- distance: '16.3km'
- }, {
- id: 5,
- name: '涓搧蹇繍鍚堣偉鐏溅绔�',
- address: '鍚堣偉鐏溅绔欎竴灞�12鍙�',
- time: '鍛ㄤ竴鑷冲懆鏃� 7:00~23:00',
- distance: '20.8km'
- }],
- goodsOptions: [{
- id: 1,
- name: '鏂囦欢'
- }, {
- id: 2,
- name: '琛f湇'
- }, {
- id: 3,
- name: '婊戦洩鏉�'
- }, {
- id: 4,
- name: '鍙戠エ'
- }, {
- id: 5,
- name: '鎵嬫満'
- }, {
- id: 6,
- name: '鐢佃剳'
- }, {
- id: 7,
- name: '闉嬪瓙'
- }, {
- id: 8,
- name: '鎶よ偆鍝�'
- }, {
- id: 9,
- name: '鐧介厭'
- }, {
- id: 10,
- name: '闉嬪瓙'
- }, {
- id: 11,
- name: '鎶よ偆鍝�'
- }, {
- id: 12,
- name: '鐧介厭'
- }, {
- id: 13,
- name: '闉嬪瓙'
- }, {
- id: 14,
- name: '鎶よ偆鍝�'
- }, {
- id: 15,
- name: '鐧介厭'
- }],
- amountDetails: [{
- label: '澶т欢琛屾潕绠�',
- count: 1,
- value: '锟�35'
- }, {
- label: '涓欢琛屾潕绠�',
- count: 1,
- value: '锟�35'
- }, {
- label: '瀵勫瓨澶╂暟',
- count: '',
- value: '2澶�'
- }, {
- label: '琛屾潕淇濅环',
- count: '',
- value: '锟�10'
- }],
- uploadedImages: [{
- url: '/static/icon/nav_home_sel@2x.png'
- }, {
- url: '/static/icon/nav_xingcheng_sel@2x.png'
- }]
+ storeList: [],
+ selectedStore: null,
+ storeForm: {
+ keyword: '',
+ page: 1,
+ isSearch: true
+ },
+ goodsOptions: [],
+ uploadedImages: []
};
},
- computed: {
- selectedStore: function selectedStore() {
- var _this = this;
- return this.storeList.find(function (item) {
- return item.id === _this.selectedStoreId;
- }) || null;
- },
+ watch: {
+ 'form.insurance': {
+ handler: function handler() {
+ this.calculateLocalPrice();
+ }
+ }
+ },
+ computed: _objectSpread(_objectSpread({}, (0, _vuex.mapState)(['latitude', 'longitude', 'cityId'])), {}, {
servicePointPlaceholder: function servicePointPlaceholder() {
return this.activeMode === 'city' ? '閫夋嫨瀵勯�佹湇鍔$偣' : '閫夋嫨瀵勫瓨鏈嶅姟鐐�';
},
- filteredStores: function filteredStores() {
- var keyword = (this.storeKeyword || '').trim();
- if (!keyword) {
- return this.storeList;
- }
- return this.storeList.filter(function (item) {
- return item.name.includes(keyword) || item.address.includes(keyword);
- });
- },
selectedGoodsText: function selectedGoodsText() {
- var _this2 = this;
+ var _this = this;
if (!this.selectedGoodsIds.length) {
return '蹇呴�夛紝璇烽�夋嫨';
}
var labels = this.goodsOptions.filter(function (item) {
- return _this2.selectedGoodsIds.includes(item.id);
+ return _this.selectedGoodsIds.includes(item.id);
}).map(function (item) {
return item.name;
});
@@ -744,8 +334,173 @@
totalPriceText: function totalPriceText() {
return '锟�150.00';
}
+ }),
+ onLoad: function onLoad() {
+ this.getNearbyShopList();
+ this.getCategoryList();
+ this.getCitySizeList();
},
methods: {
+ uploadFiles: function uploadFiles(filePaths) {
+ var _arguments = arguments,
+ _this2 = this;
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
+ var maxCount, limitedPaths, uploadTasks, results;
+ return _regenerator.default.wrap(function _callee$(_context) {
+ while (1) {
+ switch (_context.prev = _context.next) {
+ case 0:
+ maxCount = _arguments.length > 1 && _arguments[1] !== undefined ? _arguments[1] : 9;
+ if (!(!filePaths || filePaths.length === 0)) {
+ _context.next = 3;
+ break;
+ }
+ return _context.abrupt("return", []);
+ case 3:
+ limitedPaths = filePaths.slice(0, maxCount);
+ uploadTasks = limitedPaths.map(function (filePath) {
+ return new Promise(function (resolve, reject) {
+ uni.uploadFile({
+ url: _this2.$baseUrl + '/web/public/upload',
+ filePath: filePath,
+ name: 'file',
+ formData: {
+ folder: 'orders'
+ },
+ success: function success(res) {
+ if (res.statusCode === 200) {
+ var data = JSON.parse(res.data);
+ if (data.code === 200) {
+ resolve(data.data);
+ } else {
+ reject(new Error(data.msg || '涓婁紶澶辫触'));
+ }
+ } else {
+ reject(new Error('涓婁紶澶辫触'));
+ }
+ },
+ fail: function fail(err) {
+ reject(err);
+ }
+ });
+ });
+ });
+ _context.prev = 5;
+ _context.next = 8;
+ return Promise.all(uploadTasks);
+ case 8:
+ results = _context.sent;
+ return _context.abrupt("return", results);
+ case 12:
+ _context.prev = 12;
+ _context.t0 = _context["catch"](5);
+ uni.showToast({
+ title: '涓婁紶澶辫触',
+ icon: 'none'
+ });
+ throw _context.t0;
+ case 16:
+ case "end":
+ return _context.stop();
+ }
+ }
+ }, _callee, null, [[5, 12]]);
+ }))();
+ },
+ deleteImage: function deleteImage(index) {
+ this.uploadedImages.splice(index, 1);
+ this.form.goodsImages.splice(index, 1);
+ },
+ chooseAndUploadImage: function chooseAndUploadImage() {
+ var _arguments2 = arguments,
+ _this3 = this;
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
+ var maxCount, currentCount, remainingCount;
+ return _regenerator.default.wrap(function _callee3$(_context3) {
+ while (1) {
+ switch (_context3.prev = _context3.next) {
+ case 0:
+ maxCount = _arguments2.length > 0 && _arguments2[0] !== undefined ? _arguments2[0] : 9;
+ currentCount = _this3.form.goodsImages.length;
+ remainingCount = maxCount - currentCount;
+ if (!(remainingCount <= 0)) {
+ _context3.next = 6;
+ break;
+ }
+ uni.showToast({
+ title: "\u6700\u591A\u4E0A\u4F20".concat(maxCount, "\u5F20\u56FE\u7247"),
+ icon: 'none'
+ });
+ return _context3.abrupt("return");
+ case 6:
+ uni.chooseImage({
+ count: remainingCount,
+ sizeType: ['compressed'],
+ sourceType: ['album', 'camera'],
+ success: function () {
+ var _success = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(res) {
+ var tempFilePaths, uploadResults, fullPaths;
+ return _regenerator.default.wrap(function _callee2$(_context2) {
+ while (1) {
+ switch (_context2.prev = _context2.next) {
+ case 0:
+ tempFilePaths = res.tempFilePaths;
+ uni.showLoading({
+ title: '涓婁紶涓�...',
+ mask: true
+ });
+ _context2.prev = 2;
+ _context2.next = 5;
+ return _this3.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) {
+ return {
+ url: url
+ };
+ })));
+ _this3.form.goodsImages = [].concat((0, _toConsumableArray2.default)(_this3.form.goodsImages), (0, _toConsumableArray2.default)(fullPaths));
+ uni.hideLoading();
+ uni.showToast({
+ title: '涓婁紶鎴愬姛',
+ icon: 'success'
+ });
+ _context2.next = 16;
+ break;
+ case 13:
+ _context2.prev = 13;
+ _context2.t0 = _context2["catch"](2);
+ uni.hideLoading();
+ case 16:
+ case "end":
+ return _context2.stop();
+ }
+ }
+ }, _callee2, null, [[2, 13]]);
+ }));
+ function success(_x) {
+ return _success.apply(this, arguments);
+ }
+ return success;
+ }()
+ });
+ case 7:
+ case "end":
+ return _context3.stop();
+ }
+ }
+ }, _callee3);
+ }))();
+ },
+ searchStore: function searchStore() {
+ this.storeList = [];
+ this.storeForm.page = 1;
+ this.storeForm.isSearch = true;
+ this.getNearbyShopList();
+ },
switchMode: function switchMode(mode) {
this.activeMode = mode;
},
@@ -759,43 +514,336 @@
this.showAmountPopup = true;
},
openStorePopup: function openStorePopup() {
- this.tempSelectedStoreId = this.selectedStoreId;
+ this.tempSelectedStoreId = null;
this.showStorePopup = true;
},
confirmStore: function confirmStore() {
- this.selectedStoreId = this.tempSelectedStoreId;
+ this.selectedStore = this.storeList.find(function (item) {
+ return item.active;
+ });
this.showStorePopup = false;
- },
- openGoodsPopup: function openGoodsPopup() {
- this.tempSelectedGoodsIds = (0, _toConsumableArray2.default)(this.selectedGoodsIds);
- this.showGoodsPopup = true;
- },
- toggleGoods: function toggleGoods(id) {
- if (this.tempSelectedGoodsIds.includes(id)) {
- this.tempSelectedGoodsIds = this.tempSelectedGoodsIds.filter(function (item) {
- return item !== id;
- });
- return;
- }
- this.tempSelectedGoodsIds = [].concat((0, _toConsumableArray2.default)(this.tempSelectedGoodsIds), [id]);
+ this.calculateLocalPrice();
},
confirmGoods: function confirmGoods() {
- this.selectedGoodsIds = (0, _toConsumableArray2.default)(this.tempSelectedGoodsIds);
+ var _this$goodsOptions$fi, _this$goodsOptions$fi2;
+ 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) || '';
+ this.form.goodType = ((_this$goodsOptions$fi2 = this.goodsOptions.find(function (item) {
+ return item.active;
+ })) === null || _this$goodsOptions$fi2 === void 0 ? void 0 : _this$goodsOptions$fi2.id) || '';
this.showGoodsPopup = false;
},
- selectLuggage: function selectLuggage(id) {
- this.selectedLuggageId = id;
+ confirmArriveTime: function confirmArriveTime(e) {
+ var date = new Date(e.value);
+ var year = date.getFullYear();
+ var month = String(date.getMonth() + 1).padStart(2, '0');
+ 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.arriveTime = "".concat(year, "-").concat(month, "-").concat(day, " ").concat(hour, ":").concat(minute);
+ this.showArriveTimePicker = false;
+ this.calculateLocalPrice();
},
- increaseCount: function increaseCount(id) {
- var current = this.luggageCountMap[id] || 0;
- this.$set(this.luggageCountMap, id, current + 1);
+ confirmPickupTime: function confirmPickupTime(e) {
+ var date = new Date(e.value);
+ var year = date.getFullYear();
+ var month = String(date.getMonth() + 1).padStart(2, '0');
+ 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);
+ this.showPickupTimePicker = false;
+ this.calculateLocalPrice();
},
- decreaseCount: function decreaseCount(id) {
- var current = this.luggageCountMap[id] || 0;
- if (current <= 0) {
- return;
+ // 鐗╁搧鍒嗙被
+ getCategoryList: function getCategoryList() {
+ var _this4 = this;
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
+ var res;
+ return _regenerator.default.wrap(function _callee4$(_context4) {
+ while (1) {
+ switch (_context4.prev = _context4.next) {
+ case 0:
+ _context4.next = 2;
+ return _this4.$u.api.getCategoryList({
+ type: 2
+ });
+ case 2:
+ res = _context4.sent;
+ if (res.code === 200) {
+ res.data.forEach(function (item) {
+ item.active = false;
+ });
+ _this4.goodsOptions = res.data || [];
+ }
+ case 4:
+ case "end":
+ return _context4.stop();
+ }
+ }
+ }, _callee4);
+ }))();
+ },
+ getCitySizeList: function getCitySizeList() {
+ var _this5 = this;
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
+ var res;
+ return _regenerator.default.wrap(function _callee5$(_context5) {
+ while (1) {
+ switch (_context5.prev = _context5.next) {
+ case 0:
+ _context5.next = 2;
+ return _this5.$u.api.getCitySizeList({
+ cityId: _this5.cityId
+ });
+ case 2:
+ res = _context5.sent;
+ if (res.code === 200) {
+ res.data.forEach(function (item) {
+ item.count = 0;
+ });
+ _this5.luggageTypes = res.data || [];
+ }
+ case 4:
+ case "end":
+ return _context5.stop();
+ }
+ }
+ }, _callee5);
+ }))();
+ },
+ getNearbyShopList: function getNearbyShopList() {
+ var _this6 = 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) {
+ _context6.next = 2;
+ break;
+ }
+ return _context6.abrupt("return");
+ case 2:
+ _context6.next = 4;
+ return _this6.$u.api.getNearbyShopList({
+ capacity: 10,
+ page: _this6.storeForm.page,
+ model: {
+ latitude: _this6.latitude,
+ longitude: _this6.longitude,
+ cityId: _this6.cityId,
+ sortType: 1
+ }
+ });
+ case 4:
+ res = _context6.sent;
+ if (res.code === 200) {
+ 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;
+ }
+ case 6:
+ case "end":
+ return _context6.stop();
+ }
+ }
+ }, _callee6);
+ }))();
+ },
+ increaseCount: function increaseCount(index) {
+ this.luggageTypes[index].count++;
+ this.calculateLocalPrice();
+ },
+ decreaseCount: function decreaseCount(index) {
+ if (this.luggageTypes[index].count > 0) {
+ this.luggageTypes[index].count--;
}
- this.$set(this.luggageCountMap, id, current - 1);
+ this.calculateLocalPrice();
+ },
+ calculateLocalPrice: function calculateLocalPrice() {
+ var _this7 = 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;
+ }
+ 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 "end":
+ return _context7.stop();
+ }
+ }
+ }, _callee7);
+ }))();
+ },
+ createOrder: function createOrder() {
+ var _this8 = this;
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
+ var luggageList, items, res;
+ return _regenerator.default.wrap(function _callee8$(_context8) {
+ while (1) {
+ switch (_context8.prev = _context8.next) {
+ case 0:
+ if (_this8.selectedStore) {
+ _context8.next = 3;
+ 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) {
+ return item.count > 0;
+ }).map(function (item) {
+ return {
+ categoryId: item.id,
+ quantity: item.count
+ };
+ });
+ if (!(luggageList.length === 0)) {
+ _context8.next = 13;
+ break;
+ }
+ uni.showToast({
+ title: '璇烽�夋嫨琛屾潕绫诲瀷',
+ icon: 'none'
+ });
+ return _context8.abrupt("return");
+ case 13:
+ items = luggageList.map(function (item) {
+ return {
+ categoryId: item.categoryId,
+ quantity: item.quantity
+ };
+ });
+ _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:
+ res = _context8.sent;
+ if (res.code === 200) {
+ uni.showToast({
+ title: '涓嬪崟鎴愬姛',
+ icon: 'success'
+ });
+ if (res.data) {
+ _this8.processPayment(res.data.response);
+ }
+ }
+ case 18:
+ case "end":
+ return _context8.stop();
+ }
+ }
+ }, _callee8);
+ }))();
+ },
+ processPayment: function processPayment(paymentData) {
+ uni.requestPayment({
+ provider: 'wxpay',
+ timeStamp: paymentData.timeStamp || '',
+ nonceStr: paymentData.nonceStr || '',
+ package: paymentData.packageValue || '',
+ signType: paymentData.signType || 'MD5',
+ paySign: paymentData.paySign || '',
+ success: function success(res) {
+ uni.showToast({
+ title: '鏀粯鎴愬姛',
+ icon: 'success'
+ });
+ },
+ fail: function fail(err) {
+ if (err.errMsg.includes('cancel')) {
+ uni.showToast({
+ title: '宸插彇娑堟敮浠�',
+ icon: 'none'
+ });
+ } else {
+ uni.showToast({
+ title: '鏀粯澶辫触',
+ icon: 'none'
+ });
+ }
+ }
+ });
}
}
};
--
Gitblit v1.9.3