hookehuyr

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

- 在样式文件中添加分账成功和失败的样式
- 更新订单状态枚举文档
- 重构订单状态筛选逻辑,区分不同视图模式
- 添加分账状态文本和样式映射
1 /* 1 /*
2 * @Date: 2025-07-03 17:21:45 2 * @Date: 2025-07-03 17:21:45
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-08-06 13:56:19 4 + * @LastEditTime: 2025-08-06 15:02:23
5 * @FilePath: /jgdl/src/api/orders.js 5 * @FilePath: /jgdl/src/api/orders.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -24,7 +24,7 @@ const Api = { ...@@ -24,7 +24,7 @@ const Api = {
24 * @param page 页码,从0开始 24 * @param page 页码,从0开始
25 * @param page_size 每页数量 25 * @param page_size 每页数量
26 * @param type 列表类型。buy=我买的,sell=我卖的 26 * @param type 列表类型。buy=我买的,sell=我卖的
27 - * @param status 订单状态(3=待支付, 5=已支付待发货, 7=已取消, 9=已发货/待收货, 11=已收货, 13=退款中, 15=已退款, 17=退款失败) 27 + * @param status 订单状态(3=待支付, 5=已支付待发货, 7=已取消, 9=已发货/待收货, 11=已收货分账中, 13=退款中, 15=已退款, 17=退款失败, 19=分账成功, 21=分账失败)
28 * @returns data{ list[{ id, title, total_amount, status, create_time, payment_time, details{ id, vehicle_id, quantity, vehicle{} } }] } 28 * @returns data{ list[{ id, title, total_amount, status, create_time, payment_time, details{ id, vehicle_id, quantity, vehicle{} } }] }
29 */ 29 */
30 export const getOrderListAPI = (params) => fn(fetch.get(Api.GET_ORDER_LIST, params)); 30 export const getOrderListAPI = (params) => fn(fetch.get(Api.GET_ORDER_LIST, params));
......
...@@ -247,6 +247,14 @@ ...@@ -247,6 +247,14 @@
247 &.status-refund-failed { 247 &.status-refund-failed {
248 color: #f97316; 248 color: #f97316;
249 } 249 }
250 +
251 + &.status-profit-sharing-success {
252 + color: #10b981;
253 + }
254 +
255 + &.status-profit-sharing-failed {
256 + color: #f97316;
257 + }
250 } 258 }
251 259
252 /* 车辆信息 */ 260 /* 车辆信息 */
...@@ -543,6 +551,14 @@ ...@@ -543,6 +551,14 @@
543 color: #f97316; 551 color: #f97316;
544 font-weight: 600; 552 font-weight: 600;
545 } 553 }
554 +
555 + &.status-profit-sharing-success {
556 + color: #10b981;
557 + }
558 +
559 + &.status-profit-sharing-failed {
560 + color: #f97316;
561 + }
546 } 562 }
547 } 563 }
548 564
......
...@@ -29,30 +29,54 @@ ...@@ -29,30 +29,54 @@
29 <view class="tab-item" :class="{ active: activeTab === '' }" @click="setActiveTab('')"> 29 <view class="tab-item" :class="{ active: activeTab === '' }" @click="setActiveTab('')">
30 全部 30 全部
31 </view> 31 </view>
32 - <view v-if="viewMode === 'buy' || viewMode === 'verification'" class="tab-item" 32 + <!-- 我买的车状态筛选 -->
33 - :class="{ active: activeTab === 3 }" @click="setActiveTab(3)"> 33 + <template v-if="viewMode === 'buy'">
34 - 待支付 34 + <view class="tab-item" :class="{ active: activeTab === 3 }" @click="setActiveTab(3)">
35 - </view> 35 + 待支付
36 - <view v-if="viewMode === 'verification'" class="tab-item" :class="{ active: activeTab === 5 }" 36 + </view>
37 - @click="setActiveTab(5)"> 37 + <view class="tab-item" :class="{ active: activeTab === 9 }" @click="setActiveTab(9)">
38 - 已付款 38 + 待收货
39 - </view> 39 + </view>
40 - <view v-if="viewMode === 'buy' || viewMode === 'sell'" class="tab-item" :class="{ active: activeTab === 9 }" 40 + <view class="tab-item" :class="{ active: activeTab === 'completed' }" @click="setActiveTab('completed')">
41 - @click="setActiveTab(9)"> 41 + 已完成
42 - 待收货 42 + </view>
43 - </view> 43 + <view class="tab-item" :class="{ active: activeTab === 7 }" @click="setActiveTab(7)">
44 - <view v-if="viewMode === 'buy' || viewMode === 'sell'" class="tab-item" :class="{ active: activeTab === 11 }" 44 + 已取消
45 - @click="setActiveTab(11)"> 45 + </view>
46 - 已完成 46 + </template>
47 - </view> 47 + <!-- 我卖的车状态筛选 -->
48 - <view v-if="viewMode === 'buy' || viewMode === 'sell' || viewMode === 'verification'" class="tab-item" 48 + <template v-if="viewMode === 'sell'">
49 - :class="{ active: activeTab === 7 }" @click="setActiveTab(7)"> 49 + <view class="tab-item" :class="{ active: activeTab === 5 }" @click="setActiveTab(5)">
50 - 已取消 50 + 待发货
51 - </view> 51 + </view>
52 - <view v-if="viewMode === 'verification'" class="tab-item" :class="{ active: activeTab === 15 }" 52 + <view class="tab-item" :class="{ active: activeTab === 9 }" @click="setActiveTab(9)">
53 - @click="setActiveTab(15)"> 53 + 待收货
54 - 退款 54 + </view>
55 - </view> 55 + <view class="tab-item" :class="{ active: activeTab === 'profit_sharing' }" @click="setActiveTab('profit_sharing')">
56 + 分账
57 + </view>
58 + <view class="tab-item" :class="{ active: activeTab === 7 }" @click="setActiveTab(7)">
59 + 已取消
60 + </view>
61 + </template>
62 + <!-- 我的认证状态筛选 -->
63 + <template v-if="viewMode === 'verification'">
64 + <view class="tab-item" :class="{ active: activeTab === 3 }" @click="setActiveTab(3)">
65 + 待支付
66 + </view>
67 + <view class="tab-item" :class="{ active: activeTab === 5 }" @click="setActiveTab(5)">
68 + 已付款
69 + </view>
70 + <view class="tab-item" :class="{ active: activeTab === 9 }" @click="setActiveTab(9)">
71 + 待收货
72 + </view>
73 + <view class="tab-item" :class="{ active: activeTab === 7 }" @click="setActiveTab(7)">
74 + 已取消
75 + </view>
76 + <view class="tab-item" :class="{ active: activeTab === 15 }" @click="setActiveTab(15)">
77 + 退款
78 + </view>
79 + </template>
56 </view> 80 </view>
57 </nut-sticky> 81 </nut-sticky>
58 82
...@@ -603,8 +627,22 @@ const loadOrderData = async (isLoadMore = false) => { ...@@ -603,8 +627,22 @@ const loadOrderData = async (isLoadMore = false) => {
603 loading.value = true 627 loading.value = true
604 628
605 const type = viewMode.value === 'buy' ? 'buy' : viewMode.value === 'verification' ? 'verification' : 'sell' 629 const type = viewMode.value === 'buy' ? 'buy' : viewMode.value === 'verification' ? 'verification' : 'sell'
606 - // 处理退款状态:当activeTab为15时,查询状态15(已退款)和17(退款失败) 630 +
607 - const status = activeTab.value === 15 ? [15, 17] : (activeTab.value || undefined) 631 + // 处理状态筛选逻辑
632 + let status = undefined
633 + if (activeTab.value === 'completed') {
634 + // 我买的车:已完成状态包括 11=已收货分账中,19=分账成功, 21=分账失败
635 + status = [11, 19, 21]
636 + } else if (activeTab.value === 'profit_sharing') {
637 + // 我卖的车:分账状态包括 11=已收货分账中,19=分账成功, 21=分账失败
638 + status = [11, 19, 21]
639 + } else if (activeTab.value === 15) {
640 + // 认证模式:退款状态包括 15=已退款和17=退款失败
641 + status = [15, 17]
642 + } else if (activeTab.value) {
643 + // 其他单一状态
644 + status = activeTab.value
645 + }
608 const page = isLoadMore ? currentPage.value + 1 : 0 646 const page = isLoadMore ? currentPage.value + 1 : 0
609 647
610 // TAG: 添加mock数据用于测试 648 // TAG: 添加mock数据用于测试
...@@ -758,11 +796,11 @@ const getStatusText = (status) => { ...@@ -758,11 +796,11 @@ const getStatusText = (status) => {
758 case 3: 796 case 3:
759 return '待支付' 797 return '待支付'
760 case 5: 798 case 5:
761 - return viewMode.value === 'verification' ? '已付款' : '待收货' 799 + return viewMode.value === 'verification' ? '已付款' : (viewMode.value === 'sell' ? '待发货' : '待收货')
762 case 9: 800 case 9:
763 return '待收货' 801 return '待收货'
764 case 11: 802 case 11:
765 - return '已完成' 803 + return viewMode.value === 'sell' ? '已收货分账中' : '已完成'
766 case 7: 804 case 7:
767 return '已取消' 805 return '已取消'
768 case 13: 806 case 13:
...@@ -771,6 +809,10 @@ const getStatusText = (status) => { ...@@ -771,6 +809,10 @@ const getStatusText = (status) => {
771 return '已退款' 809 return '已退款'
772 case 17: 810 case 17:
773 return '退款失败' 811 return '退款失败'
812 + case 19:
813 + return viewMode.value === 'sell' ? '分账成功' : '已完成'
814 + case 21:
815 + return viewMode.value === 'sell' ? '分账失败' : '已完成'
774 default: 816 default:
775 return '未知状态' 817 return '未知状态'
776 } 818 }
...@@ -797,6 +839,10 @@ const getStatusClass = (status) => { ...@@ -797,6 +839,10 @@ const getStatusClass = (status) => {
797 return 'status-refund-success' 839 return 'status-refund-success'
798 case 17: 840 case 17:
799 return 'status-refund-failed' 841 return 'status-refund-failed'
842 + case 19:
843 + return 'status-profit-sharing-success'
844 + case 21:
845 + return 'status-profit-sharing-failed'
800 default: 846 default:
801 return '' 847 return ''
802 } 848 }
......