✨ feat(ID1001140购物车的面料减少到0的时候提示删除该商品):
This commit is contained in:
@@ -57,13 +57,14 @@ export interface StateType {
|
||||
sale_mode?: saleModeType
|
||||
checkList?: { [key in number]: boolean }
|
||||
recommendId?: number
|
||||
|
||||
delCommendId?: number
|
||||
}
|
||||
|
||||
export interface ActionsMap {
|
||||
setInitData: StateType
|
||||
updateProduct: StateType
|
||||
setRecommendId: StateType
|
||||
setDelCommendId: StateType
|
||||
}
|
||||
|
||||
export type Actions = {
|
||||
@@ -95,7 +96,7 @@ export default (props: PropsType) => {
|
||||
price_number: 0,
|
||||
},
|
||||
recommendId: 0,
|
||||
|
||||
delCommendId: 0,
|
||||
}
|
||||
function reducer(state: StateType, action: Actions) {
|
||||
switch (action.type) {
|
||||
@@ -105,6 +106,8 @@ export default (props: PropsType) => {
|
||||
return onUpdateData(state, action)
|
||||
case 'setRecommendId':
|
||||
return { ...state, recommendId: action.data.recommendId }
|
||||
case 'setDelCommendId':
|
||||
return { ...state, delCommendId: action.data.delCommendId }
|
||||
default:
|
||||
return state
|
||||
}
|
||||
@@ -127,7 +130,7 @@ const onInitData = (state: StateType, action: Actions) => {
|
||||
citem.checked = false
|
||||
})
|
||||
})
|
||||
return { ...state, list: data.list, sale_mode: data.sale_mode, recommendId: data.recommendId, statistics }
|
||||
return { ...state, list: data.list, sale_mode: data.sale_mode, recommendId: 0, statistics, delCommendId: 0 }
|
||||
}
|
||||
|
||||
// 更新数据
|
||||
|
||||
Reference in New Issue
Block a user