feat(金币代理页面): 对接兑换比例数据

This commit is contained in:
hzj 2026-04-15 19:49:02 +08:00
parent aee4293b15
commit 5c1450f64a
6 changed files with 71 additions and 32 deletions

View File

@ -96,7 +96,9 @@
"search_user": "البحث عن المستخدم", "search_user": "البحث عن المستخدم",
"enter_user_id": "يرجى إدخال id المستخدم", "enter_user_id": "يرجى إدخال id المستخدم",
"recharge": "شحن", "recharge": "شحن",
"enter_recharge_amount": "أدخل عدد القطع النقدية التي تريد إيداعها على المستخدم.", "enter_recharge_amount": "أدخل مبلغ الدولارات المراد شحنه للمستخدم.",
"recharge_auto_convert_tip": "تحويل تلقائي لعدد العملات الذهبية المطلوبة للشحن.",
"recharge_ratio_text": "*$1={ratio} عملة",
"recharge_now": "شحن الآن", "recharge_now": "شحن الآن",
"succeed": "ينجح", "succeed": "ينجح",
"seller_records": "سجل البائع", "seller_records": "سجل البائع",

View File

@ -96,7 +96,9 @@
"search_user": "ব্যবহারকারী অনুসন্ধান", "search_user": "ব্যবহারকারী অনুসন্ধান",
"enter_user_id": "দয়া করে ব্যবহারকারী আইডি লিখুন", "enter_user_id": "দয়া করে ব্যবহারকারী আইডি লিখুন",
"recharge": "রিচার্জ", "recharge": "রিচার্জ",
"enter_recharge_amount": "ব্যবহারকারীকে রিচার্জ করার মুদ্রার পরিমাণ লিখুন।", "enter_recharge_amount": "ব্যবহারকারীকে রিচার্জ করার ডলারের পরিমাণ লিখুন।",
"recharge_auto_convert_tip": "রিচার্জের জন্য প্রয়োজনীয় গোল্ড কয়েন স্বয়ংক্রিয়ভাবে রূপান্তর করা হবে।",
"recharge_ratio_text": "*$1={ratio} কয়েন",
"recharge_now": "এখন রিচার্জ করুন", "recharge_now": "এখন রিচার্জ করুন",
"succeed": "সফল", "succeed": "সফল",
"seller_records": "বিক্রেতা রেকর্ড", "seller_records": "বিক্রেতা রেকর্ড",

View File

@ -96,7 +96,9 @@
"search_user": "Search user", "search_user": "Search user",
"enter_user_id": "Please enter the user ID", "enter_user_id": "Please enter the user ID",
"recharge": "Recharge", "recharge": "Recharge",
"enter_recharge_amount": "Enter the amount of coins to be recharged to the user.", "enter_recharge_amount": "Enter the amount of Dollars to be recharged to the user.",
"recharge_auto_convert_tip": "Autoconvert the gold coins needed for recharge.",
"recharge_ratio_text": "*$1={ratio}coins",
"recharge_now": "Recharge now", "recharge_now": "Recharge now",
"succeed": "Succeed", "succeed": "Succeed",
"seller_records": "Seller Records", "seller_records": "Seller Records",

View File

@ -96,7 +96,9 @@
"search_user": "Kullanıcı ara", "search_user": "Kullanıcı ara",
"enter_user_id": "Lütfen kullanıcı ID'sini girin", "enter_user_id": "Lütfen kullanıcı ID'sini girin",
"recharge": "Yükle", "recharge": "Yükle",
"enter_recharge_amount": "Kullanıcıya yüklenecek coin miktarını girin.", "enter_recharge_amount": "Kullanıcıya yüklenecek Dolar miktarını girin.",
"recharge_auto_convert_tip": "Yükleme için gereken altın coin miktarı otomatik olarak dönüştürülür.",
"recharge_ratio_text": "*$1={ratio} coin",
"recharge_now": "Şimdi yükle", "recharge_now": "Şimdi yükle",
"succeed": "Başarılı", "succeed": "Başarılı",
"seller_records": "Satıcı Kayıtları", "seller_records": "Satıcı Kayıtları",

View File

@ -96,7 +96,9 @@
"search_user": "搜索用户", "search_user": "搜索用户",
"enter_user_id": "请输入用户id", "enter_user_id": "请输入用户id",
"recharge": "充值", "recharge": "充值",
"enter_recharge_amount": "请输入要向用户充值的硬币数量。", "enter_recharge_amount": "请输入要向用户充值的美元金额。",
"recharge_auto_convert_tip": "自动换算本次充值所需的金币数量。",
"recharge_ratio_text": "*$1={ratio}金币",
"recharge_now": "现在充值", "recharge_now": "现在充值",
"succeed": "成功", "succeed": "成功",
"seller_records": "卖家记录", "seller_records": "卖家记录",

View File

