d0fda066 by lttnew

订单生成未支付返回不能编辑

1 parent 4ecc383f
...@@ -56,10 +56,16 @@ function logout() { ...@@ -56,10 +56,16 @@ function logout() {
56 uni.removeStorageSync('webUserName') 56 uni.removeStorageSync('webUserName')
57 uni.removeStorageSync('openId') 57 uni.removeStorageSync('openId')
58 58
59 userStore.setUser(null) 59 userStore.setUser(null)
60 app.globalData.isLogin = false 60 app.globalData.isLogin = false
61 }) 61 app.globalData.userInfo = null
62 } 62 app.globalData.memberInfo = null
63 app.globalData.dept = null
64 app.globalData.deptType = null
65 app.globalData.userType = null
66 app.globalData.authenticationStatus = null
67 })
68 }
63 69
64 function getCodeImg() { 70 function getCodeImg() {
65 return request({ 71 return request({
......
...@@ -120,9 +120,11 @@ const preferentialData = ref({ ...@@ -120,9 +120,11 @@ const preferentialData = ref({
120 }) 120 })
121 const payType = ref('2') 121 const payType = ref('2')
122 const isPaying = ref(false) 122 const isPaying = ref(false)
123 const payName = ref('') 123 const payName = ref('')
124 const assoName = ref('') 124 const assoName = ref('')
125 const app = getApp() 125 const app = getApp()
126 const sourcePage = ref('')
127 const PERFECT_PAY_REFRESH_KEY = 'perfectNeedRefreshAfterPay'
126 128
127 const pickFirst = (...values) => { 129 const pickFirst = (...values) => {
128 const value = values.find(item => item !== undefined && item !== null && String(item).trim() !== '') 130 const value = values.find(item => item !== undefined && item !== null && String(item).trim() !== '')
...@@ -202,7 +204,7 @@ const onPayTypeChange = (e) => { ...@@ -202,7 +204,7 @@ const onPayTypeChange = (e) => {
202 } 204 }
203 205
204 // 支付操作 206 // 支付操作
205 const handelPay = async () => { 207 const handelPay = async () => {
206 if (memberTotalFee.value < 0) { 208 if (memberTotalFee.value < 0) {
207 uni.showToast({ 209 uni.showToast({
208 title: '支付金额异常', 210 title: '支付金额异常',
...@@ -281,10 +283,11 @@ const handelPay = async () => { ...@@ -281,10 +283,11 @@ const handelPay = async () => {
281 }) 283 })
282 return 284 return
283 } 285 }
284 data = res.data 286 data = res.data
285 } 287 }
286 288 markPerfectNeedRefresh()
287 // 无需支付,直接成功 289
290 // 无需支付,直接成功
288 if (data.payFlag == 0) { 291 if (data.payFlag == 0) {
289 uni.hideLoading() 292 uni.hideLoading()
290 isPaying.value = false 293 isPaying.value = false
...@@ -325,9 +328,10 @@ const handelPay = async () => { ...@@ -325,9 +328,10 @@ const handelPay = async () => {
325 isPaying.value = false 328 isPaying.value = false
326 } 329 }
327 330
328 onLoad((option) => { 331 onLoad((option) => {
329 console.log(66, option) 332 console.log(66, option)
330 fillPayDisplayInfo({}, {}, option) 333 sourcePage.value = option.source || ''
334 fillPayDisplayInfo({}, {}, option)
331 // 接收订单ID(再次支付时) 335 // 接收订单ID(再次支付时)
332 if (option.orderId) { 336 if (option.orderId) {
333 payForm.value.id = option.orderId 337 payForm.value.id = option.orderId
...@@ -347,7 +351,13 @@ onLoad((option) => { ...@@ -347,7 +351,13 @@ onLoad((option) => {
347 } 351 }
348 // 初始化获取费用和优惠 352 // 初始化获取费用和优惠
349 init() 353 init()
350 }) 354 })
355
356 function markPerfectNeedRefresh() {
357 if (sourcePage.value === 'perfect') {
358 uni.setStorageSync(PERFECT_PAY_REFRESH_KEY, '1')
359 }
360 }
351 361
352 // 初始化接口 362 // 初始化接口
353 async function init() { 363 async function init() {
......
...@@ -176,35 +176,14 @@ onLoad((option) => { ...@@ -176,35 +176,14 @@ onLoad((option) => {
176 176
177 onShow(() => { 177 onShow(() => {
178 if (app.globalData.isLogin) { 178 if (app.globalData.isLogin) {
179 if (quickGoPerfectByCachedStatus()) return
180 init() 179 init()
181 } else { 180 } else {
182 app.firstLoadCallback = () => { 181 app.firstLoadCallback = () => {
183 if (quickGoPerfectByCachedStatus()) return
184 init() 182 init()
185 } 183 }
186 } 184 }
187 }) 185 })
188 186
189 function quickGoPerfectByCachedStatus() {
190 if (!hasCachedAuthStatus()) return false
191 if (navigatingPerfect.value) return true
192 const authStatus = String(app.globalData.authenticationStatus)
193 const memberInfoData = app.globalData.memberInfo || {}
194 const shouldGoPerfect = authStatus === '0' ||
195 authStatus === '3' ||
196 (authStatus === '1' && !memberInfoData.memCode)
197 if (!shouldGoPerfect) return false
198 goPerfectFromDaoGuan()
199 return true
200 }
201
202 function hasCachedAuthStatus() {
203 return app.globalData.authenticationStatus !== undefined &&
204 app.globalData.authenticationStatus !== null &&
205 String(app.globalData.authenticationStatus) !== 'undefined'
206 }
207
208 function init() { 187 function init() {
209 checkImgExist() 188 checkImgExist()
210 // handelGetMyRecent() 189 // handelGetMyRecent()
...@@ -260,7 +239,7 @@ function handleAccountStatus() { ...@@ -260,7 +239,7 @@ function handleAccountStatus() {
260 const memberInfoData = app.globalData.memberInfo || {} 239 const memberInfoData = app.globalData.memberInfo || {}
261 const activeStatus = memberInfoData.activeStatus 240 const activeStatus = memberInfoData.activeStatus
262 241
263 if (!app.globalData.authenticationStatus || authStatus === 'undefined' || authStatus === '0' || authStatus === '3') { 242 if (authStatus === '0' || authStatus === '3') {
264 goPerfectFromDaoGuan() 243 goPerfectFromDaoGuan()
265 return 244 return
266 } 245 }
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
48 </uni-forms-item> 48 </uni-forms-item>
49 <uni-forms-item label="单位类型" required> 49 <uni-forms-item label="单位类型" required>
50 <view style="width: 100%;"> 50 <view style="width: 100%;">
51 <uni-data-select v-model="form.type" :localdata="typeList" placeholder="请选择单位类型"></uni-data-select> 51 <uni-data-select v-model="form.type" :disabled="!editIng" :localdata="typeList" placeholder="请选择单位类型"></uni-data-select>
52 </view> 52 </view>
53 </uni-forms-item> 53 </uni-forms-item>
54 <uni-forms-item label="联系人" required> 54 <uni-forms-item label="联系人" required>
...@@ -109,6 +109,7 @@ ...@@ -109,6 +109,7 @@
109 <view class="picker-wrapper"> 109 <view class="picker-wrapper">
110 <uni-data-picker 110 <uni-data-picker
111 v-model="coordinates1" 111 v-model="coordinates1"
112 :disabled="!editIng"
112 :localdata="regionOptions" 113 :localdata="regionOptions"
113 class="custom-picker" 114 class="custom-picker"
114 popup-title="请选择所在地区" 115 popup-title="请选择所在地区"
...@@ -204,7 +205,7 @@ ...@@ -204,7 +205,7 @@
204 <view class="notice-box"> 205 <view class="notice-box">
205 <checkbox-group @change="onNoticeChange"> 206 <checkbox-group @change="onNoticeChange">
206 <label class="notice-label"> 207 <label class="notice-label">
207 <checkbox :checked="form.notice" color="#AD181F" value="1"/> 208 <checkbox :checked="form.notice" :disabled="!editIng" color="#AD181F" value="1"/>
208 <text class="notice-text">我已阅读并同意</text> 209 <text class="notice-text">我已阅读并同意</text>
209 <text class="notice-link" @click.stop="showNotice(1)">《注册须知》</text> 210 <text class="notice-link" @click.stop="showNotice(1)">《注册须知》</text>
210 <text class="notice-link" @click.stop="showNotice(2)">《入会须知》</text> 211 <text class="notice-link" @click.stop="showNotice(2)">《入会须知》</text>
...@@ -292,6 +293,7 @@ import config from '@/config.js' ...@@ -292,6 +293,7 @@ import config from '@/config.js'
292 import customModal from '@/components/custom-modal.vue' 293 import customModal from '@/components/custom-modal.vue'
293 // import uniDataSelect from '@/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue' 294 // import uniDataSelect from '@/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue'
294 const app = getApp(); 295 const app = getApp();
296 const PERFECT_PAY_REFRESH_KEY = 'perfectNeedRefreshAfterPay'
295 297
296 // 自定义弹框 ref 298 // 自定义弹框 ref
297 const customModalRef = ref(null) 299 const customModalRef = ref(null)
...@@ -365,6 +367,7 @@ const typeIndex = computed(() => { ...@@ -365,6 +367,7 @@ const typeIndex = computed(() => {
365 367
366 // 类型选择 368 // 类型选择
367 function typeChange(e) { 369 function typeChange(e) {
370 if (!editIng.value) return
368 const index = e.detail.value 371 const index = e.detail.value
369 form.value.type = typeList.value[index].value 372 form.value.type = typeList.value[index].value
370 } 373 }
...@@ -415,6 +418,7 @@ const creditCodeValid = ref(true) ...@@ -415,6 +418,7 @@ const creditCodeValid = ref(true)
415 418
416 // 须知勾选 419 // 须知勾选
417 function onNoticeChange(e) { 420 function onNoticeChange(e) {
421 if (!editIng.value) return
418 const values = e.detail.value 422 const values = e.detail.value
419 form.value.notice = values.includes('1') 423 form.value.notice = values.includes('1')
420 } 424 }
...@@ -488,6 +492,7 @@ function handelGetMyRecent() { ...@@ -488,6 +492,7 @@ function handelGetMyRecent() {
488 // payStatus: '0' 未支付, '1' 已支付, '2' 已取消 492 // payStatus: '0' 未支付, '1' 已支付, '2' 已取消
489 if (payForm.value.content) payForm.value.content = JSON.parse(payForm.value.content) 493 if (payForm.value.content) payForm.value.content = JSON.parse(payForm.value.content)
490 if (payForm.value.payStatus === '0') { 494 if (payForm.value.payStatus === '0') {
495 lockFormForUnpaidOrder()
491 showModal({ 496 showModal({
492 title: '系统提示', 497 title: '系统提示',
493 content: '您有一笔订单尚未支付,请及时支付或取消订单。', 498 content: '您有一笔订单尚未支付,请及时支付或取消订单。',
...@@ -497,7 +502,7 @@ function handelGetMyRecent() { ...@@ -497,7 +502,7 @@ function handelGetMyRecent() {
497 // 去支付,跳转到缴费页面 502 // 去支付,跳转到缴费页面
498 const assoName = assoFullName.value 503 const assoName = assoFullName.value
499 uni.navigateTo({ 504 uni.navigateTo({
500 url: `/myCenter/goPay?payName=${encodeURIComponent(payForm.value.orderName || form.value.name || '')}&assoName=${encodeURIComponent(assoName)}&orderId=${payForm.value.id}` 505 url: `/myCenter/goPay?payName=${encodeURIComponent(payForm.value.orderName || form.value.name || '')}&assoName=${encodeURIComponent(assoName)}&orderId=${payForm.value.id}&source=perfect`
501 }) 506 })
502 }, 507 },
503 onCancel: () => { 508 onCancel: () => {
...@@ -511,6 +516,11 @@ function handelGetMyRecent() { ...@@ -511,6 +516,11 @@ function handelGetMyRecent() {
511 }) 516 })
512 } 517 }
513 518
519 function lockFormForUnpaidOrder() {
520 editIng.value = false
521 btn.value = true
522 }
523
514 // 取消订单 524 // 取消订单
515 async function handelCancelOrder() { 525 async function handelCancelOrder() {
516 if (!payForm.value.id) return 526 if (!payForm.value.id) return
...@@ -626,19 +636,25 @@ onLoad(option => { ...@@ -626,19 +636,25 @@ onLoad(option => {
626 } 636 }
627 }); 637 });
628 638
629 function init() { 639 onShow(() => {
630 getDetail() 640 if (!uni.getStorageSync(PERFECT_PAY_REFRESH_KEY)) return
641 uni.removeStorageSync(PERFECT_PAY_REFRESH_KEY)
642 init()
643 })
644
645 async function init() {
646 await getDetail()
631 getRegionsList() 647 getRegionsList()
632 // getMyMemberCertUnitFeeApi() 648 // getMyMemberCertUnitFeeApi()
633 canUseDiscountApi() 649 canUseDiscountApi()
634 getZtxDiscountPolicyApi() 650 getZtxDiscountPolicyApi()
635 getMyStatusAPI() 651 getMyStatusAPI()
636 handelGetMyRecent() 652 await handelGetMyRecent().catch(() => {})
637 } 653 }
638 654
639 // 获取详情 655 // 获取详情
640 function getDetail() { 656 function getDetail() {
641 api.getMyOwnMemberInfo({showLoading: false}).then(res => { 657 return api.getMyOwnMemberInfo({showLoading: false}).then(res => {
642 // if (res.data.memberInfo) { 658 // if (res.data.memberInfo) {
643 // Object.assign(form.value, res.data.memberInfo) 659 // Object.assign(form.value, res.data.memberInfo)
644 // } 660 // }
...@@ -821,6 +837,7 @@ function findAssoNodeWithPath(list, targetId, currentPath) { ...@@ -821,6 +837,7 @@ function findAssoNodeWithPath(list, targetId, currentPath) {
821 837
822 // 协会选择(修复:100%对齐PC端el-cascader emitPath: false逻辑,只取最后一级ID) 838 // 协会选择(修复:100%对齐PC端el-cascader emitPath: false逻辑,只取最后一级ID)
823 function changCase(e) { 839 function changCase(e) {
840 if (!editIng.value) return
824 const valueArr = e.detail?.value || e; 841 const valueArr = e.detail?.value || e;
825 // 取最后一级的value(纯ID) 842 // 取最后一级的value(纯ID)
826 const lastNode = valueArr[valueArr.length - 1]; 843 const lastNode = valueArr[valueArr.length - 1];
...@@ -831,6 +848,7 @@ function changCase(e) { ...@@ -831,6 +848,7 @@ function changCase(e) {
831 // 地址选择(核心修复:从对象中提取纯value,对齐PC端格式) 848 // 地址选择(核心修复:从对象中提取纯value,对齐PC端格式)
832 // 地址选择(还原成你之前能用的版本:纯ID数组赋值) 849 // 地址选择(还原成你之前能用的版本:纯ID数组赋值)
833 function changeAddress(e) { 850 function changeAddress(e) {
851 if (!editIng.value) return
834 const selectedValue = e.detail?.value ?? e; 852 const selectedValue = e.detail?.value ?? e;
835 853
836 // 直接赋值纯ID,不要再取 .value 854 // 直接赋值纯ID,不要再取 .value
...@@ -1064,7 +1082,7 @@ function submitCertification() { ...@@ -1064,7 +1082,7 @@ function submitCertification() {
1064 const assoName = assoFullName.value 1082 const assoName = assoFullName.value
1065 // 跳转到缴费页面 1083 // 跳转到缴费页面
1066 uni.navigateTo({ 1084 uni.navigateTo({
1067 url: `/myCenter/goPay?payName=${encodeURIComponent(form.value.name || '')}&assoName=${encodeURIComponent(assoName)}` 1085 url: `/myCenter/goPay?payName=${encodeURIComponent(form.value.name || '')}&assoName=${encodeURIComponent(assoName)}&source=perfect`
1068 }) 1086 })
1069 }, 500) 1087 }, 500)
1070 } else { 1088 } else {
...@@ -1077,6 +1095,7 @@ function submitCertification() { ...@@ -1077,6 +1095,7 @@ function submitCertification() {
1077 1095
1078 // 营业执照上传 1096 // 营业执照上传
1079 function onBusinessLicenseSelect() { 1097 function onBusinessLicenseSelect() {
1098 if (!editIng.value) return
1080 uni.chooseImage({ 1099 uni.chooseImage({
1081 count: 1, 1100 count: 1,
1082 sizeType: ['compressed'], 1101 sizeType: ['compressed'],
...@@ -1128,22 +1147,26 @@ function onBusinessLicenseSelect() { ...@@ -1128,22 +1147,26 @@ function onBusinessLicenseSelect() {
1128 } 1147 }
1129 1148
1130 function removeBusinessLicense() { 1149 function removeBusinessLicense() {
1150 if (!editIng.value) return
1131 form.value.businessLicense = '' 1151 form.value.businessLicense = ''
1132 form.value.businessLicenseName = '' 1152 form.value.businessLicenseName = ''
1133 } 1153 }
1134 1154
1135 // 删除身份证正面 1155 // 删除身份证正面
1136 function removeIdCardFront() { 1156 function removeIdCardFront() {
1157 if (!editIng.value) return
1137 form.value.legalIdcPhoto1 = '' 1158 form.value.legalIdcPhoto1 = ''
1138 } 1159 }
1139 1160
1140 // 删除身份证反面 1161 // 删除身份证反面
1141 function removeIdCardBack() { 1162 function removeIdCardBack() {
1163 if (!editIng.value) return
1142 form.value.legalIdcPhoto2 = '' 1164 form.value.legalIdcPhoto2 = ''
1143 } 1165 }
1144 1166
1145 // 身份证上传 1167 // 身份证上传
1146 function onIdCardFrontSelect() { 1168 function onIdCardFrontSelect() {
1169 if (!editIng.value) return
1147 uni.chooseImage({ 1170 uni.chooseImage({
1148 count: 1, 1171 count: 1,
1149 sizeType: ['compressed'], 1172 sizeType: ['compressed'],
...@@ -1166,6 +1189,7 @@ function onIdCardFrontSelect() { ...@@ -1166,6 +1189,7 @@ function onIdCardFrontSelect() {
1166 } 1189 }
1167 1190
1168 function onIdCardBackSelect() { 1191 function onIdCardBackSelect() {
1192 if (!editIng.value) return
1169 uni.chooseImage({ 1193 uni.chooseImage({
1170 count: 1, 1194 count: 1,
1171 sizeType: ['compressed'], 1195 sizeType: ['compressed'],
...@@ -1213,6 +1237,7 @@ function extractIdCardInfo(tempPath) { ...@@ -1213,6 +1237,7 @@ function extractIdCardInfo(tempPath) {
1213 1237
1214 // 机构照片上传 1238 // 机构照片上传
1215 function onPicturesSelect() { 1239 function onPicturesSelect() {
1240 if (!editIng.value) return
1216 uni.chooseImage({ 1241 uni.chooseImage({
1217 count: 3, 1242 count: 3,
1218 sizeType: ['compressed'], 1243 sizeType: ['compressed'],
...@@ -1252,6 +1277,7 @@ function previewImage(url) { ...@@ -1252,6 +1277,7 @@ function previewImage(url) {
1252 1277
1253 // 删除机构照片 1278 // 删除机构照片
1254 function removePictures() { 1279 function removePictures() {
1280 if (!editIng.value) return
1255 form.value.pictures = '' 1281 form.value.pictures = ''
1256 } 1282 }
1257 1283
...@@ -1269,7 +1295,7 @@ function goPay() { ...@@ -1269,7 +1295,7 @@ function goPay() {
1269 const assoName = assoFullName.value || getAssoName(form.value.parentId) 1295 const assoName = assoFullName.value || getAssoName(form.value.parentId)
1270 // 跳转到缴费页面 1296 // 跳转到缴费页面
1271 uni.navigateTo({ 1297 uni.navigateTo({
1272 url: `/myCenter/goPay?payName=${encodeURIComponent(form.value.name || '')}&assoName=${encodeURIComponent(assoName)}` 1298 url: `/myCenter/goPay?payName=${encodeURIComponent(form.value.name || '')}&assoName=${encodeURIComponent(assoName)}&source=perfect`
1273 }) 1299 })
1274 } 1300 }
1275 1301
......
...@@ -328,8 +328,6 @@ function upIdCardImgFront(e) { ...@@ -328,8 +328,6 @@ function upIdCardImgFront(e) {
328 baseFormData.value.uuid = res.data.uuid 328 baseFormData.value.uuid = res.data.uuid
329 baseFormData.value.perCode = res.data.perCode || '' 329 baseFormData.value.perCode = res.data.perCode || ''
330 baseFormData.value.validityDate = res.data.validityDate?.slice(0, 10) //去掉时分秒 330 baseFormData.value.validityDate = res.data.validityDate?.slice(0, 10) //去掉时分秒
331 // 检查有效期,未过期则弹出提示
332 checkAndShowValidityModal()
333 // baseFormData.value.cityId = res.data.cityId 331 // baseFormData.value.cityId = res.data.cityId
334 // baseFormData.value.address = res.data.address 332 // baseFormData.value.address = res.data.address
335 } else { 333 } else {
...@@ -418,7 +416,6 @@ function getExtractInfo(obj) { ...@@ -418,7 +416,6 @@ function getExtractInfo(obj) {
418 baseFormData.value.phone = res.data.phone 416 baseFormData.value.phone = res.data.phone
419 baseFormData.value.perCode = res.data.perCode || '' 417 baseFormData.value.perCode = res.data.perCode || ''
420 baseFormData.value.validityDate = res.data.validityDate?.slice(0, 10) //去掉时分秒 418 baseFormData.value.validityDate = res.data.validityDate?.slice(0, 10) //去掉时分秒
421 checkAndShowValidityModal()
422 // baseFormData.value.cityId = res.data.cityId 419 // baseFormData.value.cityId = res.data.cityId
423 // baseFormData.value.address = res.data.address 420 // baseFormData.value.address = res.data.address
424 if (res.data.photo) { 421 if (res.data.photo) {
...@@ -530,7 +527,7 @@ function goSubmit() { ...@@ -530,7 +527,7 @@ function goSubmit() {
530 if (!agree.value) { 527 if (!agree.value) {
531 uni.showToast({ 528 uni.showToast({
532 icon: 'none', 529 icon: 'none',
533 title: '请阅读入会须知', 530 title: '请阅读并同意《注册须知》和《入会须知》',
534 duration: 2000 531 duration: 2000
535 }); 532 });
536 return 533 return
...@@ -575,7 +572,9 @@ function goSubmit() { ...@@ -575,7 +572,9 @@ function goSubmit() {
575 content: '请确认信息正确', 572 content: '请确认信息正确',
576 success: function (res) { 573 success: function (res) {
577 if (res.confirm) { 574 if (res.confirm) {
578 goPay() 575 if (!checkAndShowValidityModal()) {
576 goPay()
577 }
579 } 578 }
580 } 579 }
581 }); 580 });
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!