-
zhangwei
2026-04-07 b7ae3f69ae6706a692284d2f12835d213debfb1a
src/pages/order/detail.vue
@@ -1,7 +1,7 @@
<template>
   <view class="">
      <scroll-view enable-flex="true">
         <view class="list chuany-flex chuany-flex-direction chuany-align-center c-p-b-30">
         <view class="list chuany-flex chuany-flex-direction chuany-align-center c-p-b-30" @click='toEdit'>
            <view class="content c-p-b-18">
               <view
                  class="bgblue c-p-l-18 c-p-r-18 c-p-b-10 c-p-t-10 chuany-flex chuany-justify-between chuany-font30">
@@ -43,19 +43,26 @@
               <view class='chuany-flex chuany-justify-between c-p-l-18 c-p-r-18 c-p-t-6 chuany-align-center'>
                  <view class="redcla">
                     <text class="chuany-font40">
                        {{detailItem.workPrice}}
                        {{detailItem.workPrice}}<template
                           v-if="detailItem.workPriceMax">~{{detailItem.workPriceMax}}</template>
                     </text>
                     <text class='chuany-font20'>
                        {{detailItem.workerType==0?'元/小时':'元/件'}}
                     </text>
                     <!-- <text class="chuany-font40">
                        {{detailItem.workPrice}}
                     </text>
                     <text class='chuany-font20'>
                        {{detailItem.workerType==0?'元/小时':'元/件'}}
                     </text> -->
                  </view>
                  <view class="">
                  <view class="" @click.stop="manageOrder(detailItem)">
                     <!-- <up-tag class='c-m-r-10' text="下架" shape="circle" type="error" size='mini'
                     v-if="detailItem.orderStatus==0" @click.stop="deleteOrder(detailItem)"></up-tag> -->
                     <up-button class='c-m-r-10' :text="detailItem.isEn?'下架':'上架'" shape="circle"
                        :loading='isLoading' :loadingText="detailItem.isEn?'下架中':'上架中'"
                        v-if="detailItem.orderStatus==0" :type="detailItem.isEn?'error':'primary'" size='mini'
                        @click.stop="manageOrder(detailItem)"></up-button>
                        v-if="detailItem.orderStatus==0" :type="detailItem.isEn?'error':'primary'"
                        size='mini'></up-button>
                     <!-- <up-tag text="去抢活" type="warning" shape="circle"></up-tag> -->
                     <!-- <up-tag text="去抢活" type="warning" shape="circle"></up-tag> -->
                  </view>
@@ -76,16 +83,21 @@
                     </template> -->
                     <template #right-icon v-if="!item.isSelected" class="chuany-flex">
                        <up-tag class="button-layout__item" text="录用" size="mini" type="success"
                           @click="selectBtn(item,true)"></up-tag>
                           @click="selectBtnGuding(item,true)"></up-tag>
                        <up-tag class="button-layout__item c-m-l-18" text="拒绝" size="mini" type="error"
                           @click="selectBtn(item,false)"></up-tag>
                     </template>
                     <template #right-icon v-else class="chuany-flex">
                        <template class="" v-if="item.workPrice&&!item.showEdit">
                           <up-text type="error"
                              :text="item.workerType==0?`${item.workPrice}元/小时`:`${item.workPrice}元/件` "
                              :text="detailItem.workerType==0?`${item.workPrice}元/小时`:`${item.workPrice}元/件` "
                              size='14'></up-text>
                           <up-icon name="star-fill" color="#fece01" @click='collectWorker(item)' v-if="item.isCollect"></up-icon>
                           <up-icon name="star" @click='collectWorker(item)' v-else></up-icon>
                           <up-icon name="lock-fill" color="#fece01" @click='linghuoWorker(item)' v-if="item.isGuding"></up-icon>
                           <up-icon name="lock" @click='linghuoWorker(item)' v-else></up-icon>
                           <up-icon name="edit-pen" @click='isShow(item)'></up-icon>
                           <up-icon name="trash" @click='deleteWorker(item)'></up-icon>
                        </template>
                        <up-input v-model="item.workPrice" border="none" v-else type="digit">
                           <template #suffix>
