import barcodeActionType from '../actiontype/barcodeCommon'


//扫码商品的信息
const saveProductInfo = (data,content)=>{
    let newState = JSON.parse(JSON.stringify(data));
    return Object.assign({},newState,{product:content})
}
const saveStatus = (data,content)=>{
    let newState = JSON.parse(JSON.stringify(data));
    return Object.assign({},newState,{status:content})
}
export default function(state={}, action) {
    switch (action.type) {
        case barcodeActionType.GETPRODUCTINFO:
            return saveProductInfo(state,action.data);
        case barcodeActionType.GETSTATUS :
            return saveStatus(state,action.data)
        default:
            return state;
    }
}