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 { }}> 领取后 -

+