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