@ -191,10 +191,10 @@
<div style="margin-bottom: 12px; font-weight: 600; color: #333"> <div style="margin-bottom: 12px; font-weight: 600; color: #333">
{{ t('recharge') }} {{ t('recharge') }}
</div> </div>
<div></div>
<!-- 输入金额 --> <!-- 输入金额 -->
<div <div
style=" style="
margin-bottom: 16px;
background-color: white; background-color: white;
padding: 10px 16px; padding: 10px 16px;
border-radius: 12px; border-radius: 12px;
@ -212,6 +212,15 @@
/> />
</div> </div>
<div style="margin: 10px 0 16px">
<div style="color: rgba(0, 0, 0, 0.4); font-weight: 600; font-size: 0.9em">
{{ t('recharge_auto_convert_tip') }}
</div>
<div style="color: rgba(0, 0, 0, 0.4); font-weight: 600; font-size: 0.9em">
{{ t('recharge_ratio_text', { ratio: rechargeRatio }) }}
</div>
</div>
<!-- 按钮 --> <!-- 按钮 -->
<div style="display: flex; justify-content: center"> <div style="display: flex; justify-content: center">
<button <button
@ -385,8 +394,9 @@ const AmountList = computed(() => {
}) })
const selectedAmount = ref({}) const selectedAmount = ref({})
//
const isAbleSelect = ref(false) const isAbleSelect = ref(false) //
const rechargeRatio = ref(0) // 1
// //
const amountStyle = (amountItem) => { const amountStyle = (amountItem) => {
@ -446,24 +456,6 @@ const Confirm = () => {
closedPopup() closedPopup()
} }
//
const preventDecimalInput = (event) => {
let value = event.target.value
//
value = value.replace(/[^0-9]/g, '')
// 1
if (value === '' || parseInt(value) < 1) {
value = ''
}
//
event.target.value = value
rechargeAmount.value = parseFloat(value) || 0
}
// //
const onKeyDown = (event) => { const onKeyDown = (event) => {
// e+- // e+-
@ -520,6 +512,7 @@ const getFreightThreshold = async () => {
if (resFreightThreshold.status && resFreightThreshold.body) { if (resFreightThreshold.status && resFreightThreshold.body) {
freightThreshold.value = resFreightThreshold.body freightThreshold.value = resFreightThreshold.body
isAbleSelect.value = !resFreightThreshold.body?.settinged // isAbleSelect.value = !resFreightThreshold.body?.settinged //
rechargeRatio.value = resFreightThreshold.body?.rechargeRatio || 0 //
} }
} }
@ -548,17 +541,47 @@ const initializeUser = () => {
// //
const rechargeAmount = ref('') const rechargeAmount = ref('')
const isRecharging = ref(false) const isRecharging = ref(false)
const currentCoinBalance = computed(() => {
return Number(coinsAmount.value) || 0
})
const rechargeDollarAmount = computed(() => {
return Number(rechargeAmount.value) || 0
})
const rechargeCoinsNeeded = computed(() => {
return rechargeDollarAmount.value * (Number(rechargeRatio.value) || 0)
})
// //
const canRecharge = computed(() => { const canRecharge = computed(() => {
return ( return (
selectedUser.value.id && selectedUser.value.id &&
rechargeAmount.value && rechargeAmount.value &&
parseFloat(rechargeAmount.value) > 0 && rechargeDollarAmount.value > 0 &&
Number(rechargeRatio.value) > 0 &&
rechargeCoinsNeeded.value > 0 &&
rechargeCoinsNeeded.value <= currentCoinBalance.value &&
!isRecharging.value !isRecharging.value
) )
}) })
//
const preventDecimalInput = (event) => {
let value = event.target.value
//
value = value.replace(/[^0-9]/g, '')
// 1
if (value === '' || parseInt(value) < 1) {
value = ''
}
//
event.target.value = value
rechargeAmount.value = parseFloat(value) || 0
}
// //
const goToRecords = () => { const goToRecords = () => {
router.push('/seller-records') router.push('/seller-records')
@ -573,12 +596,17 @@ const searchUser = () => {
const rechargeNow = useThrottle(async () => { const rechargeNow = useThrottle(async () => {
if (!canRecharge.value || isRecharging.value) return if (!canRecharge.value || isRecharging.value) return
const amount = parseFloat(rechargeAmount.value) const amount = rechargeDollarAmount.value
const quantity = rechargeCoinsNeeded.value
if (amount <= 0) { if (amount <= 0) {
showError(t('please_enter_valid_amount')) showError(t('please_enter_valid_amount'))
return return
} }
if (quantity <= 0 || quantity > currentCoinBalance.value) {
return
}
// ID // ID
const acceptUserId = selectedUser.value.id const acceptUserId = selectedUser.value.id
if (!acceptUserId) { if (!acceptUserId) {
@ -591,7 +619,8 @@ const rechargeNow = useThrottle(async () => {
const rechargeData = { const rechargeData = {
acceptUserId: acceptUserId, acceptUserId: acceptUserId,
quantity: amount, quantity: quantity,
amount: amount,
} }
const response = await freightRecharge(rechargeData) const response = await freightRecharge(rechargeData)
@ -604,7 +633,7 @@ const rechargeNow = useThrottle(async () => {
showSuccess( showSuccess(
t('transfer_coin_success', { t('transfer_coin_success', {
amount: amount, amount: quantity,
name: selectedUser.value.name, name: selectedUser.value.name,
}), }),
) )
@ -614,7 +643,7 @@ const rechargeNow = useThrottle(async () => {
} else { } else {
showError( showError(
t('transfer_coin_failed', { t('transfer_coin_failed', {
amount: amount, amount: quantity,
}), }),
) )
} }
@ -623,7 +652,7 @@ const rechargeNow = useThrottle(async () => {
showError( showError(
error.response.errorMsg || error.response.errorMsg ||
t('transfer_coin_failed', { t('transfer_coin_failed', {
amount: amount, amount: quantity,
}), }),
) )
} finally { } finally {