doum
2025-09-03 acb05239afb477efc73874fd88bdc502ce94c2b2
small-program/pages/freight/freight.vue
@@ -27,7 +27,7 @@
            <view class="list-item-row" @click="show2 = true">
               <view class="list-item-row-label">用车时间<b>*</b></view>
               <view class="list-item-row-val">
                  <text :style="{ color: form.startDate ? '#111111' : '' }">{{form.startDate ? form.startDate + ' 至 ' + form.endDate + ' (' + form.priceNum1 + '天) ' : '请选择'}}</text>
                  <text :style="{ color: form.startDate ? '#111111' : '' }">{{form.startDate ? form.startDate + ' 至 ' + form.endDate + ' (' + form.totalDays + '天) ' : '请选择'}}</text>
                  <u-icon name="arrow-right" color="#111111" size="16"></u-icon>
               </view>
            </view>
@@ -130,17 +130,24 @@
               <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">{{item.name}}</view>
               </view>
               <view class="list-item-row">
                  <view class="list-item-row-label">天数</view>
               <view class="list-item-row" v-if="form.carType==0">
                  <view class="list-item-row-label">用车天数</view>
                  <view class="list-item-row-val">
                     <input type="number" v-model="form.priceNum1" disabled placeholder="请输入" />
                     <input type="number" v-model="form.totalDays" disabled placeholder="" />
                     <text>天</text>
                  </view>
               </view>
               <view class="list-item-row" v-if="form.carType==1">
                  <view class="list-item-row-label">用车次数<b>*</b></view>
                  <view class="list-item-row-val">
                     <input type="number" v-model="form.priceNum1"   placeholder="请输入" />
                     <text>次</text>
                  </view>
               </view>
               <view class="list-item-row">
                  <view class="list-item-row-label">费用标准<b>*</b></view>
                  <view class="list-item-row-val">
                     <input type="number" @blur="getPrice" v-model="form.price" placeholder="请输入" />
                     <input type="digit" @blur="getPrice"  v-model="form.price" placeholder="请输入" />
                     <text>{{form.priceUnit}}</text>
                  </view>
               </view>
@@ -175,10 +182,10 @@
               <text>元</text>
            </view>
         </view>
         <view class="footer-bottom">
            <div class="footer-bottom-btn" @click="submit">
               <text>立即下单</text>
               <text>(服务完成后付款)</text>
         <view class="footer-bottom">
            <div class="footer-bottom-btn" @click="submit" >
               <text>{{form.id?'确认修改':'立即下单'}}</text>
               <text v-if="!form.id">(服务完成后付款)</text>
            </div>
         </view>
         <view style="width: 100%; height: env(safe-area-inset-bottom);"></view>
@@ -262,6 +269,7 @@
               categoryName: '',
               wayInfoDTOList: [],
               priceNum1: '',
               totalDays:null,
               priceNum2: 1,
               transportNum: '',
               transportTypeId: '',
@@ -285,7 +293,7 @@
            ],
            dw: [['个', '斤']],
            carArr: [],
            viewStatus: false
            viewStatus: true
         };
      },
      watch: {
@@ -307,6 +315,7 @@
            }).then(res => {
               if (res.code === 200) {
                  this.info = res.data
                  console.log(res.data.totalDays)
                  for (const key in this.form) {
                     this.form[key] = res.data[key]
                  }
@@ -328,7 +337,8 @@
            this.form.endDate = res.endDate
            this.form.lat = res.lat
            this.form.lgt = res.lgt
            this.form.priceNum1 = res.days
            this.form.totalDays = res.days
            this.form.priceNum1=res.days
            this.form.categoryId = res.categoryId
            this.form.categoryName = res.categoryName
            this.form.location = res.location
@@ -341,6 +351,13 @@
         this.getCategoryLists()
      },
      methods: {
          handleInputPrice(e) {
             try{
                this.form.price = Number(this.form.price).toFixed(3)
             }catch(e){
                this.form.price =null
             }
         },
         confirmDw(e) {
            this.form.transportUnit = e.value[0]
            this.show4 = false
@@ -368,8 +385,11 @@
            }
            if (!that.form.id) {
               uni.requestSubscribeMessage({
                  tmplIds: ['oVjOBLcHxIlGzOMJsdInmgI5CHGXh-UTvMzQqfFOnIg'],
                  tmplIds: ['oVjOBLcHxIlGzOMJsdInmgI5CHGXh-UTvMzQqfFOnIg','AA97cHjvlPiNO4viMkVe4JifCf9TD5b5Eb7s6El3VS8'],
                  success(res) {
                     if(that.form.carType == 0){
                        that.form.priceNum1 = that.form.totalDays
                     }
                     that.$u.api.release({
                        ...that.form,
                        price: Number(that.form.price) * 100,
@@ -396,9 +416,9 @@
                  }
               })
            } else {
               uni.requestSubscribeMessage({
                  tmplIds: ['3YSC7gouRlSjHXz4CrWOGFzPmGwEBtFj4snwdfMvKHk'],
                  success(res) {
               // uni.requestSubscribeMessage({
                  // tmplIds: ['3YSC7gouRlSjHXz4CrWOGFzPmGwEBtFj4snwdfMvKHk','AA97cHjvlPiNO4viMkVe4JifCf9TD5b5Eb7s6El3VS8'],
                  // success(res) {
                     that.$u.api.updateOrder({
                        ...that.form,
                        price: Number(that.form.price) * 100,
@@ -429,8 +449,8 @@
                           }, 1500)
                        }
                     })
                  }
               })
               //    }
               // })
            }
         },
         uploadImg() {
@@ -463,7 +483,7 @@
         getPrice() {
            if (this.form.price && this.form.priceNum1 && this.form.priceNum2) {
               this.$u.api.getTotal({
                  price: Number(this.form.price) * 100,
                  price: Number(this.form.price).toFixed(2) * 100,
                  priceUnit: this.form.priceUnit,
                  priceNum1: this.form.priceNum1,
                  priceNum2: this.form.priceNum2,
@@ -516,7 +536,7 @@
            this.form.startDate = e[0]
            this.form.endDate = e[e.length - 1]
            let time = this.form.startDate == this.form.endDate ? 1 : 0
            this.form.priceNum1 = e.length - time;
            this.form.totalDays = e.length - time;
            this.show2 = false
         },
         addAddr() {
@@ -532,15 +552,15 @@
                  if ([2].includes(type)) {
                     this.form.latitude = res.latitude
                     this.form.longitude = res.longitude
                     this.form.address = res.address
                     this.form.address = res.name || res.address
                  } else if (type === 3) {
                     this.form.locationEnd = res.address
                     this.form.locationEnd = res.name || 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
                  } else if (type === 4) {
                     this.form.wayInfoDTOList[index].lat = res.latitude
                     this.form.wayInfoDTOList[index].lgt = res.longitude
                     this.form.wayInfoDTOList[index].location = res.name || res.address
                  }
               }
            });
@@ -943,13 +963,14 @@
                  }
               }
               .list-item-row-val {
                  width: 100%;
                  // width: 100%;
                  padding: 30rpx 0;
                  box-sizing: border-box;
                  display: flex;
                  align-items: center;
                  justify-content: space-between;
                  text {
                     // width: 80%;
                     flex-shrink: 0;
                     font-weight: 400;
                     font-size: 30rpx;