-
zhangwei
2025-01-23 e5a77d6a551d13e4cf74624b31b0fa3e328b304d
src/pages/company/record.vue
@@ -3,7 +3,7 @@
      <view class="coreshop-ff">
         <up-list>
            <up-list-item>
               <up-cell :title="workerInfo.userWorker.name">
               <up-cell :title="workerInfo.userWorker?workerInfo.userWorker.name:''">
                  <template #icon>
                     <up-avatar shape="square" size="35" :src="workerInfo.avatar"
                        customStyle="margin: -3px 5px -3px 0"></up-avatar>
@@ -12,15 +12,15 @@
            </up-list-item>
            <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-font32">
                     {{dakaList.orderName}}
                  </text>
                  <text class="">
                     日期:{{$util.formatDate(dakaList.workDate)}}
                     打卡日期:{{$util.formatDate(dakaList.workDate)}}
                  </text>
               </view>
            </view>
            <view class="c-p-20">
            <view class="c-p-l-20 c-p-r-20">
               <view class="">
                  <text class="">
                     打卡记录:
@@ -45,8 +45,16 @@
                  </view>
               </view>
            </view>
            <up-cell title="工作时长" :border='false'>
               <template #right-icon>
            <up-cell title="时长" :border='false'>
               <!-- <template #right-icon>
                  {{dakaList.workTime}} 小时
               </template> -->
               <template #right-icon  v-if="dakaList.workerType!=1 && (dakaList.isShenPi!==2||dakaList.isModify)">
                  <up-input v-model="dakaList.workTime" type="digit"
                     @change='(val) => {dakaList.todaySalary=$util.roundToTwo(val*dakaList.workPrice)}'
                     border="none" placeholder="请填写时长"></up-input>
               </template>
               <template #value v-else>
                  {{dakaList.workTime}} 小时
               </template>
            </up-cell>
@@ -59,11 +67,19 @@
               <template #right-icon>
                  {{dakaList.workPrice}} {{dakaList.workerType==0?'元/小时':'元/件'}}
               </template>
               <!--
               <template #right-icon v-if="dakaList.isShenPiName!=='已结算'">
                  <up-input v-model="dakaList.workPrice" type="digit"
                     border="none" placeholder="请填写工价"></up-input>
               </template>
               <template #value v-else>
                  {{dakaList.workPrice}} {{dakaList.workerType==0?'元/小时':'元/件'}}
               </template> -->
            </up-cell>
            <up-cell title="数量" :border='false' v-if="dakaList.workerType==1">
               <template #right-icon v-if="dakaList.isShenPiName!=='已结算'">
                  <up-input v-model="dakaList.workCount"
                     @blur='(val) => {dakaList.todaySalary=$util.roundToTwo(dakaList.workCount*dakaList.workPrice)}'
               <template #right-icon v-if="dakaList.isShenPiName!=='已结算'||isModify">
                  <up-input v-model="dakaList.workCount" type="digit"
                     @change='(val) => {dakaList.todaySalary=$util.roundToTwo(val*dakaList.workPrice)}'
                     border="none" placeholder="请填写数量"></up-input>
               </template>
               <template #value v-else>
@@ -71,7 +87,14 @@
               </template>
            </up-cell>
            <up-cell title="工资" :border='false'>
               <template #right-icon>
               <!-- <template #right-icon>
                  {{dakaList.todaySalary}} 元
               </template> -->
               <template #right-icon v-if="dakaList.isShenPiName!=='已结算'||isModify">
                  <up-input v-model="dakaList.todaySalary" type="digit" border="none"
                     placeholder="请填写工资"></up-input>
               </template>
               <template #value v-else>
                  {{dakaList.todaySalary}} 元
               </template>
            </up-cell>
@@ -79,9 +102,10 @@
               <tem-steps></tem-steps>
            </view> -->
         </up-list>
         <view class="tabbtns">
            <up-button color='#fece01' class="text-69" text="确认" @click="saveDakaDetailCompany"
               v-if="dakaList.isShenPiName!=='已结算'"></up-button>
         <view class="tabbtns" v-if="dakaList.isShenPiName!=='已结算'||isModify">
            <up-button color='#fece01' :text="dakaList.isShenPiName!=='已结算'?'核准工资':'修改'"
               :loading='isLoading' :loadingText="dakaList.isShenPiName!=='已结算'?'核准中':'修改中'"
               @click="saveDakaDetailCompany"></up-button>
         </view>
      </view>
   </view>
@@ -94,18 +118,18 @@
            orderBiddingDetailId: '',
            dakaList: {},
            workCount: '',
            confirmObj: {
               orderBiddingDetailId: '', //招工打卡Id
               workTime: '', //工作时长
               workCount: '', //计件数量
               todaySalary: '' //当日工资
            },
            workerInfo: ''
            workerInfo: '',
            isLoading: false
         }
      },
      onLoad(options) {
         this.orderBiddingDetailId = options.id
         this.getDakaDetail(this.orderBiddingDetailId)
      },
      computed: {
         isModify() {
            return this.$util.minutesBetweenDates(this.dakaList.shenPitime, new Date()) <= 5 ? true : false
         }
      },
      methods: {
         getWorkerInfo(id) {
@@ -134,7 +158,7 @@
               if (this.dakaList.orderBiddingDetailCheck.length % 2 !== 0) {
                  this.dakaList.orderBiddingDetailCheck.push({})
               }
               console.log(res, '打卡');
               console.log(res, this.dakaList.workTime, '打卡');
            })
         },
         saveDakaDetailCompany() {
@@ -153,14 +177,20 @@
            if (this.dakaList.workCount) {
               obj.workCount = this.dakaList.workCount
            }
            this.isLoading = true
            this.$api.saveDakaDetailCompany(obj).then(res => {
               if (res.code == 1) {
                  this.$util.showToast({
                     title: '确认成功!',
                     icon: 'success'
                  })
                  this.getDakaDetail(this.orderBiddingDetailId)
               } else {
                  this.$util.showToast({
                     title: res.error ? res.error : '失败!'
                  })
               }
               console.log(res, '----');
               this.isLoading = false
            })
         },
      }