diff --git a/nginx.conf b/nginx.conf index 30a1a63..7ef663b 100644 --- a/nginx.conf +++ b/nginx.conf @@ -38,5 +38,24 @@ server { add_header X-Cache $upstream_cache_status; } + + + #PROXY-START/staff-api/ + location ^~ /staff-api + { + proxy_pass https://103.124.155.66/api; + proxy_set_header Host test-api.hkchc.team; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header REMOTE-HOST $remote_addr; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_http_version 1.1; + # proxy_hide_header Upgrade; + + add_header X-Cache $upstream_cache_status; + } + #PROXY-END/ + } diff --git a/src/components/bill/bill-detail-items.tsx b/src/components/bill/bill-detail-items.tsx index d710f13..5fd4b6b 100644 --- a/src/components/bill/bill-detail-items.tsx +++ b/src/components/bill/bill-detail-items.tsx @@ -22,7 +22,10 @@ const BillDetailItems = (prop: BillDetailItemsProps) => { },[prop.bill]) return (<> } title={t('manual.bill_type')} value={billType}/> - {prop.studentNumberRender?prop.studentNumberRender:} title={t('manual.student_number')} value={prop.bill.student_number || prop.bill.application_number || '-'}/>} + {prop.studentNumberRender?prop.studentNumberRender:<> + {prop.bill.student_number && prop.bill.student_number != prop.bill.application_number && } title={t('manual.student_number')} value={prop.bill.student_number}/> } + {prop.bill.application_number && } title={t('base.bill_number')} value={prop.bill.application_number}/> } + } } title={t('bill.title_student_name')} value={`${prop.bill.student_english_name||'-'}${prop.bill.student_chinese_name?' / '+ prop.bill.student_chinese_name : ''}`}/> } title={'Email'} value={prop.bill.student_email||'-'}/> diff --git a/src/components/bill/bill.less b/src/components/bill/bill.less index 639a5fb..95e694f 100644 --- a/src/components/bill/bill.less +++ b/src/components/bill/bill.less @@ -40,7 +40,7 @@ } .bill-info-detail{ margin-left: 30px; - width: 340px; + min-width: 380px; } .bill-exp-time{ font-size: 18px; diff --git a/src/components/bill/detail.tsx b/src/components/bill/detail.tsx index 6cc5645..ef76dea 100644 --- a/src/components/bill/detail.tsx +++ b/src/components/bill/detail.tsx @@ -1,38 +1,57 @@ -import styles from "@/pages/manual/manual.module.less"; import {Button, Space} from "@douyinfe/semi-ui"; import {useTranslation} from "react-i18next"; +import {useSetState} from "ahooks"; +import dayjs from "dayjs"; +import styles from "@/pages/manual/manual.module.less"; import {BillDetailItems, useBillQRCode} from "@/components/bill/index.ts"; +import {getPayUrl} from "@/components/bill/qr-code.tsx"; import './bill.less' -import dayjs from "dayjs"; type BillDetailProps = { - onCancel: ()=>void; - bill:BillModel; + onCancel: () => void; + bill: BillModel; } -const BillDetail:BasicComponent = ({bill,onCancel})=>{ - const {t} = useTranslation(); - const { exportQRCode,QRCode } = useBillQRCode() - return
-
-
-
- -
-
-
-
{t('manual.exp_time')} {dayjs(bill.expiration_time).format('YYYY-MM-DD HH:mm')}
- -
-
-
- - - - -
-
+const BillDetail: BasicComponent = ({bill, onCancel}) => { + const {t} = useTranslation(); + const {exportQRCode, QRCode} = useBillQRCode() + const [state, setState] = useSetState<{ success: boolean }>({ + success: false + }) + + const onCopy = () => { + const payUrl = getPayUrl(bill.id,'link'); + navigator.clipboard.writeText(payUrl).then(() => { + setState({success: true}) + setTimeout(() => { + setState({success: false}) + }, 3000) + }) + } + return
+
+
+
+ +
+
+
+
{t('manual.exp_time')} {dayjs(bill.expiration_time).format('YYYY-MM-DD HH:mm')}
+ +
+
+
+ + + + + +
+
} export default BillDetail \ No newline at end of file diff --git a/src/components/bill/list.tsx b/src/components/bill/list.tsx index 363f692..0d17354 100644 --- a/src/components/bill/list.tsx +++ b/src/components/bill/list.tsx @@ -43,7 +43,8 @@ export const BillList: React.FC = (props) => { showCols: string[] }>({ showCols: [ - "id", "merchant_ref", "student_number", "application_number", 'confirm_status', "initiated_paid_at", "delivered_at", "paid_at", "student_english_name", "student_email", "programme_english_name", + "id", "merchant_ref", "student_number", "application_number", 'confirm_status', "initiated_paid_at", "delivered_at", + "paid_at", "student_english_name", "student_email", "programme_english_name","department_english_name", "intake_year", "detail", "detail_confirms", "amount", "pay_amount", "actual_payment_amount", "pay_method", "status", "apply_status" ] }) diff --git a/src/components/bill/qr-code.tsx b/src/components/bill/qr-code.tsx index b198486..ab01879 100644 --- a/src/components/bill/qr-code.tsx +++ b/src/components/bill/qr-code.tsx @@ -13,9 +13,9 @@ export type BillQrcodeProps = { } // get bill payment url -function getPayUrl(billId?: string | number) { +export function getPayUrl(billId?: string | number,from='qrcode') { const rootUrl = getAppUrl(); - return `${rootUrl}/pay?bill=${billId || 0}&from=qrcode` + return `${rootUrl}/pay?bill=${billId || 0}&from=${from}` } const useBillQRCode = () => { diff --git a/src/hooks/useRemoteUserList.ts b/src/hooks/useRemoteUserList.ts index 63acaf9..f135e26 100644 --- a/src/hooks/useRemoteUserList.ts +++ b/src/hooks/useRemoteUserList.ts @@ -2,7 +2,7 @@ import {useEffect, useState} from "react"; function getRemoteUserNameList() { return new Promise((resolve, reject) => { - fetch(`${AppConfig.ldapApiUrl}/api/v1/hkchc/user/ldap/get_staff_list`, { + fetch(`/staff-api/v1/hkchc/user/ldap/get_staff_list`, { method: 'GET', headers: { Apikey: AppConfig.ldapApiKey diff --git a/src/i18n/translations/en.json b/src/i18n/translations/en.json index 7704e4e..f7eeff9 100644 --- a/src/i18n/translations/en.json +++ b/src/i18n/translations/en.json @@ -8,6 +8,7 @@ "confirm": "Confirm", "confirm_next_operation": "Please confirm this operation", "confirm_paid": "Confirm paid", + "copy-pay-url": "Copy payment link", "operate_fail": "Operation failed", "operate_success": "Operation success", "please_enter": "Please Enter", @@ -108,13 +109,13 @@ "title": "Login" }, "manual": { - "amount": "Amount", + "amount": "Bill Amount", "amount_gt0": "must be greater than 0", "amount_required": "require", "bill_type": "Bill Type", "bill_type_required": "please select bill type", "btn_generate": "Generate Bill", - "exp_time": "The bill will expires at", + "exp_time": "Bill expiration datetime", "student_number": "Student Number", "student_number_required": "required student number", "success": "Create bill success" diff --git a/src/i18n/translations/sc.json b/src/i18n/translations/sc.json index e13290a..6b64a9d 100644 --- a/src/i18n/translations/sc.json +++ b/src/i18n/translations/sc.json @@ -8,6 +8,7 @@ "confirm": "确定", "confirm_next_operation": "请确认是否进行此操作", "confirm_paid": "确认已支付", + "copy-pay-url": "复制支付链接", "operate_fail": "操作失败", "operate_success": "操作成功", "please_enter": "请输入", @@ -108,7 +109,7 @@ "title": "登录" }, "manual": { - "amount": "金额", + "amount": "账单金额", "amount_gt0": "账单金额必须大于0", "amount_required": "请填写", "bill_type": "账单类型", diff --git a/src/i18n/translations/tc.json b/src/i18n/translations/tc.json index 05e492b..82ccbf3 100644 --- a/src/i18n/translations/tc.json +++ b/src/i18n/translations/tc.json @@ -8,6 +8,7 @@ "confirm": "確定", "confirm_next_operation": "請確認是否進行此操作", "confirm_paid": "確認已支付", + "copy-pay-url": "複製付款連結", "operate_fail": "操作失敗", "operate_success": "操作成功", "please_enter": "請輸入", @@ -108,7 +109,7 @@ "title": "登入" }, "manual": { - "amount": "金額", + "amount": "帳單金額", "amount_gt0": "帳單金額必須大於0", "amount_required": "請填寫", "bill_type": "帳單類型", diff --git a/src/pages/bill/query.tsx b/src/pages/bill/query.tsx index f64a83e..f9217ae 100644 --- a/src/pages/bill/query.tsx +++ b/src/pages/bill/query.tsx @@ -72,8 +72,9 @@ const BillQuery = () => { > - + {AppMode == 'development' && 支付} } { @@ -131,8 +132,8 @@ const BillQuery = () => { } - onRowSelection={(keys)=>setSelectedKeys(keys as number[])} - rowSelectionDisabled={(r)=>(r.status != BillStatus.PAID || r.confirm_status == 'CONFIRMED')} + onRowSelection={(keys) => setSelectedKeys(keys as number[])} + rowSelectionDisabled={(r) => (r.status != BillStatus.PAID || r.confirm_status == 'CONFIRMED')} onPageChange={(page_number) => { setBillQueryParams({ ...queryParams, @@ -143,7 +144,7 @@ const BillQuery = () => { setShowBill(undefined)} //>=1.16.0 closeOnEsc={true} footer={null} diff --git a/vite.config.ts b/vite.config.ts index 85c6c49..be3016b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -37,6 +37,12 @@ export default defineConfig(({mode}) => { // target: 'http://127.0.0.1:50000', // changeOrigin: true, //rewrite: (path) => path.replace(/^\/api/, '') + }, + '/staff-api': { + target: 'https://test-api.hkchc.team', // + // target: 'http://127.0.0.1:50000', // + changeOrigin: true, + rewrite: (path) => path.replace(/^\/staff-api/, '/api/') } } }