Commit 795ceb50 authored by 陈万宝's avatar 陈万宝

Merge branch 'feature/20230315_take_out_goods' into feature/20230327_public_takeaway

parents 78e861fe 68a1db9c
...@@ -117,6 +117,7 @@ const AddRepertoryModal = (props, ref) => { ...@@ -117,6 +117,7 @@ const AddRepertoryModal = (props, ref) => {
> >
<InputNumber <InputNumber
min={0} min={0}
max={999999999}
style={{ width: 200, display: 'inline-block' }} style={{ width: 200, display: 'inline-block' }}
placeholder="请输入" placeholder="请输入"
/> />
...@@ -135,6 +136,7 @@ const AddRepertoryModal = (props, ref) => { ...@@ -135,6 +136,7 @@ const AddRepertoryModal = (props, ref) => {
> >
<InputNumber <InputNumber
min={0} min={0}
max={999999999}
style={{ width: 200 }} style={{ width: 200 }}
placeholder="请输入" placeholder="请输入"
onChange={onChangeMaxStock} onChange={onChangeMaxStock}
......
...@@ -124,6 +124,9 @@ const FormInformationBasic = forwardRef((props, ref) => { ...@@ -124,6 +124,9 @@ const FormInformationBasic = forwardRef((props, ref) => {
if (e) { if (e) {
setShopList([]); setShopList([]);
queryShopList({ shopId: e }); queryShopList({ shopId: e });
form.setFieldsValue({
storageRackIds: '',
});
} }
}; };
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
...@@ -150,15 +153,19 @@ const FormInformationBasic = forwardRef((props, ref) => { ...@@ -150,15 +153,19 @@ const FormInformationBasic = forwardRef((props, ref) => {
onTakeawayImageList(editData.commonImageList); onTakeawayImageList(editData.commonImageList);
}, [customer.isEdit, editData]); }, [customer.isEdit, editData]);
useEffect(() => { useEffect(() => {
setShopList([]);
shopGetByProductType(5);
const { shopId = '', groupId = '' } = groupShopData const { shopId = '', groupId = '' } = groupShopData
if (shopId) { if (shopId) {
queryShopList({ shopId }); queryShopList({ shopId });
} }
const temp = { const temp = {
productRefShopId: [`${shopId}`], productRefShopId: shopId ? [`${shopId}`] : [],
storageRackIds: [`${groupId}`], storageRackIds: groupId ? [+groupId] : [],
} }
setTimeout(() => {
form.setFieldsValue(temp); form.setFieldsValue(temp);
}, [])
}, [groupShopData]); }, [groupShopData]);
return ( return (
<Form <Form
...@@ -171,7 +178,7 @@ const FormInformationBasic = forwardRef((props, ref) => { ...@@ -171,7 +178,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
categoryId: [], categoryId: [],
description: '', description: '',
productRefShopId: [], productRefShopId: [],
storageRackIds: [], storageRackIds: null,
}} }}
scrollToFirstError scrollToFirstError
onValuesChange={getFormValues} onValuesChange={getFormValues}
......
...@@ -47,7 +47,7 @@ const createInitValues = () => ({ ...@@ -47,7 +47,7 @@ const createInitValues = () => ({
saleTimeType: 0, // 售卖时间 saleTimeType: 0, // 售卖时间
singleDelivery: 0, // 单点不送 singleDelivery: 0, // 单点不送
list: 1, // 列出商品 list: 1, // 列出商品
label: '', label: [],
}); });
const format = 'HH:mm'; const format = 'HH:mm';
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
...@@ -77,6 +77,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -77,6 +77,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const [tempMultiSpu, setTempMultiSpu] = useState([]); const [tempMultiSpu, setTempMultiSpu] = useState([]);
const [tempWeight, setTempWeight] = useState([]); const [tempWeight, setTempWeight] = useState([]);
const [tempSpecs, setTempSpecs] = useState([]); const [tempSpecs, setTempSpecs] = useState([]);
const [weightUnits, setWeightUnits] = useState([]);
const initialDealValue = [ const initialDealValue = [
{ {
...@@ -437,7 +438,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -437,7 +438,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const tempUnit = `${item.specs[0]?.unit || ''})`; const tempUnit = `${item.specs[0]?.unit || ''})`;
const tempSecondSpecName = `${item.specs[1]?.specName || ''}`; const tempSecondSpecName = `${item.specs[1]?.specName || ''}`;
// const isShow = tempQuantity && tempUnit && '+'; // const isShow = tempQuantity && tempUnit && '+';
// ${tempName} // ${tempName}
return `${tempSpecName} ${tempQuantity} ${tempUnit} ${tempSecondSpecName}`; return `${tempSpecName} ${tempQuantity} ${tempUnit} ${tempSecondSpecName}`;
}; };
const init = async () => { const init = async () => {
...@@ -448,8 +449,12 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -448,8 +449,12 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
if (!unitsList.length) { if (!unitsList.length) {
const res = await apiUnits(); const res = await apiUnits();
setUnitsList(res.data || []); setUnitsList(res.data || []);
let temp = res.data.filter(item => item.name === '准确重量单位');
if (temp.length && temp[0]?.children) {
const tempWeightName = temp[0]?.children.map(item => item.name);
sessionStorage.setItem('weightUnits', JSON.stringify(tempWeightName || []));
}
} }
setTempMultiSpu([]); setTempMultiSpu([]);
return false; return false;
}; };
...@@ -495,6 +500,17 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -495,6 +500,17 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
} = editData?.skuList[0]; } = editData?.skuList[0];
let specList = editData?.specList; let specList = editData?.specList;
let weight = specList.filter(item => item.specGroupName === '份量'); let weight = specList.filter(item => item.specGroupName === '份量');
const tempWeightName = JSON.parse(sessionStorage.getItem('weightUnits'));
weight.forEach(item => {
if (item?.specs?.length) {
item.specs.forEach(itm => {
if (tempWeightName.includes(itm.unit)) {
itm.quantity =
itm?.quantity.indexOf('约') > -1 ? itm?.quantity.slice(1) : itm?.quantity || '';
}
});
}
});
let specs = specList.filter(item => item.specGroupName !== '份量'); let specs = specList.filter(item => item.specGroupName !== '份量');
editData.categoryId = [firstCategoryId, secondCategoryId, thirdCategoryId]; editData.categoryId = [firstCategoryId, secondCategoryId, thirdCategoryId];
editData.saleTimeType = saleTimeType; editData.saleTimeType = saleTimeType;
...@@ -522,7 +538,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -522,7 +538,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
}); });
setTempMultiSpu(tempMultiSpu || []); setTempMultiSpu(tempMultiSpu || []);
} }
form.setFieldsValue({ productRefShopId: editData.shopId }); form.setFieldsValue({ productRefShopId: editData.shopId });
onCardSuccessImageList(editData?.detailImageList); onCardSuccessImageList(editData?.detailImageList);
getFormValues(); getFormValues();
...@@ -575,7 +591,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -575,7 +591,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
label="最少购买" label="最少购买"
// rules={[{ required: true, message: '每日最低接待量' }]} // rules={[{ required: true, message: '每日最低接待量' }]}
> >
<InputNumber min={1} style={{ width: 200 }} placeholder="请输入购买量" /> <InputNumber min={1} max={999999999} style={{ width: 200 }} placeholder="请输入购买量" />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="saleTimeType" name="saleTimeType"
...@@ -712,7 +728,12 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -712,7 +728,12 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
}} }}
rules={[{ required: true, message: '请输入分量' }]} rules={[{ required: true, message: '请输入分量' }]}
> >
<InputNumber min={1} style={{ width: 200 }} placeholder="请输入数字" /> <InputNumber
min={1}
max={999999999}
style={{ width: 200 }}
placeholder="请输入数字"
/>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="unit" name="unit"
...@@ -738,7 +759,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -738,7 +759,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
label="销售价格" label="销售价格"
rules={[{ required: true, message: '请输入销售价格' }]} rules={[{ required: true, message: '请输入销售价格' }]}
> >
<InputNumber min={0} style={{ width: 200 }} placeholder="元" /> <InputNumber min={0} max={999999999} style={{ width: 200 }} placeholder="元" />
</Form.Item> </Form.Item>
<Form.Item className={styles.itemInline}> <Form.Item className={styles.itemInline}>
<Form.Item <Form.Item
...@@ -752,6 +773,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -752,6 +773,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
> >
<InputNumber <InputNumber
min={0} min={0}
max={999999999}
style={{ width: 200, display: 'inline-block' }} style={{ width: 200, display: 'inline-block' }}
placeholder="请输入" placeholder="请输入"
/> />
...@@ -770,6 +792,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -770,6 +792,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
> >
<InputNumber <InputNumber
min={0} min={0}
max={999999999}
style={{ width: 200 }} style={{ width: 200 }}
placeholder="请输入" placeholder="请输入"
onChange={onChangeMaxStock} onChange={onChangeMaxStock}
...@@ -989,6 +1012,8 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -989,6 +1012,8 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
]} ]}
> >
<InputNumber <InputNumber
max={999999999}
min={0}
style={{ width: '200px' }} style={{ width: '200px' }}
placeholder="加价名称金额(元)" placeholder="加价名称金额(元)"
/> />
......
...@@ -487,9 +487,9 @@ const ServiceGoods = options => { ...@@ -487,9 +487,9 @@ const ServiceGoods = options => {
maskClosable={false} maskClosable={false}
keyboard={false} keyboard={false}
footer={[ footer={[
<Button key="draft" type="primary" ghost loading={pageLoading} onClick={onSaveDraft}> productType === 5 ? '' : <Button key="draft" type="primary" ghost loading={pageLoading} onClick={onSaveDraft}>
保存草稿 保存草稿
</Button>, </Button>,
<Button key="submit" type="primary" loading={pageLoading} onClick={submitEvent}> <Button key="submit" type="primary" loading={pageLoading} onClick={submitEvent}>
提交 提交
</Button>, </Button>,
...@@ -500,7 +500,7 @@ const ServiceGoods = options => { ...@@ -500,7 +500,7 @@ const ServiceGoods = options => {
> >
<Spin tip="正在加载..." spinning={pageLoading} delay={100}> <Spin tip="正在加载..." spinning={pageLoading} delay={100}>
<WrapperContainer> <WrapperContainer>
{visibleCacheEdit && ( {visibleCacheEdit && productType !== 5 && (
<div className={styles.draftBox}> <div className={styles.draftBox}>
有未保存内容。是否 有未保存内容。是否
<span className={styles.conEdit} onClick={onContinueEdit}> <span className={styles.conEdit} onClick={onContinueEdit}>
......
...@@ -111,11 +111,22 @@ const filterItems = (type, props) => { ...@@ -111,11 +111,22 @@ const filterItems = (type, props) => {
export const filterSendData = (type, params) => { export const filterSendData = (type, params) => {
// takeawayItem 外卖商品 // takeawayItem 外卖商品
const { infoMation, infoImageData, attributeApplyList, takeawayItem } = params; const { infoMation, infoImageData, attributeApplyList, takeawayItem } = params;
console.log('infoMation', infoMation, takeawayItem);
const temp = Object.assign({}, takeawayItem?.intactData, infoMation)
temp.categoryId = (Array.isArray(temp.categoryId) && temp.categoryId?.slice(temp.categoryId?.length - 1)?.toString())
// 外卖商品 // 外卖商品
if (type === 5) { if (type === 5) {
const temp = Object.assign({}, takeawayItem?.intactData, infoMation)
temp.categoryId = (Array.isArray(temp.categoryId) && temp.categoryId?.slice(temp.categoryId?.length - 1)?.toString())
temp.productRefShopId = temp.productRefShopId.toString()
const tempWeightName = JSON.parse(sessionStorage.getItem('weightUnits'))
console.log(tempWeightName, 'tempWeightName');
temp.items.forEach(item => {
if (item?.specs?.length) {
item.specs.forEach(itm => {
if (tempWeightName.includes(itm.unit)) {
itm.quantity = itm.quantity.indexOf('') > -1 ? itm.quantity : `约${itm.quantity}`
}
})
}
})
return temp; return temp;
} }
const items = filterItems(type, params); const items = filterItems(type, params);
......
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