fix: discount issues

This commit is contained in:
Rogee
2025-05-06 17:59:05 +08:00
parent 272d041f58
commit 3387fb6cff

View File

@@ -47,7 +47,7 @@ const formatPrice = (price) => {
};
const getDiscountAmount = (price, discount) => {
return (price * discount / 100);
return (price * (100 - discount) / 100);
};
const getFinalPrice = (price, discount) => {
@@ -89,25 +89,6 @@ const onSearch = (event) => {
}, 300);
};
const handleDelete = (order) => {
confirm.require({
message: `确定要删除订单 "${order.id}" 吗?`,
header: '确认删除',
icon: 'pi pi-exclamation-triangle',
acceptClass: 'p-button-danger',
accept: async () => {
try {
await orderService.deleteOrder(order.id);
toast.add({ severity: 'success', summary: '成功', detail: '订单已删除', life: 3000 });
fetchOrders();
} catch (error) {
console.error('Failed to delete order:', error);
toast.add({ severity: 'error', summary: '错误', detail: '删除订单失败', life: 3000 });
}
}
});
};
onMounted(() => {
fetchOrders();
});