doum
2025-08-22 391c0cfc4ba595ef26c7a2315c555d8c75afec7d
small-program/pages/freight/freight.vue
@@ -92,8 +92,10 @@
                  <view class="list-item-row-label">运输重量/数量<b>*</b></view>
                  <view class="list-item-row-val">
                     <input type="text" v-model="form.transportNum" placeholder="请输入" />
                     <text @click="show4 = true">{{form.transportUnit}}</text>
                     <u-icon name="arrow-down" color="#111111" size="16"></u-icon>
                     <view @click="show4 = true" style="width: 100%; flex-shrink: 0; display: flex; align-items: center; justify-content: flex-end;">
                        <text>{{form.transportUnit}}</text>
                        <u-icon name="arrow-down" color="#111111" size="16"></u-icon>
                     </view>
                  </view>
               </view>
               <view class="list-item-row" v-if="viewStatus">
@@ -126,7 +128,7 @@
                  <text>费用</text>
               </view>
               <view class="list-item-cate">
                  <view :class="item.id === form.carType ? 'list-item-cate-item active' : 'list-item-cate-item'" v-for="(item, index) in ff" :key="index" @click="form.carType = item.id">按天付费</view>
                  <view :class="item.id === form.carType ? 'list-item-cate-item active' : 'list-item-cate-item'" v-for="(item, index) in ff" :key="index" @click="form.carType = item.id">{{item.name}}</view>
               </view>
               <view class="list-item-row">
                  <view class="list-item-row-label">天数</view>
@@ -342,6 +344,9 @@
         },
         // 提交订单
         submit() {
            if (!this.form.carUnit) {
               return uni.showToast({ title: '请选择货车型号', icon: 'none' })
            }
            if (!this.form.transportTypeName) {
               return uni.showToast({ title: '请选择运输品种', icon: 'none' })
            }
@@ -357,52 +362,87 @@
            if (!this.form.linkPhone) {
               return uni.showToast({ title: '请输入联系电话', icon: 'none' })
            }
            this.$u.api.release({
               ...this.form,
               price: Number(this.form.price) * 100,
               wayInfoDTOList: [
                  {
                     lat: this.form.lat,
                     lgt: this.form.lgt,
                     location: this.form.location
                  },
                  ...this.form.wayInfoDTOList,
                  {
                     lat: this.form.latEnd,
                     lgt: this.form.lgtEnd,
                     location: this.form.locationEnd
            if (!this.form.id) {
               this.$u.api.release({
                  ...this.form,
                  price: Number(this.form.price) * 100,
                  wayInfoDTOList: [
                     {
                        lat: this.form.lat,
                        lgt: this.form.lgt,
                        location: this.form.location
                     },
                     ...this.form.wayInfoDTOList,
                     {
                        lat: this.form.latEnd,
                        lgt: this.form.lgtEnd,
                        location: this.form.locationEnd
                     }
                  ]
               }).then(res => {
                  if (res.code == 200) {
                     uni.navigateTo({
                        url: `/pages/success/success?orderId=${res.data.id}`
                     })
                  }
               ]
            }).then(res => {
               if (res.code == 200) {
                  uni.navigateTo({
                     url: `/pages/success/success?orderId=${res.data.id}`
                  })
               }
            })
               })
            } else {
               this.$u.api.updateOrder({
                  ...this.form,
                  price: Number(this.form.price) * 100,
                  wayInfoDTOList: [
                     {
                        lat: this.form.lat,
                        lgt: this.form.lgt,
                        location: this.form.location
                     },
                     ...this.form.wayInfoDTOList,
                     {
                        lat: this.form.latEnd,
                        lgt: this.form.lgtEnd,
                        location: this.form.locationEnd
                     }
                  ]
               }).then(res => {
                  if (res.code == 200) {
                     uni.showToast({
                        title: '编辑成功',
                        icon: 'success',
                        mask: true,
                        duration: 2000
                     })
                     setTimeout(() => {
                        uni.navigateBack({ delta: 1 });
                        // uni.$emit('refresh')
                     }, 1500)
                  }
               })
            }
         },
         uploadImg() {
            var that = this;
            uni.chooseImage({
               success: (chooseImageRes) => {
                  const tempFilePaths = chooseImageRes.tempFilePaths;
                  uni.uploadFile({
                     url: this.$baseUrl + '/web/public/upload',
                     filePath: tempFilePaths[0],
                     name: 'file',
                     formData: {
                        'folder': 'orders'
                     },
                     success: (uploadFileRes) => {
                        const res = JSON.parse(uploadFileRes.data)
                        that.form.multifileList.push({
                           fileurl: res.data.imgaddr,
                           name: res.data.originname,
                           url: res.data.url,
                           type: 0
                        })
                     }
                  });
                  for (let i = 0; i < chooseImageRes.tempFilePaths.length; i++) {
                     uni.uploadFile({
                        url: this.$baseUrl + '/web/public/upload',
                        filePath: chooseImageRes.tempFilePaths[i],
                        name: 'file',
                        formData: {
                           'folder': 'orders'
                        },
                        success: (uploadFileRes) => {
                           const res = JSON.parse(uploadFileRes.data)
                           that.form.multifileList.push({
                              fileurl: res.data.imgaddr,
                              name: res.data.originname,
                              url: res.data.url,
                              type: 0
                           })
                        }
                     });
                  }
               }
            });
         },