@@ -142,8 +154,11 @@
            </up-list>
         </view>
      </scroll-view>
      <up-modal :show="modalShow" :asyncClose="true" showCancelButton closeOnClickOverlay :content="content"
         @confirm="modalConfirm" @cancel="modalCancel">
      <up-modal :show="modalShowGuding" :asyncClose="true" showCancelButton :closeOnClickOverlay="true" :content="content" confirmText='是' cancelText='否'
         @confirm="modalConfirm" @cancel="modalCancelGuding" @close='modalShowGuding=false'>
         </up-modal>
      <up-modal :show="modalShow" :asyncClose="true" showCancelButton :closeOnClickOverlay="true" :content="content"
         @confirm="modalConfirm" @cancel="modalCancel" @close='modalShow=false'>
      </up-modal>
   </view>
</template>
@@ -175,17 +190,106 @@
      let {
         orderid
      } = option
      getOrder(orderid)
      orderIdVal = orderid
      console.log(option, '========orderid', orderid);
      // detailItem.value = JSON.parse($db.get('detailItem'))
   })
   onShow(() => {
      getOrder(orderIdVal)
   })
   const click = () => {
   }
   const isShow = (item) => {
      item.showEdit = true
   }
   const linghuoWorker= (item)=>{
      uni.showModal({
         title: '提示',
         content: `${item.isGuding?'取消':'添加'}${item.workerName}灵活用工?`,
         success: function(res) {
            if (res.confirm) {
               // 执行确认后的操作
               isLoading.value = true
               $api.GudingGongren({
                  orderBiddingId: item.id,
                  isGuding:!item.isGuding
               }).then(req => {
                  if (req.code == 1) {
                     $util.showToast({
                        title: `${item.isGuding?'取消':'添加'}成功!`
                     })
                     getOrder(orderIdVal)
                  } else {
                     $util.showToast({
                        title: req.error
                     })
                  }
                  isLoading.value = false
               })
            } else {
               // 执行取消后的操作
            }
         }
      })
   }
   const collectWorker = (item)=>{
      uni.showModal({
         title: '提示',
         content: `确认${item.isCollect?'取消':''}收藏${item.workerName}?`,
         success: function(res) {
            if (res.confirm) {
               // 执行确认后的操作
               isLoading.value = true
               $api.collectWorker({
                  orderBiddingId: item.id,
                  isCollect:!item.isCollect
               }).then(req => {
                  if (req.code == 1) {
                     $util.showToast({
                        title: `${item.isCollect?'取消':''}收藏成功!`
                     })
                     getOrder(orderIdVal)
                  } else {
                     $util.showToast({
                        title: req.error
                     })
                  }
                  isLoading.value = false
               })
            } else {
               // 执行取消后的操作
            }
         }
      })
   }
   const deleteWorker = (item) => {
      uni.showModal({
         title: '提示',
         content: `确认删除${item.workerName}?`,
         success: function(res) {
            if (res.confirm) {
               // 执行确认后的操作
               isLoading.value = true
               $api.saveDeltoudi({
                  orderBiddingId: item.id
               }).then(req => {
                  if (req.code == 1) {
                     $util.showToast({
                        title: '删除成功!'
                     })
                     getOrder(orderIdVal)
                  } else {
                     $util.showToast({
                        title: req.error
                     })
                  }
                  isLoading.value = false
               })
            } else {
               // 执行取消后的操作
            }
         }
      })
   }
   const saveWorkPrice = (item) => {
      let obj = {
@@ -206,7 +310,7 @@
               title: "工价保存成功!",
               icon: "success"
            })
            getOrder(orderIdVal)
            getOrder(orderIdVal, item.id)
            item.showEdit = false
         } else {
            $util.showToast({
@@ -216,6 +320,7 @@
      })
   }
   let modalShow = ref(false)
   let modalShowGuding = ref(false)
   let content = ref('')
   const toView = (item) => {
      uni.navigateTo({
@@ -223,7 +328,7 @@
      })
   }
   const toWorkerDetail = (item) => {
      $db.set('toudiItem',item)
      $db.set('toudiItem', item)
      uni.navigateTo({
         url: `/pages/worker/worker?workerid=${item.workerUserId}`
      })
@@ -243,11 +348,18 @@
         content.value = `确定拒绝${item.workerName}吗?`
      }
   }
   const selectBtnGuding = (item,val)=>{
      workerItem.value = item
      modalShowGuding.value = true
      selectVal.value = val
      content.value = `录用${item.workerName}为灵活用工吗?`
   }
   const modalConfirm = () => {
      if (selectVal.value) {
         console.log('3333333333');
         $api.saveQueRen({
            orderBiddingId: workerItem.value.id
            orderBiddingId: workerItem.value.id,
            isGuding:true
         }).then(res => {
            if (res.code == 1) {
               $util.showToast({
@@ -260,7 +372,8 @@
                  title: res.error ? res.error : '失败!'
               })
            }
            modalShow.value = false
            modalShowGuding.value = false
            workerItem.value = {}
         })
      } else {
@@ -280,6 +393,7 @@
               })
            }
            modalShow.value = false
            workerItem.value = {}
         })
      }
   }
