fix: 修复登录跳转与支付展示异常

修复 H5 未登录扫码跳转登录页路径错误,补充手机号登录印尼/中国区号选择与校验,并修正支付方式单选及币种符号展示,避免支付页显示和选择异常。

Made-with: Cursor
This commit is contained in:
2026-04-25 16:08:43 +08:00
parent 2f618ef6ec
commit 555035388a
6 changed files with 57 additions and 18 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
// export const URL = "https://my.gxfs123.com/api" //正式服务器-弃用 // export const URL = "https://my.gxfs123.com/api" //正式服务器-弃用
export const URL = "https://manager.fdzpower.com/api" //正式服务器 export const URL = "https://manager.fdzpower.com/api" //正式服务器
// export const URL = "https://fansdev.gxfs123.com/api" //测试服务器 // export const URL = "https://fansdev.gxfs123.com/api" //测试服务器
// export const URL = "http://192.168.5.11:8080" //本地调试 // export const URL = "http://192.168.0.158:8080" //本地调试
// export const URL = "http://127.0.0.1:8080" //本地调试 // export const URL = "http://127.0.0.1:8080" //本地调试
export const appid = "wx2165f0be356ae7a9" //微信小程序appid export const appid = "wx2165f0be356ae7a9" //微信小程序appid
+2
View File
@@ -402,6 +402,8 @@ export default {
paymentMethod: 'Method', paymentMethod: 'Method',
wechatPay: 'WeChat', wechatPay: 'WeChat',
alipay: 'Alipay', alipay: 'Alipay',
alipayHk: 'Alipay (Hong Kong)',
alipayId: 'Alipay (Indonesia)',
balance: 'Balance', balance: 'Balance',
payNow: 'Pay', payNow: 'Pay',
paying: 'Processing...', paying: 'Processing...',
+2
View File
@@ -401,6 +401,8 @@ export default {
paymentMethod: 'Metode Pembayaran', paymentMethod: 'Metode Pembayaran',
wechatPay: 'Pembayaran WeChat', wechatPay: 'Pembayaran WeChat',
alipay: 'Alipay', alipay: 'Alipay',
alipayHk: 'Alipay Hong Kong',
alipayId: 'Alipay Indonesia',
balance: 'Pembayaran Saldo', balance: 'Pembayaran Saldo',
payNow: 'Bayar Sekarang', payNow: 'Bayar Sekarang',
paying: 'Sedang membayar...', paying: 'Sedang membayar...',
+2
View File
@@ -401,6 +401,8 @@ export default {
paymentMethod: '支付方式', paymentMethod: '支付方式',
wechatPay: '微信支付', wechatPay: '微信支付',
alipay: '支付宝', alipay: '支付宝',
alipayHk: 'Alipay 香港',
alipayId: 'Alipay 印尼',
balance: '余额支付', balance: '余额支付',
payNow: '立即支付', payNow: '立即支付',
paying: '支付中...', paying: '支付中...',
+21 -7
View File
@@ -40,7 +40,7 @@
</view> </view>
<view class="price-item"> <view class="price-item">
<text class="label">{{ $t('payment.deposit') }}</text> <text class="label">{{ $t('payment.deposit') }}</text>
<text class="value">¥ {{ orderInfo.deposit || '90' }}</text> <text class="value">{{ currencySymbol }} {{ orderInfo.deposit || '90' }}</text>
</view> </view>
<!-- <view class="price-item"> <!-- <view class="price-item">
<text class="label">{{ $t('payment.package') }}</text> <text class="label">{{ $t('payment.package') }}</text>
@@ -49,7 +49,7 @@
<view class="price-item total"> <view class="price-item total">
<text class="label">{{ $t('payment.total') }}</text> <text class="label">{{ $t('payment.total') }}</text>
<view class="total-value"> <view class="total-value">
<text class="currency">¥</text> <text class="currency">{{ currencySymbol }}</text>
<text class="amount">{{ totalAmount }}</text> <text class="amount">{{ totalAmount }}</text>
</view> </view>
</view> </view>
@@ -61,7 +61,7 @@
<view class="card-title-bar"></view> <view class="card-title-bar"></view>
<view class="card-title">{{ $t('payment.paymentMethod') }}</view> <view class="card-title">{{ $t('payment.paymentMethod') }}</view>
</view> </view>
<view class="payment-method-item" v-for="item in paymentMethods" :key="item.paymentMethodType" <view class="payment-method-item" v-for="(item, idx) in paymentMethods" :key="`${item.paymentMethodType}-${idx}`"
@click="selectPaymentMethod(item.paymentMethodType)"> @click="selectPaymentMethod(item.paymentMethodType)">
<view class="method-left"> <view class="method-left">
<text class="method-name">{{ item.paymentMethodName }}</text> <text class="method-name">{{ item.paymentMethodName }}</text>
@@ -76,7 +76,7 @@
<!-- 底部操作栏 --> <!-- 底部操作栏 -->
<view class="bottom-bar"> <view class="bottom-bar">
<view class="pay-btn" @click="handlePayment"> <view class="pay-btn" @click="handlePayment">
<text class="currency-small">¥</text> <text class="currency-small">{{ currencySymbol }}</text>
<text class="amount-large">{{ totalAmount }}</text> <text class="amount-large">{{ totalAmount }}</text>
<text class="pay-text">{{ $t('payment.payNow') }}</text> <text class="pay-text">{{ $t('payment.payNow') }}</text>
</view> </view>
@@ -156,6 +156,14 @@
return deposit.toFixed(2) return deposit.toFixed(2)
}) })
const getCurrencySymbolByMethod = (methodType) => {
if (methodType === 'ALIPAY_ID') return 'Rp'
if (methodType === 'ALIPAY_HK') return 'HK$'
return '¥'
}
const currencySymbol = computed(() => getCurrencySymbolByMethod(selectedPaymentMethod.value))
// 加载订单信息 // 加载订单信息
const loadOrderInfo = async () => { const loadOrderInfo = async () => {
// 检查 orderId 是否存在,如果不存在则尝试从缓存获取 // 检查 orderId 是否存在,如果不存在则尝试从缓存获取
@@ -295,6 +303,8 @@
try { try {
const osType = getOsType(); const osType = getOsType();
const res = await getAntomPaymentMethods(orderInfo.value.orderNo, osType); const res = await getAntomPaymentMethods(orderInfo.value.orderNo, osType);
console.log(res.data);
console.log(res.data.paymentOptions,'支付方式');
// if (res.code === 200 && res.data && res.data.paymentOptions) { // if (res.code === 200 && res.data && res.data.paymentOptions) {
// res.data.paymentOptions.forEach(item => { // res.data.paymentOptions.forEach(item => {
// methods.push({ // methods.push({
@@ -303,10 +313,14 @@
// }); // });
// }); // });
// } // }
//因后端约束,固定支付方式ALIPAY_HK // 每条选项的 paymentMethodType 必须唯一下发到 Antom 的 paymentType 参数,否则 v-for 的 key 与单选态会异常
methods.push({ methods.push({
paymentMethodType:'ALIPAY_HK', paymentMethodType: 'ALIPAY_HK',
paymentMethodName:'ALIPAY_HK' paymentMethodName: t('payment.alipayHk')
})
methods.push({
paymentMethodType: 'ALIPAY_ID',
paymentMethodName: t('payment.alipayId')
}) })
} catch (error) { } catch (error) {
console.error('获取 Antom 支付方式失败:', error); console.error('获取 Antom 支付方式失败:', error);
+29 -10
View File
@@ -17,7 +17,7 @@
class="phone-input" class="phone-input"
v-model="phone" v-model="phone"
type="number" type="number"
maxlength="11" :maxlength="countryCode === '+86' ? 11 : 12"
:placeholder="$t('auth.phonePlaceholder')" :placeholder="$t('auth.phonePlaceholder')"
/> />
</view> </view>
@@ -41,7 +41,7 @@
<!-- 区域提示 --> <!-- 区域提示 -->
<view class="region-notice"> <view class="region-notice">
<text>{{ $t('auth.regionNotSupported') }}</text> <!-- <text>当前支持印尼+62和中国+86手机号登录</text> -->
</view> </view>
<!-- 登录按钮 --> <!-- 登录按钮 -->
@@ -87,20 +87,34 @@
const isAgreed = ref(false) // 是否同意协议 const isAgreed = ref(false) // 是否同意协议
const phone = ref('') // 手机号 const phone = ref('') // 手机号
const verifyCode = ref('') // 验证码 const verifyCode = ref('') // 验证码
const countryCode = ref('+86') // 国家区号 const countryCode = ref('+62') // 国家区号,默认印尼
const countdown = ref(0) // 验证码倒计时 const countdown = ref(0) // 验证码倒计时
let timer = null // 计时器 let timer = null // 计时器
const countryOptions = [{
label: '印尼 +62',
value: '+62'
}, {
label: '中国 +86',
value: '+86'
}]
// 勾选协议变化 // 勾选协议变化
const onAgreementChange = (e) => { const onAgreementChange = (e) => {
isAgreed.value = e.detail.value.includes('agreed') isAgreed.value = e.detail.value.includes('agreed')
} }
// 显示国家区号选择器(暂时仅支持+86 // 显示国家区号选择器
const showCountryPicker = () => { const showCountryPicker = () => {
uni.showToast({ uni.showActionSheet({
title: t('auth.onlyMainlandSupported'), itemList: countryOptions.map(item => item.label),
icon: 'none' success: ({
tapIndex
}) => {
const selected = countryOptions[tapIndex]
if (!selected || selected.value === countryCode.value) return
countryCode.value = selected.value
phone.value = ''
}
}) })
} }
@@ -110,7 +124,7 @@
uni.showToast({ title: t('auth.phoneRequired'), icon: 'none' }) uni.showToast({ title: t('auth.phoneRequired'), icon: 'none' })
return false return false
} }
const phoneReg = /^1[3-9]\d{9}$/ const phoneReg = countryCode.value === '+86' ? /^1[3-9]\d{9}$/ : /^8\d{7,11}$/
if (!phoneReg.test(phone.value)) { if (!phoneReg.test(phone.value)) {
uni.showToast({ title: t('auth.phoneInvalid'), icon: 'none' }) uni.showToast({ title: t('auth.phoneInvalid'), icon: 'none' })
return false return false
@@ -118,6 +132,11 @@
return true return true
} }
const getSubmitPhoneNumber = () => {
// 中国沿用原有 11 位手机号格式;印尼附带国家区号
return countryCode.value === '+86' ? phone.value : `${countryCode.value}${phone.value}`
}
// 发送验证码 // 发送验证码
const handleSendCode = async () => { const handleSendCode = async () => {
if (countdown.value > 0) return if (countdown.value > 0) return
@@ -126,7 +145,7 @@
try { try {
uni.showLoading({ title: t('common.sending') }) uni.showLoading({ title: t('common.sending') })
await sendVerifyCode(phone.value) await sendVerifyCode(getSubmitPhoneNumber())
uni.hideLoading() uni.hideLoading()
uni.showToast({ title: t('auth.codeSent'), icon: 'success' }) uni.showToast({ title: t('auth.codeSent'), icon: 'success' })
@@ -167,7 +186,7 @@
const res = await quickLogin({ const res = await quickLogin({
loginType: 'SMS', loginType: 'SMS',
appid, appid,
phonenumber: phone.value, phonenumber: getSubmitPhoneNumber(),
smsCode: verifyCode.value smsCode: verifyCode.value
}) })