d0fda066 by lttnew

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

1 parent 4ecc383f
......@@ -58,6 +58,12 @@ function logout() {
userStore.setUser(null)
app.globalData.isLogin = false
app.globalData.userInfo = null
app.globalData.memberInfo = null
app.globalData.dept = null
app.globalData.deptType = null
app.globalData.userType = null
app.globalData.authenticationStatus = null
})
}
......
......@@ -123,6 +123,8 @@ const isPaying = ref(false)
const payName = ref('')
const assoName = ref('')
const app = getApp()
const sourcePage = ref('')
const PERFECT_PAY_REFRESH_KEY = 'perfectNeedRefreshAfterPay'
const pickFirst = (...values) => {
const value = values.find(item => item !== undefined && item !== null && String(item).trim() !== '')
......@@ -283,6 +285,7 @@ const handelPay = async () => {
}
data = res.data
}
markPerfectNeedRefresh()
// 无需支付,直接成功
if (data.payFlag == 0) {
......@@ -327,6 +330,7 @@ const handelPay = async () => {
onLoad((option) => {
console.log(66, option)
sourcePage.value = option.source || ''
fillPayDisplayInfo({}, {}, option)
// 接收订单ID(再次支付时)
if (option.orderId) {
......@@ -349,6 +353,12 @@ onLoad((option) => {
init()
})
function markPerfectNeedRefresh() {
if (sourcePage.value === 'perfect') {
uni.setStorageSync(PERFECT_PAY_REFRESH_KEY, '1')
}
}
// 初始化接口
async function init() {
uni.showLoading({
......
......@@ -176,35 +176,14 @@ onLoad((option) => {
onShow(() => {
if (app.globalData.isLogin) {
if (quickGoPerfectByCachedStatus()) return
init()
} else {
app.firstLoadCallback = () => {
if (quickGoPerfectByCachedStatus()) return
init()
}
}
})
function quickGoPerfectByCachedStatus() {
if (!hasCachedAuthStatus()) return false
if (navigatingPerfect.value) return true
const authStatus = String(app.globalData.authenticationStatus)
const memberInfoData = app.globalData.memberInfo || {}
const shouldGoPerfect = authStatus === '0' ||
authStatus === '3' ||
(authStatus === '1' && !memberInfoData.memCode)
if (!shouldGoPerfect) return false
goPerfectFromDaoGuan()
return true
}
function hasCachedAuthStatus() {
return app.globalData.authenticationStatus !== undefined &&
app.globalData.authenticationStatus !== null &&
String(app.globalData.authenticationStatus) !== 'undefined'
}
function init() {
checkImgExist()
// handelGetMyRecent()
......@@ -260,7 +239,7 @@ function handleAccountStatus() {
const memberInfoData = app.globalData.memberInfo || {}
const activeStatus = memberInfoData.activeStatus
if (!app.globalData.authenticationStatus || authStatus === 'undefined' || authStatus === '0' || authStatus === '3') {
if (authStatus === '0' || authStatus === '3') {
goPerfectFromDaoGuan()
return
}
......
......@@ -48,7 +48,7 @@
</uni-forms-item>
<uni-forms-item label="单位类型" required>
<view style="width: 100%;">
<uni-data-select v-model="form.type" :localdata="typeList" placeholder="请选择单位类型"></uni-data-select>
<uni-data-select v-model="form.type" :disabled="!editIng" :localdata="typeList" placeholder="请选择单位类型"></uni-data-select>
</view>
</uni-forms-item>
<uni-forms-item label="联系人" required>
......@@ -109,6 +109,7 @@
<view class="picker-wrapper">
<uni-data-picker
v-model="coordinates1"
:disabled="!editIng"
:localdata="regionOptions"
class="custom-picker"
popup-title="请选择所在地区"
......@@ -204,7 +205,7 @@
<view class="notice-box">
<checkbox-group @change="onNoticeChange">
<label class="notice-label">
<checkbox :checked="form.notice" color="#AD181F" value="1"/>
<checkbox :checked="form.notice" :disabled="!editIng" color="#AD181F" value="1"/>
<text class="notice-text">我已阅读并同意</text>
<text class="notice-link" @click.stop="showNotice(1)">《注册须知》</text>
<text class="notice-link" @click.stop="showNotice(2)">《入会须知》</text>
......@@ -292,6 +293,7 @@ import config from '@/config.js'
import customModal from '@/components/custom-modal.vue'
// import uniDataSelect from '@/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue'
const app = getApp();
const PERFECT_PAY_REFRESH_KEY = 'perfectNeedRefreshAfterPay'
// 自定义弹框 ref
const customModalRef = ref(null)
......@@ -365,6 +367,7 @@ const typeIndex = computed(() => {
// 类型选择
function typeChange(e) {
if (!editIng.value) return
const index = e.detail.value
form.value.type = typeList.value[index].value
}
......@@ -415,6 +418,7 @@ const creditCodeValid = ref(true)
// 须知勾选
function onNoticeChange(e) {
if (!editIng.value) return
const values = e.detail.value
form.value.notice = values.includes('1')
}
......@@ -488,6 +492,7 @@ function handelGetMyRecent() {
// payStatus: '0' 未支付, '1' 已支付, '2' 已取消
if (payForm.value.content) payForm.value.content = JSON.parse(payForm.value.content)
if (payForm.value.payStatus === '0') {
lockFormForUnpaidOrder()
showModal({
title: '系统提示',
content: '您有一笔订单尚未支付,请及时支付或取消订单。',
......@@ -497,7 +502,7 @@ function handelGetMyRecent() {
// 去支付,跳转到缴费页面
const assoName = assoFullName.value
uni.navigateTo({
url: `/myCenter/goPay?payName=${encodeURIComponent(payForm.value.orderName || form.value.name || '')}&assoName=${encodeURIComponent(assoName)}&orderId=${payForm.value.id}`
url: `/myCenter/goPay?payName=${encodeURIComponent(payForm.value.orderName || form.value.name || '')}&assoName=${encodeURIComponent(assoName)}&orderId=${payForm.value.id}&source=perfect`
})
},
onCancel: () => {
......@@ -511,6 +516,11 @@ function handelGetMyRecent() {
})
}
function lockFormForUnpaidOrder() {
editIng.value = false
btn.value = true
}
// 取消订单
async function handelCancelOrder() {
if (!payForm.value.id) return
......@@ -626,19 +636,25 @@ onLoad(option => {
}
});
function init() {
getDetail()
onShow(() => {
if (!uni.getStorageSync(PERFECT_PAY_REFRESH_KEY)) return
uni.removeStorageSync(PERFECT_PAY_REFRESH_KEY)
init()
})
async function init() {
await getDetail()
getRegionsList()
// getMyMemberCertUnitFeeApi()
canUseDiscountApi()
getZtxDiscountPolicyApi()
getMyStatusAPI()
handelGetMyRecent()
await handelGetMyRecent().catch(() => {})
}
// 获取详情
function getDetail() {
api.getMyOwnMemberInfo({showLoading: false}).then(res => {
return api.getMyOwnMemberInfo({showLoading: false}).then(res => {
// if (res.data.memberInfo) {
// Object.assign(form.value, res.data.memberInfo)
// }
......@@ -821,6 +837,7 @@ function findAssoNodeWithPath(list, targetId, currentPath) {
// 协会选择(修复:100%对齐PC端el-cascader emitPath: false逻辑,只取最后一级ID)
function changCase(e) {
if (!editIng.value) return
const valueArr = e.detail?.value || e;
// 取最后一级的value(纯ID)
const lastNode = valueArr[valueArr.length - 1];
......@@ -831,6 +848,7 @@ function changCase(e) {
// 地址选择(核心修复:从对象中提取纯value,对齐PC端格式)
// 地址选择(还原成你之前能用的版本:纯ID数组赋值)
function changeAddress(e) {
if (!editIng.value) return
const selectedValue = e.detail?.value ?? e;
// 直接赋值纯ID,不要再取 .value
......@@ -1064,7 +1082,7 @@ function submitCertification() {
const assoName = assoFullName.value
// 跳转到缴费页面
uni.navigateTo({
url: `/myCenter/goPay?payName=${encodeURIComponent(form.value.name || '')}&assoName=${encodeURIComponent(assoName)}`
url: `/myCenter/goPay?payName=${encodeURIComponent(form.value.name || '')}&assoName=${encodeURIComponent(assoName)}&source=perfect`
})
}, 500)
} else {
......@@ -1077,6 +1095,7 @@ function submitCertification() {
// 营业执照上传
function onBusinessLicenseSelect() {
if (!editIng.value) return
uni.chooseImage({
count: 1,
sizeType: ['compressed'],
......@@ -1128,22 +1147,26 @@ function onBusinessLicenseSelect() {
}
function removeBusinessLicense() {
if (!editIng.value) return
form.value.businessLicense = ''
form.value.businessLicenseName = ''
}
// 删除身份证正面
function removeIdCardFront() {
if (!editIng.value) return
form.value.legalIdcPhoto1 = ''
}
// 删除身份证反面
function removeIdCardBack() {
if (!editIng.value) return
form.value.legalIdcPhoto2 = ''
}
// 身份证上传
function onIdCardFrontSelect() {
if (!editIng.value) return
uni.chooseImage({
count: 1,
sizeType: ['compressed'],
......@@ -1166,6 +1189,7 @@ function onIdCardFrontSelect() {
}
function onIdCardBackSelect() {
if (!editIng.value) return
uni.chooseImage({
count: 1,
sizeType: ['compressed'],
......@@ -1213,6 +1237,7 @@ function extractIdCardInfo(tempPath) {
// 机构照片上传
function onPicturesSelect() {
if (!editIng.value) return
uni.chooseImage({
count: 3,
sizeType: ['compressed'],
......@@ -1252,6 +1277,7 @@ function previewImage(url) {
// 删除机构照片
function removePictures() {
if (!editIng.value) return
form.value.pictures = ''
}
......@@ -1269,7 +1295,7 @@ function goPay() {
const assoName = assoFullName.value || getAssoName(form.value.parentId)
// 跳转到缴费页面
uni.navigateTo({
url: `/myCenter/goPay?payName=${encodeURIComponent(form.value.name || '')}&assoName=${encodeURIComponent(assoName)}`
url: `/myCenter/goPay?payName=${encodeURIComponent(form.value.name || '')}&assoName=${encodeURIComponent(assoName)}&source=perfect`
})
}
......
......@@ -328,8 +328,6 @@ function upIdCardImgFront(e) {
baseFormData.value.uuid = res.data.uuid
baseFormData.value.perCode = res.data.perCode || ''
baseFormData.value.validityDate = res.data.validityDate?.slice(0, 10) //去掉时分秒
// 检查有效期,未过期则弹出提示
checkAndShowValidityModal()
// baseFormData.value.cityId = res.data.cityId
// baseFormData.value.address = res.data.address
} else {
......@@ -418,7 +416,6 @@ function getExtractInfo(obj) {
baseFormData.value.phone = res.data.phone
baseFormData.value.perCode = res.data.perCode || ''
baseFormData.value.validityDate = res.data.validityDate?.slice(0, 10) //去掉时分秒
checkAndShowValidityModal()
// baseFormData.value.cityId = res.data.cityId
// baseFormData.value.address = res.data.address
if (res.data.photo) {
......@@ -530,7 +527,7 @@ function goSubmit() {
if (!agree.value) {
uni.showToast({
icon: 'none',
title: '请阅读入会须知',
title: '请阅读并同意《注册须知》和《入会须知》',
duration: 2000
});
return
......@@ -575,9 +572,11 @@ function goSubmit() {
content: '请确认信息正确',
success: function (res) {
if (res.confirm) {
if (!checkAndShowValidityModal()) {
goPay()
}
}
}
});
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!