🐞 fix(购物页面): 修复购物页面再次删除商品时请求错误的问题
This commit is contained in:
parent
159e0b9d56
commit
e0de46c469
@ -157,6 +157,11 @@ let ShoppingCartItem: FC<PropsType> = 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<PropsType> = 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)),
|
||||
},
|
||||
]),
|
||||
),
|
||||
},
|
||||
})
|
||||
|
@ -151,7 +151,7 @@ const ShoppingCartContainer: FC<InternalContainer> = () => {
|
||||
|
||||
// 批量某个客户的删除商品
|
||||
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<InternalContainer> = () => {
|
||||
})
|
||||
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user