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