From 71b14ab1c5f43ed00057cf0ecad6c9567210204b Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期五, 07 十一月 2025 11:07:29 +0800
Subject: [PATCH] feat: 1.3.0.1

---
 src/views/EmploymentManage/components/AddOrEditEmploymentView.vue |  116 +++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 99 insertions(+), 17 deletions(-)

diff --git a/src/views/EmploymentManage/components/AddOrEditEmploymentView.vue b/src/views/EmploymentManage/components/AddOrEditEmploymentView.vue
index e21c637..e537ff5 100644
--- a/src/views/EmploymentManage/components/AddOrEditEmploymentView.vue
+++ b/src/views/EmploymentManage/components/AddOrEditEmploymentView.vue
@@ -38,6 +38,7 @@
                   placeholder="璇疯緭鍏ラ渶姹備汉鏁�"
                   :min="0"
                   :max="999999999999"
+                  :precision="0"
                   unit="浜�"
                 ></ProFormInputNumber>
               </ProFormItemV2>
@@ -85,12 +86,7 @@
               </ProFormItemV2>
             </ProFormColItem>
           </ProFormCol>
-          <template
-            v-if="
-              form.billingMethod === EnumBillingMethod.Hour ||
-              form.billingMethod === EnumBillingMethod.Day
-            "
-          >
+          <template v-if="form.billingMethod === EnumBillingMethod.Hour">
             <ProFormCol>
               <ProFormColItem :span="12">
                 <ProFormItemV2
@@ -134,7 +130,25 @@
               </ProFormColItem>
             </ProFormCol>
           </template>
-
+          <ProFormCol v-if="form.billingMethod === EnumBillingMethod.Piece">
+            <ProFormColItem :span="12">
+              <ProFormItemV2
+                label="鎬讳欢鏁�:"
+                prop="totalPieceQuantity"
+                :check-rules="[{ message: '璇疯緭鍏ユ�讳欢鏁�' }]"
+              >
+                <ProFormInputNumber
+                  :controls="false"
+                  v-model="form.totalPieceQuantity"
+                  placeholder="璇疯緭鍏ユ�讳欢鏁�"
+                  :min="0"
+                  :max="999999999999"
+                  unit="浠�"
+                  :disabled="feeCannotEdit"
+                ></ProFormInputNumber>
+              </ProFormItemV2>
+            </ProFormColItem>
+          </ProFormCol>
           <ProFormCol>
             <ProFormColItem :span="12">
               <ProFormItemV2
@@ -303,7 +317,20 @@
               <ProFormItemV2
                 label="浠诲姟鏃堕棿:"
                 prop="time"
-                :check-rules="[{ message: '璇烽�夋嫨浠诲姟鏃堕棿', type: 'array' }]"
+                :check-rules="[
+                  { message: '璇烽�夋嫨浠诲姟鏃堕棿', type: 'array' },
+                  {
+                    validator: (rule, value, callback) => {
+                      if (form.billingMethod === EnumBillingMethod.Month) {
+                        if (dayjs(form.time[1]).diff(dayjs(form.time[0]), 'month') < 1) {
+                          callback(new Error('鏈堢粨浠诲姟鏃朵换鍔℃椂闂撮渶澶т簬涓�涓湀'));
+                        }
+                        callback();
+                      }
+                      callback();
+                    },
+                  },
+                ]"
               >
                 <ProFormDatePicker
                   v-model="form.time"
@@ -339,14 +366,13 @@
             <ProFormColItem :span="12">
               <ProFormItemV2
                 label="楠屾敹鏂瑰紡:"
-                prop="checkReceiveMethod"
+                prop="checkReceiveMethods"
                 :check-rules="[{ message: '璇烽�夋嫨楠屾敹鏂瑰紡' }]"
               >
-                <ProFormRadio
-                  v-model="form.checkReceiveMethod"
+                <ProFormCheckbox
+                  v-model="form.checkReceiveMethods"
                   :value-enum="EnumTaskCheckReceiveMethodText"
-                  :button-style="false"
-                ></ProFormRadio>
+                ></ProFormCheckbox>
               </ProFormItemV2>
             </ProFormColItem>
           </ProFormCol>
@@ -417,10 +443,10 @@
 };
 defineProps<Props>();
 const route = useRoute();
+const router = useRouter();
 const id = route.params.id as string;
 const isEdit = !!id;
 
