Commit 4344d1d2 by chenwq

```

feat(order): 订单取消详情面板增加申诉状态判断和空状态显示

- 新增hasAppealDetail计算属性来判断是否显示申诉详情
- 增加appealLoaded状态控制加载完成后的空状态显示
- 添加fallback机制处理申诉数据异常情况
- 新增订单已取消的空状态展示UI
- 优化申诉数据获取逻辑,增加异常处理和默认值
```
1 parent 0e839fd0
<template> <template>
<view class="cancel-panel"> <view class="cancel-panel">
<view class="section-title"> <template v-if="hasAppealDetail">
<image class="section-title-bar" src="/static/images/order/icon_title_bar.png" mode="scaleToFill"></image> <view class="section-title">
<text>取消详情</text> <image class="section-title-bar" src="/static/images/order/icon_title_bar.png" mode="scaleToFill"></image>
</view> <text>取消详情</text>
<template v-if="appeal?.appealState === 'CLOSED'"> </view>
<view class="cancel-row"> <view class="cancel-row">
<text class="cancel-label">责任判定</text> <text class="cancel-label">责任判定</text>
<text class="cancel-value">{{ $t('enum.appeal.appealResult.' + appeal.appealResult) }}</text> <text class="cancel-value">{{ $t('enum.appeal.appealResult.' + appeal.appealResult) }}</text>
...@@ -30,6 +30,11 @@ ...@@ -30,6 +30,11 @@
<text class="cancel-value cancel-value--desc">{{ appeal.solutionDesc }}</text> <text class="cancel-value cancel-value--desc">{{ appeal.solutionDesc }}</text>
</view> </view>
</template> </template>
<view v-else-if="appealLoaded" class="cancel-empty">
<image class="cancel-empty__image" src="https://img02.glsx.com.cn/weapp/resource/dj-aus/images/order/icon_empty.png"
mode="aspectFit"></image>
<text class="cancel-empty__text">订单已取消</text>
</view>
</view> </view>
</template> </template>
...@@ -49,23 +54,48 @@ export default class OrderCanceledInfoPanel extends Vue { ...@@ -49,23 +54,48 @@ export default class OrderCanceledInfoPanel extends Vue {
order: CanceledOrder; order: CanceledOrder;
appeal: Appeal = null; appeal: Appeal = null;
appealLoaded = false;
mounted(): void { mounted(): void {
this.loadAppeal(); this.loadAppeal();
} }
loadAppeal(): void { loadAppeal(): void {
if (!this.order?.orderId) return; this.appealLoaded = false;
if (!this.order?.orderId) {
this.appeal = this.getFallbackAppeal();
this.appealLoaded = true;
return;
}
AppealController.getAppealByOrderId(this.axios, this.order.orderId) AppealController.getAppealByOrderId(this.axios, this.order.orderId)
.then((res) => { .then((res) => {
this.appeal = res.data; this.appeal = this.normalizeAppeal(res.data) || this.getFallbackAppeal();
console.log(this.appeal);
}) })
.catch(() => { .catch(() => {
const list = this.order?.appeals || []; this.appeal = this.getFallbackAppeal();
this.appeal = Array.isArray(list) && list.length > 0 ? list[list.length - 1] : null; })
.finally(() => {
this.appealLoaded = true;
}); });
} }
get hasAppealDetail(): boolean {
return this.appealDetailAvailable(this.appeal);
}
getFallbackAppeal(): Appeal | null {
const list = this.order?.appeals || [];
return Array.isArray(list) && list.length > 0 ? this.normalizeAppeal(list[list.length - 1]) : null;
}
normalizeAppeal(appeal: Appeal | null | undefined): Appeal | null {
if (!appeal || Object.keys(appeal).length === 0) return null;
return appeal;
}
appealDetailAvailable(appeal: Appeal | null): boolean {
return appeal?.appealState === "CLOSED";
}
} }
</script> </script>
...@@ -77,6 +107,30 @@ export default class OrderCanceledInfoPanel extends Vue { ...@@ -77,6 +107,30 @@ export default class OrderCanceledInfoPanel extends Vue {
box-sizing: border-box; box-sizing: border-box;
} }
.cancel-empty {
min-height: 228px;
padding: 0 0 20px;
box-sizing: border-box;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.cancel-empty__image {
width: 136px;
height: 136px;
flex-shrink: 0;
}
.cancel-empty__text {
margin-top: 6px;
font-size: 18px;
line-height: 25px;
color: #999;
text-align: center;
}
.section-title { .section-title {
display: flex; display: flex;
align-items: center; align-items: center;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!