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 | 103 ++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 93 insertions(+), 10 deletions(-)
diff --git a/src/views/EmploymentManage/components/AddOrEditEmploymentView.vue b/src/views/EmploymentManage/components/AddOrEditEmploymentView.vue
index 073b80d..58b79b5 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>
@@ -134,7 +135,27 @@
</ProFormColItem>
</ProFormCol>
</template>
-
+ <ProFormCol v-if="form.billingMethod === EnumBillingMethod.Piece">
+ <ProFormColItem :span="12">
+ <ProFormItemV2
+ label="鎬讳欢鏁�:"
+ prop="verifyWorkHours"
+ :check-rules="[{ message: '璇疯緭鍏ヤ换鍔℃�讳欢鏁�' }]"
+ >
+ <span v-if="isDetail && !form.verifyWorkHours"></span>
+ <ProFormInputNumber
+ v-else
+ :controls="false"
+ v-model="form.verifyWorkHours"
+ placeholder="璇疯緭鍏ヤ换鍔℃�讳欢鏁�"
+ :min="0"
+ :max="999999999999"
+ unit="浠�"
+ :disabled="feeCannotEdit"
+ ></ProFormInputNumber>
+ </ProFormItemV2>
+ </ProFormColItem>
+ </ProFormCol>
<ProFormCol>
<ProFormColItem :span="12">
<ProFormItemV2
@@ -303,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"
@@ -339,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>
@@ -417,6 +450,7 @@
};
defineProps<Props>();
const route = useRoute();
+const router = useRouter();
const id = route.params.id as string;
const isEdit = !!id;
@@ -481,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,
});
@@ -535,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'),
@@ -558,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;
@@ -571,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,
@@ -597,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