diff --git a/src/components/bill/list.tsx b/src/components/bill/list.tsx index f0a7899..75158f4 100644 --- a/src/components/bill/list.tsx +++ b/src/components/bill/list.tsx @@ -1,4 +1,4 @@ -import {Table, Typography} from "@douyinfe/semi-ui"; +import {Space, Table, Typography} from "@douyinfe/semi-ui"; import {ColumnProps} from "@douyinfe/semi-ui/lib/es/table"; import React, {useMemo, useState} from "react"; import {useTranslation} from "react-i18next"; @@ -18,6 +18,7 @@ type BillListProps = { onPageChange: (pageIndex:number) => void; tableFooter?: React.ReactNode; loading?: boolean; + beforeTotalAmount?: React.ReactNode; } export const BillList: React.FC = (props) => { @@ -213,16 +214,19 @@ export const BillList: React.FC = (props) => { return -
- {t('bill.query_amount_total')} : - + headerRight={ + {props.beforeTotalAmount} +
+
+ {t('bill.query_amount_total')} : + +
+
+ {t('bill.query_amount_current_page')} : + +
-
- {t('bill.query_amount_current_page')} : - -
-
} + } >
diff --git a/src/components/bill/search-form.tsx b/src/components/bill/search-form.tsx index abc5bf3..cad17b4 100644 --- a/src/components/bill/search-form.tsx +++ b/src/components/bill/search-form.tsx @@ -104,7 +104,7 @@ const SearchForm: React.FC = (props) => { placeholder={t('base.please_enter')}/> - ASIAPAY FLYWIRE diff --git a/src/i18n/translations/en.json b/src/i18n/translations/en.json index 477d65d..eb0e30e 100644 --- a/src/i18n/translations/en.json +++ b/src/i18n/translations/en.json @@ -30,6 +30,7 @@ "confirmed": "Confirmed", "download-qr-code": "Download QR Code", "download_receipt": "Download receipt", + "export_excel": "Export Excel", "paid": "Paid", "paid_confirm": "Please confirm the order status is set to paid", "pay_status": "Bill Status", diff --git a/src/i18n/translations/sc.json b/src/i18n/translations/sc.json index 3466d87..33fc484 100644 --- a/src/i18n/translations/sc.json +++ b/src/i18n/translations/sc.json @@ -30,6 +30,7 @@ "confirmed": "已对账", "download-qr-code": "下载二维码", "download_receipt": "下载收据", + "export_excel": "导出账单列表", "paid": "已支付", "paid_confirm": "是否将此订单状态设为已支付", "pay_status": "账单状态", diff --git a/src/i18n/translations/tc.json b/src/i18n/translations/tc.json index b9e1073..f084bbf 100644 --- a/src/i18n/translations/tc.json +++ b/src/i18n/translations/tc.json @@ -30,6 +30,7 @@ "confirmed": "已對帳", "download-qr-code": "下載二維碼", "download_receipt": "下載收據", + "export_excel": "Export Excel", "paid": "已支付", "paid_confirm": "是否將此訂單狀態設為已支付", "pay_status": "帳單狀態", diff --git a/src/pages/bill/components/bill_paid_modal.tsx b/src/pages/bill/components/bill_paid_modal.tsx index 081b6f4..a517e89 100644 --- a/src/pages/bill/components/bill_paid_modal.tsx +++ b/src/pages/bill/components/bill_paid_modal.tsx @@ -37,7 +37,7 @@ export const BillPaidModal: React.FC = (props) => { } const onSubmit = (values: BillUpdateParams) => { if (!props.bill) return; - finishBill({bill:props.bill,param:values}).then(props.onConfirm) + finishBill({bill: props.bill, param: values}).then(props.onConfirm) // setState({ // loading: true // }) @@ -69,7 +69,7 @@ export const BillPaidModal: React.FC = (props) => { onSubmit={onSubmit} initValues={{ payment_channel: 'FLYWIRE', - payment_method: 'card', + payment_method: '', merchant_ref: props.bill?.merchant_ref, payment_amount: props.bill?.amount, actual_payment_amount: props.bill?.amount @@ -88,19 +88,34 @@ export const BillPaidModal: React.FC = (props) => { + {/*{*/} + {/* //*/} + {/* // }}*/} + {/* showClear field="payment_method" label={t('bill.title_pay_method')}*/} + {/*/>*/} - Card(VISA,MasterCard,UnionPay,JCB...) - Wechat - Alipay - Other - {/*ASIAPAY*/} - {/*PPS*/} - + optionList={[ + {value: 'card', label: 'Card(VISA,MasterCard,UnionPay,JCB...)'}, + {value: 'wechat', label: 'Wechat'}, + {value: 'alipay', label: 'Alipay'}, + {value: 'other', label: 'Other'}, + ]} + allowCreate filter showClear field="payment_method" label={t('bill.title_pay_method')} + placeholder={t('base.please_select')} style={{width: '100%'}}/> @@ -139,7 +154,9 @@ export const BillPaidModal: React.FC = (props) => {
- +
diff --git a/src/pages/bill/query.tsx b/src/pages/bill/query.tsx index 304370c..962d5b7 100644 --- a/src/pages/bill/query.tsx +++ b/src/pages/bill/query.tsx @@ -2,6 +2,7 @@ import {Button, Divider, Modal, Notification, Popconfirm, Toast} from "@douyinfe import {useState} from "react"; import {useRequest, useSetState} from "ahooks"; import {useTranslation} from "react-i18next"; +import {stringify} from "qs" import {BillList} from "@/components/bill/list.tsx"; import SearchForm from "@/components/bill/search-form.tsx"; @@ -12,6 +13,7 @@ import {useDownloadReceiptPDF} from "@/service/generate-pdf.ts"; import {BillDetailItems} from "@/components/bill"; import {BillPaidModal} from "@/pages/bill/components/bill_paid_modal.tsx"; import {BillTypeConfirm} from "@/pages/bill/components/bill_type_confirm.tsx"; +import {saveAs} from "file-saver"; const DownloadButton = ({bill, text}: { bill: BillModel; text: string }) => { @@ -84,11 +86,17 @@ const BillQuery = () => { }
) } + const onExportExcel = ()=>{ + const downloadUrl = `${AppConfig.API_PREFIX || '/api'}/bills/export?${stringify(queryParams)}` + saveAs(downloadUrl, 'bill-result-excel.xlsx') + } + return (
{t('bill.export_excel')}} onPageChange={(page_number) => { setBillQueryParams({ ...queryParams, diff --git a/src/pages/manual/index.tsx b/src/pages/manual/index.tsx index cd280e9..ac0dc1c 100644 --- a/src/pages/manual/index.tsx +++ b/src/pages/manual/index.tsx @@ -107,7 +107,7 @@ export default function Index() {
- {billInfo &&
{t('manual.exp_time')} {dayjs(billInfo.expiration_time).format('YYYY-MM-DD HH:mm')}
}
diff --git a/src/pages/pay/index.tsx b/src/pages/pay/index.tsx index debf165..2a13c2b 100644 --- a/src/pages/pay/index.tsx +++ b/src/pages/pay/index.tsx @@ -1,16 +1,12 @@ import {useTranslation} from "react-i18next"; import {useEffect, useState} from "react"; import {useNavigate, useSearchParams} from "react-router-dom"; -import {Radio, RadioGroup} from '@douyinfe/semi-ui'; import styles from './pay.module.less' import {PayLogo} from "@/pages/pay/component"; import MoneyFormat from "@/components/money-format.tsx"; -import FlywireLogo from "@/assets/images/pay/flywire.tsx"; -import AsiaPayLogo from "@/assets/images/pay/asia_pay.tsx"; import {getBillDetail} from "@/service/api/bill.ts"; import {BillStatus} from "@/service/types.ts"; -import {StartAsiaPay} from "@/pages/pay/component/start-asia-pay.tsx"; import {StartFlyWire} from "@/pages/pay/component/start-fly-wire.tsx"; @@ -28,7 +24,7 @@ const PayIndex = () => { return; } - const payChannel = search.get('pay_channel') || 'asia_pay' + const payChannel = search.get('pay_channel') || 'flywire' setPayChannel(payChannel) getBillDetail(Number(billId)).then((bill) => { // 判断bill状态 @@ -59,19 +55,19 @@ const PayIndex = () => { } -
- setPayChannel(e.target.value)} - value={payChannel}> - - - AsiaPay - - - - Flywire - - -
+ {/*
*/} + {/* setPayChannel(e.target.value)}*/} + {/* value={payChannel}>*/} + {/* */} + {/* */} + {/* AsiaPay*/} + {/* */} + {/* */} + {/* */} + {/* Flywire*/} + {/* */} + {/* */} + {/*
*/}
{bill.details.length == 1 ?
Payment Type:
@@ -96,7 +92,7 @@ const PayIndex = () => {
{bill.student_email &&
Your Email: {bill.student_email}
}
- { payChannel == 'asia_pay' && } + {/*{ payChannel == 'asia_pay' && }*/}
diff --git a/src/service/api/bill.ts b/src/service/api/bill.ts index 8ceff2f..980f228 100644 --- a/src/service/api/bill.ts +++ b/src/service/api/bill.ts @@ -89,16 +89,16 @@ export async function finishFlywire({bill,param}: BillUpdateFormParams){ "data": { "remark": param.remark, "payment_id": param.merchant_ref, - "amount_from": param.actual_payment_amount, + "amount_from": Number(param.actual_payment_amount) * 100, "currency_from": "HKD", - "amount_to": param.payment_amount, + "amount_to": Number(param.payment_amount) * 100, "currency_to": "HKD", "status": "guaranteed", "expiration_date": dayjs().format('YYYY-MM-DDTHH:mm:ss[Z]'), "external_reference": bill.id, "country": "CN", "payment_method": { - "type": param.payment_channel + "type": param.payment_method }, "fields": { "student_email": bill.student_email, diff --git a/src/service/generate-pdf.ts b/src/service/generate-pdf.ts index f5b77f5..d40cd8e 100644 --- a/src/service/generate-pdf.ts +++ b/src/service/generate-pdf.ts @@ -35,7 +35,7 @@ export function GeneratePdf(bill: BillModel) { title: 'Programme:', content: bill.programme_english_name }, 56) - drawItem(doc, {title: 'Mode of Study:', content: bill.attendance_mode}, bill.programme_english_name.length > 70?70:64) + drawItem(doc, {title: 'Mode of Study:', content: bill.attendance_mode == 'FT' ? 'FULL-TIME': bill.attendance_mode}, bill.programme_english_name.length > 70?70:64) // draw table autoTable(doc, { startY: 80, @@ -61,7 +61,7 @@ export function GeneratePdf(bill: BillModel) { `#${it.id}`, dayjs(bill.paid_at).format('YYYY-MM-DD'), it.bill_type, - `${bill.payment_channel}` + bill.payment_channel != bill.payment_method ? `(${bill.payment_method})` : '', + `${bill.payment_channel}` + (bill.payment_channel != bill.payment_method ? `(${bill.payment_method})` : ''), `${it.amount}` ]; })),