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

feat: 更新时间问题

parent 5d4359f5
......@@ -215,8 +215,12 @@
.ant-form-item-control-input-content {
display: flex;
}
.ant-form-text {
display: flex;
justify-content: center;
align-items: center;
}
}
}
.itemInline {
:global {
......
......@@ -195,94 +195,94 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
// 多规格
if (+repertoryType === 2) {
// if (name || editData.name) {
if (weight.length) {
let tempSku = [];
multiSpecList[0].specs = weight; // 处理specList
if (specs.length) {
specs.forEach((specsItem, specsIndex) => {
if (specsItem && !specsItem.generateSku) {
specsItem.generateSku = 1;
}
if (specsItem.specGroupName) {
specsItem?.specs?.forEach(itm => {
itm.specGroupName = specsItem.specGroupName;
});
}
multiSpecList.push(specsItem);
});
}
const sepcx = specs.map(item => item.specs);
sepcx.map(item => {
item.unit = '';
return item
});
// 生成 specs 规格sku
tempSku = [[...weight], ...sepcx].reduce(
(x, y) => {
const arr = [];
x.forEach(x => y.forEach(y => arr.push(x.concat([y]))));
return arr;
},
[[]],
);
console.log('multiSpu1111', multiSpu);
multiSpu = tempSku.map((item, index) => {
const obj = {};
obj.salePrice = salePrice;
obj.productStock = productStock;
obj.list = list;
obj.id = multiSpu?.[index]?.id || ''
obj.serviceItem = {
...temp.serviceItem,
productStock: multiSpu?.[index]?.serviceItem?.productStock || productStock,
maxStock: multiSpu?.[index]?.serviceItem?.maxStock || maxStock,
autoStock: multiSpu?.[index]?.serviceItem?.autoStock || autoStock,
};
obj.unique = '';
multiSpecList.forEach((itm, idx) => {
if (item[idx] && !item[idx]?.specGroupName) {
if (multiSpecList[idx].specGroupName) {
item[idx].specGroupName = multiSpecList[idx].specGroupName;
}
}
});
obj.specs = [...item];
return obj;
if (weight.length) {
let tempSku = [];
multiSpecList[0].specs = weight; // 处理specList
if (specs.length) {
specs.forEach((specsItem, specsIndex) => {
if (specsItem && !specsItem.generateSku) {
specsItem.generateSku = 1;
}
if (specsItem.specGroupName) {
specsItem?.specs?.forEach(itm => {
itm.specGroupName = specsItem.specGroupName;
});
}
multiSpecList.push(specsItem);
});
}
multiSpu.map(item => {
item.salePrice = 0;
item.unique = item?.specs
.map(itm => {
if (itm?.unit) {
itm.unit =
itm?.unit &&
(Array.isArray(itm?.unit) ? itm?.unit.slice(itm?.unit.length - 1)[0] : itm?.unit);
}
if (itm?.unit && peopleUnits.includes(itm.unit)) {
delete itm.quantity;
}
if (itm?.specName) {
return itm.specName;
const sepcx = specs.map(item => item.specs);
sepcx.map(item => {
item.unit = '';
return item;
});
// 生成 specs 规格sku
tempSku = [[...weight], ...sepcx].reduce(
(x, y) => {
const arr = [];
x.forEach(x => y.forEach(y => arr.push(x.concat([y]))));
return arr;
},
[[]],
);
console.log('multiSpu1111', multiSpu);
multiSpu = tempSku.map((item, index) => {
const obj = {};
obj.salePrice = salePrice;
obj.productStock = productStock;
obj.list = list;
obj.id = multiSpu?.[index]?.id || '';
obj.serviceItem = {
...temp.serviceItem,
productStock: multiSpu?.[index]?.serviceItem?.productStock || productStock,
maxStock: multiSpu?.[index]?.serviceItem?.maxStock || maxStock,
autoStock: multiSpu?.[index]?.serviceItem?.autoStock || autoStock,
};
obj.unique = '';
multiSpecList.forEach((itm, idx) => {
if (item[idx] && !item[idx]?.specGroupName) {
if (multiSpecList[idx].specGroupName) {
item[idx].specGroupName = multiSpecList[idx].specGroupName;
}
})
.toString();
}
});
obj.specs = [...item];
return obj;
});
}
console.log('multiSpu', multiSpu);
if (tempMultiSpu.length) {
multiSpu.forEach((item, index) => {
tempMultiSpu.forEach((itm, idx) => {
if (item.unique === itm.unique) {
item.serviceItem = objectComparison(item.serviceItem, itm);
}
});
multiSpu.map(item => {
item.salePrice = 0;
item.unique = item?.specs
.map(itm => {
if (itm?.unit) {
itm.unit =
itm?.unit &&
(Array.isArray(itm?.unit) ? itm?.unit.slice(itm?.unit.length - 1)[0] : itm?.unit);
}
if (itm?.unit && peopleUnits.includes(itm.unit)) {
delete itm.quantity;
}
if (itm?.specName) {
return itm.specName;
}
})
.toString();
});
console.log('multiSpu', multiSpu);
if (tempMultiSpu.length) {
multiSpu.forEach((item, index) => {
tempMultiSpu.forEach((itm, idx) => {
if (item.unique === itm.unique) {
item.serviceItem = objectComparison(item.serviceItem, itm);
}
});
}
});
}
console.log(multiSpu, 'multiSpumultiSpu');
setMultiSpu(JSON.parse(JSON.stringify(multiSpu)));
console.log(multiSpu, 'multiSpumultiSpu');
setMultiSpu(JSON.parse(JSON.stringify(multiSpu)));
// }
}
// +repertoryType === 1 单规格 2多规格
......@@ -730,15 +730,18 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
) : null}
</Form.Item>
))}
<Form.Item>
<Button
type="dashed"
onClick={() => add()}
style={{ width: '60%' }}
icon={<PlusOutlined />}
>
新增售卖时段
</Button>
{fields.length < 5 ? (
<Button
type="dashed"
onClick={() => add()}
style={{ width: '60%' }}
icon={<PlusOutlined />}
>
新增售卖时段
</Button>
) : null}
</Form.Item>
</>
)}
......@@ -787,12 +790,21 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
{repertoryType === '1' && (
<>
<Form.Item label="份量" className={styles.required}>
{form.getFieldValue(['unit']) &&
Array.isArray(form.getFieldValue(['unit'])) &&
weightUnits.includes(
form
.getFieldValue(['unit'])
.slice(1)
.toString(),
) && <span className="ant-form-text"> 约</span>}
<Form.Item
// noStyle
shouldUpdate={(prevValues, curValues) => false}
>
{form => {
let unit = form.getFieldValue('unit') || '';
console.log('unit', unit);
unit =
(unit && (Array.isArray(unit) && unit?.length && unit?.slice(1).toString())) ||
unit;
......@@ -1222,7 +1234,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
}}
shape="round"
>
统一设置库存
统一设置库存
</Button>
<div className={styles.rowWarp}>
{multiSpu.length > 0 &&
......
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