|
@@ -80,23 +80,38 @@ export function useOrder(tableRef: Ref) {
|
|
|
{
|
|
{
|
|
|
label: "订单金额",
|
|
label: "订单金额",
|
|
|
prop: "totalAmount",
|
|
prop: "totalAmount",
|
|
|
- minWidth: 90,
|
|
|
|
|
- formatter: ({ totalAmount }) => totalAmount ? `¥${(totalAmount / 100).toFixed(2)}` : "¥0.00"
|
|
|
|
|
|
|
+ minWidth: 100,
|
|
|
|
|
+ formatter: ({ totalAmount }) => totalAmount ? `¥${totalAmount}` : "¥0.00"
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- label: "实付金额",
|
|
|
|
|
- prop: "totalAmount",
|
|
|
|
|
- minWidth: 90,
|
|
|
|
|
- formatter: ({ totalAmount, discountAmount }) => {
|
|
|
|
|
- const payAmount = (totalAmount || 0) - (discountAmount || 0);
|
|
|
|
|
- return `¥${(payAmount / 100).toFixed(2)}`;
|
|
|
|
|
|
|
+ label: "优惠金额",
|
|
|
|
|
+ prop: "discountAmount",
|
|
|
|
|
+ minWidth: 100,
|
|
|
|
|
+ formatter: ({ discountAmount }) => {
|
|
|
|
|
+ const amount = discountAmount || 0;
|
|
|
|
|
+ return amount > 0 ? `¥${amount}` : "¥0.00";
|
|
|
|
|
+ },
|
|
|
|
|
+ cellRenderer: ({ row }) => {
|
|
|
|
|
+ const amount = row.discountAmount || 0;
|
|
|
|
|
+ if (amount > 0) {
|
|
|
|
|
+ return <el-tag type="success" size="small">-¥{amount}</el-tag>;
|
|
|
|
|
+ }
|
|
|
|
|
+ return <span class="text-gray-400">¥0.00</span>;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- label: "优惠金额",
|
|
|
|
|
- prop: "discountAmount",
|
|
|
|
|
- minWidth: 90,
|
|
|
|
|
- formatter: ({ discountAmount }) => discountAmount ? `¥${(discountAmount / 100).toFixed(2)}` : "¥0.00"
|
|
|
|
|
|
|
+ label: "实付金额",
|
|
|
|
|
+ prop: "paidAmount",
|
|
|
|
|
+ minWidth: 100,
|
|
|
|
|
+ formatter: ({ paidAmount, totalAmount, discountAmount }) => {
|
|
|
|
|
+ // 优先使用paidAmount,如果没有则计算
|
|
|
|
|
+ const amount = paidAmount || (totalAmount || 0) - (discountAmount || 0);
|
|
|
|
|
+ return `¥${amount}`;
|
|
|
|
|
+ },
|
|
|
|
|
+ cellRenderer: ({ row }) => {
|
|
|
|
|
+ const amount = row.paidAmount || (row.totalAmount || 0) - (row.discountAmount || 0);
|
|
|
|
|
+ return <span class="text-red-600 font-bold">¥{amount}</span>;
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
label: "支付方式",
|
|
label: "支付方式",
|
|
@@ -246,13 +261,17 @@ export function useOrder(tableRef: Ref) {
|
|
|
<ElDescriptionsItem label="门店名称">{order.shopName || "-"}</ElDescriptionsItem>
|
|
<ElDescriptionsItem label="门店名称">{order.shopName || "-"}</ElDescriptionsItem>
|
|
|
<ElDescriptionsItem label="活动 ID">{order.activityId || "-"}</ElDescriptionsItem>
|
|
<ElDescriptionsItem label="活动 ID">{order.activityId || "-"}</ElDescriptionsItem>
|
|
|
<ElDescriptionsItem label="订单金额">
|
|
<ElDescriptionsItem label="订单金额">
|
|
|
- ¥{((order.totalAmount || 0) / 100).toFixed(2)}
|
|
|
|
|
- </ElDescriptionsItem>
|
|
|
|
|
- <ElDescriptionsItem label="实付金额">
|
|
|
|
|
- ¥{(((order.totalAmount || 0) - (order.discountAmount || 0)) / 100).toFixed(2)}
|
|
|
|
|
|
|
+ ¥{order.totalAmount || '0.00'}
|
|
|
</ElDescriptionsItem>
|
|
</ElDescriptionsItem>
|
|
|
<ElDescriptionsItem label="优惠金额">
|
|
<ElDescriptionsItem label="优惠金额">
|
|
|
- ¥{((order.discountAmount || 0) / 100).toFixed(2)}
|
|
|
|
|
|
|
+ {order.discountAmount > 0 ? (
|
|
|
|
|
+ <el-tag type="success" size="small">-¥{order.discountAmount}</el-tag>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <span class="text-gray-400">¥0.00</span>
|
|
|
|
|
+ )}
|
|
|
|
|
+ </ElDescriptionsItem>
|
|
|
|
|
+ <ElDescriptionsItem label="实付金额">
|
|
|
|
|
+ <span class="text-red-600 font-bold text-lg">¥{order.paidAmount || (order.totalAmount || 0) - (order.discountAmount || 0)}</span>
|
|
|
</ElDescriptionsItem>
|
|
</ElDescriptionsItem>
|
|
|
<ElDescriptionsItem label="支付方式">
|
|
<ElDescriptionsItem label="支付方式">
|
|
|
<el-tag type={order.payType === "wechat" ? "success" : order.payType === "alipay" ? "primary" : "info"} size="small">
|
|
<el-tag type={order.payType === "wechat" ? "success" : order.payType === "alipay" ? "primary" : "info"} size="small">
|