From 1ad57791b6c66b9257fe65fe31add1bcf0d99c51 Mon Sep 17 00:00:00 2001 From: xuan Date: Wed, 1 Mar 2023 11:08:21 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(ID1001408):=20=E3=80=90?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=89=AA=E6=A0=B7=E8=AE=A2=E5=8D=95=E9=A1=B5?= =?UTF-8?q?=E3=80=91-=E5=8A=9F=E8=83=BD{=E5=88=A0=E9=99=A4=E5=89=AA?= =?UTF-8?q?=E6=A0=B7}=EF=BC=9A=E9=A1=B5=E9=9D=A2=E6=9C=89=E5=A4=9A?= =?UTF-8?q?=E4=B8=AA=E5=89=AA=E6=A0=B7=E4=BD=86=E6=8F=90=E7=A4=BA=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sampleCutting/addSampleCutting/index.tsx | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/pages/sampleCutting/addSampleCutting/index.tsx b/src/pages/sampleCutting/addSampleCutting/index.tsx index 3fc0e7d..7e818ec 100644 --- a/src/pages/sampleCutting/addSampleCutting/index.tsx +++ b/src/pages/sampleCutting/addSampleCutting/index.tsx @@ -144,12 +144,8 @@ const AddColorCard = () => { setOrder((prev) => { let newOlder: SampleCuttingCache[] = [] const targetProductIndex = prev.findIndex(item => item.product_id === productId) - + console.log('multipleSelection', prev) if (prev[targetProductIndex].multipleSelection.length === 1) { - if (prev.length === 1) { - alert.none('最后一个剪样不能删除') - return prev - } prev.splice(targetProductIndex, 1) newOlder = [...prev] } @@ -167,14 +163,10 @@ const AddColorCard = () => { } const handleCountChange = (value: number, productId: number, colorId: number) => { - console.log('value', value) - if (order.length === 1 && value === 0) { - Taro.showToast({ - title: '最后一个剪样不能删除', - icon: 'none', - duration: 2000, - }) - return + console.log('value', value, order) + const targetProductIndex = order.findIndex(item => item.product_id === productId) + if (order.length === 1 && order[targetProductIndex].multipleSelection.length === 1 && value === 0) { + return alert.none('最后一个剪样不能删除') } if (value === 0) { Taro.showModal({