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

feat:更新库存

parent 955cdc3a
...@@ -143,6 +143,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -143,6 +143,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
salePrice: salePrice || 0, salePrice: salePrice || 0,
productStock, productStock,
list: 1, list: 1,
id: skuList?.length === 1 ? skuList[0].id:'', // 单规格默认取第一个
serviceItem: { serviceItem: {
description, // 商品描述 description, // 商品描述
maxStock, // 最大库存 maxStock, // 最大库存
...@@ -475,13 +476,12 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -475,13 +476,12 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
editData.label = +label; editData.label = +label;
if (editData?.skuList.length) { if (editData?.skuList.length) {
editData.minPurchaseNum = editData?.skuList[0]?.serviceItem.minPurchaseNum; editData.minPurchaseNum = editData?.skuList[0]?.serviceItem.minPurchaseNum;
}
// 单规格 // 单规格
if (editData?.skuList.length === 1) { if (editData?.skuList.length === 1) {
let { let {
productStock, productStock,
specs, specs,
serviceItem: { maxStock, saleTimeType, saleDates, saleTimes }, serviceItem: { maxStock, saleTimeType, saleDates, saleTimes,id },
} = editData?.skuList[0]; } = editData?.skuList[0];
let { quantity, unit, salePrice } = specs[0]; let { quantity, unit, salePrice } = specs[0];
editData.productStock = productStock; editData.productStock = productStock;
...@@ -491,8 +491,9 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -491,8 +491,9 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
editData.maxStock = maxStock; editData.maxStock = maxStock;
editData.categoryId = [firstCategoryId, secondCategoryId, thirdCategoryId]; editData.categoryId = [firstCategoryId, secondCategoryId, thirdCategoryId];
editData.saleTimeType = saleTimeType; editData.saleTimeType = saleTimeType;
editData.saleDates = [1, 2, 4]; editData.saleDates = saleDates;
editData.saleTimes = saleTimes.length editData.saleTimes = saleTimes.length
editData.skuId = id
? saleTimes.map(item => { ? saleTimes.map(item => {
item = [moment(item?.startTime, format), moment(item?.endTime, format)]; item = [moment(item?.startTime, format), moment(item?.endTime, format)];
return item; return item;
...@@ -504,7 +505,11 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -504,7 +505,11 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
onCardSuccessImageList(editData?.detailImageList); onCardSuccessImageList(editData?.detailImageList);
getFormValues(); getFormValues();
// setInitValue({ ...editData }); // setInitValue({ ...editData });
}else {
} }
}
}, [customer.isEdit, editData]); }, [customer.isEdit, editData]);
useEffect(() => { useEffect(() => {
setIntactData(intactData); setIntactData(intactData);
......
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