From 339dd038fb18e148a32443a00634c39b356d146e Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Wed, 18 May 2022 16:09:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=AB=8B=E5=87=8F=E9=87=91?= =?UTF-8?q?=20=E5=8A=A0=E6=AC=BE=E5=BC=B9=E7=AA=97=E4=B8=AD=20=E9=87=91?= =?UTF-8?q?=E9=A2=9D=E4=BA=A4=E4=BA=92=E6=98=BE=E7=A4=BA=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/plan/knockGold/Dialog.jsx | 42 +++++++++++++++++++----- src/pages/plan/knockGold/index.jsx | 51 +++++++++++++++++++++-------- 2 files changed, 70 insertions(+), 23 deletions(-) diff --git a/src/pages/plan/knockGold/Dialog.jsx b/src/pages/plan/knockGold/Dialog.jsx index 9c850224..c7f3dc7a 100644 --- a/src/pages/plan/knockGold/Dialog.jsx +++ b/src/pages/plan/knockGold/Dialog.jsx @@ -4,18 +4,25 @@ import Ipt from '../../../components/input/main' import Form from '../../../components/form/main' import FormItem from '../../../components/form-item/main' import rules from './rules' -import { Button } from 'zent' +import { Button, Notify } from 'zent' export default ({ data, onChangeMoney }) => { const [stateData, setStateData] = useState({ addNew: '' }) const ref = useRef() useEffect(() => { - setStateData({ stateData: data }) + setStateData({ ...data }) }, [data]) function submit() { if (ref.current.validator()) { - onChangeMoney(false, stateData.addNew) + if ( + Number(stateData?.money) + Number(stateData.addNew) < + Number(stateData?.all_budget) + ) { + onChangeMoney(false, Number(stateData.addNew)) + } else { + Notify.error('加款失败') + } } } @@ -23,10 +30,16 @@ export default ({ data, onChangeMoney }) => { <>

- 预估当前消耗余额为 60000.21元 + 预估当前消耗余额为 + {stateData?.money}

- 预估当前剩余余额为 60000.21元 + 预估当前剩余余额为 + + {' '} + {stateData?.all_budget - stateData?.money}{' '} + + 元

{ { - setStateData({ addNew: value }) + setStateData({ ...stateData, addNew: value }) }} onClearItem={() => { - setStateData({ addNew: '' }) + setStateData({ ...stateData, addNew: '' }) }} kind='number' value={stateData.addNew} @@ -74,10 +87,21 @@ export default ({ data, onChangeMoney }) => {

预估充值后总充值批次金额为 - 60000.21 元 + + {' '} + {(Number(stateData?.money) | 0) + (stateData?.addNew | 0)}{' '} + + 元

- 预估充值后剩余余额为 60000.21元 + 预估充值后剩余余额为 + + {' '} + {stateData?.all_budget - + stateData?.money - + (stateData?.addNew | 0)}{' '} + + 元

diff --git a/src/pages/plan/knockGold/index.jsx b/src/pages/plan/knockGold/index.jsx index 930e3cdc..e987f56a 100644 --- a/src/pages/plan/knockGold/index.jsx +++ b/src/pages/plan/knockGold/index.jsx @@ -25,6 +25,10 @@ import { import _, { isArray } from 'lodash' import AddNewDialog from './Dialog' import MobileComponent from './mobileCmponent' +const getTimeList = [ + { key: 1, text: '立即生效' }, + { key: 2, text: '次日生效' } +] export default class adduserinfo extends React.Component { constructor(props) { super(props) @@ -53,13 +57,14 @@ export default class adduserinfo extends React.Component { early_notifier: [], //'预警通知人', create_time: '', // '创建时间', creator: '', // '创建人, - addNew: '', //加款 receive_number: '', //领取个数 receive_type: '1', //领取类型 usable_time: '', //可用时间 fixed_time: '', //固定时间 timer: '', //领取时间段 - timer_type: '2' //领取时间段类型 + timer_type: '2', //领取时间段类型 + effect_date_type: '', //生效日期类型 + effect_date: '' //生效日期 }, cur_product: {}, productOption: [], @@ -193,6 +198,14 @@ export default class adduserinfo extends React.Component { Notify.error('面额必须大于立减金额') return false } + if (this.state.model.money > this.state.model.all_budget) { + Notify.error('批次充值金额必须小于总预算') + return false + } + if (this.state.model.denomination > this.state.model.all_budget) { + Notify.error('面额必须小于总预算') + return false + } //缓存 let temp = [] @@ -378,14 +391,20 @@ export default class adduserinfo extends React.Component { width={'520px'} alignment={'left'} /> - {this.state.model.id ? ( + {/* {this.state.model.id ? ( - ) : null} + ) : null} */} + @@ -636,24 +655,28 @@ export default class adduserinfo extends React.Component { }}> 领取后 -

+