From 02f807824d9bca14ab98dbef5797664204ea2e41 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Wed, 1 Mar 2023 17:30:30 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(ID1001342=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E6=8E=89=E5=B7=B2=E7=BB=8F=E6=B7=BB=E5=8A=A0=E7=9A=84=E5=89=AA?= =?UTF-8?q?=E6=A0=B7=E5=90=8E=E5=88=B7=E6=96=B0=E9=A1=B5=E9=9D=A2=E4=BE=9D?= =?UTF-8?q?=E7=84=B6=E6=98=BE=E7=A4=BA=E7=BB=A7=E7=BB=AD=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/popupSelectColor/index.tsx | 16 ++++++++++++---- .../components/productItem/index.tsx | 1 - src/pages/cutSampleList/index.tsx | 10 ++++++++-- 3 files changed, 20 insertions(+), 7 deletions(-) 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) }