🐞 fix(ID1001408): 【提交剪样订单页】-功能{删除剪样}:页面有多个剪样但提示不能删除

This commit is contained in:
xuan 2023-03-01 11:08:21 +08:00
parent f3e2f7e796
commit 1ad57791b6

View File

@ -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({