Commit 4344d1d2 by chenwq

```

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

- 新增hasAppealDetail计算属性来判断是否显示申诉详情
- 增加appealLoaded状态控制加载完成后的空状态显示
- 添加fallback机制处理申诉数据异常情况
- 新增订单已取消的空状态展示UI
- 优化申诉数据获取逻辑,增加异常处理和默认值
```
1 parent 0e839fd0
<template>
<view class="cancel-panel">
<view class="section-title">
<image class="section-title-bar" src="/static/images/order/icon_title_bar.png" mode="scaleToFill"></image>
<text>取消详情</text>
</view>
<template v-if="appeal?.appealState === 'CLOSED'">
<template v-if="hasAppealDetail">
<view class="section-title">
<image class="section-title-bar" src="/static/images/order/icon_title_bar.png" mode="scaleToFill"></image>
<text>取消详情</text>
</view>
<view class="cancel-row">
<text class="cancel-label">责任判定</text>
<text class="cancel-value">{{ $t('enum.appeal.appealResult.' + appeal.appealResult) }}</text>
......@@ -30,6 +30,11 @@
<text class="cancel-value cancel-value--desc">{{ appeal.solutionDesc }}</text>
</view>
</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>
</template>
......@@ -49,23 +54,48 @@ export default class OrderCanceledInfoPanel extends Vue {
order: CanceledOrder;
appeal: Appeal = null;
appealLoaded = false;
mounted(): void {
this.loadAppeal();
}
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)
.then((res) => {
this.appeal = res.data;
console.log(this.appeal);
this.appeal = this.normalizeAppeal(res.data) || this.getFallbackAppeal();
})
.catch(() => {
const list = this.order?.appeals || [];
this.appeal = Array.isArray(list) && list.length > 0 ? list[list.length - 1] : null;
this.appeal = this.getFallbackAppeal();
})
.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>
......@@ -77,6 +107,30 @@ export default class OrderCanceledInfoPanel extends Vue {
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 {
display: flex;
align-items: center;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!