feat(车辆认证): 添加车辆认证状态样式和按钮逻辑
- 为不同认证状态添加对应的样式类 - 在车辆列表和认证车辆页面添加认证按钮 - 实现认证按钮跳转逻辑
Showing
4 changed files
with
53 additions
and
7 deletions
| ... | @@ -82,10 +82,14 @@ | ... | @@ -82,10 +82,14 @@ |
| 82 | border-radius: 8rpx; | 82 | border-radius: 8rpx; |
| 83 | padding: 12rpx; | 83 | padding: 12rpx; |
| 84 | margin-top: 8rpx; | 84 | margin-top: 8rpx; |
| 85 | - | 85 | + |
| 86 | text { | 86 | text { |
| 87 | font-size: 22rpx; | 87 | font-size: 22rpx; |
| 88 | color: #dc2626; | 88 | color: #dc2626; |
| 89 | line-height: 1.4; | 89 | line-height: 1.4; |
| 90 | } | 90 | } |
| 91 | } | 91 | } |
| 92 | + | ||
| 93 | +.action-buttons { | ||
| 94 | + gap: 30rpx; | ||
| 95 | +} | ... | ... |
| 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-16 15:59:35 | 4 | + * @LastEditTime: 2025-07-16 16:53:13 |
| 5 | * @FilePath: /jgdl/src/pages/myAuthCar/index.vue | 5 | * @FilePath: /jgdl/src/pages/myAuthCar/index.vue |
| 6 | * @Description: 我的认证车页面 | 6 | * @Description: 我的认证车页面 |
| 7 | --> | 7 | --> |
| ... | @@ -56,6 +56,8 @@ | ... | @@ -56,6 +56,8 @@ |
| 56 | ¥ {{ item.market_price?.toLocaleString() }} | 56 | ¥ {{ item.market_price?.toLocaleString() }} |
| 57 | </text> | 57 | </text> |
| 58 | </view> | 58 | </view> |
| 59 | + </view> | ||
| 60 | + <view class="action-buttons mt-4"> | ||
| 59 | <nut-button | 61 | <nut-button |
| 60 | v-if="item.review_status === 7" | 62 | v-if="item.review_status === 7" |
| 61 | @click.stop="handleSellClick(item)" | 63 | @click.stop="handleSellClick(item)" |
| ... | @@ -66,6 +68,15 @@ | ... | @@ -66,6 +68,15 @@ |
| 66 | > | 68 | > |
| 67 | 我要卖车 | 69 | 我要卖车 |
| 68 | </nut-button> | 70 | </nut-button> |
| 71 | + <nut-button | ||
| 72 | + v-if="item.verification_status === 1 || item.verification_status === 7" | ||
| 73 | + size="small" | ||
| 74 | + type="primary" | ||
| 75 | + @click="authCar(item.id)" | ||
| 76 | + color="orange" | ||
| 77 | + > | ||
| 78 | + 认证 | ||
| 79 | + </nut-button> | ||
| 69 | </view> | 80 | </view> |
| 70 | </view> | 81 | </view> |
| 71 | </view> | 82 | </view> |
| ... | @@ -259,6 +270,15 @@ const showToast = (message, type = 'success') => { | ... | @@ -259,6 +270,15 @@ const showToast = (message, type = 'success') => { |
| 259 | }) | 270 | }) |
| 260 | } | 271 | } |
| 261 | 272 | ||
| 273 | +/** | ||
| 274 | + * 认证车源 | ||
| 275 | + */ | ||
| 276 | +const authCar = (carId) => { | ||
| 277 | + Taro.navigateTo({ | ||
| 278 | + url: `/pages/setAuthCar/index?id=${carId}&mode=edit` | ||
| 279 | + }) | ||
| 280 | +} | ||
| 281 | + | ||
| 262 | // ==================== 生命周期 ==================== | 282 | // ==================== 生命周期 ==================== |
| 263 | onMounted(() => { | 283 | onMounted(() => { |
| 264 | initData() | 284 | initData() | ... | ... |
| ... | @@ -80,13 +80,21 @@ | ... | @@ -80,13 +80,21 @@ |
| 80 | background: linear-gradient(135deg, #10b981, #059669); | 80 | background: linear-gradient(135deg, #10b981, #059669); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | - &.offline { | 83 | + &.unverified { |
| 84 | - background: linear-gradient(135deg, #ef4444, #dc2626); | 84 | + background: linear-gradient(135deg, #6b7280, #4b5563); |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | &.review { | 87 | &.review { |
| 88 | background: linear-gradient(135deg, #f59e0b, #d97706); | 88 | background: linear-gradient(135deg, #f59e0b, #d97706); |
| 89 | } | 89 | } |
| 90 | + | ||
| 91 | + &.failed { | ||
| 92 | + background: linear-gradient(135deg, #ef4444, #dc2626); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + &.offline { | ||
| 96 | + background: linear-gradient(135deg, #ef4444, #dc2626); | ||
| 97 | + } | ||
| 90 | } | 98 | } |
| 91 | 99 | ||
| 92 | .status-icon { | 100 | .status-icon { | ... | ... |
| 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-16 15:50:35 | 4 | + * @LastEditTime: 2025-07-16 16:51:29 |
| 5 | * @FilePath: /jgdl/src/pages/myCar/index.vue | 5 | * @FilePath: /jgdl/src/pages/myCar/index.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -43,7 +43,7 @@ | ... | @@ -43,7 +43,7 @@ |
| 43 | <view class="car-title">{{ car.manufacture_year }}款 {{ car.brand }} {{ car.model }}</view> | 43 | <view class="car-title">{{ car.manufacture_year }}款 {{ car.brand }} {{ car.model }}</view> |
| 44 | <!-- 状态标识 --> | 44 | <!-- 状态标识 --> |
| 45 | <view class="status-badges"> | 45 | <view class="status-badges"> |
| 46 | - <view v-if="car.verification_status" class="status-badge verified"> | 46 | + <view v-if="car.verification_status" class="status-badge" :class="getVerificationStatusClass(car.verification_status)"> |
| 47 | <text>{{ verifyStatus[car.verification_status] }}</text> | 47 | <text>{{ verifyStatus[car.verification_status] }}</text> |
| 48 | </view> | 48 | </view> |
| 49 | <!-- 审核状态为3时显示上架/下架状态,否则显示审核状态 --> | 49 | <!-- 审核状态为3时显示上架/下架状态,否则显示审核状态 --> |
| ... | @@ -82,7 +82,7 @@ | ... | @@ -82,7 +82,7 @@ |
| 82 | {{ car.status === 5 ? '上架' : '下架' }} | 82 | {{ car.status === 5 ? '上架' : '下架' }} |
| 83 | </nut-button> | 83 | </nut-button> |
| 84 | <nut-button | 84 | <nut-button |
| 85 | - v-if="car.verification_status === 1" | 85 | + v-if="car.verification_status === 1 || car.verification_status === 7" |
| 86 | size="small" | 86 | size="small" |
| 87 | type="primary" | 87 | type="primary" |
| 88 | @click="authCar(car.id)" | 88 | @click="authCar(car.id)" |
| ... | @@ -150,6 +150,20 @@ const reviewStatus = ref({ | ... | @@ -150,6 +150,20 @@ const reviewStatus = ref({ |
| 150 | }) | 150 | }) |
| 151 | 151 | ||
| 152 | /** | 152 | /** |
| 153 | + * 获取认证状态样式类 | ||
| 154 | + * @param {number} status - 认证状态 (1=未认证, 3=认证待审核, 5=已认证, 7=认证失败) | ||
| 155 | + */ | ||
| 156 | +const getVerificationStatusClass = (status) => { | ||
| 157 | + const classMap = { | ||
| 158 | + 1: 'unverified', | ||
| 159 | + 3: 'review', | ||
| 160 | + 5: 'verified', | ||
| 161 | + 7: 'failed' | ||
| 162 | + } | ||
| 163 | + return classMap[status] || 'unverified' | ||
| 164 | +} | ||
| 165 | + | ||
| 166 | +/** | ||
| 153 | * 滚动样式 - 考虑header和TabBar的高度 | 167 | * 滚动样式 - 考虑header和TabBar的高度 |
| 154 | */ | 168 | */ |
| 155 | const scrollStyle = computed(() => { | 169 | const scrollStyle = computed(() => { | ... | ... |
-
Please register or login to post a comment