diff --git a/src/pages/shopping/components/shoppingCartItem/index.tsx b/src/pages/shopping/components/shoppingCartItem/index.tsx index 9af7f46..c448f41 100644 --- a/src/pages/shopping/components/shoppingCartItem/index.tsx +++ b/src/pages/shopping/components/shoppingCartItem/index.tsx @@ -157,6 +157,11 @@ let ShoppingCartItem: FC = props => { }) console.log('res===>', res) if (res.success) { + // 转成 对象形式 + // 4562: { + // id: 4562, + // ... + // } const newGoodsKind = Object.fromEntries( res.data[0]?.[BackEndSaleModeListFieldMap[selected]].map(item => [ item?.id, @@ -176,17 +181,18 @@ let ShoppingCartItem: FC = props => { purchaserId: id, goodsKind: newGoodsKind, multipleSelection: Object.fromEntries( - Object.keys(multipleSelection!).map(id => [ - id, - { + Object.keys(multipleSelection!) + .map(id => [ id, - estimate_amount: newGoodsKind[id].estimate_amount, - product_code: newGoodsKind[id].product_code, - product_color_code: newGoodsKind[id].product_color_code, - sale_mode: newGoodsKind[id].sale_mode, - count: selected === EnumSaleMode.Bulk ? newGoodsKind[id].roll : Number(formatMeterDiv(newGoodsKind[id].length)), - }, - ]), + { + id, + estimate_amount: newGoodsKind[id].estimate_amount, + product_code: newGoodsKind[id].product_code, + product_color_code: newGoodsKind[id].product_color_code, + sale_mode: newGoodsKind[id].sale_mode, + count: selected === EnumSaleMode.Bulk ? newGoodsKind[id].roll : Number(formatMeterDiv(newGoodsKind[id].length)), + }, + ]), ), }, }) diff --git a/src/pages/shopping/index.tsx b/src/pages/shopping/index.tsx index 7306914..c4b94bd 100644 --- a/src/pages/shopping/index.tsx +++ b/src/pages/shopping/index.tsx @@ -151,7 +151,7 @@ const ShoppingCartContainer: FC = () => { // 批量某个客户的删除商品 const handleDelete = async () => { - const multipleSelection = colorStore?.[currentCheckedPurchaserId]?.['multipleSelection'] + const multipleSelection = colorStore?.[currentCheckedPurchaserId].multipleSelection let checked: Goods[] = Object.values(multipleSelection!) if (checked.length === 0) { return Taro.showToast({ title: '请选择商品', icon: 'error' }) @@ -166,6 +166,15 @@ const ShoppingCartContainer: FC = () => { }) if (res.success) { alert.success('删除成功') + // 清空多选 + dispatch({ + type: ShoppingDispatchType.UPDATE_CHANGED_CHECKBOX, + data: { + purchaserId: currentCheckedPurchaserId, + goodsKind: colorStore?.[currentCheckedPurchaserId].goodsKind, + multipleSelection: {}, + }, + }) fetchData(searchOptions) // Observer.notify(currentCheckedPurchaserId) } else {