Showing
3 changed files
with
50 additions
and
49 deletions
| 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-08-13 16:22:54 | 4 | + * @LastEditTime: 2025-08-13 16:46:03 |
| 5 | * @FilePath: /jgdl/src/pages/collectionSettings/index.vue | 5 | * @FilePath: /jgdl/src/pages/collectionSettings/index.vue |
| 6 | * @Description: 收款设置 | 6 | * @Description: 收款设置 |
| 7 | --> | 7 | --> |
| ... | @@ -118,8 +118,8 @@ | ... | @@ -118,8 +118,8 @@ |
| 118 | 118 | ||
| 119 | <view class="form-content"> | 119 | <view class="form-content"> |
| 120 | <view class="form-item"> | 120 | <view class="form-item"> |
| 121 | - <text class="form-label"><text class="required-mark">*</text>身份证姓名</text> | 121 | + <text class="form-label"><text class="required-mark">*</text>用户名称</text> |
| 122 | - <input v-model="tempIdentityInfo.userName" placeholder="请输入身份证姓名" class="form-input native-input" /> | 122 | + <input v-model="tempIdentityInfo.userName" placeholder="请输入真实姓名" class="form-input native-input" /> |
| 123 | </view> | 123 | </view> |
| 124 | 124 | ||
| 125 | <view class="form-item"> | 125 | <view class="form-item"> |
| ... | @@ -1145,7 +1145,7 @@ const saveIdentityInfo = async () => { | ... | @@ -1145,7 +1145,7 @@ const saveIdentityInfo = async () => { |
| 1145 | */ | 1145 | */ |
| 1146 | const goBack = () => { | 1146 | const goBack = () => { |
| 1147 | Taro.redirectTo({ | 1147 | Taro.redirectTo({ |
| 1148 | - url: '/pages/sell/index' | 1148 | + url: '/pages/sell/index?from=collectionSettings' |
| 1149 | }); | 1149 | }); |
| 1150 | }; | 1150 | }; |
| 1151 | 1151 | ... | ... |
| ... | @@ -156,6 +156,9 @@ import BASE_URL from '@/utils/config'; | ... | @@ -156,6 +156,9 @@ import BASE_URL from '@/utils/config'; |
| 156 | import { updateProfileAPI, sendSmsCodeAPI } from '@/api/index'; | 156 | import { updateProfileAPI, sendSmsCodeAPI } from '@/api/index'; |
| 157 | import { useUserStore } from '@/stores/user'; | 157 | import { useUserStore } from '@/stores/user'; |
| 158 | 158 | ||
| 159 | +// 获取页面参数 | ||
| 160 | +const { target } = Taro.getCurrentInstance().router.params | ||
| 161 | + | ||
| 159 | // 用户状态管理 | 162 | // 用户状态管理 |
| 160 | const userStore = useUserStore() | 163 | const userStore = useUserStore() |
| 161 | 164 | ||
| ... | @@ -467,6 +470,14 @@ const handleRegister = async () => { | ... | @@ -467,6 +470,14 @@ const handleRegister = async () => { |
| 467 | title: '保存成功', | 470 | title: '保存成功', |
| 468 | icon: 'success', | 471 | icon: 'success', |
| 469 | complete: () => { | 472 | complete: () => { |
| 473 | + // 如果页面参数target=sell,跳转到sell页面 | ||
| 474 | + if (target === 'sell') { | ||
| 475 | + Taro.redirectTo({ | ||
| 476 | + url: '/pages/sell/index?from=register' | ||
| 477 | + }) | ||
| 478 | + return | ||
| 479 | + } | ||
| 480 | + | ||
| 470 | // 获取页面栈信息 | 481 | // 获取页面栈信息 |
| 471 | const pages = Taro.getCurrentPages() | 482 | const pages = Taro.getCurrentPages() |
| 472 | 483 | ... | ... |
| ... | @@ -332,7 +332,7 @@ | ... | @@ -332,7 +332,7 @@ |
| 332 | <script setup> | 332 | <script setup> |
| 333 | import { ref, reactive, onMounted, computed } from 'vue' | 333 | import { ref, reactive, onMounted, computed } from 'vue' |
| 334 | import { Plus, Right, Location, Close } from '@nutui/icons-vue-taro' | 334 | import { Plus, Right, Location, Close } from '@nutui/icons-vue-taro' |
| 335 | -import Taro, { useDidShow, useDidHide } from '@tarojs/taro' | 335 | +import Taro, { useDidShow } from '@tarojs/taro' |
| 336 | import BASE_URL from '@/utils/config'; | 336 | import BASE_URL from '@/utils/config'; |
| 337 | import BrandModelPicker from '@/components/BrandModelPicker.vue' | 337 | import BrandModelPicker from '@/components/BrandModelPicker.vue' |
| 338 | import PaymentAgreementModal from '@/components/PaymentAgreementModal.vue' | 338 | import PaymentAgreementModal from '@/components/PaymentAgreementModal.vue' |
| ... | @@ -358,7 +358,7 @@ const goBack = () => { | ... | @@ -358,7 +358,7 @@ const goBack = () => { |
| 358 | 358 | ||
| 359 | // 获取页面参数 | 359 | // 获取页面参数 |
| 360 | const instance = Taro.getCurrentInstance() | 360 | const instance = Taro.getCurrentInstance() |
| 361 | -const { id, mode, type } = instance.router?.params || {} | 361 | +const { id, mode, type, from } = instance.router?.params || {} |
| 362 | const isEditMode = ref(mode === 'edit' && id) | 362 | const isEditMode = ref(mode === 'edit' && id) |
| 363 | const isAuthMode = ref(type === 'auth' && id) | 363 | const isAuthMode = ref(type === 'auth' && id) |
| 364 | const isMyCarMode = ref(type === 'myCar' && id) | 364 | const isMyCarMode = ref(type === 'myCar' && id) |
| ... | @@ -419,12 +419,8 @@ const conditionPickerVisible = ref(false) | ... | @@ -419,12 +419,8 @@ const conditionPickerVisible = ref(false) |
| 419 | const brakeWearPickerVisible = ref(false) | 419 | const brakeWearPickerVisible = ref(false) |
| 420 | const tireWearPickerVisible = ref(false) | 420 | const tireWearPickerVisible = ref(false) |
| 421 | 421 | ||
| 422 | -// 收款协议弹框显示状态 | 422 | +// 收款说明弹框显示状态 |
| 423 | const paymentAgreementVisible = ref(false) | 423 | const paymentAgreementVisible = ref(false) |
| 424 | -// 标记是否是上传图片后触发的useDidShow | ||
| 425 | -const isUploadingImage = ref(false) | ||
| 426 | -// 标记是否已经显示过收款说明弹框(避免应用切换时重复显示) | ||
| 427 | -const hasShownPaymentAgreement = ref(false) | ||
| 428 | 424 | ||
| 429 | // 新的品牌型号选择器状态 | 425 | // 新的品牌型号选择器状态 |
| 430 | // 品牌型号选择器组件引用 | 426 | // 品牌型号选择器组件引用 |
| ... | @@ -467,7 +463,7 @@ const modelOptions = ref([]) | ... | @@ -467,7 +463,7 @@ const modelOptions = ref([]) |
| 467 | 463 | ||
| 468 | 464 | ||
| 469 | const conditionOptions = ref([ | 465 | const conditionOptions = ref([ |
| 470 | - { text: '9成新', value: '9成新' }, | 466 | + { text: '全新', value: '全新' }, |
| 471 | { text: '8成新', value: '8成新' }, | 467 | { text: '8成新', value: '8成新' }, |
| 472 | { text: '7成新', value: '7成新' }, | 468 | { text: '7成新', value: '7成新' }, |
| 473 | { text: '6成新', value: '6成新' }, | 469 | { text: '6成新', value: '6成新' }, |
| ... | @@ -487,9 +483,6 @@ const wearLevelOptions = ref([ | ... | @@ -487,9 +483,6 @@ const wearLevelOptions = ref([ |
| 487 | * @param {String} type - 图片类型 (front/left/right/other) | 483 | * @param {String} type - 图片类型 (front/left/right/other) |
| 488 | */ | 484 | */ |
| 489 | const triggerUpload = (type) => { | 485 | const triggerUpload = (type) => { |
| 490 | - // 设置上传标记 | ||
| 491 | - isUploadingImage.value = true | ||
| 492 | - | ||
| 493 | Taro.chooseImage({ | 486 | Taro.chooseImage({ |
| 494 | count: 1, | 487 | count: 1, |
| 495 | sizeType: ['compressed'], | 488 | sizeType: ['compressed'], |
| ... | @@ -499,8 +492,6 @@ const triggerUpload = (type) => { | ... | @@ -499,8 +492,6 @@ const triggerUpload = (type) => { |
| 499 | uploadImage(tempFilePath, type) | 492 | uploadImage(tempFilePath, type) |
| 500 | }, | 493 | }, |
| 501 | fail: function () { | 494 | fail: function () { |
| 502 | - // 上传失败时重置标记 | ||
| 503 | - isUploadingImage.value = false | ||
| 504 | Taro.showToast({ | 495 | Taro.showToast({ |
| 505 | title: '选择图片失败', | 496 | title: '选择图片失败', |
| 506 | icon: 'none' | 497 | icon: 'none' |
| ... | @@ -533,9 +524,6 @@ const uploadImage = (filePath, type) => { | ... | @@ -533,9 +524,6 @@ const uploadImage = (filePath, type) => { |
| 533 | let upload_data = JSON.parse(res.data); | 524 | let upload_data = JSON.parse(res.data); |
| 534 | Taro.hideLoading({ | 525 | Taro.hideLoading({ |
| 535 | success: () => { | 526 | success: () => { |
| 536 | - // 重置上传标记 | ||
| 537 | - isUploadingImage.value = false | ||
| 538 | - | ||
| 539 | if (res.statusCode === 200) { | 527 | if (res.statusCode === 200) { |
| 540 | uploadedImages[type] = upload_data.data.src; | 528 | uploadedImages[type] = upload_data.data.src; |
| 541 | // 同时更新formData中对应的照片字段 | 529 | // 同时更新formData中对应的照片字段 |
| ... | @@ -557,9 +545,6 @@ const uploadImage = (filePath, type) => { | ... | @@ -557,9 +545,6 @@ const uploadImage = (filePath, type) => { |
| 557 | fail: function () { | 545 | fail: function () { |
| 558 | Taro.hideLoading({ | 546 | Taro.hideLoading({ |
| 559 | success: () => { | 547 | success: () => { |
| 560 | - // 重置上传标记 | ||
| 561 | - isUploadingImage.value = false | ||
| 562 | - | ||
| 563 | Taro.showToast({ | 548 | Taro.showToast({ |
| 564 | icon: 'error', | 549 | icon: 'error', |
| 565 | title: '上传失败,稍后重试!', | 550 | title: '上传失败,稍后重试!', |
| ... | @@ -860,7 +845,7 @@ const onBrandModelCancel = () => { | ... | @@ -860,7 +845,7 @@ const onBrandModelCancel = () => { |
| 860 | const convertTextToScore = (text, type) => { | 845 | const convertTextToScore = (text, type) => { |
| 861 | if (type === 'condition') { | 846 | if (type === 'condition') { |
| 862 | const conditionMap = { | 847 | const conditionMap = { |
| 863 | - '9成新': 5, | 848 | + '全新': 5, |
| 864 | '8成新': 4, | 849 | '8成新': 4, |
| 865 | '7成新': 3, | 850 | '7成新': 3, |
| 866 | '6成新': 2, | 851 | '6成新': 2, |
| ... | @@ -886,7 +871,7 @@ const convertTextToScore = (text, type) => { | ... | @@ -886,7 +871,7 @@ const convertTextToScore = (text, type) => { |
| 886 | const convertScoreToText = (score, type) => { | 871 | const convertScoreToText = (score, type) => { |
| 887 | if (type === 'condition') { | 872 | if (type === 'condition') { |
| 888 | const scoreMap = { | 873 | const scoreMap = { |
| 889 | - 5: '9成新', | 874 | + 5: '全新', |
| 890 | 4: '8成新', | 875 | 4: '8成新', |
| 891 | 3: '7成新', | 876 | 3: '7成新', |
| 892 | 2: '6成新', | 877 | 2: '6成新', |
| ... | @@ -1177,8 +1162,8 @@ const checkUserPermission = async () => { | ... | @@ -1177,8 +1162,8 @@ const checkUserPermission = async () => { |
| 1177 | if (res.confirm) { | 1162 | if (res.confirm) { |
| 1178 | if (permissionResult.missingFields.includes('phone')) { | 1163 | if (permissionResult.missingFields.includes('phone')) { |
| 1179 | // 用户信息未填写 | 1164 | // 用户信息未填写 |
| 1180 | - Taro.navigateTo({ | 1165 | + Taro.redirectTo({ |
| 1181 | - url: '/pages/register/index' | 1166 | + url: '/pages/register/index?target=sell' |
| 1182 | }) | 1167 | }) |
| 1183 | } else if (permissionResult.missingFields.includes('name') || permissionResult.missingFields.includes('bank_id') || permissionResult.missingFields.includes('bank_no') || permissionResult.missingFields.includes('idcard') || permissionResult.missingFields.includes('bank_img') || permissionResult.missingFields.includes('idcard_1_img') || permissionResult.missingFields.includes('idcard_2_img') || permissionResult.missingFields.includes('idcard_effect_begin') || permissionResult.missingFields.includes('idcard_effect_end') || permissionResult.missingFields.includes('idcard_address')) { | 1168 | } else if (permissionResult.missingFields.includes('name') || permissionResult.missingFields.includes('bank_id') || permissionResult.missingFields.includes('bank_no') || permissionResult.missingFields.includes('idcard') || permissionResult.missingFields.includes('bank_img') || permissionResult.missingFields.includes('idcard_1_img') || permissionResult.missingFields.includes('idcard_2_img') || permissionResult.missingFields.includes('idcard_effect_begin') || permissionResult.missingFields.includes('idcard_effect_end') || permissionResult.missingFields.includes('idcard_address')) { |
| 1184 | // 收款信息未填写 | 1169 | // 收款信息未填写 |
| ... | @@ -1207,6 +1192,14 @@ onMounted(async () => { | ... | @@ -1207,6 +1192,14 @@ onMounted(async () => { |
| 1207 | if (isEditMode.value) { | 1192 | if (isEditMode.value) { |
| 1208 | loadCarData() | 1193 | loadCarData() |
| 1209 | } | 1194 | } |
| 1195 | + | ||
| 1196 | + // 默认权限检查逻辑 | ||
| 1197 | + const hasPermission = await checkUserPermission() | ||
| 1198 | + if (hasPermission) { | ||
| 1199 | + // 权限验证通过,显示收款说明弹框 | ||
| 1200 | + paymentAgreementVisible.value = true | ||
| 1201 | + } | ||
| 1202 | + | ||
| 1210 | // 动态修改标题 | 1203 | // 动态修改标题 |
| 1211 | // wx.setNavigationBarTitle({ | 1204 | // wx.setNavigationBarTitle({ |
| 1212 | // title: isEditMode.value ? '编辑车源' : '发布车源' | 1205 | // title: isEditMode.value ? '编辑车源' : '发布车源' |
| ... | @@ -1229,32 +1222,29 @@ onMounted(async () => { | ... | @@ -1229,32 +1222,29 @@ onMounted(async () => { |
| 1229 | 1222 | ||
| 1230 | // 页面显示时执行(包括首次加载和从其他页面返回) | 1223 | // 页面显示时执行(包括首次加载和从其他页面返回) |
| 1231 | useDidShow(async () => { | 1224 | useDidShow(async () => { |
| 1232 | - // 如果是上传图片后触发的useDidShow,则跳过 | 1225 | + // 权限检查逻辑 - 仅在特殊情况下触发 |
| 1233 | - if (isUploadingImage.value) { | 1226 | + const pages = Taro.getCurrentPages() |
| 1234 | - return | 1227 | + // const currentPage = pages[pages.length - 1] |
| 1235 | - } | 1228 | + const prevPage = pages.length > 1 ? pages[pages.length - 2] : null |
| 1236 | - | ||
| 1237 | - // 如果已经显示过收款说明弹框,则跳过(避免应用切换时重复显示) | ||
| 1238 | - if (hasShownPaymentAgreement.value) { | ||
| 1239 | - return | ||
| 1240 | - } | ||
| 1241 | 1229 | ||
| 1242 | - const hasPermission = await checkUserPermission() | 1230 | + let shouldCheckPermission = false |
| 1243 | 1231 | ||
| 1244 | - if (!hasPermission) { | 1232 | + // 第一个条件:如果当前页面没有上一页,判断参数有没有from=collectionSettings |
| 1245 | - return | 1233 | + // if (!prevPage && from === 'collectionSettings') { |
| 1234 | + // shouldCheckPermission = true | ||
| 1235 | + // } | ||
| 1236 | + // 如果当前页面有前一页,判断前一页是不是/pages/register/index返回过来的 | ||
| 1237 | + if (!prevPage && from === 'sell') { | ||
| 1238 | + shouldCheckPermission = true | ||
| 1246 | } | 1239 | } |
| 1247 | 1240 | ||
| 1248 | - // 权限验证通过,显示收款说明弹框 | 1241 | + if (shouldCheckPermission) { |
| 1249 | - paymentAgreementVisible.value = true | 1242 | + const hasPermission = await checkUserPermission() |
| 1250 | - // 标记已经显示过弹框 | 1243 | + if (hasPermission) { |
| 1251 | - hasShownPaymentAgreement.value = true | 1244 | + // 权限验证通过,显示收款说明弹框 |
| 1252 | -}) | 1245 | + paymentAgreementVisible.value = true |
| 1253 | - | 1246 | + } |
| 1254 | -// 页面隐藏时执行(切换应用或跳转到其他页面) | 1247 | + } |
| 1255 | -useDidHide(() => { | ||
| 1256 | - // 重置弹框显示标记,确保下次进入页面时能正常显示 | ||
| 1257 | - hasShownPaymentAgreement.value = false | ||
| 1258 | }) | 1248 | }) |
| 1259 | 1249 | ||
| 1260 | /** | 1250 | /** | ... | ... |
-
Please register or login to post a comment