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

export default {
  [Types.FETCH_ORDER_PRODUCT_REQUEST](state) {
    state.productInfo = {};
    state.fetchingPro = true;
  },
  [Types.FETCH_ORDER_PRODUCT_FAILED](state) {
    state.fetchingPro = false;
  },

  /**
   * 获取商品信息成功
   * @param state
   * @param order
   * @param refresh
   */
  [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.FETCH_NOENTRY_ORDER_PRODUCT_REQUEST](state) {
    state.noEntryOrderInfo = {};
    state.fetchingOrder = true;
  },
  [Types.FETCH_NOENTRY_ORDER_PRODUCT_FAILED](state) {
    state.fetchingOrder = false;
  },

  /**
   * 获取未入驻商家调价时的商品详情
   * @param state
   * @param order
   */
  [Types.FETCH_NOENTRY_ORDER_PRODUCT_SUCCESS](state, {order}) {
    state.fetchingOrder = false;
    if (order && order.data) {
      state.noEntryOrderInfo = order.data || {};
    }
  },

  [Types.MERGE_CHANGEPRICE_DATA](state, {skc, mergeData}) {
    Object.assign(skc, mergeData);
  },

  [Types.POST_NOSALE_REQUEST](state) {
    state.fetchingNoSale = true;
  },

  [Types.POST_NOSALE_FAILED](state) {
    state.fetchingNoSale = false;
  },

  [Types.POST_NOSALE_SUCCESS](state) {
    state.fetchingNoSale = false;
  },

  [Types.POST_CHANGE_PRICE_REQUEST](state) {
    state.fetchingChangePrice = true;
  },

  [Types.POST_CHANGEPRICE_FAILED](state) {
    state.fetchingChangePrice = false;
  },

  [Types.POST_CHANGEPRICE_SUCCESS](state) {
    state.fetchingChangePrice = false;
  },

  [Types.POST_CALCPRICE_REQUEST](state) {
    state.fetchingCalcPrice = true;
  },

  [Types.POST_CALCPRICE_FAILED](state) {
    state.fetchingCalcPrice = false;
  },

  [Types.POST_CALCPRICE_SUCCESS](state) {
    state.fetchingCalcPrice = true;
  },

  [Types.POST_NOENTRY_CALCPRICE_REQUEST](state) {
    state.fetchingCalcPrice = true;
  },

  [Types.POST_NOENTRY_CALCPRICE_FAILED](state) {
    state.fetchingCalcPrice = false;
  },

  [Types.POST_NOENTRY_CALCPRICE_SUCCESS](state) {
    state.fetchingCalcPrice = false;
  },

  [Types.POST_NOENTRY_CHANGE_PRICE_REQUEST](state) {
    state.fetchingChangePrice = true;
  },

  [Types.POST_NOENTRY_CHANGE_PRICE_FAILED](state) {
    state.fetchingChangePrice = false;
  },

  [Types.POST_NOENTRY_CHANGE_PRICE_SUCCESS](state) {
    state.fetchingChangePrice = false;
  }

};