hookehuyr

fix(myCar): 修复车源状态切换时的提示消息不一致问题

修改状态切换逻辑,使用局部变量存储状态值,确保提示消息与操作一致。同时调整成功提示的显示方式和持续时间。
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-10 16:26:10 4 + * @LastEditTime: 2025-07-10 17:40:19
5 * @FilePath: /jgdl/src/pages/myCar/index.vue 5 * @FilePath: /jgdl/src/pages/myCar/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -203,18 +203,21 @@ const toggleOffline = (car) => { ...@@ -203,18 +203,21 @@ const toggleOffline = (car) => {
203 const confirmOffline = async () => { 203 const confirmOffline = async () => {
204 if (currentOfflineCar.value) { 204 if (currentOfflineCar.value) {
205 const car = currentOfflineCar.value 205 const car = currentOfflineCar.value
206 + let status = car.status
206 if (car.status === 3) { 207 if (car.status === 3) {
207 car.status = 5 208 car.status = 5
209 + status = 5
208 } else { 210 } else {
209 - car.status = 3 211 + status = 3
210 } 212 }
211 213
212 // 调用API更新车源状态 214 // 调用API更新车源状态
213 - const { code } = await changeVehicleStatusAPI({ id: car.id, status: car.status }) 215 + const { code, msg } = await changeVehicleStatusAPI({ id: car.id, status: status })
214 if (code) { 216 if (code) {
215 Taro.showToast({ 217 Taro.showToast({
216 - title: car.status === 3 ? '已下架' : '已上架', 218 + title: status === 5 ? '下架成功' : msg,
217 - icon: 'success' 219 + icon: 'none',
220 + duration: 2000
218 }) 221 })
219 } 222 }
220 } 223 }
......