mutations.js 1.46 KB
import * as Types from './types';

export default {
  [Types.FETCH_ORDER_PRODUCT_REQUEST](state) {
    state.orderInfo = {};
    state.fetchingPro = true;
  },
  [Types.FETCH_ORDER_PRODUCT_FAILD](state) {
    state.fetchingPro = false;
  },
  [Types.FETCH_ORDER_PRODUCT_SUCCESS](state, {order, refresh}) {
    state.fetchingPro = false;

    if (order.productInfo && state.productInfo.productId !== order.productInfo.productId || refresh) {
      state.productInfo = order.productInfo || state.productInfo;
    }
    if (refresh) {
      state.skcs = order.data;
    } else if (order.data) {
      state.skcs = state.skcs.concat(order.data);
    }
  },
  [Types.MERGE_CHANGEPRICE_DATA](state, {skc, mergeData}) {
    Object.assign(skc, mergeData);
  },
  [Types.POST_NOSALE_REQUEST](state) {
    state.fetchingNoSale = true;
  },
  [Types.POST_NOSALE_FAILD](state) {
    state.fetchingNoSale = false;
  },
  [Types.POST_NOSALE_SUCCESS](state) {
    state.fetchingNoSale = false;
  },
  [Types.POST_CHANGEPRICE_REQUEST](state) {
    state.fetchingChangePrice = true;
  },
  [Types.POST_CHANGEPRICE_FAILD](state) {
    state.fetchingChangePrice = false;
  },
  [Types.POST_CHANGEPRICE_SUCCESS](state) {
    state.fetchingChangePrice = false;
  },
  [Types.POST_CALCPRICE_REQUEST](state) {
    state.fetchingCalcPrice = true;
  },
  [Types.POST_CALCPRICE_FAILD](state) {
    state.fetchingCalcPrice = false;
  },
  [Types.POST_CALCPRICE_SUCCESS](state) {
    state.fetchingCalcPrice = false;
  },
};