Commit 5b5381e5 authored by 陈万宝's avatar 陈万宝

feat: 新增份量单位

parent 2e5a3edf
...@@ -186,3 +186,48 @@ ...@@ -186,3 +186,48 @@
color: #0e75fd; color: #0e75fd;
cursor: pointer; cursor: pointer;
} }
.required {
:global {
.ant-form-item-label > {
::before {
display: inline-block;
margin-right: 4px;
color: #ff4d4f;
font-size: 14px;
font-family: SimSun, sans-serif;
line-height: 1;
content: '*';
}
}
.ant-form-item {
margin-bottom: 0;
}
}
}
.itemInline {
:global {
.ant-form-item-control-input-content {
display: flex;
}
.ant-form-item {
margin-bottom: 0;
}
}
}
.textStyle{
color: red;
}
.multiSpecification {
display: flex;
flex-flow: row wrap;
}
.specRepertory {
width: 50px;
background-color: #319bfe;
border-radius: 25px;
color: #fff;
height: 20px;
line-height: 20px;
text-align: center;
}
import React, { useState, useEffect, forwardRef } from 'react'; import React, { useState, useEffect, forwardRef, useRef, useImperativeHandle } from 'react';
import { Button, Modal } from 'antd'; import { Button, Modal } from 'antd';
const AddMenusModal = props => {
const AddMenusModal = (props, ref) => {
const [confirmLoading, setConfirmLoading] = useState(false); const [confirmLoading, setConfirmLoading] = useState(false);
const [modalText, setModalText] = useState('Content of the modal'); const [modalText, setModalText] = useState('Content of the modal');
const { open, setOpen } = props; const [open, setOpen] = useState(false);
// const {
// open,
// setOpen,
// } = props;
useImperativeHandle(ref, () => ({
// changeVal 就是暴露给父组件的方法
setOpen: newVal => {
setOpen(newVal)
},
}));
const handleOk = () => { const handleOk = () => {
setModalText('The modal will be closed after two seconds'); setModalText('The modal will be closed after two seconds');
setConfirmLoading(true); setConfirmLoading(true);
...@@ -18,25 +31,23 @@ const AddMenusModal = props => { ...@@ -18,25 +31,23 @@ const AddMenusModal = props => {
console.log('Clicked cancel button'); console.log('Clicked cancel button');
setOpen(false); setOpen(false);
}; };
useEffect(() => { useEffect(() => {
console.log('open', open); console.log('open', open);
}, [open]); }, [open])
return ( return (
<> <>
{open && 222} {open && <Modal
{open && ( title="Title"
<Modal visible={open}
title="Title" onOk={handleOk}
open={open} confirmLoading={confirmLoading}
onOk={handleOk} onCancel={handleCancel}
confirmLoading={confirmLoading} >
onCancel={handleCancel} <p>{modalText}</p>
> </Modal>}
<p>{modalText}</p>
</Modal>
)}
</> </>
); );
}; };
export default forwardRef(AddMenusModal); export default forwardRef(AddMenusModal);
import React, { useState, useEffect, forwardRef, useRef, useImperativeHandle } from 'react';
import { Button, Modal, Radio, Form, InputNumber, Switch } from 'antd';
import styles from '../common.less';
import { ENUM_SET_REPERTORY } from '../config';
const AddRepertoryModal = (props, ref) => {
const [confirmLoading, setConfirmLoading] = useState(false);
const [modalText, setModalText] = useState('Content of the modal');
const [openRepertory, setOpenRepertory] = useState(false);
// const {
// open,
// setOpen,
// } = props;
useImperativeHandle(ref, () => ({
// changeVal 就是暴露给父组件的方法
setOpenRepertory: newVal => {
setOpenRepertory(newVal);
},
}));
const onChange3 = () => {};
const handleOk = () => {
setModalText('The modal will be closed after two seconds');
setConfirmLoading(true);
setTimeout(() => {
setOpenRepertory(false);
setConfirmLoading(false);
}, 2000);
};
const handleCancel = () => {
console.log('Clicked cancel button');
setOpenRepertory(false);
};
useEffect(() => {
console.log('open', openRepertory);
}, [openRepertory]);
return (
<>
{openRepertory && (
<Modal
title="修改库存"
visible={openRepertory}
onOk={handleOk}
confirmLoading={confirmLoading}
onCancel={handleCancel}
>
<Form>
<Form.Item className={styles.itemInline}>
<Form.Item
name="receptionVolume"
label="剩余库存"
style={{
display: 'flex',
marginRight: '8px',
}}
rules={[{ required: true, message: '请填写剩余库存' }]}
>
<InputNumber
min={1}
style={{ width: 200, display: 'inline-block' }}
placeholder="请输入"
/>
</Form.Item>
<Form.Item name="limitPurchase" style={{ width: 200, display: 'inline-block' }}>
<Radio.Group options={ENUM_SET_REPERTORY} onChange={onChange3} value={1} />
</Form.Item>
</Form.Item>
<Form.Item
name="receptionVolume"
label="最大库存"
rules={[{ required: true, message: '请填写最大库存' }]}
>
<InputNumber min={1} style={{ width: 200 }} placeholder="请输入" />
</Form.Item>
<Form.Item name="receptionVolume" label="自动补足">
<Switch
checkedChildren="开启"
unCheckedChildren="关闭"
defaultChecked
onChange={onChange3}
/>
</Form.Item>
<div className={styles.textStyle}>修改成功后,原库存将被替换,请谨慎操作!</div>
</Form>
</Modal>
)}
</>
);
};
export default forwardRef(AddRepertoryModal);
import React, { useState, useEffect, forwardRef, useRef, useImperativeHandle } from 'react';
import { Button, Modal, Radio, Form, InputNumber, Switch } from 'antd';
import styles from '../common.less';
import { ENUM_SET_REPERTORY } from '../config';
const AddRepertoryModal = (props, ref) => {
const [confirmLoading, setConfirmLoading] = useState(false);
const [modalText, setModalText] = useState('Content of the modal');
const [openRepertory, setOpenRepertory] = useState(false);
// const {
// open,
// setOpen,
// } = props;
useImperativeHandle(ref, () => ({
// changeVal 就是暴露给父组件的方法
setOpenRepertory: newVal => {
setOpenRepertory(newVal);
},
}));
const onChange3 = () => {};
const handleOk = () => {
setModalText('The modal will be closed after two seconds');
setConfirmLoading(true);
setTimeout(() => {
setOpenRepertory(false);
setConfirmLoading(false);
}, 2000);
};
const handleCancel = () => {
console.log('Clicked cancel button');
setOpenRepertory(false);
};
useEffect(() => {
console.log('open', openRepertory);
}, [openRepertory]);
return (
<>
{openRepertory && (
<Modal
title="修改库存"
visible={openRepertory}
onOk={handleOk}
confirmLoading={confirmLoading}
onCancel={handleCancel}
>
<Form>
<Form.Item className={styles.itemInline}>
<Form.Item
name="receptionVolume"
label="剩余库存"
style={{
display: 'flex',
marginRight: '8px',
}}
rules={[{ required: true, message: '请填写剩余库存' }]}
>
<InputNumber
min={1}
style={{ width: 200, display: 'inline-block' }}
placeholder="请输入"
/>
</Form.Item>
<Form.Item name="limitPurchase" style={{ width: 200, display: 'inline-block' }}>
<Radio.Group options={ENUM_SET_REPERTORY} onChange={onChange3} value={1} />
</Form.Item>
</Form.Item>
<Form.Item
name="receptionVolume"
label="最大库存"
rules={[{ required: true, message: '请填写最大库存' }]}
>
<InputNumber min={1} style={{ width: 200 }} placeholder="请输入" />
</Form.Item>
<Form.Item name="receptionVolume" label="自动补足">
<Switch
checkedChildren="开启"
unCheckedChildren="关闭"
defaultChecked
onChange={onChange3}
/>
</Form.Item>
<div className={styles.textStyle}>修改成功后,原库存将被替换,请谨慎操作!</div>
</Form>
</Modal>
)}
</>
);
};
export default forwardRef(AddRepertoryModal);
import React, { useState, useEffect, forwardRef, useRef, useImperativeHandle } from 'react';
import { Button, Modal } from 'antd';
const AddSellTimeModal = (props, ref) => {
const [confirmLoading, setConfirmLoading] = useState(false);
const [modalText, setModalText] = useState('Content of the modal');
const [open, setOpen] = useState(false);
// const {
// open,
// setOpen,
// } = props;
useImperativeHandle(ref, () => ({
// changeVal 就是暴露给父组件的方法
setOpen: newVal => {
setOpen(newVal)
},
}));
const handleOk = () => {
setModalText('The modal will be closed after two seconds');
setConfirmLoading(true);
setTimeout(() => {
setOpen(false);
setConfirmLoading(false);
}, 2000);
};
const handleCancel = () => {
console.log('Clicked cancel button');
setOpen(false);
};
useEffect(() => {
console.log('open', open);
}, [open])
return (
<>
{open && <Modal
title="Title"
visible={open}
onOk={handleOk}
confirmLoading={confirmLoading}
onCancel={handleCancel}
>
<p>{modalText}</p>
</Modal>}
</>
);
};
export default forwardRef(AddSellTimeModal);
...@@ -6,11 +6,12 @@ import React, { ...@@ -6,11 +6,12 @@ import React, {
useImperativeHandle, useImperativeHandle,
useRef, useRef,
} from 'react'; } from 'react';
import { Cascader, Form, Input, Select, Popover, Button, Checkbox, Divider } from 'antd'; import { Cascader, Form, Input, Select, Popover, Button, Checkbox, Divider, Modal } from 'antd';
import { formItemLayout } from '../config'; import { formItemLayout } from '../config';
import { ServiceContext } from '../context'; import { ServiceContext } from '../context';
import { debounce } from '@/utils/utils'; import { debounce } from '@/utils/utils';
import AddMenusModal from './AddMenusModal'; import AddMenusModal from './AddMenusModal';
import UploadImage from './UploadImage';
const CreateSelectOption = optionList => const CreateSelectOption = optionList =>
optionList.map(brandItem => ( optionList.map(brandItem => (
...@@ -39,7 +40,8 @@ const FormInformationBasic = forwardRef((props, ref) => { ...@@ -39,7 +40,8 @@ const FormInformationBasic = forwardRef((props, ref) => {
const [noreBrandList, setNoreBrandList] = useState([]); const [noreBrandList, setNoreBrandList] = useState([]);
const customer = useContext(ServiceContext); const customer = useContext(ServiceContext);
const childAddMenusModalRef = useRef(null); const childAddMenusModalRef = useRef(null);
const [open, setOpen] = useState(false); const [cardImageList, setCardImageList] = useState([]);
const onCheck = async () => { const onCheck = async () => {
try { try {
const values = await form.validateFields(); const values = await form.validateFields();
...@@ -62,12 +64,11 @@ const FormInformationBasic = forwardRef((props, ref) => { ...@@ -62,12 +64,11 @@ const FormInformationBasic = forwardRef((props, ref) => {
return null; return null;
} }
}; };
// 自定义加入菜单
const showModal = () => { const showModal = () => {
setOpen(true); childAddMenusModalRef.current.setOpen(true);
console.log('3333', open);
}; };
// 自定义下拉 // 自定义菜单下拉
const dropdownRender = menus => ( const dropdownRender = menus => (
<div> <div>
{menus} {menus}
...@@ -89,6 +90,12 @@ const FormInformationBasic = forwardRef((props, ref) => { ...@@ -89,6 +90,12 @@ const FormInformationBasic = forwardRef((props, ref) => {
</div> </div>
</div> </div>
); );
const onCardSuccessImageList = imgList => {
setCardImageList(imgList);
form.setFieldsValue({
cardImageList: imgList,
});
};
const getFormValues = debounce(() => { const getFormValues = debounce(() => {
const values = form.getFieldsValue(); const values = form.getFieldsValue();
props.onValuesChange({ infoMation: values }); props.onValuesChange({ infoMation: values });
...@@ -158,7 +165,8 @@ const FormInformationBasic = forwardRef((props, ref) => { ...@@ -158,7 +165,8 @@ const FormInformationBasic = forwardRef((props, ref) => {
</Form.Item> </Form.Item>
)} )}
{/* 新增菜单分组弹框 */} {/* 新增菜单分组弹框 */}
<AddMenusModal open={open} ref={childAddMenusModalRef} /> <AddMenusModal ref={childAddMenusModalRef} />
<Form.Item <Form.Item
name="categoryId" name="categoryId"
label="商品类目" label="商品类目"
...@@ -173,6 +181,29 @@ const FormInformationBasic = forwardRef((props, ref) => { ...@@ -173,6 +181,29 @@ const FormInformationBasic = forwardRef((props, ref) => {
options={newCategoryList[customer.productType]} options={newCategoryList[customer.productType]}
/> />
</Form.Item> </Form.Item>
{/* 外卖-商品图片 */}
{customer.isTakeawayService && (
<Form.Item
name="cardImageList"
label="商品图片"
extra="支持.jpg/png格式图片,建议单张比例1:1,大小200kb左右,最多可以上传5张"
rules={[
{
required: true,
type: 'array',
message: '请上传商品图片!',
},
]}
>
<UploadImage
name="cardImageList"
limit={5}
disabled={customer.isDisabled}
pictures={cardImageList}
setPictureList={list => onCardSuccessImageList(list)}
/>
</Form.Item>
)}
{!customer.isTakeawayService && !customer.isCard && ( {!customer.isTakeawayService && !customer.isCard && (
<Form.Item <Form.Item
......
This diff is collapsed.
...@@ -323,3 +323,11 @@ export const StaticColumns = customer => [ ...@@ -323,3 +323,11 @@ export const StaticColumns = customer => [
disabeldRender: () => customer.isDisabled, disabeldRender: () => customer.isDisabled,
}, },
]; ];
export const ENUM_REPERTORY = [
{ label: '单规格', value: '单规格' },
{ label: '多规格', value: '多规格' },
]
export const ENUM_SET_REPERTORY = [
{ label: '清零', value: '清零' },
{ label: '最大', value: '最大' },
]
...@@ -9,6 +9,7 @@ import FormRuleSetting from './components/FormRuleSetting'; ...@@ -9,6 +9,7 @@ import FormRuleSetting from './components/FormRuleSetting';
import FormRuleVPictures from './components/FormRuleVPictures'; import FormRuleVPictures from './components/FormRuleVPictures';
import FormSettlementOthers from './components/FormSettlementOthers'; import FormSettlementOthers from './components/FormSettlementOthers';
import FormAttr from './components/FormAttr'; import FormAttr from './components/FormAttr';
import FormTakeaway from './components/FormTakeaway';
import localStorage from '@/utils/localStorage'; import localStorage from '@/utils/localStorage';
import { import {
merchantBrandList, merchantBrandList,
...@@ -45,6 +46,7 @@ const ServiceGoods = options => { ...@@ -45,6 +46,7 @@ const ServiceGoods = options => {
const picturesRef = useRef(null); const picturesRef = useRef(null);
const settleOtrRef = useRef(null); const settleOtrRef = useRef(null);
const attrRef = useRef(null); const attrRef = useRef(null);
const takeawayRef = useRef(null);
const [pageId, setPageId] = useState(null); const [pageId, setPageId] = useState(null);
const [categoryIds, setCategoryIds] = useState([]); // 商品品类ID const [categoryIds, setCategoryIds] = useState([]); // 商品品类ID
...@@ -476,7 +478,7 @@ const ServiceGoods = options => { ...@@ -476,7 +478,7 @@ const ServiceGoods = options => {
onValuesChange={onValuesChange} onValuesChange={onValuesChange}
/>, />,
]} ]}
{ productType !== 5 && <>
<Title title="价格与库存" /> <Title title="价格与库存" />
<FormPriceOrStock <FormPriceOrStock
ref={stockRef} ref={stockRef}
...@@ -486,6 +488,8 @@ const ServiceGoods = options => { ...@@ -486,6 +488,8 @@ const ServiceGoods = options => {
skuList={editData.skuList} skuList={editData.skuList}
onValuesChange={onValuesChange} onValuesChange={onValuesChange}
/> />
</>}
{ productType !== 5 && <>
<Title title="规则设置" /> <Title title="规则设置" />
{productType === 4 && ( {productType === 4 && (
<FormRuleSetting <FormRuleSetting
...@@ -495,13 +499,16 @@ const ServiceGoods = options => { ...@@ -495,13 +499,16 @@ const ServiceGoods = options => {
onValuesChange={onValuesChange} onValuesChange={onValuesChange}
/> />
)} )}
</>}
{ productType !== 5 && <>
<FormRuleVPictures <FormRuleVPictures
ref={picturesRef} ref={picturesRef}
specKeyItem={specKeyList} specKeyItem={specKeyList}
editData={editData.infoImageData} editData={editData.infoImageData}
onValuesChange={onValuesChange} onValuesChange={onValuesChange}
/> />
</>}
{productType === 4 && ( {productType === 4 && (
<FormSettlementOthers <FormSettlementOthers
ref={settleOtrRef} ref={settleOtrRef}
...@@ -509,6 +516,15 @@ const ServiceGoods = options => { ...@@ -509,6 +516,15 @@ const ServiceGoods = options => {
onValuesChange={onValuesChange} onValuesChange={onValuesChange}
/> />
)} )}
{ productType === 5 && <>
<FormTakeaway
ref={takeawayRef}
editData={editData.serviceItem}
supplierIdList={supplierIdList}
onValuesChange={onValuesChange}
/>
</>}
</ServiceContext.Provider> </ServiceContext.Provider>
</WrapperContainer> </WrapperContainer>
</Spin> </Spin>
......
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