feat:【antd】【erp 系统】sale 重构代码风格(修复“优惠后金额”未计算的问题)
This commit is contained in:
@@ -162,6 +162,15 @@ export function useFormSchema(formType: string): VbenFormSchema[] {
|
||||
formatter: erpPriceInputFormatter,
|
||||
disabled: true,
|
||||
},
|
||||
dependencies: {
|
||||
triggerFields: ['totalPrice', 'otherPrice'],
|
||||
componentProps: (values) => {
|
||||
const totalPrice = values.totalPrice || 0;
|
||||
const otherPrice = values.otherPrice || 0;
|
||||
values.discountedPrice = totalPrice - otherPrice;
|
||||
return {};
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'otherPrice',
|
||||
|
||||
@@ -21,7 +21,6 @@ const formData = ref<
|
||||
ErpSaleOutApi.SaleOut & {
|
||||
accountId?: number;
|
||||
customerId?: number;
|
||||
discountedPrice?: number;
|
||||
discountPercent?: number;
|
||||
fileUrl?: string;
|
||||
order?: ErpSaleOrderApi.SaleOrder;
|
||||
@@ -40,7 +39,6 @@ const formData = ref<
|
||||
discountPrice: 0,
|
||||
totalPrice: 0,
|
||||
otherPrice: 0,
|
||||
discountedPrice: 0,
|
||||
items: [],
|
||||
});
|
||||
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
|
||||
@@ -167,20 +165,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
no: undefined,
|
||||
accountId: undefined,
|
||||
outTime: undefined,
|
||||
remark: undefined,
|
||||
fileUrl: undefined,
|
||||
discountPercent: 0,
|
||||
customerId: undefined,
|
||||
discountPrice: 0,
|
||||
totalPrice: 0,
|
||||
otherPrice: 0,
|
||||
items: [],
|
||||
};
|
||||
formData.value = undefined;
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
|
||||
@@ -161,6 +161,15 @@ export function useFormSchema(formType: string): VbenFormSchema[] {
|
||||
formatter: erpPriceInputFormatter,
|
||||
disabled: true,
|
||||
},
|
||||
dependencies: {
|
||||
triggerFields: ['totalPrice', 'otherPrice'],
|
||||
componentProps: (values) => {
|
||||
const totalPrice = values.totalPrice || 0;
|
||||
const otherPrice = values.otherPrice || 0;
|
||||
values.discountedPrice = totalPrice - otherPrice;
|
||||
return {};
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'otherPrice',
|
||||
|
||||
@@ -25,7 +25,6 @@ const formData = ref<
|
||||
ErpSaleReturnApi.SaleReturn & {
|
||||
accountId?: number;
|
||||
customerId?: number;
|
||||
discountedPrice?: number;
|
||||
discountPercent?: number;
|
||||
fileUrl?: string;
|
||||
order?: ErpSaleOrderApi.SaleOrder;
|
||||
@@ -44,7 +43,6 @@ const formData = ref<
|
||||
discountPrice: 0,
|
||||
totalPrice: 0,
|
||||
otherPrice: 0,
|
||||
discountedPrice: 0,
|
||||
items: [],
|
||||
});
|
||||
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
|
||||
@@ -171,20 +169,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
no: undefined,
|
||||
accountId: undefined,
|
||||
returnTime: undefined,
|
||||
remark: undefined,
|
||||
fileUrl: undefined,
|
||||
discountPercent: 0,
|
||||
customerId: undefined,
|
||||
discountPrice: 0,
|
||||
totalPrice: 0,
|
||||
otherPrice: 0,
|
||||
items: [],
|
||||
};
|
||||
formData.value = undefined;
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
|
||||
Reference in New Issue
Block a user