@@ -287,36 +401,74 @@
      modalShow.value = false
      workerItem.value = {}
   }
   const getOrder = (orderid) => {
   const modalCancelGuding = () => {
      $api.saveQueRen({
         orderBiddingId: workerItem.value.id,
         isGuding:false
      }).then(res => {
         if (res.code == 1) {
            $util.showToast({
               title: "录用成功!",
               icon: "success"
            })
            getOrder(orderIdVal)
         } else {
            $util.showToast({
               title: res.error ? res.error : '失败!'
            })
         }
         modalShowGuding.value = false
         workerItem.value = {}
      })
   }
   const getOrder = (orderid, id) => {
      $api.getOrder(orderid).then(res => {
         if (res.code == 1) {
            res.data.orderBidding.forEach(item => {
               item.showEdit = false
               if (id == item.id) {
                  toWorkerDetail(item)
               }
            })
            console.log(res.data);
            detailItem.value = res.data
         }
      })
   }
   const manageOrder = (item) => {
      let obj = {
         orderId: item.id
      }
      isLoading.value = true
      if (item.isEn) {
         $api.deleteOrder(obj).then(res => {
            if (res.code == 1) {
               $util.showToast({
                  title: '下架成功!'
               })
               getOrder(orderIdVal)
            } else {
               $util.showToast({
                  title: res.error
               })
         uni.showModal({
            title: '提示',
            content: '确认下架该工作吗?下架后将删除相关数据!',
            success: function(res) {
               if (res.confirm) {
                  // 执行确认后的操作
                  isLoading.value = true
                  $api.deleteOrder(obj).then(req => {
                     if (req.code == 1) {
                        $util.showToast({
                           title: '下架成功!'
                        })
                        getOrder(orderIdVal)
                     } else {
                        $util.showToast({
                           title: req.error
                        })
                     }
                     isLoading.value = false
                  })
               } else {
                  // 执行取消后的操作
               }
            }
            isLoading.value = false
         })
      } else {
         item.OldId = item.id
         item.id = 0
         $api.saveOrder(item).then(res => {
            if (res.code == 1) {
               $util.showToast({
@@ -333,6 +485,12 @@
         })
      }
   }
   const toEdit = () => {
      $db.set('editItem', detailItem.value)
      uni.navigateTo({
         url: `/pages/release/index`
      })
   }
</script>
<style lang='scss'>