🐞 fix(购物页面): 修复购物页面再次删除商品时请求错误的问题
This commit is contained in:
parent
159e0b9d56
commit
e0de46c469
@ -157,6 +157,11 @@ let ShoppingCartItem: FC<PropsType> = props => {
|
|||||||
})
|
})
|
||||||
console.log('res===>', res)
|
console.log('res===>', res)
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
|
// 转成 对象形式
|
||||||
|
// 4562: {
|
||||||
|
// id: 4562,
|
||||||
|
// ...
|
||||||
|
// }
|
||||||
const newGoodsKind = Object.fromEntries(
|
const newGoodsKind = Object.fromEntries(
|
||||||
res.data[0]?.[BackEndSaleModeListFieldMap[selected]].map(item => [
|
res.data[0]?.[BackEndSaleModeListFieldMap[selected]].map(item => [
|
||||||
item?.id,
|
item?.id,
|
||||||
@ -176,17 +181,18 @@ let ShoppingCartItem: FC<PropsType> = props => {
|
|||||||
purchaserId: id,
|
purchaserId: id,
|
||||||
goodsKind: newGoodsKind,
|
goodsKind: newGoodsKind,
|
||||||
multipleSelection: Object.fromEntries(
|
multipleSelection: Object.fromEntries(
|
||||||
Object.keys(multipleSelection!).map(id => [
|
Object.keys(multipleSelection!)
|
||||||
id,
|
.map(id => [
|
||||||
{
|
|
||||||
id,
|
id,
|
||||||
estimate_amount: newGoodsKind[id].estimate_amount,
|
{
|
||||||
product_code: newGoodsKind[id].product_code,
|
id,
|
||||||
product_color_code: newGoodsKind[id].product_color_code,
|
estimate_amount: newGoodsKind[id].estimate_amount,
|
||||||
sale_mode: newGoodsKind[id].sale_mode,
|
product_code: newGoodsKind[id].product_code,
|
||||||
count: selected === EnumSaleMode.Bulk ? newGoodsKind[id].roll : Number(formatMeterDiv(newGoodsKind[id].length)),
|
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 handleDelete = async () => {
|
||||||
const multipleSelection = colorStore?.[currentCheckedPurchaserId]?.['multipleSelection']
|
const multipleSelection = colorStore?.[currentCheckedPurchaserId].multipleSelection
|
||||||
let checked: Goods[] = Object.values(multipleSelection!)
|
let checked: Goods[] = Object.values(multipleSelection!)
|
||||||
if (checked.length === 0) {
|
if (checked.length === 0) {
|
||||||
return Taro.showToast({ title: '请选择商品', icon: 'error' })
|
return Taro.showToast({ title: '请选择商品', icon: 'error' })
|
||||||
@ -166,6 +166,15 @@ const ShoppingCartContainer: FC<InternalContainer> = () => {
|
|||||||
})
|
})
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
alert.success('删除成功')
|
alert.success('删除成功')
|
||||||
|
// 清空多选
|
||||||
|
dispatch({
|
||||||
|
type: ShoppingDispatchType.UPDATE_CHANGED_CHECKBOX,
|
||||||
|
data: {
|
||||||
|
purchaserId: currentCheckedPurchaserId,
|
||||||
|
goodsKind: colorStore?.[currentCheckedPurchaserId].goodsKind,
|
||||||
|
multipleSelection: {},
|
||||||
|
},
|
||||||
|
})
|
||||||
fetchData(searchOptions)
|
fetchData(searchOptions)
|
||||||
// Observer.notify(currentCheckedPurchaserId)
|
// Observer.notify(currentCheckedPurchaserId)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user