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) => {
>
<InputNumber
min={0}
max={999999999}
style={{ width: 200, display: 'inline-block' }}
placeholder="请输入"
/>
......@@ -135,6 +136,7 @@ const AddRepertoryModal = (props, ref) => {
>
<InputNumber
min={0}
max={999999999}
style={{ width: 200 }}
placeholder="请输入"
onChange={onChangeMaxStock}
......
......@@ -124,6 +124,9 @@ const FormInformationBasic = forwardRef((props, ref) => {
if (e) {
setShopList([]);
queryShopList({ shopId: e });
form.setFieldsValue({
storageRackIds: '',
});
}
};
useImperativeHandle(ref, () => ({
......@@ -150,15 +153,19 @@ const FormInformationBasic = forwardRef((props, ref) => {
onTakeawayImageList(editData.commonImageList);
}, [customer.isEdit, editData]);
useEffect(() => {
setShopList([]);
shopGetByProductType(5);
const { shopId = '', groupId = '' } = groupShopData
if (shopId) {
queryShopList({ shopId });
}
const temp = {
productRefShopId: [`${shopId}`],
storageRackIds: [`${groupId}`],
productRefShopId: shopId ? [`${shopId}`] : [],
storageRackIds: groupId ? [+groupId] : [],
}
setTimeout(() => {
form.setFieldsValue(temp);
}, [])
}, [groupShopData]);
return (
<Form
......@@ -171,7 +178,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
categoryId: [],
description: '',
productRefShopId: [],
storageRackIds: [],
storageRackIds: null,
}}
scrollToFirstError
onValuesChange={getFormValues}
......
......@@ -47,7 +47,7 @@ const createInitValues = () => ({
saleTimeType: 0, // 售卖时间
singleDelivery: 0, // 单点不送
list: 1, // 列出商品
label: '',
label: [],
});
const format = 'HH:mm';
const { RangePicker } = DatePicker;
......@@ -77,6 +77,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const [tempMultiSpu, setTempMultiSpu] = useState([]);
const [tempWeight, setTempWeight] = useState([]);
const [tempSpecs, setTempSpecs] = useState([]);
const [weightUnits, setWeightUnits] = useState([]);
const initialDealValue = [
{
......@@ -448,8 +449,12 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
if (!unitsList.length) {
const res = await apiUnits();
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([]);
return false;
};
......@@ -495,6 +500,17 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
} = editData?.skuList[0];
let specList = editData?.specList;
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 !== '份量');
editData.categoryId = [firstCategoryId, secondCategoryId, thirdCategoryId];
editData.saleTimeType = saleTimeType;
......@@ -575,7 +591,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
label="最少购买"
// rules={[{ required: true, message: '每日最低接待量' }]}
>
<InputNumber min={1} style={{ width: 200 }} placeholder="请输入购买量" />
<InputNumber min={1} max={999999999} style={{ width: 200 }} placeholder="请输入购买量" />
</Form.Item>
<Form.Item
name="saleTimeType"
......@@ -712,7 +728,12 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
}}
rules={[{ required: true, message: '请输入分量' }]}
>
<InputNumber min={1} style={{ width: 200 }} placeholder="请输入数字" />
<InputNumber
min={1}
max={999999999}
style={{ width: 200 }}
placeholder="请输入数字"
/>
</Form.Item>
<Form.Item
name="unit"
......@@ -738,7 +759,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
label="销售价格"
rules={[{ required: true, message: '请输入销售价格' }]}
>
<InputNumber min={0} style={{ width: 200 }} placeholder="元" />
<InputNumber min={0} max={999999999} style={{ width: 200 }} placeholder="元" />
</Form.Item>
<Form.Item className={styles.itemInline}>
<Form.Item
......@@ -752,6 +773,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
>
<InputNumber
min={0}
max={999999999}
style={{ width: 200, display: 'inline-block' }}
placeholder="请输入"
/>
......@@ -770,6 +792,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
>
<InputNumber
min={0}
max={999999999}
style={{ width: 200 }}
placeholder="请输入"
onChange={onChangeMaxStock}
......@@ -989,6 +1012,8 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
]}
>
<InputNumber
max={999999999}
min={0}
style={{ width: '200px' }}
placeholder="加价名称金额(元)"
/>
......
......@@ -487,7 +487,7 @@ const ServiceGoods = options => {
maskClosable={false}
keyboard={false}
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 key="submit" type="primary" loading={pageLoading} onClick={submitEvent}>
......@@ -500,7 +500,7 @@ const ServiceGoods = options => {
>
<Spin tip="正在加载..." spinning={pageLoading} delay={100}>
<WrapperContainer>
{visibleCacheEdit && (
{visibleCacheEdit && productType !== 5 && (
<div className={styles.draftBox}>
有未保存内容。是否
<span className={styles.conEdit} onClick={onContinueEdit}>
......
......@@ -111,11 +111,22 @@ const filterItems = (type, props) => {
export const filterSendData = (type, params) => {
// takeawayItem 外卖商品
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) {
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;
}
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