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
+21 -7
View File
@@ -40,7 +40,7 @@
</view>
<view class="price-item">
<text class="label">{{ $t('payment.deposit') }}</text>
<text class="value">¥ {{ orderInfo.deposit || '90' }}</text>
<text class="value">{{ currencySymbol }} {{ orderInfo.deposit || '90' }}</text>
</view>
<!-- <view class="price-item">
<text class="label">{{ $t('payment.package') }}</text>
@@ -49,7 +49,7 @@
<view class="price-item total">
<text class="label">{{ $t('payment.total') }}</text>
<view class="total-value">
<text class="currency">¥</text>
<text class="currency">{{ currencySymbol }}</text>
<text class="amount">{{ totalAmount }}</text>
</view>
</view>
@@ -61,7 +61,7 @@
<view class="card-title-bar"></view>
<view class="card-title">{{ $t('payment.paymentMethod') }}</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)">
<view class="method-left">
<text class="method-name">{{ item.paymentMethodName }}</text>
@@ -76,7 +76,7 @@
<!-- 底部操作栏 -->
<view class="bottom-bar">
<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="pay-text">{{ $t('payment.payNow') }}</text>
</view>
@@ -156,6 +156,14 @@
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 () => {
// 检查 orderId 是否存在,如果不存在则尝试从缓存获取
@@ -295,6 +303,8 @@
try {
const osType = getOsType();
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) {
// res.data.paymentOptions.forEach(item => {
// methods.push({
@@ -303,10 +313,14 @@
// });
// });
// }
//因后端约束,固定支付方式ALIPAY_HK
// 每条选项的 paymentMethodType 必须唯一下发到 Antom 的 paymentType 参数,否则 v-for 的 key 与单选态会异常
methods.push({
paymentMethodType:'ALIPAY_HK',
paymentMethodName:'ALIPAY_HK'
paymentMethodType: 'ALIPAY_HK',
paymentMethodName: t('payment.alipayHk')
})
methods.push({
paymentMethodType: 'ALIPAY_ID',
paymentMethodName: t('payment.alipayId')
})
} catch (error) {
console.error('获取 Antom 支付方式失败:', error);
+29 -10
View File
@@ -17,7 +17,7 @@
class="phone-input"
v-model="phone"
type="number"
maxlength="11"
:maxlength="countryCode === '+86' ? 11 : 12"
:placeholder="$t('auth.phonePlaceholder')"
/>
</view>
@@ -41,7 +41,7 @@
<!-- 区域提示 -->
<view class="region-notice">
<text>{{ $t('auth.regionNotSupported') }}</text>
<!-- <text>当前支持印尼+62和中国+86手机号登录</text> -->
</view>
<!-- 登录按钮 -->
@@ -87,20 +87,34 @@
const isAgreed = ref(false) // 是否同意协议
const phone = ref('') // 手机号
const verifyCode = ref('') // 验证码
const countryCode = ref('+86') // 国家区号
const countryCode = ref('+62') // 国家区号,默认印尼
const countdown = ref(0) // 验证码倒计时
let timer = null // 计时器
const countryOptions = [{
label: '印尼 +62',
value: '+62'
}, {
label: '中国 +86',
value: '+86'
}]
// 勾选协议变化
const onAgreementChange = (e) => {
isAgreed.value = e.detail.value.includes('agreed')
}
// 显示国家区号选择器(暂时仅支持+86
// 显示国家区号选择器
const showCountryPicker = () => {
uni.showToast({
title: t('auth.onlyMainlandSupported'),
icon: 'none'
uni.showActionSheet({
itemList: countryOptions.map(item => item.label),
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' })
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)) {
uni.showToast({ title: t('auth.phoneInvalid'), icon: 'none' })
return false
@@ -118,6 +132,11 @@
return true
}
const getSubmitPhoneNumber = () => {
// 中国沿用原有 11 位手机号格式;印尼附带国家区号
return countryCode.value === '+86' ? phone.value : `${countryCode.value}${phone.value}`
}
// 发送验证码
const handleSendCode = async () => {
if (countdown.value > 0) return
@@ -126,7 +145,7 @@
try {
uni.showLoading({ title: t('common.sending') })
await sendVerifyCode(phone.value)
await sendVerifyCode(getSubmitPhoneNumber())
uni.hideLoading()
uni.showToast({ title: t('auth.codeSent'), icon: 'success' })
@@ -167,7 +186,7 @@
const res = await quickLogin({
loginType: 'SMS',
appid,
phonenumber: phone.value,
phonenumber: getSubmitPhoneNumber(),
smsCode: verifyCode.value
})