Commit 2496c3a9 by 秦嘉祺

Merge branch 'feature/20210310_调整导码量单位' into 'master'

调整导码数量单位

See merge request !2
parents 4d028376 55197846
...@@ -45,3 +45,7 @@ ol { ...@@ -45,3 +45,7 @@ ol {
} }
} }
} }
.ant-form-explain {
color: #f5222d;
}
\ No newline at end of file
import { Form, Input, Modal, Select, DatePicker, InputNumber } from 'antd'; import { Form, Input, Modal, Select, DatePicker} from 'antd';
import { FormComponentProps } from 'antd/es/form'; import { FormComponentProps } from 'antd/es/form';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { number } from 'prop-types';
import moment from 'moment'; import moment from 'moment';
const FormItem = Form.Item; const FormItem = Form.Item;
...@@ -18,12 +17,31 @@ interface CreateFormProps extends FormComponentProps { ...@@ -18,12 +17,31 @@ interface CreateFormProps extends FormComponentProps {
class CreateForm extends Component<CreateFormProps, any> { class CreateForm extends Component<CreateFormProps, any> {
// const { dispatch } = this.props; // const { dispatch } = this.props;
// const { modalVisible, form, handleAdd, handleModalVisible } = this.props; // const { modalVisible, form, handleAdd, handleModalVisible } = this.props;
state = {
amountUnit:0
};
componentWillReceiveProps(props:any) {
const { modalVisible } = this.props;
if (!modalVisible) {
this.setState({amountUnit: 0});
}
}
selectAmountUnit = (value: number) => {
this.setState({amountUnit: value});
}
okHandle = () => { okHandle = () => {
const { form, handleAdd } = this.props; const { form, handleAdd } = this.props;
form.validateFields((err, fieldsValue) => { form.validateFields((err, fieldsValue) => {
if (err) return; if (err) return;
// form.resetFields(); const {amountUnit} = this.state;
if (amountUnit === 1) {
fieldsValue.CouponAmount = fieldsValue.CouponAmount* 10000;
}
handleAdd(fieldsValue); handleAdd(fieldsValue);
}); });
}; };
...@@ -52,6 +70,12 @@ class CreateForm extends Component<CreateFormProps, any> { ...@@ -52,6 +70,12 @@ class CreateForm extends Component<CreateFormProps, any> {
render() { render() {
const { modalVisible, form, handleModalVisible } = this.props; const { modalVisible, form, handleModalVisible } = this.props;
const { getFieldDecorator } = form; const { getFieldDecorator } = form;
const selectAfter = (
<Select defaultValue={0} className="select-after" onChange={this.selectAmountUnit}>
<Option value={0}></Option>
<Option value={1}></Option>
</Select>
);
return ( return (
<Modal <Modal
destroyOnClose destroyOnClose
...@@ -78,12 +102,12 @@ class CreateForm extends Component<CreateFormProps, any> { ...@@ -78,12 +102,12 @@ class CreateForm extends Component<CreateFormProps, any> {
rules: [{ required: true, message: '请输入活动号', min: 1 }], rules: [{ required: true, message: '请输入活动号', min: 1 }],
})(<Input placeholder="请输入活动号" />)} })(<Input placeholder="请输入活动号" />)}
</FormItem> </FormItem>
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="导码量"> <FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="导码量" help="注意导码单位!">
{getFieldDecorator('CouponAmount', { {getFieldDecorator('CouponAmount', {
rules: [ rules: [
{required: true, message: '请输入导码量'}, {required: true, message: '请输入导码量'},
{ pattern: /^[1-9]\d*$/g,required: true, message: '只能输入正整数'}], { pattern: /^[1-9]\d*$/g,required: true, message: '只能输入正整数'}],
})(<Input placeholder="请输入导码量,单位是万" addonAfter={<div></div>} />)} })(<Input placeholder="请输入导码量,单位是个或万" addonAfter={selectAfter} />)}
</FormItem> </FormItem>
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label={"有效期"}> <FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label={"有效期"}>
{getFieldDecorator('vaildDate', { {getFieldDecorator('vaildDate', {
...@@ -117,12 +141,6 @@ class CreateForm extends Component<CreateFormProps, any> { ...@@ -117,12 +141,6 @@ class CreateForm extends Component<CreateFormProps, any> {
} }
], ],
}) })
// (
// <Select placeholder="请选择供应商" style={{ width: '100%' }}>
// <Option value="1575">趋加</Option>
// <Option value="2250">趋加麦钱包</Option>
// <Option value="1701">趋加支付宝</Option>
// </Select>)}
( (
<Select placeholder="请选择供应商" style={{ width: '100%' }}> <Select placeholder="请选择供应商" style={{ width: '100%' }}>
<Option value="1679">趋佳</Option> <Option value="1679">趋佳</Option>
......
...@@ -128,7 +128,13 @@ class TableList extends Component<TableListProps, TableListState> { ...@@ -128,7 +128,13 @@ class TableList extends Component<TableListProps, TableListState> {
dataIndex: 'CouponAmount', dataIndex: 'CouponAmount',
sorter: true, sorter: true,
align: 'right', align: 'right',
render: (val: string) => `${val} 万`, render: (val: number) => {
if (val> 10000) {
return <span>{val/10000}<span style={{color:"#f5222d"}}></span></span>;
}else {
return val;
}
},
// mark to display a total number // mark to display a total number
needTotal: true, needTotal: true,
}, },
......
...@@ -3,7 +3,7 @@ import { TableListParams } from './data.d'; ...@@ -3,7 +3,7 @@ import { TableListParams } from './data.d';
//export const apiAddress = "http://localhost:8001"; //export const apiAddress = "http://localhost:8001";
//export const apiAddress = "http://172.16.0.152:809"; //export const apiAddress = "http://172.16.0.152:809";
export const apiAddress = "http://115.159.226.87:8090"; export const apiAddress = "http://115.159.226.87:8090";
const getExportRecord = apiAddress + "/Coupon/GetExportRecord"; const getExportRecord = apiAddress + "/Coupon/GetExportRecord";
const addExportRecord =apiAddress + "/Coupon/AddExportRecord"; const addExportRecord =apiAddress + "/Coupon/AddExportRecord";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment