|  |  | 
 |  |  |           :contactPhoneNumber="item.contactPhoneNumber" | 
 |  |  |           :checkReceiveStatus="item.checkReceiveStatus" | 
 |  |  |           :checkReceiveMethod="detail?.checkReceiveMethod" | 
 |  |  |           :submitCheckReceiveStatus="item.submitCheckReceiveStatus" | 
 |  |  |           @checkReceive="goTaskDetail(item)" | 
 |  |  |           @checkInOrOut="(ev) => checkReceiveTask(ev, item.id)" | 
 |  |  |           @checkInOrOut="(ev) => checkReceiveTask(ev, item)" | 
 |  |  |         /> | 
 |  |  |       </template> | 
 |  |  |     </InfiniteLoading> | 
 |  |  |     <nut-popup v-model:visible="dialogVisible"> | 
 |  |  |       <div class="payroll-form-wrapper"> | 
 |  |  |         <nut-form :model-value="form" ref="formRef"> | 
 |  |  |           <nut-form-item | 
 |  |  |             label="服务费:" | 
 |  |  |             class="bole-form-item" | 
 |  |  |             prop="serviceFee" | 
 |  |  |             label-width="90px" | 
 |  |  |           > | 
 |  |  |             <div class="bole-form-input-wrapper"> | 
 |  |  |               <NumberInput | 
 |  |  |                 v-model.trim="form.serviceFee" | 
 |  |  |                 class="nut-input-text bole-input-text" | 
 |  |  |                 placeholder="请输入服务费" | 
 |  |  |                 :min="0" | 
 |  |  |                 :max="999999999999" | 
 |  |  |                 :precision="2" | 
 |  |  |                 type="text" | 
 |  |  |                 disabled | 
 |  |  |               /> | 
 |  |  |               <div class="form-input-unit">元</div> | 
 |  |  |             </div> | 
 |  |  |           </nut-form-item> | 
 |  |  |           <nut-form-item | 
 |  |  |             label="超时:" | 
 |  |  |             class="bole-form-item" | 
 |  |  |             prop="timeoutHours" | 
 |  |  |             label-width="90px" | 
 |  |  |           > | 
 |  |  |             <div class="bole-form-input-wrapper"> | 
 |  |  |               <NumberInput | 
 |  |  |                 v-model.trim="form.timeoutHours" | 
 |  |  |                 class="nut-input-text bole-input-text" | 
 |  |  |                 placeholder="请输入超时时长" | 
 |  |  |                 :min="0" | 
 |  |  |                 :max="999999999999" | 
 |  |  |                 :precision="2" | 
 |  |  |                 type="text" | 
 |  |  |                 @change="onTimeoutHoursChange" | 
 |  |  |               /> | 
 |  |  |               <div class="form-input-unit">小时</div> | 
 |  |  |             </div> | 
 |  |  |           </nut-form-item> | 
 |  |  |           <nut-form-item | 
 |  |  |             label="超时费用:" | 
 |  |  |             class="bole-form-item" | 
 |  |  |             prop="timeoutFee" | 
 |  |  |             label-width="90px" | 
 |  |  |           > | 
 |  |  |             <div class="bole-form-input-wrapper"> | 
 |  |  |               <NumberInput | 
 |  |  |                 v-model.trim="form.timeoutFee" | 
 |  |  |                 class="nut-input-text bole-input-text" | 
 |  |  |                 placeholder="请输入超时费用" | 
 |  |  |                 :min="0" | 
 |  |  |                 :max="999999999999" | 
 |  |  |                 :precision="2" | 
 |  |  |                 type="text" | 
 |  |  |               /> | 
 |  |  |               <div class="form-input-unit">元</div> | 
 |  |  |             </div> | 
 |  |  |           </nut-form-item> | 
 |  |  |           <nut-form-item | 
 |  |  |             label="其他费用:" | 
 |  |  |             class="bole-form-item" | 
 |  |  |             prop="otherFee" | 
 |  |  |             label-width="90px" | 
 |  |  |           > | 
 |  |  |             <div class="bole-form-input-wrapper"> | 
 |  |  |               <NumberInput | 
 |  |  |                 v-model.trim="form.otherFee" | 
 |  |  |                 class="nut-input-text bole-input-text" | 
 |  |  |                 placeholder="请输入其他费用" | 
 |  |  |                 :max="999999999999" | 
 |  |  |                 :precision="2" | 
 |  |  |                 type="text" | 
 |  |  |               /> | 
 |  |  |               <div class="form-input-unit">元</div> | 
 |  |  |             </div> | 
 |  |  |           </nut-form-item> | 
 |  |  |           <nut-form-item | 
 |  |  |             label="结算金额:" | 
 |  |  |             class="bole-form-item" | 
 |  |  |             prop="settlementAmount" | 
 |  |  |             label-width="90px" | 
 |  |  |           > | 
 |  |  |             {{ `${settlementAmount}元` }} | 
 |  |  |           </nut-form-item> | 
 |  |  |           <nut-form-item | 
 |  |  |             label="备注:" | 
 |  |  |             class="bole-form-item alignTop" | 
 |  |  |             prop="remark" | 
 |  |  |             label-width="90px" | 
 |  |  |           > | 
 |  |  |             <nut-textarea v-model="form.remark" rows="4" placeholder="请输入备注"> </nut-textarea> | 
 |  |  |           </nut-form-item> | 
 |  |  |         </nut-form> | 
 |  |  |         <div class="payroll-form-footer"> | 
 |  |  |           <nut-button @click="handleCancel">取消</nut-button> | 
 |  |  |           <nut-button type="primary" @click="handleConfirm">确认</nut-button> | 
 |  |  |         </div> | 
 |  |  |       </div> | 
 |  |  |     </nut-popup> | 
 |  |  |   </LoadingLayout> | 
 |  |  | </template> | 
 |  |  |  | 
 |  |  | 
 |  |  | import * as taskCheckReceiveServices from '@12333/services/apiV2/taskCheckReceive'; | 
 |  |  | import { useInfiniteLoading } from '@12333/hooks'; | 
 |  |  | import TaskCheckCard from '../components/TaskCheckCard.vue'; | 
 |  |  | import { MyTaskCard } from '@12333/components'; | 
 |  |  | import { EnumTaskCheckReceiveMethod, EnumTaskCheckReceiveStatus } from '@12333/constants'; | 
 |  |  | import { Message, setOSSLink } from '@12333/utils'; | 
 |  |  | import { MyTaskCard, NumberInput } from '@12333/components'; | 
 |  |  | import { | 
 |  |  |   EnumTaskCheckReceiveMethod, | 
 |  |  |   EnumTaskCheckReceiveStatus, | 
 |  |  |   EnumTaskUserSubmitCheckReceiveStatus, | 
 |  |  | } from '@12333/constants'; | 
 |  |  | import { Message, setOSSLink, toRound } from '@12333/utils'; | 
 |  |  | import dayjs from 'dayjs'; | 
 |  |  | import { CheckInOrOutEventEnum } from '../constants'; | 
 |  |  |  | 
 |  |  | defineOptions({ | 
 |  |  |   name: 'InnerPage', | 
 |  |  | 
 |  |  | const id = router.params?.id ?? ''; | 
 |  |  | const date = router.params?.date ?? ''; | 
 |  |  | const checkReceiveStatus = Number(router.params?.checkReceiveStatus); | 
 |  |  |  | 
 |  |  | const dialogVisible = ref(false); | 
 |  |  |  | 
 |  |  | const form = reactive({ | 
 |  |  |   serviceFee: 0, | 
 |  |  |   timeoutHours: 0, | 
 |  |  |   timeoutFee: 0, | 
 |  |  |   otherFee: 0, | 
 |  |  |   remark: '', | 
 |  |  |   timeoutServiceFee: 0, | 
 |  |  |  | 
 |  |  |   taskInfoId: '', | 
 |  |  |   checkInTime: '', | 
 |  |  |   checkoutTime: '', | 
 |  |  | }); | 
 |  |  |  | 
 |  |  | const detail = ref<API.GetCheckReceiveTasksQueryResultItem>(); | 
 |  |  |  | 
 |  |  | 
 |  |  |   } | 
 |  |  | ); | 
 |  |  |  | 
 |  |  | const settlementAmount = computed(() => sumSettlementAmount()); | 
 |  |  |  | 
 |  |  | function onTimeoutHoursChange(event: any) { | 
 |  |  |   form.timeoutFee = Number(form.timeoutServiceFee) | 
 |  |  |     ? form.timeoutServiceFee * event.detail.value | 
 |  |  |     : 0; | 
 |  |  | } | 
 |  |  |  | 
 |  |  | function sumSettlementAmount() { | 
 |  |  |   return toRound( | 
 |  |  |     getFeeValue(Number(form.timeoutFee ?? 0)) + | 
 |  |  |       getFeeValue(Number(form.serviceFee ?? 0)) + | 
 |  |  |       getFeeValue(Number(form.otherFee ?? 0)) | 
 |  |  |   ); | 
 |  |  | } | 
 |  |  |  | 
 |  |  | function getFeeValue(val: number) { | 
 |  |  |   return val || 0; | 
 |  |  | } | 
 |  |  |  | 
 |  |  | async function openDialog(item: API.GetCheckReceiveTaskQueryResultItem) { | 
 |  |  |   let res = await calcTaskCheckReceive(item); | 
 |  |  |   if (res) { | 
 |  |  |     dialogVisible.value = true; | 
 |  |  |     form.taskInfoId = item.id; | 
 |  |  |     form.serviceFee = res.serviceFee ?? 0; | 
 |  |  |     form.timeoutHours = res.timeoutHours ?? 0; | 
 |  |  |     form.timeoutServiceFee = detail.value?.timeoutServiceFee ?? 0; | 
 |  |  |     form.otherFee = 0; | 
 |  |  |     form.timeoutFee = 0; | 
 |  |  |     form.remark = ''; | 
 |  |  |   } | 
 |  |  | } | 
 |  |  |  | 
 |  |  | function handleCancel() { | 
 |  |  |   dialogVisible.value = false; | 
 |  |  | } | 
 |  |  |  | 
 |  |  | async function handleConfirm() { | 
 |  |  |   try { | 
 |  |  |     let params: API.CheckReceiveTaskCommand = { | 
 |  |  |       taskInfoUserId: form.taskInfoId, | 
 |  |  |       date: dayjs(date).format('YYYY-MM-DD'), | 
 |  |  |       checkOutTime: dayjs().format('YYYY-MM-DD HH:mm:ss'), | 
 |  |  |       checkReceiveStatus: EnumTaskUserSubmitCheckReceiveStatus.Success, | 
 |  |  |       serviceFee: form.serviceFee, | 
 |  |  |       timeoutHours: form.timeoutHours, | 
 |  |  |       timeoutFee: form.timeoutFee, | 
 |  |  |       otherFee: form.otherFee, | 
 |  |  |       remark: form.remark, | 
 |  |  |       settlementAmount: settlementAmount.value, | 
 |  |  |     }; | 
 |  |  |     let res = await taskCheckReceiveServices.checkReceiveTask(params); | 
 |  |  |     if (res) { | 
 |  |  |       Message.success('提交成功'); | 
 |  |  |       dialogVisible.value = false; | 
 |  |  |       infiniteLoadingProps.value?.refetch?.(); | 
 |  |  |     } | 
 |  |  |   } catch (error) {} | 
 |  |  | } | 
 |  |  |  | 
 |  |  | async function calcTaskCheckReceive(item: API.GetCheckReceiveTaskQueryResultItem) { | 
 |  |  |   try { | 
 |  |  |     let params: API.CalcTaskCheckReceiveCommand = { | 
 |  |  |       taskInfoId: id, | 
 |  |  |       checkInTime: dayjs(item.checkInTime).format('YYYY-MM-DD HH:mm:ss'), | 
 |  |  |       checkOutTime: dayjs().format('YYYY-MM-DD HH:mm:ss'), | 
 |  |  |     }; | 
 |  |  |     return await taskCheckReceiveServices.calcTaskCheckReceive(params); | 
 |  |  |   } catch (error) {} | 
 |  |  | } | 
 |  |  |  | 
 |  |  | function goTaskDetail(item: API.GetCheckReceiveTaskQueryResultItem) { | 
 |  |  |   if (detail.value.checkReceiveMethod !== EnumTaskCheckReceiveMethod.CheckIn) { | 
 |  |  |     if (item.checkReceiveStatus === EnumTaskCheckReceiveStatus.Completed) { | 
 |  |  | 
 |  |  |   } | 
 |  |  | } | 
 |  |  |  | 
 |  |  | async function checkReceiveTask(ev: CheckInOrOutEventEnum, taskInfoUserId: string) { | 
 |  |  | async function checkReceiveTask( | 
 |  |  |   ev: EnumTaskUserSubmitCheckReceiveStatus, | 
 |  |  |   item: API.GetCheckReceiveTaskQueryResultItem | 
 |  |  | ) { | 
 |  |  |   try { | 
 |  |  |     let params: API.CheckReceiveTaskCommand = { | 
 |  |  |       taskInfoUserId: taskInfoUserId, | 
 |  |  |       taskInfoUserId: item.id, | 
 |  |  |       date: dayjs(date).format('YYYY-MM-DD'), | 
 |  |  |     }; | 
 |  |  |     if (ev === CheckInOrOutEventEnum.CheckIn) { | 
 |  |  |     if (ev === EnumTaskUserSubmitCheckReceiveStatus.WaitCheckReceive) { | 
 |  |  |       params.checkInTime = dayjs().format('YYYY-MM-DD HH:mm:ss'); | 
 |  |  |     } else if (ev === CheckInOrOutEventEnum.CheckOut) { | 
 |  |  |       params.checkOutTime = dayjs().format('YYYY-MM-DD HH:mm:ss'); | 
 |  |  |       params.checkReceiveStatus = ev; | 
 |  |  |     } else if (ev === EnumTaskUserSubmitCheckReceiveStatus.Success) { | 
 |  |  |       openDialog(item); | 
 |  |  |       return; | 
 |  |  |       // params.checkOutTime = dayjs().format('YYYY-MM-DD HH:mm:ss'); | 
 |  |  |       // params.checkReceiveStatus = ev; | 
 |  |  |     } else if (ev === EnumTaskUserSubmitCheckReceiveStatus.Fail) { | 
 |  |  |       params.checkReceiveStatus = ev; | 
 |  |  |     } | 
 |  |  |     let res = await taskCheckReceiveServices.checkReceiveTask(params); | 
 |  |  |     if (res) { | 
 |  |  | 
 |  |  |   } catch (error) {} | 
 |  |  | } | 
 |  |  | </script> | 
 |  |  | <style lang="scss"> | 
 |  |  | @import '@/styles/common.scss'; | 
 |  |  |  | 
 |  |  | .taskCheckDetail-page-wrapper { | 
 |  |  |   .bole-form-input-wrapper { | 
 |  |  |     display: flex; | 
 |  |  |     align-items: center; | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |   .form-input-unit { | 
 |  |  |     margin-left: 10px; | 
 |  |  |     color: boleGetCssVar('text-color', 'primary'); | 
 |  |  |     flex-shrink: 0; | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |   .payroll-form-wrapper { | 
 |  |  |     width: 600px; | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |   .payroll-form-footer { | 
 |  |  |     padding: 10px 20px; | 
 |  |  |     text-align: center; | 
 |  |  |  | 
 |  |  |     .nut-button + .nut-button { | 
 |  |  |       margin-left: 20px; | 
 |  |  |     } | 
 |  |  |   } | 
 |  |  | } | 
 |  |  | </style> |