diff --git a/src/components/popupSelectColor/index.tsx b/src/components/popupSelectColor/index.tsx index b389a37..63d9ee3 100644 --- a/src/components/popupSelectColor/index.tsx +++ b/src/components/popupSelectColor/index.tsx @@ -33,7 +33,7 @@ export interface ColorItem { export interface Param { show: boolean product_id: number - onClose?: () => void + onClose?: (val: number) => void onSelected?: (val: ColorItem[]) => void defaultValueIds?: number[] } @@ -60,7 +60,7 @@ export default memo((props: Param) => { const initData = (data) => { if (defaultValueIds.length > 0) { - return data.map((item, index) => { + return data?.map((item, index) => { if (defaultValueIds.includes(item.id)) { return data[index] = { ...item, status: true } } @@ -97,8 +97,16 @@ export default memo((props: Param) => { }) onSelected?.(data) } + + const onCloseEven = () => { + let num = 0 + colorList?.map((item) => { + if (item.status) { num++ } + }) + onClose?.(num) + } return - + 请选择色号剪样( {colorList.length} ) 剪样大小为A4,大约22cm*30cm @@ -113,7 +121,7 @@ export default memo((props: Param) => { - 取消 + 取消 领取剪样({selectCount}) diff --git a/src/pages/colorCardList/components/productItem/index.tsx b/src/pages/colorCardList/components/productItem/index.tsx index 0dcc666..41aed53 100644 --- a/src/pages/colorCardList/components/productItem/index.tsx +++ b/src/pages/colorCardList/components/productItem/index.tsx @@ -45,7 +45,6 @@ export default memo((props: ParamType) => { return false } }, [selectList]) - return }) diff --git a/src/pages/cutSampleList/index.tsx b/src/pages/cutSampleList/index.tsx index a69802c..76ad80a 100644 --- a/src/pages/cutSampleList/index.tsx +++ b/src/pages/cutSampleList/index.tsx @@ -103,7 +103,7 @@ export default () => { const onSelectData = (val: ParamItem) => { setShowColorList(true) setSelectItem(val) - + setSelectColorIds([]) // 获取该面料下的颜色数据 const index = selectProsuctIds.indexOf(val.id) if (index !== -1) { @@ -114,7 +114,13 @@ export default () => { setSelectColorIds(colorIds) } } - const onClose = () => { + const onClose = (val: number) => { + if (!val) { + const res = selectProcutColors?.filter(item => item.id !== selectItem?.id) + const res2 = selectProsuctIds?.filter(item => item !== selectItem?.id) + setSelectProcutColors(() => res) + setSelectProsuctIds(() => res2) + } setShowColorList(false) }