From ea7b4a69aadc495dd4242ece3df703a514ba2235 Mon Sep 17 00:00:00 2001 From: callmeyan Date: Mon, 5 Aug 2024 17:04:35 +0800 Subject: [PATCH] modify confirm --- src/i18n/translations/en.json | 2 + src/i18n/translations/sc.json | 2 + src/i18n/translations/tc.json | 2 + .../bill/components/bill_type_confirm.tsx | 90 +++++++++++-------- src/pages/bill/query.tsx | 6 +- src/types/bill.d.ts | 5 ++ 6 files changed, 66 insertions(+), 41 deletions(-) diff --git a/src/i18n/translations/en.json b/src/i18n/translations/en.json index 707ed08..f1e67fc 100644 --- a/src/i18n/translations/en.json +++ b/src/i18n/translations/en.json @@ -1,5 +1,6 @@ { "base": { + "add": "Add", "bill_number": "Bill Number", "btn_search_submit": "Search", "cancel": "Cancel", @@ -12,6 +13,7 @@ "please_select": "Please Select", "qr-code": "QRCode", "query_bill": "Failed to query bill:", + "remove": "Remove", "student_number": "Student Number" }, "bill": { diff --git a/src/i18n/translations/sc.json b/src/i18n/translations/sc.json index 7564236..032ca01 100644 --- a/src/i18n/translations/sc.json +++ b/src/i18n/translations/sc.json @@ -1,5 +1,6 @@ { "base": { + "add": "增加", "bill_number": "账单编号", "btn_search_submit": "搜索", "cancel": "取消", @@ -12,6 +13,7 @@ "please_select": "请选择", "qr-code": "二维码", "query_bill": "查询账单失败:", + "remove": "删除", "student_number": "学号" }, "bill": { diff --git a/src/i18n/translations/tc.json b/src/i18n/translations/tc.json index 1435007..f28990b 100644 --- a/src/i18n/translations/tc.json +++ b/src/i18n/translations/tc.json @@ -1,5 +1,6 @@ { "base": { + "add": "增加", "bill_number": "帳單編號", "btn_search_submit": "搜尋", "cancel": "取消", @@ -12,6 +13,7 @@ "please_select": "請選擇", "qr-code": "QRCode", "query_bill": "查詢帳單失敗:", + "remove": "刪除", "student_number": "學號" }, "bill": { diff --git a/src/pages/bill/components/bill_type_confirm.tsx b/src/pages/bill/components/bill_type_confirm.tsx index 7bac267..f708b40 100644 --- a/src/pages/bill/components/bill_type_confirm.tsx +++ b/src/pages/bill/components/bill_type_confirm.tsx @@ -1,4 +1,4 @@ -import {Button, Select, Popconfirm, Space, Tag} from "@douyinfe/semi-ui"; +import {Button, Select, Popconfirm, Space, Tag, Divider, Input} from "@douyinfe/semi-ui"; import React, {useState} from "react"; import {useSetState} from "ahooks"; import MoneyFormat from "@/components/money-format.tsx"; @@ -11,47 +11,63 @@ type BillTypeConfirmProps = { } export const BillTypeConfirm: React.FC = (props) => { - const [it,setItem] = useState(props.data) + const [it, setItem] = useState(props.data) const {t} = useTranslation() - const [state,setState] = useSetState({ - loading:false, - bill_type: props.data.bill_type + const [state, setState] = useSetState<{ + billTypeList: BillTypeConfirm[]; + loading?: boolean, + confirmed?: boolean, + }>({ + loading: false, + billTypeList: [ + {bill_type:props.data.bill_type,amount:props.data.amount} + ] }) const onConfirmBill = () => { - setState({loading:true}) - confirmBillType({id:it.id,type:state.bill_type}).then(() => { - setState({loading:false}) - setItem({...it,confirm_status:'CONFIRMED'}) - }).catch(() => { - setState({loading:false}) - }) + setState({loading: true}) + // confirmBillType({id: it.id, type: state.bill_type}).then(() => { + // setState({loading: false}) + // setItem({...it, confirm_status: 'CONFIRMED'}) + // }).catch(() => { + // setState({loading: false}) + // }) } - return
-
-
{it.bill_type}
-
+ const onChange = (value:string,index:number,type:'type'|'amount')=>{ + + } + const onRemove = (index:number) =>{ + if(state.billTypeList.length <= 1) return; + } + return (<> +
+
+
{it.bill_type}
+ Total Amount:
+ {state.billTypeList.map((item, index) => { + return (
+ + + + onChange(v,index,'amount')} style={{width: 120}}/> + + +
) + })} +
+ +
-
- - {it.confirm_status != 'CONFIRMED' && } - { - it.confirm_status == 'CONFIRMED' ? {state.bill_type} : <> - onConfirmBill()} - position={'topRight'} - content={`${t('bill.confirm_bill_type')}?`} - > - - } - -
-
+ + ) } \ No newline at end of file diff --git a/src/pages/bill/query.tsx b/src/pages/bill/query.tsx index 5ed6ea3..4781d89 100644 --- a/src/pages/bill/query.tsx +++ b/src/pages/bill/query.tsx @@ -193,11 +193,9 @@ const BillQuery = () => { !state.confirmBill.application_number_confirm && } + Bill Type Confirm { - state.confirmBill.details.map((it, idx) => (
- - -
)) + state.confirmBill.details.map((it, idx) => ()) }
} diff --git a/src/types/bill.d.ts b/src/types/bill.d.ts index 929cf52..c089235 100644 --- a/src/types/bill.d.ts +++ b/src/types/bill.d.ts @@ -109,4 +109,9 @@ type BillUpdateParams = { remark?: string; merchant_ref?: string; payment_amount?: number | string; +} + +type BillTypeConfirm = { + bill_type: string; + amount: number; } \ No newline at end of file