hookehuyr

feat: 添加车辆已售状态样式和禁用表单交互

- 为已售车辆添加特殊样式和标签显示
- 增加表单禁用状态的样式和交互限制
- 优化订单剩余时间计算逻辑
- 更新测试环境的openid配置
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-14 16:51:45 4 + * @LastEditTime: 2025-07-18 11:37:09
5 * @FilePath: /jgdl/src/pages/auth/index.vue 5 * @FilePath: /jgdl/src/pages/auth/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -90,7 +90,8 @@ export default { ...@@ -90,7 +90,8 @@ export default {
90 90
91 // 测试环境下传递openid,正式环境不传递 91 // 测试环境下传递openid,正式环境不传递
92 if (process.env.NODE_ENV === 'development') { 92 if (process.env.NODE_ENV === 'development') {
93 - requestData.openid = 'h-008'; 93 + // requestData.openid = 'h-008';
94 + requestData.openid = 'oWbdFvkD5VtloC50wSNR9IWiU2q8';
94 } 95 }
95 96
96 request.post('/srv/?a=openid', requestData) 97 request.post('/srv/?a=openid', requestData)
......
...@@ -176,6 +176,24 @@ ...@@ -176,6 +176,24 @@
176 font-size: 40rpx; 176 font-size: 40rpx;
177 font-weight: bold; 177 font-weight: bold;
178 color: #f97316; 178 color: #f97316;
179 + display: flex;
180 + align-items: center;
181 + gap: 16rpx;
182 +
183 + .sold-price {
184 + text-decoration: line-through;
185 + color: #999;
186 + }
187 +}
188 +
189 +.sold-label {
190 + font-size: 28rpx;
191 + color: #ef4444;
192 + // background: #fef2f2;
193 + // border: 1rpx solid #fecaca;
194 + // border-radius: 8rpx;
195 + // padding: 4rpx 12rpx;
196 + font-weight: normal;
179 } 197 }
180 198
181 .market-price { 199 .market-price {
......
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-17 11:00:00 4 + * @LastEditTime: 2025-07-18 12:20:28
5 * @FilePath: /jgdl/src/pages/myCar/index.vue 5 * @FilePath: /jgdl/src/pages/myCar/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
40 <!-- 右侧:车辆信息 --> 40 <!-- 右侧:车辆信息 -->
41 <nut-col :span="18"> 41 <nut-col :span="18">
42 <view class="car-info"> 42 <view class="car-info">
43 - <view class="car-title">{{ car.manufacture_year }}款 {{ car.brand }} {{ car.model }}</view> 43 + <view class="car-title" @click="goToCarDetail(car.id)">{{ 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" :class="getVerificationStatusClass(car.verification_status)"> 46 <view v-if="car.verification_status" class="status-badge" :class="getVerificationStatusClass(car.verification_status)">
...@@ -65,15 +65,18 @@ ...@@ -65,15 +65,18 @@
65 </nut-config-provider> 65 </nut-config-provider>
66 </view> 66 </view>
67 <view class="price-section"> 67 <view class="price-section">
68 - <view v-if="car.price" class="current-price">¥{{ car.price }}</view> 68 + <view v-if="car.price" class="current-price">
69 - <view v-if="car.market_price" class="market-price">市场价 ¥{{ car.market_price }}</view> 69 + <text :class="{ 'sold-price': car.is_sold }">¥{{ car.price }}</text>
70 + <text v-if="car.is_sold" class="sold-label">已售出</text>
71 + </view>
72 + <view v-if="car.market_price && !car.is_sold" class="market-price">市场价 ¥{{ car.market_price }}</view>
70 </view> 73 </view>
71 </view> 74 </view>
72 </nut-col> 75 </nut-col>
73 </nut-row> 76 </nut-row>
74 77
75 - <!-- 操作按钮 --> 78 + <!-- 操作按钮 只能修改未卖出的车 -->
76 - <view class="action-buttons mt-2"> 79 + <view v-if="!car.is_sold" class="action-buttons mt-2">
77 <nut-button size="small" type="default" @click="editCar(car.id)">编辑</nut-button> 80 <nut-button size="small" type="default" @click="editCar(car.id)">编辑</nut-button>
78 <!-- 只有审核状态为3时才显示上架/下架按钮 --> 81 <!-- 只有审核状态为3时才显示上架/下架按钮 -->
79 <nut-button 82 <nut-button
...@@ -82,7 +85,7 @@ ...@@ -82,7 +85,7 @@
82 :type="car.status === 5 ? 'success' : 'warning'" 85 :type="car.status === 5 ? 'success' : 'warning'"
83 @click="toggleOffline(car)" 86 @click="toggleOffline(car)"
84 > 87 >
85 - {{ car.status === 5 && !car.is_sold ? '上架' : '下架' }} 88 + {{ car.status === 5 ? '上架' : '下架' }}
86 </nut-button> 89 </nut-button>
87 <nut-button 90 <nut-button
88 v-if="car.review_status === 5" 91 v-if="car.review_status === 5"
...@@ -345,7 +348,14 @@ const showToast = (message, type = 'success') => { ...@@ -345,7 +348,14 @@ const showToast = (message, type = 'success') => {
345 }) 348 })
346 } 349 }
347 350
348 - 351 +/**
352 + * 跳转到车源详情页
353 + */
354 +const goToCarDetail = (carId) => {
355 + Taro.navigateTo({
356 + url: `/pages/productDetail/index?id=${carId}`
357 + })
358 +}
349 359
350 // 页面加载时获取数据 360 // 页面加载时获取数据
351 useDidShow(() => { 361 useDidShow(() => {
......
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 18:23:31 4 + * @LastEditTime: 2025-07-18 12:23:09
5 * @FilePath: /jgdl/src/pages/myOrders/index.vue 5 * @FilePath: /jgdl/src/pages/myOrders/index.vue
6 * @Description: 订单管理页面 6 * @Description: 订单管理页面
7 --> 7 -->
...@@ -440,7 +440,11 @@ const loadOrderData = async (isLoadMore = false) => { ...@@ -440,7 +440,11 @@ const loadOrderData = async (isLoadMore = false) => {
440 440
441 // TODO: 为待支付订单添加mock的倒计时时间(1800秒用于测试) 441 // TODO: 为待支付订单添加mock的倒计时时间(1800秒用于测试)
442 if (processedOrder.status === 3) { 442 if (processedOrder.status === 3) {
443 - processedOrder.remain_time = processedOrder.pay_time || 1800 443 + // 计算剩余时间(毫秒)
444 + const current_date = new Date(processedOrder.server_time);
445 + const end_date = new Date(processedOrder.pay_deadline_time);
446 + let time_left = end_date - current_date;
447 + processedOrder.remain_time = time_left || 1800
444 } 448 }
445 449
446 return processedOrder 450 return processedOrder
......
...@@ -149,10 +149,23 @@ ...@@ -149,10 +149,23 @@
149 font-weight: 500; 149 font-weight: 500;
150 } 150 }
151 151
152 +.form-value-disabled {
153 + color: #d1d5db !important; /* 禁用状态文字颜色 */
154 +}
155 +
152 .arrow-icon { 156 .arrow-icon {
153 color: #9ca3af; 157 color: #9ca3af;
154 } 158 }
155 159
160 +.arrow-icon-disabled {
161 + color: #d1d5db !important; /* 禁用状态箭头颜色 */
162 +}
163 +
164 +.form-item-disabled {
165 + opacity: 0.6; /* 禁用状态整体透明度 */
166 + cursor: not-allowed;
167 +}
168 +
156 .form-item-content { 169 .form-item-content {
157 display: flex; 170 display: flex;
158 justify-content: space-between; 171 justify-content: space-between;
......
...@@ -127,11 +127,11 @@ ...@@ -127,11 +127,11 @@
127 127
128 <!-- 品牌型号选择(新版) --> 128 <!-- 品牌型号选择(新版) -->
129 <nut-form-item label-position="top" label="品牌型号选择" prop="brandModel"> 129 <nut-form-item label-position="top" label="品牌型号选择" prop="brandModel">
130 - <view class="form-item-content" @click="showBrandModelPicker"> 130 + <view class="form-item-content" :class="{ 'form-item-disabled': isVerified }" @click="showBrandModelPicker">
131 - <text class="form-value" :class="{ 'form-value-selected': formData.brand && formData.model, 'form-value-placeholder': !(formData.brand && formData.model) }"> 131 + <text class="form-value" :class="{ 'form-value-selected': formData.brand && formData.model, 'form-value-placeholder': !(formData.brand && formData.model), 'form-value-disabled': isVerified }">
132 {{ formData.brand && formData.model ? `${formData.brand} ${formData.model}` : '请选择品牌型号' }} 132 {{ formData.brand && formData.model ? `${formData.brand} ${formData.model}` : '请选择品牌型号' }}
133 </text> 133 </text>
134 - <Right class="arrow-icon" /> 134 + <Right class="arrow-icon" :class="{ 'arrow-icon-disabled': isVerified }" />
135 </view> 135 </view>
136 </nut-form-item> 136 </nut-form-item>
137 137
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
163 163
164 <!-- 续航里程 --> 164 <!-- 续航里程 -->
165 <nut-form-item label="续航里程" prop="range_km"> 165 <nut-form-item label="续航里程" prop="range_km">
166 - <nut-input v-model="formData.range_km" placeholder="请输入" type="number" input-align="right" @input="validateRangeInput"> 166 + <nut-input v-model="formData.range_km" placeholder="请输入" type="number" input-align="right" :disabled="isVerified" @click="validateRangeInput" @input="validateNumberInput($event, 'range_km', false)">
167 <template #right> 167 <template #right>
168 <text class="unit">公里</text> 168 <text class="unit">公里</text>
169 </template> 169 </template>
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
173 <!-- 最高时速 --> 173 <!-- 最高时速 -->
174 <nut-form-item label="最高时速" prop="max_speed_kmh"> 174 <nut-form-item label="最高时速" prop="max_speed_kmh">
175 <nut-input v-model="formData.max_speed_kmh" placeholder="请输入" type="number" 175 <nut-input v-model="formData.max_speed_kmh" placeholder="请输入" type="number"
176 - input-align="right" @input="validateMaxSpeedInput"> 176 + input-align="right" :disabled="isVerified" @click="validateMaxSpeedInput" @input="validateNumberInput($event, 'max_speed_kmh', false)">
177 <template #right> 177 <template #right>
178 <text class="unit">km/h</text> 178 <text class="unit">km/h</text>
179 </template> 179 </template>
...@@ -320,7 +320,7 @@ ...@@ -320,7 +320,7 @@
320 </template> 320 </template>
321 321
322 <script setup> 322 <script setup>
323 -import { ref, reactive, onMounted } from 'vue' 323 +import { ref, reactive, onMounted, computed } from 'vue'
324 import { Plus, Right, Location, Close } from '@nutui/icons-vue-taro' 324 import { Plus, Right, Location, Close } from '@nutui/icons-vue-taro'
325 import Taro from '@tarojs/taro' 325 import Taro from '@tarojs/taro'
326 import BASE_URL from '@/utils/config'; 326 import BASE_URL from '@/utils/config';
...@@ -419,6 +419,22 @@ const tireWearValue = ref([]) ...@@ -419,6 +419,22 @@ const tireWearValue = ref([])
419 // 年份选择器最大日期限制(当前年份的12月31日) 419 // 年份选择器最大日期限制(当前年份的12月31日)
420 const maxYearDate = ref(new Date(new Date().getFullYear(), 11, 31)) 420 const maxYearDate = ref(new Date(new Date().getFullYear(), 11, 31))
421 421
422 +// 计算属性:判断是否为已认证状态
423 +const isVerified = computed(() => {
424 + return isEditMode.value && formData.verification_status === 5
425 +})
426 +
427 +/**
428 + * 显示已认证不能修改的提醒
429 + */
430 +const showVerifiedTip = () => {
431 + Taro.showToast({
432 + title: '车辆已认证,该项不能修改',
433 + icon: 'none',
434 + duration: 2000
435 + })
436 +}
437 +
422 // 选择器选项数据 438 // 选择器选项数据
423 const schoolOptions = ref([]) 439 const schoolOptions = ref([])
424 const brandOptions = ref([]) 440 const brandOptions = ref([])
...@@ -672,19 +688,27 @@ const validateMileageInput = (event) => { ...@@ -672,19 +688,27 @@ const validateMileageInput = (event) => {
672 } 688 }
673 689
674 /** 690 /**
675 - * 校验续航里程输入,只允许整数,范围0-99999 691 + * 校验续航里程输入权限
676 - * @param {Object} event - 输入事件对象 692 + * @param {Object} event - 点击事件对象
677 */ 693 */
694 +// eslint-disable-next-line no-unused-vars
678 const validateRangeInput = (event) => { 695 const validateRangeInput = (event) => {
679 - validateNumberInput(event, 'range_km', false) 696 + if (isVerified.value) {
697 + showVerifiedTip()
698 + return
699 + }
680 } 700 }
681 701
682 /** 702 /**
683 - * 校验最高时速输入,只允许整数,范围0-99999 703 + * 校验最高时速输入权限
684 - * @param {Object} event - 输入事件对象 704 + * @param {Object} event - 点击事件对象
685 */ 705 */
706 +// eslint-disable-next-line no-unused-vars
686 const validateMaxSpeedInput = (event) => { 707 const validateMaxSpeedInput = (event) => {
687 - validateNumberInput(event, 'max_speed_kmh', false) 708 + if (isVerified.value) {
709 + showVerifiedTip()
710 + return
711 + }
688 } 712 }
689 713
690 /** 714 /**
...@@ -765,6 +789,10 @@ const onTireWearConfirm = ({ selectedValue }) => { ...@@ -765,6 +789,10 @@ const onTireWearConfirm = ({ selectedValue }) => {
765 * 显示品牌型号选择器 789 * 显示品牌型号选择器
766 */ 790 */
767 const showBrandModelPicker = () => { 791 const showBrandModelPicker = () => {
792 + if (isVerified.value) {
793 + showVerifiedTip()
794 + return
795 + }
768 brandModelPickerRef.value?.show() 796 brandModelPickerRef.value?.show()
769 } 797 }
770 798
......