From f483f159e98b867bd961134e8ff0053400929cc8 Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期四, 06 十一月 2025 18:23:47 +0800
Subject: [PATCH] feat: 接口

---
 src/views/EmploymentManage/components/AddOrEditEmploymentView.vue |   80 +++++++++++++++++++++++++++++++++++----
 1 files changed, 71 insertions(+), 9 deletions(-)

diff --git a/src/views/EmploymentManage/components/AddOrEditEmploymentView.vue b/src/views/EmploymentManage/components/AddOrEditEmploymentView.vue
index ebd6cbf..58b79b5 100644
--- a/src/views/EmploymentManage/components/AddOrEditEmploymentView.vue
+++ b/src/views/EmploymentManage/components/AddOrEditEmploymentView.vue
@@ -324,7 +324,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"
@@ -360,14 +373,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>
@@ -438,6 +450,7 @@
 };
 defineProps<Props>();
 const route = useRoute();
+const router = useRouter();
 const id = route.params.id as string;
 const isEdit = !!id;
 
@@ -502,7 +515,7 @@
   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,
 });
@@ -556,7 +569,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'),
@@ -579,6 +592,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;
@@ -592,6 +633,27 @@
 }
 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,
@@ -618,7 +680,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