jiangping
2025-07-18 14c69fe80e4fa6c73dfdf4ed51973396305d27d4
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) {
@@ -137,7 +137,31 @@
    _vm.e0 = function ($event) {
      _vm.show = true
    }
    _vm.e1 = function ($event) {
    _vm.e1 = function ($event, index) {
      var _temp = arguments[arguments.length - 1].currentTarget.dataset,
        _temp2 = _temp.eventParams || _temp["event-params"],
        index = _temp2.index
      var _temp, _temp2
      return _vm.form.multifileList.splice(index, 1)
    }
    _vm.e2 = function ($event) {
      _vm.viewStatus = !_vm.viewStatus
    }
    _vm.e3 = function ($event) {
      _vm.show = true
    }
    _vm.e4 = function ($event) {
      _vm.show = true
    }
    _vm.e5 = function ($event, index) {
      var _temp3 = arguments[arguments.length - 1].currentTarget.dataset,
        _temp4 = _temp3.eventParams || _temp3["event-params"],
        index = _temp4.index
      var _temp3, _temp4
      $event.stopPropagation()
      return _vm.form.wayInfoDTOList.splice(index, 1)
    }
    _vm.e6 = function ($event) {
      _vm.show = false
    }
  }
@@ -174,27 +198,32 @@
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(uni) {
/* WEBPACK VAR INJECTION */(function(uni, wx) {
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
var _vuex = __webpack_require__(/*! vuex */ 33);
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 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 = {
  components: {
    sunuiMverify: sunuiMverify
  },
  computed: _objectSpread({}, (0, _vuex.mapState)(['navHeight', 'statusbarHeight', 'userInfo', 'token', 'openid'])),
  computed: _objectSpread(_objectSpread({}, (0, _vuex.mapState)(['navHeight', 'statusbarHeight', 'userInfo', 'token', 'openid'])), {}, {
    totalPrice: function totalPrice() {
      return this.form.estimatedAccount / 100;
    }
  }),
  onShow: function onShow(options) {
    this.typeViewId = 0;
    if (this.token && this.token != '' && this.userInfo && JSON.stringify(this.userInfo) != '{}') {
@@ -209,8 +238,20 @@
      show: false,
      isLogin: false,
      typeId: 0,
      carId: 1,
      type: [{
        name: '用工',
        id: 0
      }, {
        name: '运货',
        id: 1
      }, {
        name: '订餐',
        id: 2
      }],
      searchType: [{
        name: '全部',
        id: ''
      }, {
        name: '用工',
        id: 0
      }, {
@@ -230,50 +271,276 @@
        name: '包装工',
        id: 2
      }],
      car: [{
        name: '三轮车',
        id: 1
      }, {
        name: '小货车',
        id: 2
      }],
      car: [],
      btn: __webpack_require__(/*! @/static/image/btn.png */ 169),
      typeViewId: 0,
      carImage: '',
      carRemark: '',
      orderFood: [],
      viewStatus: false,
      form: {
        startDate: '',
        endDate: '',
        latitude: '',
        longitude: '',
        address: '',
        location: '',
        locationEnd: '',
        wayInfoDTOList: [],
        workType: 0,
        days: ''
      }
        categoryId: '',
        categoryName: '',
        days: '',
        locationRemark: '',
        supplement: '',
        multifileList: [],
        linkName: '',
        linkPhone: '',
        estimatedAccount: '',
        price: ''
      },
      orderList: [],
      typeVal: '',
      page: 1
    };
  },
  onLoad: function onLoad() {
    this.getCategoryLists();
    this.getOrderList();
    this.form.linkPhone = this.userInfo.telephone;
  },
  watch: {
    typeId: {
      handler: function handler(news, old) {
        this.form = {
          startDate: '',
          endDate: '',
          latitude: '',
          longitude: '',
          location: '',
          locationEnd: '',
          wayInfoDTOList: [],
          workType: 0,
          categoryId: '',
          categoryName: '',
          days: '',
          locationRemark: '',
          supplement: '',
          multifileList: [],
          linkName: '',
          linkPhone: '',
          estimatedAccount: '',
          price: ''
        };
        this.viewStatus = false;
        this.carImage = '';
        this.carRemark = '';
      }
    },
    orderFood: {
      deep: true,
      handler: function handler(news, old) {
        var price = 0;
        news.forEach(function (item) {
          var num = 0;
          item.list.forEach(function (child) {
            if (child.active) {
              num = Number(child.price);
            }
          });
          if (item.num && num > 0) {
            price += num * item.num;
          }
        });
        this.form.price = price;
      }
    },
    'form.price': {
      handler: function handler(news, old) {
        if (news > 0) {
          this.getPrice();
        }
      }
    }
  },
  methods: {
    clickCate: function clickCate(id) {
      this.typeVal = id;
      this.page = 1;
      this.list = [];
      this.getOrderList();
    },
    // 订单分页
    getOrderList: function getOrderList() {
      var _this = this;
      this.$u.api.orderPage({
        capacity: 10,
        page: this.page,
        model: {
          queryMyOrderType: 2,
          type: this.typeVal
        }
      }).then(function (res) {
        res.data.records.forEach(function (item) {
          // 订餐单
          if (item.type === 2) {
            item.wayInfoCopy = JSON.parse(item.wayInfo).map(function (item) {
              return "".concat(item.name).concat(item.price / 100, "\u5143(").concat(item.num, "\u4EFD)");
            }).join(' | ');
          }
        });
        console.log(res.data.records);
        _this.orderList = [].concat((0, _toConsumableArray2.default)(_this.orderList), (0, _toConsumableArray2.default)(res.data.records));
      });
    },
    // 提交订单
    submit: function submit() {
      if (!this.form.startDate) {
        return uni.showToast({
          title: '请选择用餐时间',
          icon: 'none'
        });
      }
      if (this.form.price === 0) {
        return uni.showToast({
          title: '请选择用餐时间',
          icon: 'none'
        });
      }
      if (!this.form.address) {
        return uni.showToast({
          title: '请选择用餐地点',
          icon: 'none'
        });
      }
      if (!this.form.linkPhone) {
        return uni.showToast({
          title: '请输入联系电话',
          icon: 'none'
        });
      }
      var cateringDTOList = [];
      this.orderFood.forEach(function (item) {
        item.list.forEach(function (child) {
          if (child.active) {
            cateringDTOList.push({
              name: item.name,
              num: item.num,
              price: Number(child.price) * Number(item.num) * 100
            });
          }
        });
      });
      this.$u.api.release(_objectSpread(_objectSpread({}, this.form), {}, {
        type: 2,
        price: Number(this.form.price) * 100,
        priceNum1: this.form.days,
        location: this.form.address,
        lat: this.form.latitude,
        lgt: this.form.longitude,
        cateringDTOList: cateringDTOList
      })).then(function (res) {
        if (res.code == 200) {
          wx.requestPayment({
            timeStamp: res.data.object.timeStamp,
            nonceStr: res.data.object.nonceStr,
            package: res.data.object.packageVal,
            signType: res.data.object.signType,
            paySign: res.data.object.paySign,
            success: function success(res1) {
              if (res1.errMsg = 'requestPayment:ok') {
                uni.showToast({
                  title: '支付成功',
                  icon: 'success',
                  duration: 2000
                });
                setTimeout(function () {
                  uni.navigateTo({
                    url: "/pages/success/success?orderId=".concat(res.data.id)
                  });
                }, 1500);
              }
            },
            fail: function fail(err) {
              console.log(err);
            }
          });
        }
      });
      console.log(cateringDTOList);
    },
    uploadImg: function uploadImg() {
      var _this2 = this;
      uni.chooseImage({
        success: function success(chooseImageRes) {
          var tempFilePaths = chooseImageRes.tempFilePaths;
          uni.uploadFile({
            url: _this2.$baseUrl + '/web/public/upload',
            filePath: tempFilePaths[0],
            name: 'file',
            formData: {
              'folder': 'orders'
            },
            success: function success(uploadFileRes) {
              var res = JSON.parse(uploadFileRes.data);
              _this2.form.multifileList.push({
                fileurl: res.data.imgaddr,
                name: res.data.originname,
                url: res.data.url,
                type: 0
              });
            }
          });
        }
      });
    },
    // 计算金额
    getPrice: function getPrice() {
      var that = this;
      if (that.form.price && that.form.days) {
        that.$u.api.getTotal({
          price: Number(that.form.price) * 100,
          priceNum1: that.form.days,
          type: 2
        }).then(function (res) {
          that.form.estimatedAccount = res.data;
        });
      }
    },
    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;
      if (this.typeId === 2) {
        this.getPrice();
      }
    },
    selectAddress: function selectAddress(type) {
      var _this = this;
    selectAddress: function selectAddress(type, index) {
      var _this3 = this;
      uni.chooseLocation({
        success: function success(res) {
          if (type === 1) {
            _this.form.latitude = res.latitude;
            _this.form.longitude = res.longitude;
            _this.form.address = res.address;
          if ([1, 2].includes(type)) {
            _this3.form.latitude = res.latitude;
            _this3.form.longitude = res.longitude;
            _this3.form.address = res.address;
          } else if (type === 3) {
            _this3.form.locationEnd = res.address;
            _this3.form.latEnd = res.latitude;
            _this3.form.lgtEnd = res.longitude;
          } else if (type === 4) {
            _this3.form.wayInfoDTOList[0].lat = res.latitude;
            _this3.form.wayInfoDTOList[0].lgt = res.longitude;
            _this3.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 +548,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,42 +562,118 @@
        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);
    mverify: function mverify(e, id) {
      console.log('验证结果:', e, id);
    },
    // 选择套餐
    selectMenu: function selectMenu(a, b) {
      this.orderFood.forEach(function (item, index) {
        if (index === a) {
          item.list.forEach(function (child, childIndex) {
            child.active = b === childIndex;
          });
        }
      });
    },
    getCategoryLists: function getCategoryLists() {
      var _this4 = this;
      this.$u.api.getCategoryList({
        type: 1
      }).then(function (res) {
        _this4.car = res.data;
        _this4.form.categoryId = res.data[0].id;
        _this4.form.categoryName = res.data[0].name;
        _this4.carRemark = res.data[0].remark;
        _this4.carImage = res.data[0].iconFull;
      });
      this.$u.api.getCategoryList({
        type: 2
      }).then(function (res) {
        res.data.forEach(function (item) {
          item.num = '';
          item.list = item.detailList.map(function (child) {
            return {
              active: false,
              price: child
            };
          });
        });
        _this4.orderFood = res.data;
      });
    }
  }
};
exports.default = _default;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
/***/ }),