后台
This commit is contained in:
parent
48cc0b4fa6
commit
639288be0c
|
|
@ -83,7 +83,10 @@
|
|||
<template #error><div style="width:60px;height:60px;background:#f5f5f5;border-radius:6px"></div></template>
|
||||
</el-image>
|
||||
<div style="flex:1;min-width:0">
|
||||
<div style="font-size:14px;font-weight:600;color:#333">{{ item.product_name }}</div>
|
||||
<div style="font-size:14px;font-weight:600;color:#333">
|
||||
{{ item.product_name }}
|
||||
<el-tag v-if="Number(item.returned_qty) > 0" type="danger" size="small" style="margin-left:8px">已退货</el-tag>
|
||||
</div>
|
||||
<div style="font-size:12px;color:#999;margin-top:4px">
|
||||
<span v-if="item.style_no" style="margin-right:12px">款号:{{ item.style_no }}</span>
|
||||
<span v-if="item.barcode" style="margin-right:12px">条形码:{{ item.barcode }}</span>
|
||||
|
|
@ -523,7 +526,7 @@
|
|||
</el-dialog>
|
||||
|
||||
<!-- Return Records Dialog -->
|
||||
<el-dialog v-model="showReturnRecordsDialog" title="退货记录" width="700px" top="5vh">
|
||||
<el-dialog v-model="showReturnRecordsDialog" title="退货记录" width="1060px" top="5vh">
|
||||
<div v-if="returnRecordsLoading" v-loading="true" style="min-height:120px"></div>
|
||||
<div v-else-if="returnRecords.length === 0" style="text-align:center;padding:40px;color:#999">暂无退货记录</div>
|
||||
<div v-else>
|
||||
|
|
@ -540,13 +543,20 @@
|
|||
<span v-if="record.refund_time" style="font-size:12px;color:#999">退款时间: {{ formatTime(record.refund_time) }}</span>
|
||||
<el-image v-if="record.refund_proof" :src="record.refund_proof" style="width:48px;height:48px;border-radius:4px" fit="cover" :preview-src-list="[record.refund_proof]" preview-teleported />
|
||||
</div>
|
||||
<el-table :data="record.items" size="small" stripe style="margin-top:8px">
|
||||
<el-table-column prop="productName" label="商品" min-width="140" />
|
||||
<el-table-column prop="modelName" label="规格名称" min-width="120" />
|
||||
<el-table-column prop="quantity" label="退货数量" width="80" align="center" />
|
||||
<el-table-column label="退款小计" width="100" align="right">
|
||||
<el-table :data="record.items" size="small" stripe border style="margin-top:8px"
|
||||
:header-cell-style="{ background:'#fafafa', fontWeight:600, fontSize:'12px' }"
|
||||
:cell-style="{ fontSize:'12px' }">
|
||||
<el-table-column prop="productName" label="商品名称" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="styleNo" label="款号" width="90" show-overflow-tooltip />
|
||||
<el-table-column prop="modelName" label="规格名称" width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="barcode" label="条形码" width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="fineness" label="成色" width="70" align="center" />
|
||||
<el-table-column prop="mainStone" label="主石" width="60" align="center" />
|
||||
<el-table-column prop="subStone" label="副石" width="60" align="center" />
|
||||
<el-table-column prop="ringSize" label="手寸" width="50" align="center" />
|
||||
<el-table-column label="价格" width="100" align="right">
|
||||
<template #default="{ row }">
|
||||
<span style="color:#e4393c">¥{{ (row.quantity * Number(row.unitPrice)).toFixed(2) }}</span>
|
||||
<span style="color:#e4393c;font-weight:600">¥{{ Number(row.unitPrice).toFixed(2) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
|
|||
|
|
@ -98,7 +98,8 @@ export async function adminGetOrders(req: Request, res: Response): Promise<void>
|
|||
const [itemRows] = await pool.execute<RowDataPacket[]>(
|
||||
`SELECT oi.order_id, oi.id, oi.product_id, oi.spec_data_id, oi.quantity, oi.unit_price, oi.spec_snapshot,
|
||||
p.name as product_name, p.thumb, p.banner_images, p.style_no,
|
||||
sd.model_name, sd.fineness, sd.main_stone, sd.sub_stone, sd.ring_size, sd.barcode
|
||||
sd.model_name, sd.fineness, sd.main_stone, sd.sub_stone, sd.ring_size, sd.barcode,
|
||||
IFNULL((SELECT SUM(ori.quantity) FROM order_return_items ori WHERE ori.order_item_id = oi.id), 0) as returned_qty
|
||||
FROM order_items oi
|
||||
LEFT JOIN products p ON oi.product_id = p.id
|
||||
LEFT JOIN spec_data sd ON oi.spec_data_id = sd.id
|
||||
|
|
@ -488,7 +489,14 @@ export async function adminGetOrderReturns(req: Request, res: Response): Promise
|
|||
'quantity', ri.quantity,
|
||||
'unitPrice', ri.unit_price,
|
||||
'productName', IFNULL(p.name, ''),
|
||||
'modelName', IFNULL(sd.model_name, '')
|
||||
'styleNo', IFNULL(p.style_no, ''),
|
||||
'modelName', IFNULL(sd.model_name, ''),
|
||||
'barcode', IFNULL(sd.barcode, ''),
|
||||
'fineness', IFNULL(sd.fineness, ''),
|
||||
'mainStone', IFNULL(sd.main_stone, ''),
|
||||
'subStone', IFNULL(sd.sub_stone, ''),
|
||||
'ringSize', IFNULL(sd.ring_size, ''),
|
||||
'specSnapshot', oi.spec_snapshot
|
||||
)
|
||||
) AS items
|
||||
FROM order_returns r
|
||||
|
|
@ -504,6 +512,19 @@ export async function adminGetOrderReturns(req: Request, res: Response): Promise
|
|||
|
||||
for (const r of returns as any[]) {
|
||||
if (typeof r.items === 'string') r.items = JSON.parse(r.items)
|
||||
// Fill from snapshot if spec_data was deleted
|
||||
for (const item of r.items || []) {
|
||||
if (!item.modelName && item.specSnapshot) {
|
||||
const snap = typeof item.specSnapshot === 'string' ? JSON.parse(item.specSnapshot) : item.specSnapshot
|
||||
item.modelName = snap.model_name || ''
|
||||
item.barcode = snap.barcode || ''
|
||||
item.fineness = snap.fineness || ''
|
||||
item.mainStone = snap.main_stone || ''
|
||||
item.subStone = snap.sub_stone || ''
|
||||
item.ringSize = snap.ring_size || ''
|
||||
}
|
||||
delete item.specSnapshot
|
||||
}
|
||||
}
|
||||
|
||||
res.json({ code: 0, data: returns })
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user