diff --git a/config/url.js b/config/url.js index 0219e93..1e4c28a 100644 --- a/config/url.js +++ b/config/url.js @@ -1,7 +1,7 @@ // export const URL = "https://my.gxfs123.com/api" //正式服务器-弃用 export const URL = "https://manager.fdzpower.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 appid = "wx2165f0be356ae7a9" //微信小程序appid diff --git a/locale/en-US.js b/locale/en-US.js index ba1127f..b1b5c40 100644 --- a/locale/en-US.js +++ b/locale/en-US.js @@ -402,6 +402,8 @@ export default { paymentMethod: 'Method', wechatPay: 'WeChat', alipay: 'Alipay', + alipayHk: 'Alipay (Hong Kong)', + alipayId: 'Alipay (Indonesia)', balance: 'Balance', payNow: 'Pay', paying: 'Processing...', diff --git a/locale/id-ID.js b/locale/id-ID.js index 075b732..fa4bcfc 100644 --- a/locale/id-ID.js +++ b/locale/id-ID.js @@ -401,6 +401,8 @@ export default { paymentMethod: 'Metode Pembayaran', wechatPay: 'Pembayaran WeChat', alipay: 'Alipay', + alipayHk: 'Alipay Hong Kong', + alipayId: 'Alipay Indonesia', balance: 'Pembayaran Saldo', payNow: 'Bayar Sekarang', paying: 'Sedang membayar...', diff --git a/locale/zh-CN.js b/locale/zh-CN.js index 71d0b58..01b6cf1 100644 --- a/locale/zh-CN.js +++ b/locale/zh-CN.js @@ -401,6 +401,8 @@ export default { paymentMethod: '支付方式', wechatPay: '微信支付', alipay: '支付宝', + alipayHk: 'Alipay 香港', + alipayId: 'Alipay 印尼', balance: '余额支付', payNow: '立即支付', paying: '支付中...', diff --git a/subPackages/order/payment.vue b/subPackages/order/payment.vue index a34b886..bb8aa29 100644 --- a/subPackages/order/payment.vue +++ b/subPackages/order/payment.vue @@ -40,7 +40,7 @@ {{ $t('payment.deposit') }} - ¥ {{ orderInfo.deposit || '90' }} + {{ currencySymbol }} {{ orderInfo.deposit || '90' }} - ¥ + {{ currencySymbol }} {{ totalAmount }} {{ $t('payment.payNow') }} @@ -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); diff --git a/subPackages/user/login/phone.vue b/subPackages/user/login/phone.vue index 4100729..edf2330 100644 --- a/subPackages/user/login/phone.vue +++ b/subPackages/user/login/phone.vue @@ -17,7 +17,7 @@ class="phone-input" v-model="phone" type="number" - maxlength="11" + :maxlength="countryCode === '+86' ? 11 : 12" :placeholder="$t('auth.phonePlaceholder')" /> @@ -41,7 +41,7 @@ - {{ $t('auth.regionNotSupported') }} + @@ -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 })