From de1ef43c565e1666484d7d71203afd7526f4e3de Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期五, 18 七月 2025 08:53:43 +0800
Subject: [PATCH] 用工运货接口对接

---
 small-program/unpackage/dist/dev/mp-weixin/pages/index/index.js |  171 +++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 124 insertions(+), 47 deletions(-)

diff --git a/small-program/unpackage/dist/dev/mp-weixin/pages/index/index.js b/small-program/unpackage/dist/dev/mp-weixin/pages/index/index.js
index 59313f9..b6deed2 100644
--- a/small-program/unpackage/dist/dev/mp-weixin/pages/index/index.js
+++ b/small-program/unpackage/dist/dev/mp-weixin/pages/index/index.js
@@ -103,13 +103,13 @@
 try {
   components = {
     sunuiMverify: function () {
-      return __webpack_require__.e(/*! import() | components/sunui-mverify/sunui-mverify */ "components/sunui-mverify/sunui-mverify").then(__webpack_require__.bind(null, /*! @/components/sunui-mverify/sunui-mverify.vue */ 372))
+      return __webpack_require__.e(/*! import() | components/sunui-mverify/sunui-mverify */ "components/sunui-mverify/sunui-mverify").then(__webpack_require__.bind(null, /*! @/components/sunui-mverify/sunui-mverify.vue */ 380))
     },
     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 */ 379))
+      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 */ 387))
     },
     uCalendar: function () {
-      return Promise.all(/*! import() | node-modules/uview-ui/components/u-calendar/u-calendar */[__webpack_require__.e("common/vendor"), __webpack_require__.e("node-modules/uview-ui/components/u-calendar/u-calendar")]).then(__webpack_require__.bind(null, /*! uview-ui/components/u-calendar/u-calendar.vue */ 542))
+      return Promise.all(/*! import() | node-modules/uview-ui/components/u-calendar/u-calendar */[__webpack_require__.e("common/vendor"), __webpack_require__.e("node-modules/uview-ui/components/u-calendar/u-calendar")]).then(__webpack_require__.bind(null, /*! uview-ui/components/u-calendar/u-calendar.vue */ 396))
     },
   }
 } catch (e) {
@@ -138,6 +138,17 @@
       _vm.show = true
     }
     _vm.e1 = function ($event) {
+      _vm.show = true
+    }
+    _vm.e2 = function ($event, index) {
+      var _temp = arguments[arguments.length - 1].currentTarget.dataset,
+        _temp2 = _temp.eventParams || _temp["event-params"],
+        index = _temp2.index
+      var _temp, _temp2
+      $event.stopPropagation()
+      return _vm.form.wayInfoDTOList.splice(index, 1)
+    }
+    _vm.e3 = function ($event) {
       _vm.show = false
     }
   }
@@ -187,7 +198,7 @@
 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 sunuiMverify = function sunuiMverify() {
   __webpack_require__.e(/*! require.ensure | components/sunui-mverify/sunui-mverify */ "components/sunui-mverify/sunui-mverify").then((function () {
-    return resolve(__webpack_require__(/*! @/components/sunui-mverify/sunui-mverify.vue */ 372));
+    return resolve(__webpack_require__(/*! @/components/sunui-mverify/sunui-mverify.vue */ 380));
   }).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
 };
 var _default = {
@@ -209,7 +220,6 @@
       show: false,
       isLogin: false,
       typeId: 0,
-      carId: 1,
       type: [{
         name: '鐢ㄥ伐',
         id: 0
@@ -230,50 +240,62 @@
         name: '鍖呰宸�',
         id: 2
       }],
-      car: [{
-        name: '涓夎疆杞�',
-        id: 1
-      }, {
-        name: '灏忚揣杞�',
-        id: 2
-      }],
+      car: [],
       btn: __webpack_require__(/*! @/static/image/btn.png */ 169),
       typeViewId: 0,
+      carImage: '',
+      carRemark: '',
       form: {
         startDate: '',
         endDate: '',
         latitude: '',
         longitude: '',
-        address: '',
+        location: '',
+        locationEnd: '',
+        wayInfoDTOList: [],
         workType: 0,
+        categoryId: '',
+        categoryName: '',
         days: ''
       }
     };
   },
