|
|
@@ -134,9 +134,9 @@ export function useOrder(tableRef: Ref) {
|
|
|
minWidth: 85,
|
|
|
cellRenderer: ({ row }) => {
|
|
|
const statusMap: Record<string, { label: string; type: string }> = {
|
|
|
- "unpaid": { label: "待支付", type: "warning" },
|
|
|
- "paid": { label: "已支付", type: "success" },
|
|
|
- "refund": { label: "已退款", type: "danger" }
|
|
|
+ "UNPAID": { label: "待支付", type: "warning" },
|
|
|
+ "PAID": { label: "已支付", type: "success" },
|
|
|
+ "REFUND": { label: "已退款", type: "danger" }
|
|
|
};
|
|
|
const status = statusMap[row.payStatus] || { label: "未知", type: "info" };
|
|
|
return <el-tag type={status.type as any}>{status.label}</el-tag>;
|
|
|
@@ -244,85 +244,140 @@ export function useOrder(tableRef: Ref) {
|
|
|
try {
|
|
|
const { data } = await getOrderById(row.id);
|
|
|
const order = data;
|
|
|
-
|
|
|
+
|
|
|
+ // 支付状态样式
|
|
|
+ const payStatusStyle = order.payStatus === "PAID"
|
|
|
+ ? "success" : order.payStatus === "REFUND"
|
|
|
+ ? "danger" : "warning";
|
|
|
+ const payStatusText = order.payStatusLabel || (order.payStatus === "PAID" ? "已支付" : order.payStatus === "REFUND" ? "已退款" : "待支付");
|
|
|
+
|
|
|
+ // 订单状态样式
|
|
|
+ const statusStyle = order.status === 1
|
|
|
+ ? "success" : order.status === 3
|
|
|
+ ? "danger" : order.status === 2
|
|
|
+ ? "info" : "warning";
|
|
|
+ const statusText = order.statusText || (order.status === 0 ? "待支付" : order.status === 1 ? "已完成" : order.status === 2 ? "已取消" : "已退款");
|
|
|
+
|
|
|
+ // 支付方式样式
|
|
|
+ const payTypeMap: Record<string, { text: string; type: string }> = {
|
|
|
+ "wechat": { text: "微信支付", type: "success" },
|
|
|
+ "alipay": { text: "支付宝", type: "primary" },
|
|
|
+ "cash": { text: "现金", type: "warning" },
|
|
|
+ "free": { text: "免费", type: "info" }
|
|
|
+ };
|
|
|
+ const payType = payTypeMap[order.payType] || { text: order.payType || "-", type: "info" };
|
|
|
+
|
|
|
addDialog({
|
|
|
- title: `订单详情 - ${order.orderNo}`,
|
|
|
- width: "70%",
|
|
|
+ title: `订单详情`,
|
|
|
+ width: "720px",
|
|
|
draggable: true,
|
|
|
- fullscreen: deviceDetection(),
|
|
|
closeOnClickModal: false,
|
|
|
contentRenderer: () => (
|
|
|
- <div>
|
|
|
- <ElDescriptions column={2} border>
|
|
|
- <ElDescriptionsItem label="订单编号">{order.orderNo}</ElDescriptionsItem>
|
|
|
- <ElDescriptionsItem label="支付订单号">{order.outTradeNo || "-"}</ElDescriptionsItem>
|
|
|
- <ElDescriptionsItem label="用户 ID">{order.userId || "-"}</ElDescriptionsItem>
|
|
|
- <ElDescriptionsItem label="设备 ID">{order.deviceId || "-"}</ElDescriptionsItem>
|
|
|
+ <div style="max-height: 70vh; overflow-y: auto; padding: 0 4px;">
|
|
|
+ {/* 基本信息 */}
|
|
|
+ <div style="font-size: 15px; font-weight: 600; margin-bottom: 10px; color: var(--el-text-color-primary);">基本信息</div>
|
|
|
+ <ElDescriptions column={3} border size="small">
|
|
|
+ <ElDescriptionsItem label="订单编号" span={2}>{order.orderNo}</ElDescriptionsItem>
|
|
|
<ElDescriptionsItem label="门店名称">{order.shopName || "-"}</ElDescriptionsItem>
|
|
|
- <ElDescriptionsItem label="活动 ID">{order.activityId || "-"}</ElDescriptionsItem>
|
|
|
+ <ElDescriptionsItem label="支付订单号" span={2}>{order.outTradeNo || "-"}</ElDescriptionsItem>
|
|
|
+ <ElDescriptionsItem label="设备 ID">{order.deviceId || "-"}</ElDescriptionsItem>
|
|
|
+ <ElDescriptionsItem label="活动 ID" span={2}>{order.activityId || "-"}</ElDescriptionsItem>
|
|
|
+ <ElDescriptionsItem label="用户 ID">{order.userId || "-"}</ElDescriptionsItem>
|
|
|
+ </ElDescriptions>
|
|
|
+
|
|
|
+ {/* 金额与状态 */}
|
|
|
+ <div style="font-size: 15px; font-weight: 600; margin: 14px 0 10px; color: var(--el-text-color-primary);">金额与状态</div>
|
|
|
+ <ElDescriptions column={3} border size="small">
|
|
|
<ElDescriptionsItem label="订单金额">
|
|
|
- ¥{order.totalAmount || '0.00'}
|
|
|
+ <span>¥{order.totalAmount || "0.00"}</span>
|
|
|
</ElDescriptionsItem>
|
|
|
<ElDescriptionsItem label="优惠金额">
|
|
|
{order.discountAmount > 0 ? (
|
|
|
<el-tag type="success" size="small">-¥{order.discountAmount}</el-tag>
|
|
|
) : (
|
|
|
- <span class="text-gray-400">¥0.00</span>
|
|
|
+ <span style="color: #999">¥0.00</span>
|
|
|
)}
|
|
|
</ElDescriptionsItem>
|
|
|
<ElDescriptionsItem label="实付金额">
|
|
|
- <span class="text-red-600 font-bold text-lg">¥{order.paidAmount || (order.totalAmount || 0) - (order.discountAmount || 0)}</span>
|
|
|
+ <span style="color: #e6a23c; font-weight: 600; font-size: 15px;">¥{order.paidAmount || (order.totalAmount || 0) - (order.discountAmount || 0)}</span>
|
|
|
</ElDescriptionsItem>
|
|
|
<ElDescriptionsItem label="支付方式">
|
|
|
- <el-tag type={order.payType === "wechat" ? "success" : order.payType === "alipay" ? "primary" : "info"} size="small">
|
|
|
- {order.payType === "wechat" ? "微信支付" : order.payType === "alipay" ? "支付宝" : order.payType === "cash" ? "现金" : order.payType === "free" ? "免费" : order.payType || "-"}
|
|
|
- </el-tag>
|
|
|
+ <el-tag type={payType.type as any} size="small">{payType.text}</el-tag>
|
|
|
</ElDescriptionsItem>
|
|
|
<ElDescriptionsItem label="支付状态">
|
|
|
- <el-tag type={order.payStatus === "paid" ? "success" : order.payStatus === "refund" ? "danger" : "warning"}>
|
|
|
- {order.payStatus === "paid" ? "已支付" : order.payStatus === "refund" ? "已退款" : "待支付"}
|
|
|
- </el-tag>
|
|
|
+ <el-tag type={payStatusStyle as any} size="small">{payStatusText}</el-tag>
|
|
|
</ElDescriptionsItem>
|
|
|
<ElDescriptionsItem label="订单状态">
|
|
|
- <el-tag type={order.status === 1 ? "success" : order.status === 3 ? "danger" : order.status === 2 ? "info" : "warning"}>
|
|
|
- {order.status === 0 ? "待支付" : order.status === 1 ? "已完成" : order.status === 2 ? "已取消" : "已退款"}
|
|
|
- </el-tag>
|
|
|
- </ElDescriptionsItem>
|
|
|
- <ElDescriptionsItem label="下单时间">
|
|
|
- {dayjs(order.createTime).format("YYYY-MM-DD HH:mm:ss")}
|
|
|
+ <el-tag type={statusStyle as any} size="small">{statusText}</el-tag>
|
|
|
</ElDescriptionsItem>
|
|
|
- <ElDescriptionsItem label="支付时间">
|
|
|
- {order.payTime ? dayjs(order.payTime).format("YYYY-MM-DD HH:mm:ss") : "-"}
|
|
|
- </ElDescriptionsItem>
|
|
|
- {order.videoUrl && (
|
|
|
- <ElDescriptionsItem label="支付视频" span={2}>
|
|
|
- <video src={order.videoUrl} controls class="w-full max-w-md" />
|
|
|
- </ElDescriptionsItem>
|
|
|
- )}
|
|
|
- {order.confidence && (
|
|
|
- <ElDescriptionsItem label="置信度">
|
|
|
- {(order.confidence * 100).toFixed(2)}%
|
|
|
- </ElDescriptionsItem>
|
|
|
- )}
|
|
|
+ <ElDescriptionsItem label="下单时间">{dayjs(order.createTime).format("YYYY-MM-DD HH:mm:ss")}</ElDescriptionsItem>
|
|
|
+ <ElDescriptionsItem label="支付时间" span={2}>{order.payTime ? dayjs(order.payTime).format("YYYY-MM-DD HH:mm:ss") : "-"}</ElDescriptionsItem>
|
|
|
</ElDescriptions>
|
|
|
-
|
|
|
- <div class="mt-4">
|
|
|
- <div class="font-bold mb-2">订单商品</div>
|
|
|
- <ElTable data={order.items || []} border>
|
|
|
- <ElTableColumn prop="productName" label="商品名称" />
|
|
|
- <ElTableColumn
|
|
|
- prop="price"
|
|
|
- label="单价"
|
|
|
- formatter={({ price }) => `¥${((price || 0) / 100).toFixed(2)}`}
|
|
|
- />
|
|
|
- <ElTableColumn prop="quantity" label="数量" />
|
|
|
- <ElTableColumn
|
|
|
- prop="amount"
|
|
|
- label="小计"
|
|
|
- formatter={({ amount }) => `¥${((amount || 0) / 100).toFixed(2)}`}
|
|
|
- />
|
|
|
- </ElTable>
|
|
|
- </div>
|
|
|
+
|
|
|
+ {/* 视频与置信度 */}
|
|
|
+ {(order.videoUrl || order.confidence) && (
|
|
|
+ <>
|
|
|
+ <div style="font-size: 15px; font-weight: 600; margin: 14px 0 10px; color: var(--el-text-color-primary);">其他信息</div>
|
|
|
+ <ElDescriptions column={3} border size="small">
|
|
|
+ {order.videoUrl && (
|
|
|
+ <ElDescriptionsItem label="支付视频" span={3}>
|
|
|
+ <video src={order.videoUrl} controls style="width: 100%; max-width: 360px; max-height: 200px;" />
|
|
|
+ </ElDescriptionsItem>
|
|
|
+ )}
|
|
|
+ {order.confidence && (
|
|
|
+ <ElDescriptionsItem label="置信度">{(order.confidence * 100).toFixed(2)}%</ElDescriptionsItem>
|
|
|
+ )}
|
|
|
+ </ElDescriptions>
|
|
|
+ </>
|
|
|
+ )}
|
|
|
+
|
|
|
+ {/* 订单商品 */}
|
|
|
+ {order.products && order.products.length > 0 && (
|
|
|
+ <>
|
|
|
+ <div style="font-size: 15px; font-weight: 600; margin: 14px 0 10px; color: var(--el-text-color-primary);">订单商品</div>
|
|
|
+ <ElTable data={order.products} border size="small" style="width: 100%">
|
|
|
+ <ElTableColumn prop="productName" label="商品名称" min-width={140} />
|
|
|
+ <ElTableColumn
|
|
|
+ prop="pic"
|
|
|
+ label="图片"
|
|
|
+ width={70}
|
|
|
+ align="center"
|
|
|
+ v-slots={{
|
|
|
+ default: ({ row }: any) => row.pic ? (
|
|
|
+ <el-image src={row.pic} style="width: 40px; height: 40px" fit="cover" preview-teleported={true} preview-src-list={[row.pic]} />
|
|
|
+ ) : <span style="color: #999">-</span>
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <ElTableColumn
|
|
|
+ label="单价"
|
|
|
+ width={90}
|
|
|
+ align="right"
|
|
|
+ v-slots={{
|
|
|
+ default: ({ row }: any) => <span>¥{row.price || "0.00"}</span>
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <ElTableColumn
|
|
|
+ label="数量"
|
|
|
+ width={60}
|
|
|
+ align="center"
|
|
|
+ v-slots={{
|
|
|
+ default: ({ row }: any) => <span>×{row.productNum || 1}</span>
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <ElTableColumn
|
|
|
+ label="小计"
|
|
|
+ width={100}
|
|
|
+ align="right"
|
|
|
+ v-slots={{
|
|
|
+ default: ({ row }: any) => {
|
|
|
+ const subtotal = row.price && row.productNum ? (row.price * row.productNum) : 0;
|
|
|
+ return <span style="font-weight: 500">¥{subtotal.toFixed(2)}</span>;
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </ElTable>
|
|
|
+ </>
|
|
|
+ )}
|
|
|
</div>
|
|
|
),
|
|
|
hideFooter: true
|