-const { settlementAccessList } = useEnterpriseWalletAccessSelect();
 const { supplierEnterpriseSelect } = useGetSupplierEnterpriseSelect();
 
 function disabledDate(time: Date) {
@@ -469,6 +495,7 @@
   needPeopleNumber: null as number,
   billingMethod: EnumBillingMethod.Day,
   serviceFee: null,
+  totalPieceQuantity: null as number,
   settlementCycle: EnumSettlementCycle.Day,
   settlementDate: null as number,
   benefits: [] as string[],
@@ -482,9 +509,13 @@
   verifyWorkHours: null as number,
   timeoutServiceFee: null as number,
   description: '',
-  checkReceiveMethod: '' as any as EnumTaskCheckReceiveMethod,
+  checkReceiveMethods: [] as any as EnumTaskCheckReceiveMethod[],
   applyTime: [] as unknown as ModelValueType,
   settlementAccess: '' as any as EnumEnterpriseWalletAccess,
+});
+
+const { settlementAccessList } = useEnterpriseWalletAccessSelect({
+  supplierEnterpriseId: computed(() => form.supplierEnterpriseId),
 });
 
 const { isLoading } = useQuery({
@@ -503,6 +534,7 @@
     form.name = data.name;
     form.needPeopleNumber = data.needPeopleNumber;
     form.billingMethod = data.billingMethod;
+    form.totalPieceQuantity = data.totalPieceQuantity;
     form.serviceFee = data.serviceFee;
     form.settlementCycle = data.settlementCycle;
     form.settlementDate = data.settlementDate;
@@ -532,7 +564,7 @@
     form.verifyWorkHours = data.verifyWorkHours;
     form.timeoutServiceFee = data.timeoutServiceFee;
     form.description = data.description;
-    form.checkReceiveMethod = data.checkReceiveMethod;
+    form.checkReceiveMethods = data.checkReceiveMethods;
     form.applyTime = [
       format(data.applyBeginTime, 'YYYY-MM-DD 00:00:00'),
       format(data.applyEndTime, 'YYYY-MM-DD 23:59:59'),
@@ -555,6 +587,34 @@
     name: 'TaskManageList',
   });
 }
+
+function calculateMonthInterval(startDate, endDate) {
+  const diffInDays = dayjs(endDate).diff(startDate, 'day');
+  const monthInterval = Math.ceil(diffInDays / 30);
+  return monthInterval > 15 ? Math.ceil(monthInterval / 30) : monthInterval;
+}
+
+function calculateServicesFee(
+  billingMethod: EnumBillingMethod,
+  serviceFee: number,
+  time: ModelValueType,
+  needPeopleNumber: number,
+  verifyWorkHours: number
+) {
+  const monthInterval = calculateMonthInterval(time[0], time[1]);
+  const dayInterval = dayjs(time[1]).diff(time[0], 'day');
+  switch (billingMethod) {
+    case EnumBillingMethod.Month:
+      return monthInterval * serviceFee * needPeopleNumber;
+    case EnumBillingMethod.Day:
+      return serviceFee * dayInterval * needPeopleNumber;
+    case EnumBillingMethod.Hour:
+      return serviceFee * dayInterval * needPeopleNumber * verifyWorkHours;
+    case EnumBillingMethod.Piece:
+      return serviceFee * needPeopleNumber;
+  }
+}
+
 const productFormRef = ref<FormInstance>();
 function handleConfirm() {
   if (!productFormRef.value) return;
@@ -568,11 +628,33 @@
 }
 async function submit() {
   try {
+    // const estimateServicesFee = calculateServicesFee(
+    //   form.billingMethod,
+    //   form.serviceFee,
+    //   form.time,
+    //   form.needPeopleNumber,
+    //   form.verifyWorkHours
+    // );
+    // if (estimateServicesFee > 10000) {
+    //   Message.tipMessage('鎮ㄥ綋鍓嶈处鎴蜂綑棰濅笉瓒筹紝鏆傛椂鏃犳硶鍙戝竷浠诲姟锛岃鍏呭�煎悗鎿嶄綔', {
+    //     confirmButtonText: '绔嬪嵆鍏呭��',
+    //     cancelButtonText: '鍙栨秷',
+    //     type: 'warning',
+    //     callback: (action) => {
+    //       if (action === 'confirm') {
+    //         router.push({
+    //           name: 'BalanceManageV2',
+    //         });
+    //       }
+    //     },
+    //   });
+    // }
     let params: API.SaveTaskInfoCommand = {
       supplierEnterpriseId: form.supplierEnterpriseId,
       name: form.name,
       needPeopleNumber: form.needPeopleNumber,
       billingMethod: form.billingMethod,
+      totalPieceQuantity: form.totalPieceQuantity,
       serviceFee: form.serviceFee,
       settlementCycle: form.settlementCycle,
       settlementDate: form.settlementDate ? form.settlementDate : 0,
@@ -594,7 +676,7 @@
       verifyWorkHours: form.verifyWorkHours,
       timeoutServiceFee: form.timeoutServiceFee,
       description: form.description,
-      checkReceiveMethod: form.checkReceiveMethod,
+      checkReceiveMethods: form.checkReceiveMethods,
       settlementAccess: form.settlementAccess,
     };
     if (isEdit) {

--
Gitblit v1.9.1