Compare commits
No commits in common. "730d1b4fb6552f0e7acc8f46038ef8ddb62f23be" and "ae1d587b917de1a0996fdb2b026407ed41cc7d81" have entirely different histories.
730d1b4fb6
...
ae1d587b91
@ -1,16 +1,13 @@
|
|||||||
{
|
{
|
||||||
"base": {
|
"base": {
|
||||||
"add": "Add",
|
"add": "Add",
|
||||||
"add_success": "Add success",
|
|
||||||
"bill_number": "Bill Number",
|
"bill_number": "Bill Number",
|
||||||
"btn_search_submit": "Search",
|
"btn_search_submit": "Search",
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
"close": "Close",
|
"close": "Close",
|
||||||
"confirm": "Confirm",
|
"confirm": "Confirm",
|
||||||
"confirm_and_add": "Confirm and add",
|
|
||||||
"confirm_delete": "Please confirm delete record",
|
"confirm_delete": "Please confirm delete record",
|
||||||
"confirm_import": "Confirm Import",
|
"confirm_import": "Confirm Import",
|
||||||
"confirm_information": "Confirmation Information",
|
|
||||||
"confirm_next_operation": "Are you sure to process this action",
|
"confirm_next_operation": "Are you sure to process this action",
|
||||||
"confirm_paid": "Confirm paid",
|
"confirm_paid": "Confirm paid",
|
||||||
"copy-pay-url": "Copy payment link",
|
"copy-pay-url": "Copy payment link",
|
||||||
@ -29,10 +26,9 @@
|
|||||||
"select_excel_file": "Select File",
|
"select_excel_file": "Select File",
|
||||||
"select_upload_file": "Select File",
|
"select_upload_file": "Select File",
|
||||||
"student_number": "Student Number",
|
"student_number": "Student Number",
|
||||||
"title_error_tip": "Error message",
|
|
||||||
"validate": {
|
"validate": {
|
||||||
"email": "Email format is incorrect",
|
"email": "Email format is incorrect",
|
||||||
"error_details_message": "Bill detail not correct"
|
"error_details_message": "Please set bill details"
|
||||||
},
|
},
|
||||||
"warning": "Warning"
|
"warning": "Warning"
|
||||||
},
|
},
|
||||||
@ -60,7 +56,6 @@
|
|||||||
"confirm_success": "Confirm success!",
|
"confirm_success": "Confirm success!",
|
||||||
"confirmed": "Confirmed",
|
"confirmed": "Confirmed",
|
||||||
"create": {
|
"create": {
|
||||||
"add_confirm": "The data is abnormal. Please confirm whether to continue",
|
|
||||||
"confirm": "Confirm Add",
|
"confirm": "Confirm Add",
|
||||||
"pay_area": "Payment Area"
|
"pay_area": "Payment Area"
|
||||||
},
|
},
|
||||||
|
@ -1,16 +1,13 @@
|
|||||||
{
|
{
|
||||||
"base": {
|
"base": {
|
||||||
"add": "增加",
|
"add": "增加",
|
||||||
"add_success": "添加成功",
|
|
||||||
"bill_number": "账单编号",
|
"bill_number": "账单编号",
|
||||||
"btn_search_submit": "搜索",
|
"btn_search_submit": "搜索",
|
||||||
"cancel": "取消",
|
"cancel": "取消",
|
||||||
"close": "关闭",
|
"close": "关闭",
|
||||||
"confirm": "确定",
|
"confirm": "确定",
|
||||||
"confirm_and_add": "确认并添加",
|
|
||||||
"confirm_delete": "请确认是否删除此数据",
|
"confirm_delete": "请确认是否删除此数据",
|
||||||
"confirm_import": "确认导入",
|
"confirm_import": "确认导入",
|
||||||
"confirm_information": "确认信息",
|
|
||||||
"confirm_next_operation": "请确认是否进行此操作",
|
"confirm_next_operation": "请确认是否进行此操作",
|
||||||
"confirm_paid": "确认已支付",
|
"confirm_paid": "确认已支付",
|
||||||
"copy-pay-url": "复制支付链接",
|
"copy-pay-url": "复制支付链接",
|
||||||
@ -29,10 +26,9 @@
|
|||||||
"select_excel_file": "选择文件",
|
"select_excel_file": "选择文件",
|
||||||
"select_upload_file": "选择文件",
|
"select_upload_file": "选择文件",
|
||||||
"student_number": "学号",
|
"student_number": "学号",
|
||||||
"title_error_tip": "错误提示",
|
|
||||||
"validate": {
|
"validate": {
|
||||||
"email": "Email格式不正确",
|
"email": "Email格式不正确",
|
||||||
"error_details_message": "账单详情设置不正确"
|
"error_details_message": "请设置账单详情"
|
||||||
},
|
},
|
||||||
"warning": "警告"
|
"warning": "警告"
|
||||||
},
|
},
|
||||||
@ -60,7 +56,6 @@
|
|||||||
"confirm_success": "对账成功!",
|
"confirm_success": "对账成功!",
|
||||||
"confirmed": "已对账",
|
"confirmed": "已对账",
|
||||||
"create": {
|
"create": {
|
||||||
"add_confirm": "数据异常请确认是否继续添加",
|
|
||||||
"confirm": "确认添加",
|
"confirm": "确认添加",
|
||||||
"pay_area": "支付区域"
|
"pay_area": "支付区域"
|
||||||
},
|
},
|
||||||
|
@ -1,16 +1,13 @@
|
|||||||
{
|
{
|
||||||
"base": {
|
"base": {
|
||||||
"add": "增加",
|
"add": "增加",
|
||||||
"add_success": "添加成功",
|
|
||||||
"bill_number": "帳單編號",
|
"bill_number": "帳單編號",
|
||||||
"btn_search_submit": "搜尋",
|
"btn_search_submit": "搜尋",
|
||||||
"cancel": "取消",
|
"cancel": "取消",
|
||||||
"close": "關閉",
|
"close": "關閉",
|
||||||
"confirm": "確定",
|
"confirm": "確定",
|
||||||
"confirm_and_add": "確認並添加",
|
|
||||||
"confirm_delete": "請確認是否刪除此數據",
|
"confirm_delete": "請確認是否刪除此數據",
|
||||||
"confirm_import": "確認導入",
|
"confirm_import": "確認導入",
|
||||||
"confirm_information": "確認訊息",
|
|
||||||
"confirm_next_operation": "請確認是否進行此操作",
|
"confirm_next_operation": "請確認是否進行此操作",
|
||||||
"confirm_paid": "確認已支付",
|
"confirm_paid": "確認已支付",
|
||||||
"copy-pay-url": "複製付款連結",
|
"copy-pay-url": "複製付款連結",
|
||||||
@ -29,10 +26,9 @@
|
|||||||
"select_excel_file": "選擇文件",
|
"select_excel_file": "選擇文件",
|
||||||
"select_upload_file": "選擇文件",
|
"select_upload_file": "選擇文件",
|
||||||
"student_number": "學號",
|
"student_number": "學號",
|
||||||
"title_error_tip": "錯誤提示",
|
|
||||||
"validate": {
|
"validate": {
|
||||||
"email": "Email格式不正確",
|
"email": "Email格式不正確",
|
||||||
"error_details_message": "帳單詳情設定不正確"
|
"error_details_message": "請設定帳單詳情"
|
||||||
},
|
},
|
||||||
"warning": "警告"
|
"warning": "警告"
|
||||||
},
|
},
|
||||||
@ -60,7 +56,6 @@
|
|||||||
"confirm_success": "對帳成功!",
|
"confirm_success": "對帳成功!",
|
||||||
"confirmed": "已對帳",
|
"confirmed": "已對帳",
|
||||||
"create": {
|
"create": {
|
||||||
"add_confirm": "數據異常請確認是否繼續添加",
|
|
||||||
"confirm": "確認新增",
|
"confirm": "確認新增",
|
||||||
"pay_area": "支付區域"
|
"pay_area": "支付區域"
|
||||||
},
|
},
|
||||||
|
@ -123,12 +123,12 @@ const UserPermissionItem = ({it, onChange, usernameOptionList,roleOptionList}: U
|
|||||||
defaultChecked={it.apply_button}
|
defaultChecked={it.apply_button}
|
||||||
onChange={e => onValueChange({apply_button: !!e.target.checked})}/>
|
onChange={e => onValueChange({apply_button: !!e.target.checked})}/>
|
||||||
</div>
|
</div>
|
||||||
{user?.permissions?.role == 'root' && <div className={`item item-type item-type-bill-permission`}>
|
<div className={`item item-type item-type-bill-permission`}>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
defaultChecked={it.permission_edit}
|
defaultChecked={it.permission_edit}
|
||||||
disabled={user?.username == it.username}
|
disabled={user?.username == it.username}
|
||||||
onChange={e => onValueChange({permission_edit: !!e.target.checked})}/>
|
onChange={e => onValueChange({permission_edit: !!e.target.checked})}/>
|
||||||
</div>}
|
</div>
|
||||||
<div className="item item-operation text-center">
|
<div className="item item-operation text-center">
|
||||||
<Space>
|
<Space>
|
||||||
{user?.username != it.username && <Popconfirm
|
{user?.username != it.username && <Popconfirm
|
||||||
@ -273,8 +273,7 @@ const Permission = () => {
|
|||||||
className={`item item-type item-type-bill-btn-confirm`}>{t(`permission.title.bill.btn.confirm`)}</div>
|
className={`item item-type item-type-bill-btn-confirm`}>{t(`permission.title.bill.btn.confirm`)}</div>
|
||||||
<div
|
<div
|
||||||
className={`item item-type item-type-bill-btn-check`}>{t(`permission.title.bill.btn.check`)}</div>
|
className={`item item-type item-type-bill-btn-check`}>{t(`permission.title.bill.btn.check`)}</div>
|
||||||
|
<div className={`item item-type item-type-bill-permission`}>{t(`permission.title.permission`)}</div>
|
||||||
{user?.permissions?.role == 'root' && <div className={`item item-type item-type-bill-permission`}>{t(`permission.title.permission`)}</div>}
|
|
||||||
<div className="item item-operation">{t('bill.title_operate')}</div>
|
<div className="item item-operation">{t('bill.title_operate')}</div>
|
||||||
</div>
|
</div>
|
||||||
{state.list.map((it, index) => (<UserPermissionItem
|
{state.list.map((it, index) => (<UserPermissionItem
|
||||||
|
@ -1,19 +1,6 @@
|
|||||||
import {
|
import {Button, Col, Divider, Form, InputNumber, Modal, Row, Select, Space} from "@douyinfe/semi-ui";
|
||||||
Button,
|
|
||||||
Col,
|
|
||||||
Descriptions,
|
|
||||||
Divider,
|
|
||||||
Form,
|
|
||||||
InputNumber,
|
|
||||||
Modal,
|
|
||||||
Row,
|
|
||||||
Select,
|
|
||||||
Space,
|
|
||||||
Toast
|
|
||||||
} from "@douyinfe/semi-ui";
|
|
||||||
import {IconAlertCircle} from "@douyinfe/semi-icons";
|
import {IconAlertCircle} from "@douyinfe/semi-icons";
|
||||||
import {Data} from "@douyinfe/semi-ui/lib/es/descriptions";
|
import React from "react";
|
||||||
import React, {useMemo} from "react";
|
|
||||||
import {useTranslation} from "react-i18next";
|
import {useTranslation} from "react-i18next";
|
||||||
import {useSetState} from "ahooks";
|
import {useSetState} from "ahooks";
|
||||||
|
|
||||||
@ -21,8 +8,6 @@ import {useBillTypes} from "@/hooks/useBillTypes.ts";
|
|||||||
import {usePaymentChannels} from "@/hooks/usePaymentChannels.ts";
|
import {usePaymentChannels} from "@/hooks/usePaymentChannels.ts";
|
||||||
import {addBillRecord} from "@/service/api/bill.ts"
|
import {addBillRecord} from "@/service/api/bill.ts"
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import MoneyFormat from "@/components/money-format.tsx";
|
|
||||||
import {BizError} from "@/service/types.ts";
|
|
||||||
|
|
||||||
type BillPaidModalProps = {
|
type BillPaidModalProps = {
|
||||||
onConfirm: () => void
|
onConfirm: () => void
|
||||||
@ -99,17 +84,14 @@ export const BillTypeList: React.FC<BillTypeListProps> = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const AddBillModal: React.FC<BillPaidModalProps> = (props) => {
|
export const AddBillModal: React.FC<BillPaidModalProps> = (props) => {
|
||||||
const {t, i18n} = useTranslation()
|
const {t} = useTranslation()
|
||||||
const {paymentChannelList, paymentMethodList} = usePaymentChannels();
|
const {paymentChannelList, paymentMethodList} = usePaymentChannels();
|
||||||
|
|
||||||
const [state, setState] = useSetState<{
|
const [state, setState] = useSetState<{
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
confirmLoading?: boolean;
|
|
||||||
open?: boolean;
|
open?: boolean;
|
||||||
details: ConfirmedBillDetail[];
|
details: ConfirmedBillDetail[];
|
||||||
errorMessage?: string;
|
errorMessage?: string;
|
||||||
errorConfirmMessage?: string;
|
|
||||||
values?: CreateBillRecordModel
|
|
||||||
}>({
|
}>({
|
||||||
details: []
|
details: []
|
||||||
})
|
})
|
||||||
@ -126,25 +108,19 @@ export const AddBillModal: React.FC<BillPaidModalProps> = (props) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setState({
|
||||||
|
loading: true, errorMessage: undefined
|
||||||
|
})
|
||||||
values.details = state.details
|
values.details = state.details
|
||||||
values.check_student = true;
|
values.check_student = true;
|
||||||
values.initiated_paid_date = dayjs(values.initiated_paid_date).format("YYYY-MM-DD")
|
values.initiated_paid_date = dayjs(values.initiated_paid_date).format("YYYY-MM-DD")
|
||||||
values.paid_date = dayjs(values.paid_date).format("YYYY-MM-DD")
|
values.paid_date = dayjs(values.paid_date).format("YYYY-MM-DD")
|
||||||
values.delivered_date = dayjs(values.delivered_date).format("YYYY-MM-DD")
|
values.delivered_date = dayjs(values.delivered_date).format("YYYY-MM-DD")
|
||||||
setState({
|
|
||||||
loading: true, errorMessage: undefined,values
|
|
||||||
})
|
|
||||||
addBillRecord(values).then(()=>{
|
addBillRecord(values).then(()=>{
|
||||||
setState({open:false})
|
setState({open:false})
|
||||||
Toast.success(t('base.add_success'))
|
|
||||||
props.onConfirm()
|
props.onConfirm()
|
||||||
}).catch((e: BizError) => {
|
}).catch(e => {
|
||||||
if (e.code == -50415) { // STUDENT_INFO_NOT_FOUND
|
|
||||||
// duplicate
|
|
||||||
setState({errorConfirmMessage: e.message})
|
|
||||||
} else {
|
|
||||||
setState({errorMessage: e.message})
|
setState({errorMessage: e.message})
|
||||||
}
|
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
setState({
|
setState({
|
||||||
loading: false
|
loading: false
|
||||||
@ -159,58 +135,6 @@ export const AddBillModal: React.FC<BillPaidModalProps> = (props) => {
|
|||||||
errorMessage:undefined
|
errorMessage:undefined
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// process confirm
|
|
||||||
const handleCloseConfirm = () => {
|
|
||||||
setState({errorConfirmMessage: undefined})
|
|
||||||
}
|
|
||||||
const handleConfirmAdd = () => {
|
|
||||||
if (!state.values) return;
|
|
||||||
setState({confirmLoading: true})
|
|
||||||
state.values.check_student = false;
|
|
||||||
addBillRecord(state.values).then(() => {
|
|
||||||
setState({
|
|
||||||
loading: false,
|
|
||||||
open: false,
|
|
||||||
errorMessage: undefined,
|
|
||||||
errorConfirmMessage: undefined,
|
|
||||||
})
|
|
||||||
Toast.success(t('base.add_success'))
|
|
||||||
props.onConfirm()
|
|
||||||
}).catch(e => {
|
|
||||||
setState({errorConfirmMessage: e.message})
|
|
||||||
}).finally(() => {
|
|
||||||
setState({
|
|
||||||
confirmLoading: false,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const details = useMemo(() => {
|
|
||||||
if (!state.values) return;
|
|
||||||
const {
|
|
||||||
application_number, payment_channel, payment_method,
|
|
||||||
student_email, merchant_ref, paid_area,
|
|
||||||
initiated_paid_date, paid_date, delivered_date
|
|
||||||
} = state.values
|
|
||||||
//, span: 2
|
|
||||||
const _data: Data[] = [
|
|
||||||
{key: 'Merchant Ref', value: merchant_ref},
|
|
||||||
{key: t('bill.bill_number'), value: application_number},
|
|
||||||
{key: 'Email', value: student_email},
|
|
||||||
{key: t('bill.title_pay_channel'), value: payment_channel},
|
|
||||||
{key: t('bill.title_pay_method'), value: payment_method},
|
|
||||||
{key: t('bill.create.pay_area'), value: paid_area},
|
|
||||||
{key: t('bill.title_initiated_paid_at'), value: initiated_paid_date},
|
|
||||||
{key: t('bill.title_paid_at'), value: paid_date},
|
|
||||||
{key: t('bill.title_delivered_at'), value: delivered_date, span: 2},
|
|
||||||
]
|
|
||||||
state.details.forEach(it => {
|
|
||||||
_data.push({key: t('bill.title_bill_type'), value: it.bill_type})
|
|
||||||
_data.push({key: t('bill.title_amount'), value: <MoneyFormat money={it.amount}/>})
|
|
||||||
});
|
|
||||||
return _data
|
|
||||||
}, [i18n.language, state.values]);
|
|
||||||
return (<>
|
return (<>
|
||||||
<Button onClick={() => setState({open: true})} theme={'solid'}>{t('bill.add_bill_record')}</Button>
|
<Button onClick={() => setState({open: true})} theme={'solid'}>{t('bill.add_bill_record')}</Button>
|
||||||
<Modal
|
<Modal
|
||||||
@ -222,6 +146,7 @@ export const AddBillModal: React.FC<BillPaidModalProps> = (props) => {
|
|||||||
width={600}
|
width={600}
|
||||||
maskClosable={false}
|
maskClosable={false}
|
||||||
>
|
>
|
||||||
|
|
||||||
<Form<CreateBillRecordModel> onSubmit={onSubmit} initValues={{
|
<Form<CreateBillRecordModel> onSubmit={onSubmit} initValues={{
|
||||||
merchant_ref: '',
|
merchant_ref: '',
|
||||||
application_number: '',
|
application_number: '',
|
||||||
@ -335,8 +260,7 @@ export const AddBillModal: React.FC<BillPaidModalProps> = (props) => {
|
|||||||
</Row>
|
</Row>
|
||||||
<div>
|
<div>
|
||||||
<BillTypeList onChange={(details) => setState({details})}/>
|
<BillTypeList onChange={(details) => setState({details})}/>
|
||||||
{state.errorMessage &&
|
{state.errorMessage && <div className="semi-form-field-error-message" style={{marginBottom: 10}}>
|
||||||
<div className="semi-form-field-error-message align-center" style={{marginBottom: 10}}>
|
|
||||||
<IconAlertCircle/>
|
<IconAlertCircle/>
|
||||||
<span style={{marginLeft: 5}}>{state.errorMessage}</span>
|
<span style={{marginLeft: 5}}>{state.errorMessage}</span>
|
||||||
</div>}
|
</div>}
|
||||||
@ -352,25 +276,5 @@ export const AddBillModal: React.FC<BillPaidModalProps> = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<Modal
|
|
||||||
visible={!!state.errorConfirmMessage}
|
|
||||||
title={t('base.confirm_information')}
|
|
||||||
closeOnEsc={true}
|
|
||||||
onCancel={handleCloseConfirm}
|
|
||||||
width={600}
|
|
||||||
maskClosable={false}
|
|
||||||
okText={t('base.confirm_and_add')}
|
|
||||||
onOk={handleConfirmAdd}
|
|
||||||
okButtonProps={{loading: state.confirmLoading}}
|
|
||||||
>
|
|
||||||
<Descriptions layout='horizontal' align='plain' data={details} column={2}/>
|
|
||||||
<Divider style={{margin: '10px 0'}}>{t('base.title_error_tip')}</Divider>
|
|
||||||
{state.errorConfirmMessage &&
|
|
||||||
<div className="semi-form-field-error-message align-center" style={{marginBottom: 10}}>
|
|
||||||
<IconAlertCircle/>
|
|
||||||
<span style={{marginLeft: 5}}>{state.errorConfirmMessage}</span>
|
|
||||||
</div>}
|
|
||||||
</Modal>
|
|
||||||
</>)
|
</>)
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user