feat(车辆销售): 添加车辆状态字段并实现编辑上架车辆确认提示
在编辑模式下,当车辆处于上架状态时,添加确认提示框防止误操作 添加status字段用于跟踪车辆状态(3=已上架, 5=已下架)
Showing
1 changed file
with
28 additions
and
2 deletions
| ... | @@ -389,7 +389,8 @@ const formData = reactive({ | ... | @@ -389,7 +389,8 @@ const formData = reactive({ |
| 389 | left_photo: '', | 389 | left_photo: '', |
| 390 | right_photo: '', | 390 | right_photo: '', |
| 391 | other_photo: '', | 391 | other_photo: '', |
| 392 | - verification_status: '' | 392 | + verification_status: '', |
| 393 | + status: '' // 车辆状态字段 (3=已上架, 5=已下架) | ||
| 393 | }) | 394 | }) |
| 394 | 395 | ||
| 395 | // 选择器显示状态 | 396 | // 选择器显示状态 |
| ... | @@ -910,6 +911,30 @@ const updateCar = async (id, data) => { | ... | @@ -910,6 +911,30 @@ const updateCar = async (id, data) => { |
| 910 | const onPublish = async () => { | 911 | const onPublish = async () => { |
| 911 | if (!validateForm()) return | 912 | if (!validateForm()) return |
| 912 | 913 | ||
| 914 | + // 编辑模式下,如果车辆是上架状态,需要确认提示 | ||
| 915 | + if (isEditMode.value && formData.status === 3) { | ||
| 916 | + Taro.showModal({ | ||
| 917 | + title: '提示', | ||
| 918 | + content: '保存后, 车辆将下架,修改资料需等待审核后才能再上架,是否仍要提交修改?', | ||
| 919 | + confirmText: '确认保存', | ||
| 920 | + cancelText: '取消', | ||
| 921 | + success: (res) => { | ||
| 922 | + if (res.confirm) { | ||
| 923 | + performSave() | ||
| 924 | + } | ||
| 925 | + } | ||
| 926 | + }) | ||
| 927 | + return | ||
| 928 | + } | ||
| 929 | + | ||
| 930 | + // 直接保存 | ||
| 931 | + performSave() | ||
| 932 | +} | ||
| 933 | + | ||
| 934 | +/** | ||
| 935 | + * 执行保存操作 | ||
| 936 | + */ | ||
| 937 | +const performSave = async () => { | ||
| 913 | const loadingTitle = isEditMode.value ? '保存中...' : '发布中...' | 938 | const loadingTitle = isEditMode.value ? '保存中...' : '发布中...' |
| 914 | Taro.showLoading({ title: loadingTitle }) | 939 | Taro.showLoading({ title: loadingTitle }) |
| 915 | 940 | ||
| ... | @@ -1028,7 +1053,8 @@ const loadCarData = async () => { | ... | @@ -1028,7 +1053,8 @@ const loadCarData = async () => { |
| 1028 | price: carData.price, | 1053 | price: carData.price, |
| 1029 | market_price: carData.market_price, | 1054 | market_price: carData.market_price, |
| 1030 | note: carData.note, | 1055 | note: carData.note, |
| 1031 | - verification_status: carData.verification_status | 1056 | + verification_status: carData.verification_status, |
| 1057 | + status: carData.status // 添加车辆状态字段 | ||
| 1032 | }) | 1058 | }) |
| 1033 | 1059 | ||
| 1034 | // 填充图片数据 | 1060 | // 填充图片数据 | ... | ... |
-
Please register or login to post a comment