-
zhangwei
2024-09-12 f7aa204aa8d20b090d7943969ddeb9871a1fad76
src/pages/checkin/workdetail.vue
@@ -3,11 +3,11 @@
      <view class="coreshop-ff">
         <view class="c-p-20">
            <view class="chuany-flex chuany-justify-between chuany-flex-wrap">
               <text class="chuany-font34 chuany-text-bold">
               <text class="chuany-font34">
                  {{dakaList.orderName}}
               </text>
               <text class="">
                  日期:{{$util.formatDate(dakaList.workDate)}}
                  打卡日期:{{$util.formatDate(dakaList.workDate)}}
               </text>
            </view>
         </view>
@@ -36,7 +36,7 @@
               </view>
            </view>
         </view>
         <up-cell title="工作时长" :border='false'>
         <up-cell title="时长" :border='false'>
            <template #right-icon>
               {{dakaList.workTime}} 小时
            </template>
@@ -51,9 +51,14 @@
               {{dakaList.workPrice}} {{dakaList.workerType==0?'元/小时':'元/件'}}
            </template>
         </up-cell>
         <up-cell title="数量" :border='false'  v-if="dakaList.workerType==1" >
            <template #right-icon>
               <up-input v-model="workCount" border="none" placeholder="请填写数量"></up-input>
         <up-cell title="数量" :border='false' v-if="dakaList.workerType==1">
            <template #right-icon v-if="dakaList.isShenPiName!=='已结算'">
               <up-input v-model="dakaList.workCount" type="digit"
                  @blur='(val) => {dakaList.todaySalary=$util.roundToTwo(dakaList.workCount*dakaList.workPrice)}'
                  border="none" placeholder="请填写数量"></up-input>
            </template>
            <template #value v-else>
               {{dakaList.workCount}}
            </template>
         </up-cell>
         <up-cell title="工资" :border='false'>
@@ -65,7 +70,8 @@
            <tem-steps></tem-steps>
         </view> -->
         <view class="tabbtns">
            <up-button color='#fece01' class="text-69" text="工资申报" @click="saveDakaDetail"></up-button>
            <up-button color='#fece01' class="text-69" text="工资申报" :loading='isLoading' loadingText="申报中"
               v-if="dakaList.isShenPiName!=='已结算'" @click="saveDakaDetail"></up-button>
         </view>
      </view>
   </view>
@@ -83,7 +89,8 @@
               workTime: '', //工作时长
               workCount: '', //计件数量
               todaySalary: '' //当日工资
            }
            },
            isLoading: false
         }
      },
      onLoad(options) {
@@ -101,6 +108,7 @@
               orderBiddingDetailId: id
            }).then(res => {
               this.dakaList = res.data
               this.dakaList.workCount = res.data.workCount
               if (this.dakaList.orderBiddingDetailCheck.length == 0) {
                  this.dakaList.orderBiddingDetailCheck.length = 2
               }
@@ -114,7 +122,7 @@
            })
         },
         saveDakaDetail() {
            if (dakaList.workerType == 1 && this.workCount) {
            if (this.dakaList.workerType == 1 && !this.dakaList.workCount) {
               this.$util.showToast({
                  title: '请填写数量!',
                  icon: 'error'
@@ -122,15 +130,27 @@
               return
            }
            let obj = {
               orderBiddingDetailId: dakaList.orderBiddingDetailId, //招工打卡Id
               workTime: dakaList.workTime, //工作时长
               todaySalary: dakaList.todaySalary //当日工资
               orderBiddingDetailId: this.dakaList.orderBiddingDetailId, //招工打卡Id
               workTime: this.dakaList.workTime, //工作时长
               todaySalary: this.dakaList.todaySalary //当日工资
            }
            if (this.workCount) {
               obj.workCount = this.workCount
            if (this.dakaList.workCount) {
               obj.workCount = this.dakaList.workCount
            }
            this.isLoading = true
            this.$api.saveDakaDetail(obj).then(res => {
               console.log(res, '----');
               console.log(res);
               if (res.code == 1) {
                  this.$util.showToast({
                     title: '申报成功!',
                     icon: 'success'
                  })
               } else {
                  this.$util.showToast({
                     title: res.error ? res.error : '失败!'
                  })
               }
               this.isLoading = false
            })
         },
      }
@@ -197,7 +217,8 @@
         background-color: #2979ff;
      }
   }
   .u-cell__body{
   .u-cell__body {
      padding: 6px 15px !important;
   }
</style>