解决多个请求异步问题:
const arr = delTmp.map(item => dispatch({
type: 'common/test',
payload: {
headerMessage: {
enterpriseGuid,
openId,
wxtoken,
'Content-Type': 'application/json'
},
otherdata: {
changeType: false,
itemInfoDTO: item,
modifyNum: 0
},
otherPlatform: true,
doNotForward: true
}
}))
Promise.all(arr).then(data => {
// 弹窗提示菜谱可能更新
Taro.showModal({
title: '',
content: '购物车部分商品不可下单将进行删除,请重新选购',
showCancel: false,
confirmText: '好的',
success: res => {
if (res.confirm) {
getShopCart()
}
}
}).then(res => {
})
})