fix(order): 修复已取消订单退款标签及支付状态显示问题

- 新增 canShowRefundTag 函数,未支付订单不再展示退款标签
- 已取消(CANCELLED)订单的支付方式字段返回空字符串
- 修改 isUnpaid 函数,排除已取消订单被误判为未支付状态
This commit is contained in:
pikachu1995@126.com
2026-11-12 09:49:16 +08:00
parent 3d77c58e63
commit 52c92731c8

View File

@@ -73,7 +73,7 @@
</div>
<div class="goods-num">共{{ goods.num }}件</div>
<div class="goods-extra">
<el-tag v-if="refundPriceList(goods.isRefund) && !isUnpaid(order)" type="warning" size="small">{{ refundPriceList(goods.isRefund) }}</el-tag>
<el-tag v-if="canShowRefundTag(order, goods)" type="warning" size="small">{{ refundPriceList(goods.isRefund) }}</el-tag>
</div>
</div>
</div>
@@ -160,7 +160,7 @@
</div>
<div class="goods-num">共{{ goods.num }}件</div>
<div class="goods-extra">
<el-tag v-if="refundPriceList(goods.isRefund) && !isUnpaid(order)" type="warning" size="small">{{ refundPriceList(goods.isRefund) }}</el-tag>
<el-tag v-if="canShowRefundTag(order, goods)" type="warning" size="small">{{ refundPriceList(goods.isRefund) }}</el-tag>
</div>
</div>
</div>
@@ -264,6 +264,11 @@ function refundPriceList(status) {
return "";
}
}
function canShowRefundTag (order, goods) {
// 未支付订单未发生资金交易,不展示退款标签
if (!order || order.payStatus !== 'PAID') return false;
return !!refundPriceList(goods?.isRefund);
}
function goodsDetail (skuId, goodsId) {
// 跳转商品详情
let routeUrl = router.resolve({
@@ -445,13 +450,16 @@ function paymentLabel (order) {
if (order.paymentMethod && map[order.paymentMethod]) {
return map[order.paymentMethod]
}
if (order.orderStatus === 'CANCELLED') {
return ''
}
if (isUnpaid(order)) {
return '待支付'
}
return ''
}
function isUnpaid (order) {
return order.payStatus === 'UNPAID' || order.orderStatus === 'UNPAID'
return (order.payStatus === 'UNPAID' || order.orderStatus === 'UNPAID') && order.orderStatus !== 'CANCELLED'
}
watch(() => route.query.tag, () => {