From 6d8eebbff0457f8c3293039df26fe24a41c17aec Mon Sep 17 00:00:00 2001 From: callmeyan Date: Sun, 14 Jul 2024 23:02:27 +0800 Subject: [PATCH] update pay channel --- src/pages/bill/external_create.tsx | 3 ++- src/pages/pay/index.tsx | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pages/bill/external_create.tsx b/src/pages/bill/external_create.tsx index 8f86e23..2d9f64e 100644 --- a/src/pages/bill/external_create.tsx +++ b/src/pages/bill/external_create.tsx @@ -35,9 +35,10 @@ const ExternalCreate = () => { const navigate = useNavigate() const createBill = (params: ExternalCreateParamsType) => { setState({loading: true}) + const pay_channel = searchParams.get('pay_channel') || 'asia_pay' createExternalBill(params).then((ret) => { setState({loading: false}) - navigate(`/pay?bill=${ret.id}`, {replace: true}) + navigate(`/pay?bill=${ret.id}&pay_channel=${pay_channel}`, {replace: true}) }).catch(() => { setState({loading: false, 'error': 'create pay order failed'}) }) diff --git a/src/pages/pay/index.tsx b/src/pages/pay/index.tsx index a1b7e58..debf165 100644 --- a/src/pages/pay/index.tsx +++ b/src/pages/pay/index.tsx @@ -17,7 +17,7 @@ import {StartFlyWire} from "@/pages/pay/component/start-fly-wire.tsx"; const PayIndex = () => { const {t} = useTranslation() const navigate = useNavigate() - const [payChannel, setPayChannel] = useState('asia_pay') + const [payChannel, setPayChannel] = useState('') const [search] = useSearchParams(); const [bill, setBill] = useState() @@ -27,6 +27,9 @@ const PayIndex = () => { navigate(`/pay/error?bill=${billId}`, {replace: true}) return; } + + const payChannel = search.get('pay_channel') || 'asia_pay' + setPayChannel(payChannel) getBillDetail(Number(billId)).then((bill) => { // 判断bill状态 if (bill.status != BillStatus.PENDING) {