hookehuyr

feat(订单): 添加认证订单功能并更新业务类型枚举

更新订单API的业务类型枚举值从'sell'改为'buy_sell'
在订单管理页面添加认证订单视图模式和相关逻辑
添加认证状态映射和订单列表过滤逻辑
更新订单状态显示文本以适应认证订单场景
...@@ -39,7 +39,7 @@ export const getOrderDetailAPI = (params) => fn(fetch.get(Api.GET_ORDER_DETAIL, ...@@ -39,7 +39,7 @@ export const getOrderDetailAPI = (params) => fn(fetch.get(Api.GET_ORDER_DETAIL,
39 * @description: 创建订单 39 * @description: 创建订单
40 * @param vehicle_id 车辆ID 40 * @param vehicle_id 车辆ID
41 * @param total_amount 总价 41 * @param total_amount 总价
42 - * @param business_type 业务类型(sell=买车订单, verification=认证订单) 42 + * @param business_type buy_sell=买车订单, verification=认证订单)
43 * @returns data{ id } 43 * @returns data{ id }
44 */ 44 */
45 export const createOrderAPI = (params) => fn(fetch.post(Api.CREATE_ORDER, params)); 45 export const createOrderAPI = (params) => fn(fetch.post(Api.CREATE_ORDER, params));
......
1 <!-- 1 <!--
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-07-29 16:57:13 4 + * @LastEditTime: 2025-08-01 14:31:38
5 * @FilePath: /jgdl/src/pages/myCar/index.vue 5 * @FilePath: /jgdl/src/pages/myCar/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -171,6 +171,7 @@ const themeVars = { ...@@ -171,6 +171,7 @@ const themeVars = {
171 // 认证状态映射 171 // 认证状态映射
172 const verifyStatus = ref({ 172 const verifyStatus = ref({
173 1: '未认证', 173 1: '未认证',
174 + 2: '认证待付款',
174 3: '认证待审核', 175 3: '认证待审核',
175 5: '已认证', 176 5: '已认证',
176 7: '认证失败' 177 7: '认证失败'
......
1 <!-- 1 <!--
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-07-30 11:06:55 4 + * @LastEditTime: 2025-08-01 14:43:46
5 * @FilePath: /jgdl/src/pages/myOrders/index.vue 5 * @FilePath: /jgdl/src/pages/myOrders/index.vue
6 * @Description: 订单管理页面 6 * @Description: 订单管理页面
7 --> 7 -->
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
17 <view class="toggle-option" :class="{ active: viewMode === 'sell' }" @click="setViewMode('sell')"> 17 <view class="toggle-option" :class="{ active: viewMode === 'sell' }" @click="setViewMode('sell')">
18 我卖的车 18 我卖的车
19 </view> 19 </view>
20 + <view class="toggle-option" :class="{ active: viewMode === 'verification' }" @click="setViewMode('verification')">
21 + 我的认证
22 + </view>
20 </view> 23 </view>
21 </view> 24 </view>
22 25
...@@ -25,19 +28,19 @@ ...@@ -25,19 +28,19 @@
25 <view class="tab-item" :class="{ active: activeTab === '' }" @click="setActiveTab('')"> 28 <view class="tab-item" :class="{ active: activeTab === '' }" @click="setActiveTab('')">
26 全部 29 全部
27 </view> 30 </view>
28 - <view v-if="viewMode === 'buy'" class="tab-item" :class="{ active: activeTab === 3 }" @click="setActiveTab(3)"> 31 + <view v-if="viewMode === 'buy' || viewMode === 'verification'" class="tab-item" :class="{ active: activeTab === 3 }" @click="setActiveTab(3)">
29 待支付 32 待支付
30 </view> 33 </view>
31 - <view class="tab-item" :class="{ active: activeTab === 5 }" @click="setActiveTab(5)"> 34 + <view v-if="viewMode === 'buy' || viewMode === 'sell' || viewMode === 'verification'" class="tab-item" :class="{ active: activeTab === 5 }" @click="setActiveTab(5)">
32 - 待发 35 + {{ viewMode === 'verification' ? '已付款' : '待收货' }}
33 </view> 36 </view>
34 - <view class="tab-item" :class="{ active: activeTab === 9 }" @click="setActiveTab(9)"> 37 + <view v-if="viewMode === 'buy' || viewMode === 'sell'" class="tab-item" :class="{ active: activeTab === 9 }" @click="setActiveTab(9)">
35 待收货 38 待收货
36 </view> 39 </view>
37 - <view class="tab-item" :class="{ active: activeTab === 11 }" @click="setActiveTab(11)"> 40 + <view v-if="viewMode === 'buy' || viewMode === 'sell'" class="tab-item" :class="{ active: activeTab === 11 }" @click="setActiveTab(11)">
38 已完成 41 已完成
39 </view> 42 </view>
40 - <view class="tab-item" :class="{ active: activeTab === 7 }" @click="setActiveTab(7)"> 43 + <view v-if="viewMode === 'buy' || viewMode === 'sell' || viewMode === 'verification'" class="tab-item" :class="{ active: activeTab === 7 }" @click="setActiveTab(7)">
41 已取消 44 已取消
42 </view> 45 </view>
43 </view> 46 </view>
...@@ -75,10 +78,10 @@ ...@@ -75,10 +78,10 @@
75 <view class="vehicle-details"> 78 <view class="vehicle-details">
76 <text class="vehicle-name">{{ order.details.vehicle.brand }} {{ order.details.vehicle.model }}</text> 79 <text class="vehicle-name">{{ order.details.vehicle.brand }} {{ order.details.vehicle.model }}</text>
77 <text class="vehicle-specs"> 80 <text class="vehicle-specs">
78 - {{ order.details.vehicle.manufacture_year }}年 | 续航{{ order.details.vehicle.range_km }}km 81 + <text>{{ order.details.vehicle.manufacture_year }}年 | </text>续航{{ order.details.vehicle.range_km }}km
79 </text> 82 </text>
80 <text class="vehicle-battery">电池容量:{{ order.details.vehicle.battery_capacity_ah }}Ah</text> 83 <text class="vehicle-battery">电池容量:{{ order.details.vehicle.battery_capacity_ah }}Ah</text>
81 - <text class="vehicle-price">¥{{ order.details.vehicle.price }}</text> 84 + <text v-if="order.details.vehicle.price" class="vehicle-price">¥{{ order.details.vehicle.price }}</text>
82 </view> 85 </view>
83 </nut-col> 86 </nut-col>
84 </nut-row> 87 </nut-row>
...@@ -95,6 +98,18 @@ ...@@ -95,6 +98,18 @@
95 </text> 98 </text>
96 </view> 99 </view>
97 100
101 + <!-- 认证模式: 支付剩余时间 -->
102 + <view v-if="viewMode === 'verification' && order.status === 3" class="payment-countdown">
103 + <text class="countdown-text">剩余支付时间:{{ formatCountdown(order.remain_time) }}</text>
104 + </view>
105 +
106 + <!-- 认证模式: 认证剩余时间 - 文字描述 -->
107 + <view v-if="viewMode === 'verification' && order.status === 9" class="auto-receipt-countdown">
108 + <text class="countdown-text">
109 + {{ order.receiving_deadline_desc }}
110 + </text>
111 + </view>
112 +
98 <!-- 操作按钮 --> 113 <!-- 操作按钮 -->
99 <view v-if="!order.is_sold" class="order-actions"> 114 <view v-if="!order.is_sold" class="order-actions">
100 <!-- 买车模式:待支付状态 --> 115 <!-- 买车模式:待支付状态 -->
...@@ -108,6 +123,17 @@ ...@@ -108,6 +123,17 @@
108 </nut-button> 123 </nut-button>
109 </template> 124 </template>
110 125
126 + <!-- 认证模式:待支付状态 -->
127 + <template v-if="viewMode === 'verification' && order.status === 3">
128 + <nut-button type="default" size="small" @click="handleCancelOrder(order.id)"
129 + :loading="cancelingOrderId === order.id" :disabled="cancelingOrderId === order.id">
130 + {{ cancelingOrderId === order.id ? '取消中...' : '取消订单' }}
131 + </nut-button>
132 + <nut-button type="primary" size="small" @click="handlePayment(order)" color="orange" class="ml-2">
133 + 去支付
134 + </nut-button>
135 + </template>
136 +
111 <!-- 买车模式:待收货状态 --> 137 <!-- 买车模式:待收货状态 -->
112 <template v-if="viewMode === 'buy' && order.status === 9"> 138 <template v-if="viewMode === 'buy' && order.status === 9">
113 <nut-button type="default" size="small" @click="viewOrderDetail(order.id)"> 139 <nut-button type="default" size="small" @click="viewOrderDetail(order.id)">
...@@ -486,6 +512,9 @@ const boughtOrders = ref([]) ...@@ -486,6 +512,9 @@ const boughtOrders = ref([])
486 // 订单数据 - 我卖的车 512 // 订单数据 - 我卖的车
487 const soldOrders = ref([]) 513 const soldOrders = ref([])
488 514
515 +// 订单数据 - 我认证的车
516 +const verificationOrders = ref([])
517 +
489 // 分页相关状态 518 // 分页相关状态
490 const currentPage = ref(0) 519 const currentPage = ref(0)
491 const pageLimit = ref(10) 520 const pageLimit = ref(10)
...@@ -497,7 +526,7 @@ const countdownIntervals = ref(new Map()) // 摮瘥葵霈W恣摰 ...@@ -497,7 +526,7 @@ const countdownIntervals = ref(new Map()) // 摮瘥葵霈W恣摰
497 * 根据当前视图模式和筛选条件获取过滤后的订单列表 526 * 根据当前视图模式和筛选条件获取过滤后的订单列表
498 */ 527 */
499 const filteredOrders = computed(() => { 528 const filteredOrders = computed(() => {
500 - const orders = viewMode.value === 'buy' ? boughtOrders.value : soldOrders.value 529 + const orders = viewMode.value === 'buy' ? boughtOrders.value : viewMode.value === 'verification' ? verificationOrders.value : soldOrders.value
501 530
502 if (activeTab.value === '') { 531 if (activeTab.value === '') {
503 return orders 532 return orders
...@@ -544,7 +573,7 @@ const loadOrderData = async (isLoadMore = false) => { ...@@ -544,7 +573,7 @@ const loadOrderData = async (isLoadMore = false) => {
544 try { 573 try {
545 loading.value = true 574 loading.value = true
546 575
547 - const type = viewMode.value === 'buy' ? 'buy' : 'sell' 576 + const type = viewMode.value === 'buy' ? 'buy' : viewMode.value === 'verification' ? 'verification' : 'sell'
548 const status = activeTab.value || undefined 577 const status = activeTab.value || undefined
549 const page = isLoadMore ? currentPage.value + 1 : 0 578 const page = isLoadMore ? currentPage.value + 1 : 0
550 579
...@@ -612,7 +641,7 @@ const loadOrderData = async (isLoadMore = false) => { ...@@ -612,7 +641,7 @@ const loadOrderData = async (isLoadMore = false) => {
612 return processedOrder 641 return processedOrder
613 }) 642 })
614 643
615 - const targetOrders = viewMode.value === 'buy' ? boughtOrders : soldOrders 644 + const targetOrders = viewMode.value === 'buy' ? boughtOrders : viewMode.value === 'verification' ? verificationOrders : soldOrders
616 645
617 if (isLoadMore) { 646 if (isLoadMore) {
618 targetOrders.value = [...targetOrders.value, ...newOrders] 647 targetOrders.value = [...targetOrders.value, ...newOrders]
...@@ -663,6 +692,7 @@ const resetListState = (resetData = false) => { ...@@ -663,6 +692,7 @@ const resetListState = (resetData = false) => {
663 // 清空订单数据 692 // 清空订单数据
664 boughtOrders.value = [] 693 boughtOrders.value = []
665 soldOrders.value = [] 694 soldOrders.value = []
695 + verificationOrders.value = []
666 // 重新加载数据 696 // 重新加载数据
667 loadOrderData(false) 697 loadOrderData(false)
668 } 698 }
...@@ -698,7 +728,7 @@ const getStatusText = (status) => { ...@@ -698,7 +728,7 @@ const getStatusText = (status) => {
698 case 3: 728 case 3:
699 return '待支付' 729 return '待支付'
700 case 5: 730 case 5:
701 - return '待发货' 731 + return viewMode.value === 'verification' ? '已付款' : '待收货'
702 case 9: 732 case 9:
703 return '待收货' 733 return '待收货'
704 case 11: 734 case 11:
...@@ -762,7 +792,7 @@ const startCountdown = (order) => { ...@@ -762,7 +792,7 @@ const startCountdown = (order) => {
762 } 792 }
763 793
764 const timer = setInterval(async () => { 794 const timer = setInterval(async () => {
765 - const orders = viewMode.value === 'buy' ? boughtOrders : soldOrders 795 + const orders = viewMode.value === 'buy' ? boughtOrders : viewMode.value === 'verification' ? verificationOrders : soldOrders
766 const targetOrderIndex = orders.value.findIndex(o => o.id === order.id) 796 const targetOrderIndex = orders.value.findIndex(o => o.id === order.id)
767 797
768 if (targetOrderIndex !== -1) { 798 if (targetOrderIndex !== -1) {
...@@ -808,7 +838,7 @@ const handleTimeoutCancel = async (order) => { ...@@ -808,7 +838,7 @@ const handleTimeoutCancel = async (order) => {
808 } 838 }
809 839
810 // 更新订单状态为已取消 840 // 更新订单状态为已取消
811 - const orders = viewMode.value === 'buy' ? boughtOrders : soldOrders 841 + const orders = viewMode.value === 'buy' ? boughtOrders : viewMode.value === 'verification' ? verificationOrders : soldOrders
812 const targetOrderIndex = orders.value.findIndex(o => o.id === order.id) 842 const targetOrderIndex = orders.value.findIndex(o => o.id === order.id)
813 843
814 if (targetOrderIndex !== -1) { 844 if (targetOrderIndex !== -1) {
...@@ -881,7 +911,7 @@ const onPayClose = () => { ...@@ -881,7 +911,7 @@ const onPayClose = () => {
881 */ 911 */
882 const onPaySuccess = ({ orderId }) => { 912 const onPaySuccess = ({ orderId }) => {
883 // 找到对应的订单并更新状态 913 // 找到对应的订单并更新状态
884 - const orders = viewMode.value === 'buy' ? boughtOrders.value : soldOrders.value 914 + const orders = viewMode.value === 'buy' ? boughtOrders.value : viewMode.value === 'verification' ? verificationOrders.value : soldOrders.value
885 const order = orders.find(o => o.id === orderId) 915 const order = orders.find(o => o.id === orderId)
886 916
887 if (order) { 917 if (order) {
...@@ -901,7 +931,7 @@ const onPaySuccess = ({ orderId }) => { ...@@ -901,7 +931,7 @@ const onPaySuccess = ({ orderId }) => {
901 */ 931 */
902 const viewOrderDetail = async (orderId) => { 932 const viewOrderDetail = async (orderId) => {
903 // 找到对应的订单 933 // 找到对应的订单
904 - const orders = viewMode.value === 'buy' ? boughtOrders.value : soldOrders.value 934 + const orders = viewMode.value === 'buy' ? boughtOrders.value : viewMode.value === 'verification' ? verificationOrders.value : soldOrders.value
905 const order = orders.find(o => o.id === orderId) 935 const order = orders.find(o => o.id === orderId)
906 936
907 if (order) { 937 if (order) {
...@@ -926,7 +956,7 @@ const closeOrderDetailPopup = () => { ...@@ -926,7 +956,7 @@ const closeOrderDetailPopup = () => {
926 */ 956 */
927 const rateOrder = (orderId) => { 957 const rateOrder = (orderId) => {
928 // 找到对应的订单 958 // 找到对应的订单
929 - const orders = viewMode.value === 'buy' ? boughtOrders.value : soldOrders.value 959 + const orders = viewMode.value === 'buy' ? boughtOrders.value : viewMode.value === 'verification' ? verificationOrders.value : soldOrders.value
930 const order = orders.find(o => o.id === orderId) 960 const order = orders.find(o => o.id === orderId)
931 961
932 if (order) { 962 if (order) {
...@@ -983,7 +1013,7 @@ const submitRate = async () => { ...@@ -983,7 +1013,7 @@ const submitRate = async () => {
983 }) 1013 })
984 if (response.code) { 1014 if (response.code) {
985 // API提交成功后的处理 1015 // API提交成功后的处理
986 - const currentOrders = viewMode.value === 'buy' ? boughtOrders : soldOrders 1016 + const currentOrders = viewMode.value === 'buy' ? boughtOrders : viewMode.value === 'verification' ? verificationOrders : soldOrders
987 const order = currentOrders.value.find(o => o.id === currentRateOrder.value.id) 1017 const order = currentOrders.value.find(o => o.id === currentRateOrder.value.id)
988 if (order) { 1018 if (order) {
989 // 创建评价数据对象 1019 // 创建评价数据对象
...@@ -1109,7 +1139,7 @@ const performCancelOrder = async (orderId) => { ...@@ -1109,7 +1139,7 @@ const performCancelOrder = async (orderId) => {
1109 1139
1110 if (response.code) { 1140 if (response.code) {
1111 // API取消成功后的处理 1141 // API取消成功后的处理
1112 - const orders = viewMode.value === 'buy' ? boughtOrders : soldOrders 1142 + const orders = viewMode.value === 'buy' ? boughtOrders : viewMode.value === 'verification' ? verificationOrders : soldOrders
1113 const order = orders.value.find(o => o.id === orderId) 1143 const order = orders.value.find(o => o.id === orderId)
1114 1144
1115 if (order) { 1145 if (order) {
...@@ -1120,7 +1150,7 @@ const performCancelOrder = async (orderId) => { ...@@ -1120,7 +1150,7 @@ const performCancelOrder = async (orderId) => {
1120 } 1150 }
1121 1151
1122 // 更新订单状态为已取消 1152 // 更新订单状态为已取消
1123 - const orders = viewMode.value === 'buy' ? boughtOrders : soldOrders 1153 + const orders = viewMode.value === 'buy' ? boughtOrders : viewMode.value === 'verification' ? verificationOrders : soldOrders
1124 const targetOrderIndex = orders.value.findIndex(o => o.id === orderId) 1154 const targetOrderIndex = orders.value.findIndex(o => o.id === orderId)
1125 1155
1126 if (targetOrderIndex !== -1) { 1156 if (targetOrderIndex !== -1) {
...@@ -1281,7 +1311,7 @@ const performConfirmShip = async (orderId) => { ...@@ -1281,7 +1311,7 @@ const performConfirmShip = async (orderId) => {
1281 1311
1282 if (response.code) { 1312 if (response.code) {
1283 // API发货成功后的处理 1313 // API发货成功后的处理
1284 - const orders = viewMode.value === 'buy' ? boughtOrders : soldOrders 1314 + const orders = viewMode.value === 'buy' ? boughtOrders : viewMode.value === 'verification' ? verificationOrders : soldOrders
1285 const order = orders.value.find(o => o.id === orderId) 1315 const order = orders.value.find(o => o.id === orderId)
1286 1316
1287 if (order) { 1317 if (order) {
...@@ -1329,7 +1359,7 @@ const performDeleteOrder = async (orderId) => { ...@@ -1329,7 +1359,7 @@ const performDeleteOrder = async (orderId) => {
1329 1359
1330 if (response.code) { 1360 if (response.code) {
1331 // API删除成功后的处理 1361 // API删除成功后的处理
1332 - const orders = viewMode.value === 'buy' ? boughtOrders : soldOrders 1362 + const orders = viewMode.value === 'buy' ? boughtOrders : viewMode.value === 'verification' ? verificationOrders : soldOrders
1333 const orderIndex = orders.value.findIndex(order => order.id === orderId) 1363 const orderIndex = orders.value.findIndex(order => order.id === orderId)
1334 1364
1335 if (orderIndex !== -1) { 1365 if (orderIndex !== -1) {
......
1 <!-- 1 <!--
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-07-31 15:29:14 4 + * @LastEditTime: 2025-08-01 14:35:15
5 * @FilePath: /jgdl/src/pages/productDetail/index.vue 5 * @FilePath: /jgdl/src/pages/productDetail/index.vue
6 * @Description: 商品详情页 6 * @Description: 商品详情页
7 --> 7 -->
...@@ -485,7 +485,7 @@ const handlePurchase = async () => { ...@@ -485,7 +485,7 @@ const handlePurchase = async () => {
485 const onPay = async ({ id, remain_time, price }) => { 485 const onPay = async ({ id, remain_time, price }) => {
486 try { 486 try {
487 const { code, data } = await createOrderAPI({ 487 const { code, data } = await createOrderAPI({
488 - business_type: 'sell', 488 + business_type: 'buy_sell',
489 vehicle_id: id, 489 vehicle_id: id,
490 total_amount: price 490 total_amount: price
491 }) 491 })
......