This commit is contained in:
ah--desktop
2026-01-12 00:14:47 +08:00
parent e1f39c1815
commit 59a649f002
65 changed files with 5097 additions and 369 deletions
@@ -68,7 +68,10 @@ const formData = ref<Partial<OrderDTO.Create>>({
linkSpecName: '',
quantity: 1,
unitPrice: 0,
costPrice: 0,
productCost: 0,
shippingCost: 0,
otherCost: 0,
remark: '',
});
// 下拉选项数据
@@ -103,7 +106,7 @@ const rules = {
],
quantity: [{ required: true, message: '请输入数量', trigger: 'blur' }],
unitPrice: [{ required: true, message: '请输入销售单价', trigger: 'blur' }],
costPrice: [{ required: true, message: '请输入成本价', trigger: 'blur' }],
productCost: [{ required: true, message: '请输入商品成本', trigger: 'blur' }],
};
// 表单引用
@@ -212,7 +215,9 @@ function handleProductChange(productId: number | undefined) {
formData.value.linkProductName = '';
formData.value.productSpecId = undefined;
formData.value.linkSpecName = '';
formData.value.costPrice = 0;
formData.value.productCost = 0;
formData.value.shippingCost = 0;
formData.value.otherCost = 0;
productSpecOptions.value = [];
}
}
@@ -225,11 +230,15 @@ function handleProductSpecChange(specId: number | undefined) {
);
if (selectedSpec) {
formData.value.linkSpecName = selectedSpec.spec.name;
formData.value.costPrice = selectedSpec.spec.costPrice;
formData.value.productCost = selectedSpec.spec.productCost;
formData.value.shippingCost = selectedSpec.spec.shippingCost || 0;
formData.value.otherCost = selectedSpec.spec.otherCost || 0;
}
} else {
formData.value.linkSpecName = '';
formData.value.costPrice = 0;
formData.value.productCost = 0;
formData.value.shippingCost = 0;
formData.value.otherCost = 0;
}
}
@@ -274,7 +283,10 @@ async function open(edit: boolean, record?: OrderVO.Info) {
linkSpecName: record.linkSpecName,
quantity: record.quantity,
unitPrice: record.unitPrice,
costPrice: record.costPrice,
productCost: record.productCost,
shippingCost: record.shippingCost || 0,
otherCost: record.otherCost || 0,
remark: record.remark || '',
}
: {
shopId: undefined,
@@ -288,7 +300,10 @@ async function open(edit: boolean, record?: OrderVO.Info) {
linkSpecName: '',
quantity: 1,
unitPrice: 0,
costPrice: 0,
productCost: 0,
shippingCost: 0,
otherCost: 0,
remark: '',
};
// 如果是编辑模式且有商品ID,加载商品和规格选项
@@ -319,7 +334,9 @@ async function open(edit: boolean, record?: OrderVO.Info) {
spec: {
id: record.productSpecId,
name: record.linkSpecName || '',
costPrice: record.costPrice,
productCost: record.productCost,
shippingCost: record.shippingCost,
otherCost: record.otherCost,
} as ProductSpecVO.Info,
});
}
@@ -354,7 +371,10 @@ async function handleSubmit() {
linkSpecName: formData.value.linkSpecName,
quantity: formData.value.quantity,
unitPrice: formData.value.unitPrice,
costPrice: formData.value.costPrice,
productCost: formData.value.productCost,
shippingCost: formData.value.shippingCost,
otherCost: formData.value.otherCost,
remark: formData.value.remark,
};
await updateOrderApi(currentRecord.value.id, updateData);
message.success('更新订单成功');
@@ -372,7 +392,10 @@ async function handleSubmit() {
linkSpecName: formData.value.linkSpecName,
quantity: formData.value.quantity!,
unitPrice: formData.value.unitPrice!,
costPrice: formData.value.costPrice!,
productCost: formData.value.productCost!,
shippingCost: formData.value.shippingCost,
otherCost: formData.value.otherCost,
remark: formData.value.remark,
};
await createOrderApi(createData);
message.success('创建订单成功');
@@ -532,10 +555,10 @@ defineExpose({
/>
</Form.Item>
<Form.Item label="成本价" name="costPrice">
<Form.Item label="商品成本" name="productCost">
<InputNumber
v-model:value="formData.costPrice"
placeholder="请输入成本价"
v-model:value="formData.productCost"
placeholder="请输入商品成本"
style="width: 100%"
:min="0"
:precision="2"
@@ -543,6 +566,36 @@ defineExpose({
</Form.Item>
</div>
<div class="grid grid-cols-2 gap-4">
<Form.Item label="运费成本" name="shippingCost">
<InputNumber
v-model:value="formData.shippingCost"
placeholder="请输入运费成本"
style="width: 100%"
:min="0"
:precision="2"
/>
</Form.Item>
<Form.Item label="其他成本" name="otherCost">
<InputNumber
v-model:value="formData.otherCost"
placeholder="请输入其他成本"
style="width: 100%"
:min="0"
:precision="2"
/>
</Form.Item>
</div>
<Form.Item label="备注" name="remark">
<Input.TextArea
v-model:value="formData.remark"
placeholder="请输入备注"
:rows="3"
/>
</Form.Item>
<Form.Item label="实收金额" name="receivedAmount">
<InputNumber
v-model:value="formData.receivedAmount"