hookehuyr

feat(订单): 添加分账状态支持并优化订单状态筛选逻辑

- 在样式文件中添加分账成功和失败的样式
- 更新订单状态枚举文档
- 重构订单状态筛选逻辑,区分不同视图模式
- 添加分账状态文本和样式映射
/*
* @Date: 2025-07-03 17:21:45
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-08-06 13:56:19
* @LastEditTime: 2025-08-06 15:02:23
* @FilePath: /jgdl/src/api/orders.js
* @Description: 文件描述
*/
......@@ -24,7 +24,7 @@ const Api = {
* @param page 页码,从0开始
* @param page_size 每页数量
* @param type 列表类型。buy=我买的,sell=我卖的
* @param status 订单状态(3=待支付, 5=已支付待发货, 7=已取消, 9=已发货/待收货, 11=已收货, 13=退款中, 15=已退款, 17=退款失败)
* @param status 订单状态(3=待支付, 5=已支付待发货, 7=已取消, 9=已发货/待收货, 11=已收货分账中, 13=退款中, 15=已退款, 17=退款失败, 19=分账成功, 21=分账失败)
* @returns data{ list[{ id, title, total_amount, status, create_time, payment_time, details{ id, vehicle_id, quantity, vehicle{} } }] }
*/
export const getOrderListAPI = (params) => fn(fetch.get(Api.GET_ORDER_LIST, params));
......
......@@ -247,6 +247,14 @@
&.status-refund-failed {
color: #f97316;
}
&.status-profit-sharing-success {
color: #10b981;
}
&.status-profit-sharing-failed {
color: #f97316;
}
}
/* 车辆信息 */
......@@ -543,6 +551,14 @@
color: #f97316;
font-weight: 600;
}
&.status-profit-sharing-success {
color: #10b981;
}
&.status-profit-sharing-failed {
color: #f97316;
}
}
}
......
......@@ -29,30 +29,54 @@
<view class="tab-item" :class="{ active: activeTab === '' }" @click="setActiveTab('')">
全部
</view>
<view v-if="viewMode === 'buy' || viewMode === 'verification'" class="tab-item"
:class="{ active: activeTab === 3 }" @click="setActiveTab(3)">
<!-- 我买的车状态筛选 -->
<template v-if="viewMode === 'buy'">
<view class="tab-item" :class="{ active: activeTab === 3 }" @click="setActiveTab(3)">
待支付
</view>
<view v-if="viewMode === 'verification'" class="tab-item" :class="{ active: activeTab === 5 }"
@click="setActiveTab(5)">
已付款
</view>
<view v-if="viewMode === 'buy' || viewMode === 'sell'" class="tab-item" :class="{ active: activeTab === 9 }"
@click="setActiveTab(9)">
<view class="tab-item" :class="{ active: activeTab === 9 }" @click="setActiveTab(9)">
待收货
</view>
<view v-if="viewMode === 'buy' || viewMode === 'sell'" class="tab-item" :class="{ active: activeTab === 11 }"
@click="setActiveTab(11)">
<view class="tab-item" :class="{ active: activeTab === 'completed' }" @click="setActiveTab('completed')">
已完成
</view>
<view v-if="viewMode === 'buy' || viewMode === 'sell' || viewMode === 'verification'" class="tab-item"
:class="{ active: activeTab === 7 }" @click="setActiveTab(7)">
<view class="tab-item" :class="{ active: activeTab === 7 }" @click="setActiveTab(7)">
已取消
</view>
<view v-if="viewMode === 'verification'" class="tab-item" :class="{ active: activeTab === 15 }"
@click="setActiveTab(15)">
</template>
<!-- 我卖的车状态筛选 -->
<template v-if="viewMode === 'sell'">
<view class="tab-item" :class="{ active: activeTab === 5 }" @click="setActiveTab(5)">
待发货
</view>
<view class="tab-item" :class="{ active: activeTab === 9 }" @click="setActiveTab(9)">
待收货
</view>
<view class="tab-item" :class="{ active: activeTab === 'profit_sharing' }" @click="setActiveTab('profit_sharing')">
分账
</view>
<view class="tab-item" :class="{ active: activeTab === 7 }" @click="setActiveTab(7)">
已取消
</view>
</template>
<!-- 我的认证状态筛选 -->
<template v-if="viewMode === 'verification'">
<view class="tab-item" :class="{ active: activeTab === 3 }" @click="setActiveTab(3)">
待支付
</view>
<view class="tab-item" :class="{ active: activeTab === 5 }" @click="setActiveTab(5)">
已付款
</view>
<view class="tab-item" :class="{ active: activeTab === 9 }" @click="setActiveTab(9)">
待收货
</view>
<view class="tab-item" :class="{ active: activeTab === 7 }" @click="setActiveTab(7)">
已取消
</view>
<view class="tab-item" :class="{ active: activeTab === 15 }" @click="setActiveTab(15)">
退款
</view>
</template>
</view>
</nut-sticky>
......@@ -603,8 +627,22 @@ const loadOrderData = async (isLoadMore = false) => {
loading.value = true
const type = viewMode.value === 'buy' ? 'buy' : viewMode.value === 'verification' ? 'verification' : 'sell'
// 处理退款状态:当activeTab为15时,查询状态15(已退款)和17(退款失败)
const status = activeTab.value === 15 ? [15, 17] : (activeTab.value || undefined)
// 处理状态筛选逻辑
let status = undefined
if (activeTab.value === 'completed') {
// 我买的车:已完成状态包括 11=已收货分账中,19=分账成功, 21=分账失败
status = [11, 19, 21]
} else if (activeTab.value === 'profit_sharing') {
// 我卖的车:分账状态包括 11=已收货分账中,19=分账成功, 21=分账失败
status = [11, 19, 21]
} else if (activeTab.value === 15) {
// 认证模式:退款状态包括 15=已退款和17=退款失败
status = [15, 17]
} else if (activeTab.value) {
// 其他单一状态
status = activeTab.value
}
const page = isLoadMore ? currentPage.value + 1 : 0
// TAG: 添加mock数据用于测试
......@@ -758,11 +796,11 @@ const getStatusText = (status) => {
case 3:
return '待支付'
case 5:
return viewMode.value === 'verification' ? '已付款' : '待收货'
return viewMode.value === 'verification' ? '已付款' : (viewMode.value === 'sell' ? '待发货' : '待收货')
case 9:
return '待收货'
case 11:
return '已完成'
return viewMode.value === 'sell' ? '已收货分账中' : '已完成'
case 7:
return '已取消'
case 13:
......@@ -771,6 +809,10 @@ const getStatusText = (status) => {
return '已退款'
case 17:
return '退款失败'
case 19:
return viewMode.value === 'sell' ? '分账成功' : '已完成'
case 21:
return viewMode.value === 'sell' ? '分账失败' : '已完成'
default:
return '未知状态'
}
......@@ -797,6 +839,10 @@ const getStatusClass = (status) => {
return 'status-refund-success'
case 17:
return 'status-refund-failed'
case 19:
return 'status-profit-sharing-success'
case 21:
return 'status-profit-sharing-failed'
default:
return ''
}
......