diff --git a/apps/admin/app/dashboard/payment/payment-form.tsx b/apps/admin/app/dashboard/payment/payment-form.tsx index 96f62a2..973234f 100644 --- a/apps/admin/app/dashboard/payment/payment-form.tsx +++ b/apps/admin/app/dashboard/payment/payment-form.tsx @@ -30,6 +30,7 @@ import { SheetTitle, SheetTrigger, } from '@workspace/ui/components/sheet'; +import { MarkdownEditor } from '@workspace/ui/custom-components/editor'; import { EnhancedInput } from '@workspace/ui/custom-components/enhanced-input'; import { Icon } from '@workspace/ui/custom-components/icon'; import { unitConversion } from '@workspace/ui/utils'; @@ -75,6 +76,7 @@ export default function PaymentForm({ fee_mode: z.coerce.number().min(0).max(2), fee_percent: z.coerce.number().optional(), fee_amount: z.coerce.number().optional(), + description: z.string().optional(), }); const form = useForm>({ @@ -376,6 +378,23 @@ export default function PaymentForm({ ))} )} + + ( + + {t('description')} + + form.setValue(field.name, value as string)} + /> + + + + )} + /> diff --git a/apps/admin/config/use-global.tsx b/apps/admin/config/use-global.tsx index e81b0c7..5ce3cc5 100644 --- a/apps/admin/config/use-global.tsx +++ b/apps/admin/config/use-global.tsx @@ -63,6 +63,7 @@ export const useGlobalStore = create((set) => ({ verify_code_interval: 60, }, oauth_methods: [], + web_ad: false, }, user: undefined, setCommon: (common) => diff --git a/apps/admin/locales/cs-CZ/payment.json b/apps/admin/locales/cs-CZ/payment.json index 44707dd..2f87495 100644 --- a/apps/admin/locales/cs-CZ/payment.json +++ b/apps/admin/locales/cs-CZ/payment.json @@ -19,6 +19,8 @@ "delete": "Smazat", "deleteSuccess": "Úspěšně smazáno", "deleteWarning": "Opravdu chcete smazat tuto platební metodu? Tuto akci nelze vrátit zpět.", + "description": "Popis", + "descriptionPlaceholder": "Zadejte popis platební metody", "domain": "Doména", "domainPlaceholder": "volitelné, např. {example}", "edit": "Upravit", diff --git a/apps/admin/locales/de-DE/payment.json b/apps/admin/locales/de-DE/payment.json index 4be8d6b..fc08e7d 100644 --- a/apps/admin/locales/de-DE/payment.json +++ b/apps/admin/locales/de-DE/payment.json @@ -19,6 +19,8 @@ "delete": "Löschen", "deleteSuccess": "Erfolgreich gelöscht", "deleteWarning": "Sind Sie sicher, dass Sie diese Zahlungsmethode löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.", + "description": "Beschreibung", + "descriptionPlaceholder": "Geben Sie die Beschreibung der Zahlungsmethode ein", "domain": "Domain", "domainPlaceholder": "optional, z.B. {example}", "edit": "Bearbeiten", diff --git a/apps/admin/locales/en-US/payment.json b/apps/admin/locales/en-US/payment.json index 0eeee6f..869e14b 100644 --- a/apps/admin/locales/en-US/payment.json +++ b/apps/admin/locales/en-US/payment.json @@ -19,6 +19,8 @@ "delete": "Delete", "deleteSuccess": "Deleted successfully", "deleteWarning": "Are you sure you want to delete this payment method? This action cannot be undone.", + "description": "Description", + "descriptionPlaceholder": "Enter payment method description", "domain": "Domain", "domainPlaceholder": "optional, e.g. {example}", "edit": "Edit", diff --git a/apps/admin/locales/es-ES/payment.json b/apps/admin/locales/es-ES/payment.json index 20d2e0b..d77ae12 100644 --- a/apps/admin/locales/es-ES/payment.json +++ b/apps/admin/locales/es-ES/payment.json @@ -19,6 +19,8 @@ "delete": "Eliminar", "deleteSuccess": "Eliminado con éxito", "deleteWarning": "¿Está seguro de que desea eliminar este método de pago? Esta acción no se puede deshacer.", + "description": "Descripción", + "descriptionPlaceholder": "Ingrese la descripción del método de pago", "domain": "Dominio", "domainPlaceholder": "opcional, p. ej. {example}", "edit": "Editar", diff --git a/apps/admin/locales/es-MX/payment.json b/apps/admin/locales/es-MX/payment.json index b449172..e0ac77c 100644 --- a/apps/admin/locales/es-MX/payment.json +++ b/apps/admin/locales/es-MX/payment.json @@ -19,6 +19,8 @@ "delete": "Eliminar", "deleteSuccess": "Eliminado con éxito", "deleteWarning": "¿Está seguro de que desea eliminar este método de pago? Esta acción no se puede deshacer.", + "description": "Descripción", + "descriptionPlaceholder": "Ingresa la descripción del método de pago", "domain": "Dominio", "domainPlaceholder": "opcional, p. ej. {example}", "edit": "Editar", diff --git a/apps/admin/locales/fa-IR/payment.json b/apps/admin/locales/fa-IR/payment.json index 2a04410..3066878 100644 --- a/apps/admin/locales/fa-IR/payment.json +++ b/apps/admin/locales/fa-IR/payment.json @@ -19,6 +19,8 @@ "delete": "حذف", "deleteSuccess": "با موفقیت حذف شد", "deleteWarning": "آیا مطمئن هستید که می‌خواهید این روش پرداخت را حذف کنید؟ این عمل قابل بازگشت نیست.", + "description": "توضیحات", + "descriptionPlaceholder": "توضیحات روش پرداخت را وارد کنید", "domain": "دامنه", "domainPlaceholder": "اختیاری، به عنوان مثال {example}", "edit": "ویرایش", diff --git a/apps/admin/locales/fi-FI/payment.json b/apps/admin/locales/fi-FI/payment.json index 4d9da41..e00de3d 100644 --- a/apps/admin/locales/fi-FI/payment.json +++ b/apps/admin/locales/fi-FI/payment.json @@ -19,6 +19,8 @@ "delete": "Poista", "deleteSuccess": "Poisto onnistui", "deleteWarning": "Oletko varma, että haluat poistaa tämän maksutavan? Tätä toimintoa ei voi peruuttaa.", + "description": "Kuvaus", + "descriptionPlaceholder": "Syötä maksutavan kuvaus", "domain": "Verkkotunnus", "domainPlaceholder": "valinnainen, esim. {esimerkki}", "edit": "Muokkaa", diff --git a/apps/admin/locales/fr-FR/payment.json b/apps/admin/locales/fr-FR/payment.json index 6033d69..84eaa46 100644 --- a/apps/admin/locales/fr-FR/payment.json +++ b/apps/admin/locales/fr-FR/payment.json @@ -19,6 +19,8 @@ "delete": "Supprimer", "deleteSuccess": "Supprimé avec succès", "deleteWarning": "Êtes-vous sûr de vouloir supprimer ce mode de paiement ? Cette action ne peut pas être annulée.", + "description": "Description", + "descriptionPlaceholder": "Entrez la description du mode de paiement", "domain": "Domaine", "domainPlaceholder": "facultatif, par exemple {exemple}", "edit": "Modifier", diff --git a/apps/admin/locales/hi-IN/payment.json b/apps/admin/locales/hi-IN/payment.json index e9ad10e..6d9e51f 100644 --- a/apps/admin/locales/hi-IN/payment.json +++ b/apps/admin/locales/hi-IN/payment.json @@ -19,6 +19,8 @@ "delete": "हटाएं", "deleteSuccess": "सफलता से हटाया गया", "deleteWarning": "क्या आप वास्तव में इस भुगतान विधि को हटाना चाहते हैं? यह क्रिया पूर्ववत नहीं की जा सकती।", + "description": "विवरण", + "descriptionPlaceholder": "भुगतान विधि का विवरण दर्ज करें", "domain": "डोमेन", "domainPlaceholder": "वैकल्पिक, जैसे कि {example}", "edit": "संपादित करें", diff --git a/apps/admin/locales/hu-HU/payment.json b/apps/admin/locales/hu-HU/payment.json index a58be43..4bd7465 100644 --- a/apps/admin/locales/hu-HU/payment.json +++ b/apps/admin/locales/hu-HU/payment.json @@ -19,6 +19,8 @@ "delete": "Törlés", "deleteSuccess": "Sikeresen törölve", "deleteWarning": "Biztosan törölni szeretné ezt a fizetési módot? Ez a művelet nem vonható vissza.", + "description": "Leírás", + "descriptionPlaceholder": "Írja be a fizetési mód leírását", "domain": "Domain", "domainPlaceholder": "opcionális, pl. {példa}", "edit": "Szerkesztés", diff --git a/apps/admin/locales/ja-JP/payment.json b/apps/admin/locales/ja-JP/payment.json index 96c0afa..c7596e9 100644 --- a/apps/admin/locales/ja-JP/payment.json +++ b/apps/admin/locales/ja-JP/payment.json @@ -19,6 +19,8 @@ "delete": "削除", "deleteSuccess": "削除成功", "deleteWarning": "この支払い方法を削除してもよろしいですか?この操作は元に戻せません。", + "description": "説明", + "descriptionPlaceholder": "支払い方法の説明を入力してください", "domain": "ドメイン", "domainPlaceholder": "任意、例:{example}", "edit": "編集", diff --git a/apps/admin/locales/ko-KR/payment.json b/apps/admin/locales/ko-KR/payment.json index e443c9a..b2e4340 100644 --- a/apps/admin/locales/ko-KR/payment.json +++ b/apps/admin/locales/ko-KR/payment.json @@ -19,6 +19,8 @@ "delete": "삭제", "deleteSuccess": "삭제 성공", "deleteWarning": "이 결제 수단을 삭제하시겠습니까? 이 작업은 취소할 수 없습니다.", + "description": "설명", + "descriptionPlaceholder": "결제 수단 설명을 입력하세요", "domain": "도메인", "domainPlaceholder": "선택 사항, 예: {example}", "edit": "편집", diff --git a/apps/admin/locales/no-NO/payment.json b/apps/admin/locales/no-NO/payment.json index d486a32..264a00a 100644 --- a/apps/admin/locales/no-NO/payment.json +++ b/apps/admin/locales/no-NO/payment.json @@ -19,6 +19,8 @@ "delete": "Slett", "deleteSuccess": "Slettet med suksess", "deleteWarning": "Er du sikker på at du vil slette denne betalingsmetoden? Denne handlingen kan ikke angres.", + "description": "Beskrivelse", + "descriptionPlaceholder": "Skriv inn beskrivelse av betalingsmetode", "domain": "Domene", "domainPlaceholder": "valgfritt, f.eks. {example}", "edit": "Rediger", diff --git a/apps/admin/locales/pl-PL/payment.json b/apps/admin/locales/pl-PL/payment.json index 8bffc71..3306cf4 100644 --- a/apps/admin/locales/pl-PL/payment.json +++ b/apps/admin/locales/pl-PL/payment.json @@ -19,6 +19,8 @@ "delete": "Usuń", "deleteSuccess": "Usunięto pomyślnie", "deleteWarning": "Czy na pewno chcesz usunąć tę metodę płatności? Ta akcja jest nieodwracalna.", + "description": "Opis", + "descriptionPlaceholder": "Wprowadź opis metody płatności", "domain": "Domena", "domainPlaceholder": "opcjonalnie, np. {example}", "edit": "Edytuj", diff --git a/apps/admin/locales/pt-BR/payment.json b/apps/admin/locales/pt-BR/payment.json index 0f8b0cc..1ead05b 100644 --- a/apps/admin/locales/pt-BR/payment.json +++ b/apps/admin/locales/pt-BR/payment.json @@ -19,6 +19,8 @@ "delete": "Excluir", "deleteSuccess": "Excluído com sucesso", "deleteWarning": "Você tem certeza de que deseja excluir este método de pagamento? Esta ação não pode ser desfeita.", + "description": "Descrição", + "descriptionPlaceholder": "Insira a descrição do método de pagamento", "domain": "Domínio", "domainPlaceholder": "opcional, por exemplo, {exemplo}", "edit": "Editar", diff --git a/apps/admin/locales/ro-RO/payment.json b/apps/admin/locales/ro-RO/payment.json index fbe4106..3155286 100644 --- a/apps/admin/locales/ro-RO/payment.json +++ b/apps/admin/locales/ro-RO/payment.json @@ -19,6 +19,8 @@ "delete": "Șterge", "deleteSuccess": "Șters cu succes", "deleteWarning": "Ești sigur că vrei să ștergi această metodă de plată? Această acțiune nu poate fi anulată.", + "description": "Descriere", + "descriptionPlaceholder": "Introduceți descrierea metodei de plată", "domain": "Domeniu", "domainPlaceholder": "opțional, de exemplu {example}", "edit": "Editează", diff --git a/apps/admin/locales/ru-RU/payment.json b/apps/admin/locales/ru-RU/payment.json index fc9e77d..e64483b 100644 --- a/apps/admin/locales/ru-RU/payment.json +++ b/apps/admin/locales/ru-RU/payment.json @@ -19,6 +19,8 @@ "delete": "Удалить", "deleteSuccess": "Успешно удалено", "deleteWarning": "Вы уверены, что хотите удалить этот способ оплаты? Это действие нельзя отменить.", + "description": "Описание", + "descriptionPlaceholder": "Введите описание метода оплаты", "domain": "Домен", "domainPlaceholder": "необязательно, например, {example}", "edit": "Редактировать", diff --git a/apps/admin/locales/th-TH/payment.json b/apps/admin/locales/th-TH/payment.json index d63faf7..0253a77 100644 --- a/apps/admin/locales/th-TH/payment.json +++ b/apps/admin/locales/th-TH/payment.json @@ -19,6 +19,8 @@ "delete": "ลบ", "deleteSuccess": "ลบสำเร็จ", "deleteWarning": "คุณแน่ใจหรือไม่ว่าต้องการลบวิธีการชำระเงินนี้? การกระทำนี้ไม่สามารถย้อนกลับได้", + "description": "คำอธิบาย", + "descriptionPlaceholder": "กรอกคำอธิบายวิธีการชำระเงิน", "domain": "โดเมน", "domainPlaceholder": "ไม่บังคับ เช่น {example}", "edit": "แก้ไข", diff --git a/apps/admin/locales/tr-TR/payment.json b/apps/admin/locales/tr-TR/payment.json index 85faf23..fe754be 100644 --- a/apps/admin/locales/tr-TR/payment.json +++ b/apps/admin/locales/tr-TR/payment.json @@ -19,6 +19,8 @@ "delete": "Sil", "deleteSuccess": "Başarıyla silindi", "deleteWarning": "Bu ödeme yöntemini silmek istediğinize emin misiniz? Bu işlem geri alınamaz.", + "description": "Açıklama", + "descriptionPlaceholder": "Ödeme yöntemi açıklamasını girin", "domain": "Alan Adı", "domainPlaceholder": "isteğe bağlı, örn. {example}", "edit": "Düzenle", diff --git a/apps/admin/locales/uk-UA/payment.json b/apps/admin/locales/uk-UA/payment.json index efc1caf..482c4fb 100644 --- a/apps/admin/locales/uk-UA/payment.json +++ b/apps/admin/locales/uk-UA/payment.json @@ -19,6 +19,8 @@ "delete": "Видалити", "deleteSuccess": "Успішно видалено", "deleteWarning": "Ви впевнені, що хочете видалити цей спосіб оплати? Цю дію не можна скасувати.", + "description": "Опис", + "descriptionPlaceholder": "Введіть опис способу оплати", "domain": "Домен", "domainPlaceholder": "необов'язково, наприклад, {example}", "edit": "Редагувати", diff --git a/apps/admin/locales/vi-VN/payment.json b/apps/admin/locales/vi-VN/payment.json index d483c18..854c0eb 100644 --- a/apps/admin/locales/vi-VN/payment.json +++ b/apps/admin/locales/vi-VN/payment.json @@ -19,6 +19,8 @@ "delete": "Xóa", "deleteSuccess": "Xóa thành công", "deleteWarning": "Bạn có chắc chắn muốn xóa phương thức thanh toán này không? Hành động này không thể hoàn tác.", + "description": "Mô tả", + "descriptionPlaceholder": "Nhập mô tả phương thức thanh toán", "domain": "Miền", "domainPlaceholder": "tùy chọn, ví dụ: {example}", "edit": "Chỉnh Sửa", diff --git a/apps/admin/locales/zh-CN/payment.json b/apps/admin/locales/zh-CN/payment.json index a61fbf9..d033aa6 100644 --- a/apps/admin/locales/zh-CN/payment.json +++ b/apps/admin/locales/zh-CN/payment.json @@ -19,6 +19,8 @@ "delete": "删除", "deleteSuccess": "删除成功", "deleteWarning": "您确定要删除此支付方式吗?此操作无法撤销。", + "description": "描述", + "descriptionPlaceholder": "输入支付方式描述", "domain": "域名", "domainPlaceholder": "可选,例如 {example}", "edit": "编辑", diff --git a/apps/admin/locales/zh-HK/payment.json b/apps/admin/locales/zh-HK/payment.json index 0adde42..30329ee 100644 --- a/apps/admin/locales/zh-HK/payment.json +++ b/apps/admin/locales/zh-HK/payment.json @@ -19,6 +19,8 @@ "delete": "刪除", "deleteSuccess": "刪除成功", "deleteWarning": "您確定要刪除此付款方式嗎?此操作無法撤銷。", + "description": "描述", + "descriptionPlaceholder": "輸入付款方式描述", "domain": "域名", "domainPlaceholder": "可選,例如 {example}", "edit": "編輯", diff --git a/apps/admin/services/admin/index.ts b/apps/admin/services/admin/index.ts index f9e3438..37cdd29 100644 --- a/apps/admin/services/admin/index.ts +++ b/apps/admin/services/admin/index.ts @@ -1,5 +1,5 @@ // @ts-ignore - + // API 更新时间: // API 唯一标识: import * as ads from './ads'; diff --git a/apps/admin/services/admin/typings.d.ts b/apps/admin/services/admin/typings.d.ts index 4eb9059..72cceb8 100644 --- a/apps/admin/services/admin/typings.d.ts +++ b/apps/admin/services/admin/typings.d.ts @@ -233,6 +233,7 @@ declare namespace API { type CreatePaymentMethodRequest = { name: string; platform: string; + description: string; icon?: string; domain?: string; config: Record; @@ -964,6 +965,7 @@ declare namespace API { id: number; name: string; platform: string; + description: string; icon: string; fee_mode: number; fee_percent: number; @@ -974,6 +976,7 @@ declare namespace API { id: number; name: string; platform: string; + description: string; icon?: string; domain?: string; config: Record; @@ -987,6 +990,7 @@ declare namespace API { id: number; name: string; platform: string; + description: string; icon: string; domain: string; config: Record; @@ -1524,6 +1528,7 @@ declare namespace API { id: number; name: string; platform: string; + description: string; icon?: string; domain?: string; config: Record; diff --git a/apps/admin/services/common/index.ts b/apps/admin/services/common/index.ts index 73b3bda..61ba129 100644 --- a/apps/admin/services/common/index.ts +++ b/apps/admin/services/common/index.ts @@ -1,5 +1,5 @@ // @ts-ignore - + // API 更新时间: // API 唯一标识: import * as auth from './auth'; diff --git a/apps/admin/services/common/typings.d.ts b/apps/admin/services/common/typings.d.ts index acf19f6..e91d415 100644 --- a/apps/admin/services/common/typings.d.ts +++ b/apps/admin/services/common/typings.d.ts @@ -364,6 +364,7 @@ declare namespace API { id: number; name: string; platform: string; + description: string; icon: string; fee_mode: number; fee_percent: number; @@ -374,6 +375,7 @@ declare namespace API { id: number; name: string; platform: string; + description: string; icon?: string; domain?: string; config: Record; @@ -387,6 +389,7 @@ declare namespace API { id: number; name: string; platform: string; + description: string; icon: string; domain: string; config: Record; diff --git a/apps/user/app/(main)/purchasing/content.tsx b/apps/user/app/(main)/purchasing/content.tsx index 39a44a5..2f1ca78 100644 --- a/apps/user/app/(main)/purchasing/content.tsx +++ b/apps/user/app/(main)/purchasing/content.tsx @@ -25,7 +25,7 @@ export default function Content({ subscription }: { subscription?: API.Subscribe const [params, setParams] = useState({ quantity: 1, subscribe_id: 0, - payment: '', + payment: -1, coupon: '', platform: 'email', identifier: '', diff --git a/apps/user/components/subscribe/duration-selector.tsx b/apps/user/components/subscribe/duration-selector.tsx index 4b2f146..fa34ee0 100644 --- a/apps/user/components/subscribe/duration-selector.tsx +++ b/apps/user/components/subscribe/duration-selector.tsx @@ -27,11 +27,7 @@ const DurationSelector: React.FC = ({ [onChange], ); - const DurationOption: React.FC<{ value: string; label: string; discount?: number }> = ({ - value, - label, - discount, - }) => ( + const DurationOption: React.FC<{ value: string; label: string }> = ({ value, label }) => (
); + // 查找当前选中项的折扣信息 + const currentDiscount = discounts.find((item) => item.quantity === quantity)?.discount; + const discountPercentage = currentDiscount ? 100 - currentDiscount : 0; + return ( <>
{t('purchaseDuration')}
@@ -58,10 +57,19 @@ const DurationSelector: React.FC = ({ key={item.quantity} value={String(item.quantity)} label={`${item.quantity} / ${t(unitTime)}`} - discount={100 - item.discount} /> ))} +
+ {t('discountInfo')}: + {discountPercentage > 0 ? ( + + -{discountPercentage}% {t('discount')} + + ) : ( + -- + )} +
); }; diff --git a/apps/user/components/subscribe/payment-methods.tsx b/apps/user/components/subscribe/payment-methods.tsx index c768ce1..63f022d 100644 --- a/apps/user/components/subscribe/payment-methods.tsx +++ b/apps/user/components/subscribe/payment-methods.tsx @@ -1,8 +1,6 @@ 'use client'; import { getAvailablePaymentMethods } from '@/services/user/portal'; -// import { getAvailablePaymentMethods } from '@/services/user/payment'; -// import { getAvailablePaymentMethods } from '@/services/user/payment'; import { useQuery } from '@tanstack/react-query'; import { Label } from '@workspace/ui/components/label'; import { RadioGroup, RadioGroupItem } from '@workspace/ui/components/radio-group'; @@ -11,8 +9,8 @@ import Image from 'next/image'; import React, { memo } from 'react'; interface PaymentMethodsProps { - value: string; - onChange: (value: string) => void; + value: number; + onChange: (value: number) => void; balance?: boolean; } @@ -24,9 +22,9 @@ const PaymentMethods: React.FC = ({ value, onChange, balanc queryFn: async () => { const { data } = await getAvailablePaymentMethods(); const methods = data.data?.list || []; - if (!value && methods[0]?.mark) onChange(methods[0]?.mark); + if (!value && methods[0]?.id) onChange(methods[0]?.id); if (balance) return methods; - return methods.filter((item) => item.mark !== 'balance'); + return methods.filter((item) => item.id !== -1); }, }); return ( @@ -34,26 +32,26 @@ const PaymentMethods: React.FC = ({ value, onChange, balanc
{t('paymentMethod')}
onChange(Number(val))} > {data?.map((item) => ( -
- +
+
diff --git a/apps/user/components/subscribe/purchase.tsx b/apps/user/components/subscribe/purchase.tsx index 8abf49e..89fad07 100644 --- a/apps/user/components/subscribe/purchase.tsx +++ b/apps/user/components/subscribe/purchase.tsx @@ -29,7 +29,7 @@ export default function Purchase({ subscribe, setSubscribe }: Readonly>({ quantity: 1, subscribe_id: 0, - payment: 'balance', + payment: -1, coupon: '', }); const [loading, startTransition] = useTransition(); diff --git a/apps/user/components/subscribe/recharge.tsx b/apps/user/components/subscribe/recharge.tsx index 502a558..9373837 100644 --- a/apps/user/components/subscribe/recharge.tsx +++ b/apps/user/components/subscribe/recharge.tsx @@ -2,8 +2,6 @@ import useGlobalStore from '@/config/use-global'; import { recharge } from '@/services/user/order'; -import { getAvailablePaymentMethods } from '@/services/user/payment'; -import { useQuery } from '@tanstack/react-query'; import { Button, ButtonProps } from '@workspace/ui/components/button'; import { Dialog, @@ -13,15 +11,13 @@ import { DialogTitle, DialogTrigger, } from '@workspace/ui/components/dialog'; -import { Label } from '@workspace/ui/components/label'; -import { RadioGroup, RadioGroupItem } from '@workspace/ui/components/radio-group'; import { EnhancedInput } from '@workspace/ui/custom-components/enhanced-input'; import { unitConversion } from '@workspace/ui/utils'; import { LoaderCircle } from 'lucide-react'; import { useTranslations } from 'next-intl'; -import Image from 'next/image'; import { useRouter } from 'next/navigation'; -import { useEffect, useState, useTransition } from 'react'; +import { useState, useTransition } from 'react'; +import PaymentMethods from './payment-methods'; export default function Recharge(props: Readonly) { const t = useTranslations('subscribe'); @@ -34,27 +30,9 @@ export default function Recharge(props: Readonly) { const [params, setParams] = useState({ amount: 0, - payment: '', + payment: 1, }); - const { data: paymentMethods } = useQuery({ - enabled: open, - queryKey: ['getAvailablePaymentMethods'], - queryFn: async () => { - const { data } = await getAvailablePaymentMethods(); - return data.data?.list || []; - }, - }); - - useEffect(() => { - if (paymentMethods?.length) { - setParams((prev) => ({ - ...prev, - payment: paymentMethods.find((item) => item.mark !== 'balance')?.mark as string, - })); - } - }, [paymentMethods]); - return ( @@ -86,43 +64,10 @@ export default function Recharge(props: Readonly) { suffix={currency.currency_unit} />
-
{t('paymentMethod')}
- { - setParams({ - ...params, - payment: value, - }); - }} - > - {paymentMethods - ?.filter((item) => item.mark !== 'balance') - ?.map((item) => { - return ( -
- - -
- ); - })} -
+ onChange={(value) => setParams({ ...params, payment: value })} + />