hookehuyr

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

修改状态切换逻辑,使用局部变量存储状态值,确保提示消息与操作一致。同时调整成功提示的显示方式和持续时间。
<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-07-10 16:26:10
* @LastEditTime: 2025-07-10 17:40:19
* @FilePath: /jgdl/src/pages/myCar/index.vue
* @Description: 文件描述
-->
......@@ -203,18 +203,21 @@ const toggleOffline = (car) => {
const confirmOffline = async () => {
if (currentOfflineCar.value) {
const car = currentOfflineCar.value
let status = car.status
if (car.status === 3) {
car.status = 5
status = 5
} else {
car.status = 3
status = 3
}
// 调用API更新车源状态
const { code } = await changeVehicleStatusAPI({ id: car.id, status: car.status })
const { code, msg } = await changeVehicleStatusAPI({ id: car.id, status: status })
if (code) {
Taro.showToast({
title: car.status === 3 ? '已下架' : '已上架',
icon: 'success'
title: status === 5 ? '下架成功' : msg,
icon: 'none',
duration: 2000
})
}
}
......