+  onLoad: function onLoad() {
+    this.getCategoryLists();
+  },
   methods: {
+    addAddr: function addAddr() {
+      this.form.wayInfoDTOList.push({
+        lat: '',
+        lgt: '',
+        location: ''
+      });
+    },
     confirmDate: function confirmDate(e) {
       this.form.startDate = e[0];
       this.form.endDate = e[e.length - 1];
       this.form.days = e.length;
       this.show = false;
     },
-    selectAddress: function selectAddress(type) {
+    selectAddress: function selectAddress(type, index) {
       var _this = this;
       uni.chooseLocation({
         success: function success(res) {
-          if (type === 1) {
+          if ([1, 2].includes(type)) {
             _this.form.latitude = res.latitude;
             _this.form.longitude = res.longitude;
             _this.form.address = res.address;
+          } else if (type === 3) {
+            _this.form.locationEnd = res.address;
+            _this.form.latEnd = res.latitude;
+            _this.form.lgtEnd = res.longitude;
+          } else if (type === 4) {
+            _this.form.wayInfoDTOList[0].lat = res.latitude;
+            _this.form.wayInfoDTOList[0].lgt = res.longitude;
+            _this.form.wayInfoDTOList[0].location = res.address;
           }
         }
       });
-      // uni.getLocation({
-      // 	type: 'gcj02',
-      // 	success: function (res) {
-      // 		console.log(res)
-      // 	}
-      // });
     },
     clickType: function clickType(e) {
       this.typeId = e;
@@ -281,8 +303,11 @@
     clickTypeWork: function clickTypeWork(e) {
       this.form.workType = e;
     },
-    clickCar: function clickCar(e) {
-      this.carId = e;
+    clickCar: function clickCar(item) {
+      this.form.categoryId = item.id;
+      this.form.categoryName = item.name;
+      this.carImage = item.iconFull;
+      this.carRemark = item.remark;
     },
     jump: function jump() {
       if (!this.userInfo || !this.token) {
@@ -292,37 +317,89 @@
         return;
       }
       var form = this.form;
-      if (!form.startDate || !form.endDate) {
-        return uni.showToast({
-          title: '璇烽�夋嫨鐢ㄥ伐鏃堕棿',
-          icon: 'none'
-        });
-      } else if (!form.latitude || !form.longitude) {
-        return uni.showToast({
-          title: '璇烽�夋嫨鐢ㄥ伐鍦扮偣',
-          icon: 'none'
-        });
-      }
 
-      // 閲囨憳宸�
-      if (this.form.workType === 0) {
+      // 鐢ㄥ伐
+      if (this.typeId === 0) {
+        if (!form.startDate || !form.endDate) {
+          return uni.showToast({
+            title: '璇烽�夋嫨鐢ㄥ伐鏃堕棿',
+            icon: 'none'
+          });
+        } else if (!form.latitude || !form.longitude) {
+          return uni.showToast({
+            title: '璇烽�夋嫨鐢ㄥ伐鍦扮偣',
+            icon: 'none'
+          });
+        }
+
+        // 閲囨憳宸�
+        if (this.form.workType === 0) {
+          uni.navigateTo({
+            url: "/pages/using-workers/using-workers?days=".concat(form.days, "&startDate=").concat(form.startDate, "&endDate=").concat(form.endDate, "&latitude=").concat(form.latitude, "&longitude=").concat(form.longitude, "&address=").concat(form.location, "&workType=").concat(form.workType)
+          });
+          // 鍒嗘嫞宸�
+        } else if (this.form.workType === 1) {
+          uni.navigateTo({
+            url: "/pages/sorting/sorting?days=".concat(form.days, "&startDate=").concat(form.startDate, "&endDate=").concat(form.endDate, "&latitude=").concat(form.latitude, "&longitude=").concat(form.longitude, "&address=").concat(form.location, "&workType=").concat(form.workType)
+          });
+          // 鍖呰宸�
+        } else if (this.form.workType === 2) {
+          uni.navigateTo({
+            url: "/pages/packaging-worker/packaging-worker?days=".concat(form.days, "&startDate=").concat(form.startDate, "&endDate=").concat(form.endDate, "&latitude=").concat(form.latitude, "&longitude=").concat(form.longitude, "&address=").concat(form.location, "&workType=").concat(form.workType)
+          });
+        }
+        // 杩愯揣
+      } else if (this.typeId === 1) {
+        if (!form.startDate || !form.endDate) {
+          return uni.showToast({
+            title: '璇烽�夋嫨鐢ㄨ溅鏃堕棿',
+            icon: 'none'
+          });
+        } else if (!form.latitude || !form.longitude) {
+          return uni.showToast({
+            title: '璇烽�夋嫨鐢ㄨ溅璧风偣',
+            icon: 'none'
+          });
+        } else if (!form.latEnd || !form.lgtEnd) {
+          return uni.showToast({
+            title: '璇烽�夋嫨鐢ㄨ溅缁堢偣',
+            icon: 'none'
+          });
+        }
+        var carData = {
+          startDate: form.startDate,
+          endDate: form.endDate,
+          lat: form.latitude,
+          lgt: form.longitude,
+          location: form.address,
+          latEnd: form.latEnd,
+          lgtEnd: form.lgtEnd,
+          locationEnd: form.locationEnd,
+          wayInfoDTOList: form.wayInfoDTOList,
+          categoryId: form.categoryId,
+          categoryName: form.categoryName,
+          days: form.days
+        };
+        uni.setStorageSync('carData', carData);
         uni.navigateTo({
-          url: "/pages/using-workers/using-workers?days=".concat(form.days, "&startDate=").concat(form.startDate, "&endDate=").concat(form.endDate, "&latitude=").concat(form.latitude, "&longitude=").concat(form.longitude, "&address=").concat(form.address, "&workType=").concat(form.workType)
-        });
-        // 鍒嗘嫞宸�
-      } else if (this.form.workType === 1) {
-        uni.navigateTo({
-          url: "/pages/sorting/sorting?days=".concat(form.days, "&startDate=").concat(form.startDate, "&endDate=").concat(form.endDate, "&latitude=").concat(form.latitude, "&longitude=").concat(form.longitude, "&address=").concat(form.address, "&workType=").concat(form.workType)
-        });
-        // 鍖呰宸�
-      } else if (this.form.workType === 2) {
-        uni.navigateTo({
-          url: "/pages/packaging-worker/packaging-worker?days=".concat(form.days, "&startDate=").concat(form.startDate, "&endDate=").concat(form.endDate, "&latitude=").concat(form.latitude, "&longitude=").concat(form.longitude, "&address=").concat(form.address, "&workType=").concat(form.workType)
+          url: "/pages/freight/freight"
         });
       }
     },
     mverify: function mverify(e) {
       console.log('楠岃瘉缁撴灉:', e);
+    },
+    getCategoryLists: function getCategoryLists() {
+      var _this2 = this;
+      this.$u.api.getCategoryList({
+        type: 1
+      }).then(function (res) {
+        _this2.car = res.data;
+        _this2.form.categoryId = res.data[0].id;
+        _this2.form.categoryName = res.data[0].name;
+        _this2.carRemark = res.data[0].remark;
+        _this2.carImage = res.data[0].iconFull;
+      });
     }
   }
 };

--
Gitblit v1.9.3