更新:加按钮节流

This commit is contained in:
2025-11-28 11:48:39 +08:00
parent 12de098e10
commit 3587e15e7a
3 changed files with 55 additions and 4 deletions

View File

@@ -66,6 +66,7 @@
import { useMessage } from '@/uni_modules/wot-design-uni'
import { getBookBuyConfigList, getAgreement, getActivityDescription, verifyGooglePay, getPlaceOrder } from '@/api/modules/user'
import { useUserStore } from '@/stores/user'
import { useThrottle } from '@/hooks/useThrottle';
const googlePay = uni.requireNativePlugin("sn-googlepay5");
const userStore = useUserStore()
@@ -226,7 +227,11 @@
// payType.value = val;
}
const handleRecharge = async () => {
/**
* 点击支付按钮
*/
const paymentButton = async () => {
if (!state.value) {
uni.showToast({
title: t('order.readAgreeServices'),
@@ -237,7 +242,8 @@
getPlaceOrderObj()
uni.showLoading({ title: '生成订单中...' })
}
// 节流支付按钮
const handleRecharge = useThrottle(paymentButton);
/**
* 初始化
@@ -275,6 +281,11 @@
getPayAll()
} else {
console.log('查询失败', e);
uni.showToast({
title: 'No product found.',
icon: 'none',
duration: 2000
})
// 查询失败
}
}
@@ -326,12 +337,12 @@
},
);
}
/**
* 校验订单
*/
const googleVerify = async () => {
console.log(typeof aloneItem.value.priceTypeId, typeof purchaseToken.value, typeof orderSn.value);
console.log(typeof aloneItem.value.priceTypeId, typeof purchaseToken.value, typeof orderSn.value);
try {
const obj = await verifyGooglePay(aloneItem.value.priceTypeId, purchaseToken.value, orderSn.value)
uni.switchTab({