修复:不同系统支付,显示支付方式不同

This commit is contained in:
2025-12-15 11:18:22 +08:00
parent 1457a24cea
commit 9e00409e5e

View File

@@ -3,7 +3,7 @@
<!-- 自定义导航栏 --> <!-- 自定义导航栏 -->
<nav-bar :title="$t('order.recharge')"></nav-bar> <nav-bar :title="$t('order.recharge')"></nav-bar>
<!-- 活动充值金额 --> <!-- 活动充值金额 -->
<view class="block" v-if="eventAmountList.length > 0"> <view class="block" v-if="eventAmountList?.length > 0">
<!-- <view class="text">{{$t('order.rechargeAmount')}}</view> --> <!-- <view class="text">{{$t('order.rechargeAmount')}}</view> -->
<view class="text">活动充值金额</view> <view class="text">活动充值金额</view>
<view class="recharge"> <view class="recharge">
@@ -39,13 +39,11 @@
<view class="cha_fangsh"> <view class="cha_fangsh">
<view class="cf_title">{{$t('user.paymentMethod')}}</view> <view class="cf_title">{{$t('user.paymentMethod')}}</view>
<view class="cf_radio"> <view class="cf_radio">
<radio-group v-for="item in iosPaylist"> <radio-group>
<view> <view>
<view :class="payType == item.id ? 'Tab_xf cf_xuanx' : 'cf_xuanx'"> <view class="cf_xuanx">
<!-- <image class="pay_item_img" :src="item.imgUrl" mode="aspectFil"> <text>{{ isAndroid ? $t('user.googlePay') : $t('user.applePay')}}</text>
</image> --> <radio checked="true;" @click="choseType(item.id)"></radio>
<text>{{ item.title }}</text>
<radio :checked="payType === item.id" @click="choseType(item.id)"></radio>
</view> </view>
</view> </view>
</radio-group> </radio-group>
@@ -88,14 +86,6 @@
const userStore = useUserStore() const userStore = useUserStore()
const { t } = useI18n() const { t } = useI18n()
const message = useMessage() const message = useMessage()
const payType = ref('1')
const iosPaylist = ref([
{
title: "Google Pay",
id: '1',
// imgUrl: "/static/icon/currency.png"
}
])
// 充值列表 // 充值列表
const rechargeList = ref([]) const rechargeList = ref([])
// 金额列表单独每项 // 金额列表单独每项
@@ -135,7 +125,7 @@
const eventAmountList = ref([]) const eventAmountList = ref([])
//正常金额数据 //正常金额数据
const standardAmountList = ref([]) const standardAmountList = ref([])
// 声明ios实例
const iapChannel = ref(null) const iapChannel = ref(null)
/** /**
@@ -257,10 +247,10 @@
*/ */
const getProductInfo = () => { const getProductInfo = () => {
const id = String(aloneItem.value.priceTypeId) const id = String(aloneItem.value.priceTypeId)
iapChannel.value.requestProduct([id], (res: any) => { iapChannel.value.requestProduct([id], (res : any) => {
console.log(res, '查询苹果后台配置的商品id'); console.log(res, '查询苹果后台配置的商品id');
topay(id) topay(id)
}, (err: any) => { }, (err : any) => {
uni.showToast({ title: '未获取到产品信息,请联系管理员', icon: 'none' }); uni.showToast({ title: '未获取到产品信息,请联系管理员', icon: 'none' });
console.error('失败', err); console.error('失败', err);
}); });
@@ -269,7 +259,7 @@
/** /**
* 准备支付-调出支付窗口 * 准备支付-调出支付窗口
*/ */
const topay = (id: string) => { const topay = (id : string) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.hideLoading() uni.hideLoading()
uni.requestPayment({ uni.requestPayment({
@@ -325,9 +315,9 @@
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
iapChannel.value.restoreCompletedTransactions({ iapChannel.value.restoreCompletedTransactions({
manualFinishTransaction: true, manualFinishTransaction: true,
}, (res: unknown) => { }, (res : unknown) => {
console.log(res, '成功-restoreCompletedTransactions'); console.log(res, '成功-restoreCompletedTransactions');
res.map((item: any) => { res.map((item : any) => {
finishTransaction(item) finishTransaction(item)
}) })
resolve(res); resolve(res);
@@ -496,13 +486,6 @@
} }
} }
/**
* 切换支付方式
*/
const choseType = () => {
// payType.value = val;
}
onMounted(() => { onMounted(() => {
getDevName(); getDevName();
getActivityDescriptionData() getActivityDescriptionData()