MrShi
2025-07-19 9b1a32a3df7d54d19373551a3df34970d1a6a34f
small-program/pages/using-workers/using-workers.vue
@@ -56,7 +56,7 @@
               <view class="list-item-row-label">图片</view>
               <view class="list-item-row-upload">
                  <view class="upload-item" v-for="(item, index) in form.multifileList" :key="index">
                     <image :src="item.url" mode="widthFix"></image>
                     <image :src="item.url || item.fileurlFull" mode="widthFix"></image>
                     <image class="upload-item-dele" @click="form.multifileList.splice(index, 1)" src="/static/icon/ic_delete1@2x.png" mode="widthFix"></image>
                  </view>
                  <view class="upload-item" @click="uploadImg">
@@ -155,6 +155,7 @@
            show: false,
            show1: false,
            form: {
               id: null,
               days: '',
               startDate: '',
               endDate: '',
@@ -175,19 +176,34 @@
               estimatedAccount: '',
               type: 0
            },
            modify: false,
            cateList: [],
            viewStatus: false
         };
      },
      onLoad(option) {
         this.form.linkPhone = this.userInfo.telephone
         this.form.days = option.days
         this.form.startDate = option.startDate
         this.form.endDate = option.endDate
         this.form.lat = option.latitude
         this.form.lgt = option.longitude
         this.form.location = option.address
         this.form.workType = option.workType
         // 编辑
         if (option.id) {
            this.form.id = option.id
            this.$u.api.getDetail({
               orderId: option.id
            }).then(res => {
               for (const key in this.form) {
                  this.form[key] = res.data[key]
               }
               this.form.days = res.data.totalDays
               this.form.price = Number(this.form.price) / 100
            })
         } else {
            this.form.linkPhone = this.userInfo.telephone
            this.form.days = option.days
            this.form.startDate = option.startDate
            this.form.endDate = option.endDate
            this.form.lat = option.latitude
            this.form.lgt = option.longitude
            this.form.location = option.address
            this.form.workType = option.workType
         }
         this.getCateList()
      },
      methods: {
@@ -205,14 +221,33 @@
            if (!this.form.linkPhone) {
               return uni.showToast({ title: '请输入联系电话', icon: 'none' })
            }
            this.$u.api.release({ ...this.form, price: Number(this.form.price) * 100 })
               .then(res => {
                  if (res.code == 200) {
                     uni.navigateTo({
                        url: `/pages/success/success?orderId=${res.data.id}`
                     })
                  }
               })
            if (!this.form.id) {
               this.$u.api.release({ ...this.form, price: Number(this.form.price) * 100 })
                  .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  })
                  .then(res => {
                     if (res.code == 200) {
                        uni.showToast({
                           title: '编辑成功',
                           icon: 'success',
                           mask: true,
                           duration: 2000
                        })
                        setTimeout(() => {
                           uni.navigateBack({ delta: 1 });
                           uni.$emit('refresh')
                        }, 1500)
                     }
                  })
            }
         },
         // 计算金额
         getPrice() {
@@ -225,6 +260,7 @@
                  type: this.form.type,
                  workType: this.form.workType
               }).then(res => {
                  this.modify = true
                  this.form.estimatedAccount = res.data
               })
            }