Commit b6e89ae0 authored by 陈万宝's avatar 陈万宝

Merge branch 'feature/20230327_public_takeaway' of...

Merge branch 'feature/20230327_public_takeaway' of http://git.quantgroup.cn/ui/merchant-manage-ui into feature/20230327_public_takeaway
parents 2fbbeff5 f6899240
...@@ -19,7 +19,6 @@ import { ...@@ -19,7 +19,6 @@ import {
notification, notification,
Spin, Spin,
Tabs, Tabs,
InputNumber,
} from 'antd'; } from 'antd';
import styles from './style.less'; import styles from './style.less';
import { import {
...@@ -353,6 +352,7 @@ class BusinessInfo extends Component { ...@@ -353,6 +352,7 @@ class BusinessInfo extends Component {
} }
onChangeBusinessModel = e => { onChangeBusinessModel = e => {
console.log('....');
this.getCategoryList(e); this.getCategoryList(e);
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
mainCategoryId: '', mainCategoryId: '',
...@@ -980,14 +980,18 @@ class BusinessInfo extends Component { ...@@ -980,14 +980,18 @@ class BusinessInfo extends Component {
<Col span={12}> <Col span={12}>
<FormItem label="银行帐号" labelCol={{ span: 8 }}> <FormItem label="银行帐号" labelCol={{ span: 8 }}>
{getFieldDecorator('bankAccount', { {getFieldDecorator('bankAccount', {
rules: [{ required: true, message: '请输入银行帐号!' }], rules: [
{ required: true, message: '请输入银行帐号!' },
{ pattern: /^[0-9]*$/, message: '请输入数字' },
],
initialValue: businessInfo.bankAccount, initialValue: businessInfo.bankAccount,
})(<InputNumber style={{ width: '100%' }} controls={false} min={1} />)} })(<Input />)}
</FormItem> </FormItem>
</Col> </Col>
<Col span={12}> <Col span={12}>
<FormItem label="联行号" labelCol={{ span: 8 }}> <FormItem label="联行号" labelCol={{ span: 8 }}>
{getFieldDecorator('interbankNum', { {getFieldDecorator('interbankNum', {
rules: [{ pattern: /^[0-9]*$/, message: '请输入数字' }],
initialValue: businessInfo.interbankNum, initialValue: businessInfo.interbankNum,
})(<Input maxLength={50} />)} })(<Input maxLength={50} />)}
</FormItem> </FormItem>
...@@ -1063,9 +1067,12 @@ class BusinessInfo extends Component { ...@@ -1063,9 +1067,12 @@ class BusinessInfo extends Component {
<Col span={12}> <Col span={12}>
<FormItem label="银行帐号" labelCol={{ span: 8 }}> <FormItem label="银行帐号" labelCol={{ span: 8 }}>
{getFieldDecorator('bankAccount', { {getFieldDecorator('bankAccount', {
rules: [{ required: true, message: '请输入银行帐号!' }], rules: [
{ required: true, message: '请输入银行帐号!' },
{ pattern: /^[0-9]*$/, message: '请输入数字' },
],
initialValue: businessInfo.bankAccount, initialValue: businessInfo.bankAccount,
})(<InputNumber style={{ width: '100%' }} controls={false} min={1} />)} })(<Input />)}
</FormItem> </FormItem>
</Col> </Col>
</Row> </Row>
...@@ -1124,9 +1131,12 @@ class BusinessInfo extends Component { ...@@ -1124,9 +1131,12 @@ class BusinessInfo extends Component {
<Col span={12}> <Col span={12}>
<FormItem label="银行帐号" labelCol={{ span: 8 }}> <FormItem label="银行帐号" labelCol={{ span: 8 }}>
{getFieldDecorator('bankAccount', { {getFieldDecorator('bankAccount', {
rules: [{ required: true, message: '请输入银行帐号!' }], rules: [
{ required: true, message: '请输入银行帐号!' },
{ pattern: /^[0-9]*$/, message: '请输入数字' },
],
initialValue: businessInfo.bankAccount, initialValue: businessInfo.bankAccount,
})(<InputNumber style={{ width: '100%' }} controls={false} min={1} />)} })(<Input />)}
</FormItem> </FormItem>
</Col> </Col>
</Row> </Row>
......
...@@ -20,6 +20,7 @@ const StoreModal = props => { ...@@ -20,6 +20,7 @@ const StoreModal = props => {
formInfo, formInfo,
status, status,
productBusiness, productBusiness,
existTakewayShop,
} = props; } = props;
const [areaAddr, setAreaAddr] = useState([]); const [areaAddr, setAreaAddr] = useState([]);
const [visibleMap, setVisibleMap] = useState(false); const [visibleMap, setVisibleMap] = useState(false);
...@@ -30,7 +31,7 @@ const StoreModal = props => { ...@@ -30,7 +31,7 @@ const StoreModal = props => {
address: '', address: '',
}); });
const [disabled, setDisabled] = useState(false); const [disabled, setDisabled] = useState(false);
const [isDisabled, setIsDisabled] = useState(true); const [isDisabled, setIsDisabled] = useState(false);
const [businessModel, setBusinessModel] = useState([ const [businessModel, setBusinessModel] = useState([
{ label: '到家外卖业务(外卖配送业务)', value: 1 }, { label: '到家外卖业务(外卖配送业务)', value: 1 },
{ label: '实物商品业务员', value: 2 }, { label: '实物商品业务员', value: 2 },
...@@ -38,30 +39,11 @@ const StoreModal = props => { ...@@ -38,30 +39,11 @@ const StoreModal = props => {
]); ]);
const divDom = useRef(); const divDom = useRef();
useEffect(() => {
setDisabled(props.status);
}, [props.status]);
useEffect(() => {
if (props.productBusiness.length) {
businessModel.forEach(item => {
if (!props.productBusiness.includes(item.value)) {
item.disabled = true;
}
if (props.existTakewayShop && item.value === 1) {
item.disabled = true;
}
});
const val = props.productBusiness.includes(1);
setIsDisabled(val);
setBusinessModel(businessModel);
}
}, [props.productBusiness]);
const handleCancel = isSuccess => { const handleCancel = isSuccess => {
resetFields(); resetFields();
onCancel(isSuccess); onCancel(isSuccess);
}; };
const onSubmit = () => { const onSubmit = () => {
validateFields(async (error, fieldsValue) => { validateFields(async (error, fieldsValue) => {
if (!error) { if (!error) {
...@@ -252,7 +234,24 @@ const StoreModal = props => { ...@@ -252,7 +234,24 @@ const StoreModal = props => {
if (visible) { if (visible) {
resetFields(); resetFields();
const info = Object.assign({}, formInfo); const info = Object.assign({}, formInfo);
console.log(info); const val = info?.productBusiness?.includes(1);
setIsDisabled(val);
if (status === 'look') {
setDisabled(true);
} else {
setDisabled(false);
}
const data = [...businessModel];
data.forEach(item => {
item.disabled = !productBusiness.includes(item.value);
if (existTakewayShop && item.value === 1 && !val) {
item.disabled = true;
} else {
item.disabled = false;
}
});
setBusinessModel(data);
if (info && info.id) { if (info && info.id) {
info.week = info.businessHours.weeks; info.week = info.businessHours.weeks;
const hours = info.businessHours.hoursItems; const hours = info.businessHours.hoursItems;
...@@ -265,6 +264,7 @@ const StoreModal = props => { ...@@ -265,6 +264,7 @@ const StoreModal = props => {
}); });
}); });
} }
info.lnglat = `${info.longitude},${info.latitude}`; info.lnglat = `${info.longitude},${info.latitude}`;
info.addr = [info.provinceId, info.cityId, info.countyId]; info.addr = [info.provinceId, info.cityId, info.countyId];
info.shopHeadImage = (info.shopHeadImage && [info.shopHeadImage]) || []; info.shopHeadImage = (info.shopHeadImage && [info.shopHeadImage]) || [];
......
...@@ -25,7 +25,7 @@ export default () => { ...@@ -25,7 +25,7 @@ export default () => {
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
const [storeInfo, setStoreInfo] = useState({}); const [storeInfo, setStoreInfo] = useState({});
const [areaAddr, setAreaAddr] = useState([]); const [areaAddr, setAreaAddr] = useState([]);
const [status, setStatus] = useState(); const [status, setStatus] = useState(false);
const [dataList, setDataList] = useState([]); const [dataList, setDataList] = useState([]);
const [pageNo, setPageNo] = useState(1); const [pageNo, setPageNo] = useState(1);
const [totalNum, setTotalNum] = useState(0); const [totalNum, setTotalNum] = useState(0);
...@@ -41,18 +41,17 @@ export default () => { ...@@ -41,18 +41,17 @@ export default () => {
setProductBusiness(res.productBusiness || []); setProductBusiness(res.productBusiness || []);
setExistTakewayShop(res.existTakewayShop); setExistTakewayShop(res.existTakewayShop);
} }
setVisible(true);
}; };
const onCreate = () => { const onCreate = () => {
setStatus('add');
setStoreInfo({}); setStoreInfo({});
setVisible(true);
getBusiness(); getBusiness();
}; };
const onShowInfo = (info, val) => { const onShowInfo = (info, val) => {
setStoreInfo(info); setStoreInfo(info);
const value = val !== 'edit'; setStatus(val);
setStatus(value);
setVisible(true);
getBusiness(); getBusiness();
}; };
...@@ -272,7 +271,7 @@ export default () => { ...@@ -272,7 +271,7 @@ export default () => {
fixed: 'right', fixed: 'right',
render: (val, r) => ( render: (val, r) => (
<div className={style.actionBtn}> <div className={style.actionBtn}>
<Button key="look" onClick={() => onShowInfo(r)}> <Button key="look" onClick={() => onShowInfo(r, 'look')}>
查看 查看
</Button> </Button>
<Button key="seek" onClick={() => onShowInfo(r, 'edit')}> <Button key="seek" onClick={() => onShowInfo(r, 'edit')}>
......
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