actions.js 1.66 KB
import * as Types from './types';

export default {
  async fetchProduct({commit}, {productId, page = 1, refresh = false, storageId}) {
    commit(Types.FETCH_ORDER_PRODUCT_REQUEST);

    const result = await this.$api.get('/api/ufo/seller/entryGoodsSizeList', {
      productId,
      page
    });

    if (result && result.code === 200) {
      commit(Types.FETCH_ORDER_PRODUCT_SUCCESS, {
        order: result.data,
        refresh,
        storageId
      });
    } else {
      commit(Types.FETCH_ORDER_PRODUCT_FAILD);
    }
  },
  async postNoSale({commit}, payload) {
    commit(Types.POST_NOSALE_REQUEST);
    const result = await this.$api.get('/api/ufo/sellerOrder/batchDownShelf', payload);

    if (result && result.code === 200) {
      commit(Types.POST_NOSALE_SUCCESS, {
        order: result.data
      });
    } else {
      commit(Types.POST_NOSALE_FAILD);
    }
    return result || {};
  },
  async postCalcPrice({commit}, payload) {
    commit(Types.POST_CALCPRICE_REQUEST);
    const result = await this.$api.get('/api/ufo/sellerOrder/computeAdjustPrice', payload);

    if (result && result.code === 200) {
      commit(Types.POST_CALCPRICE_SUCCESS, {
        order: result.data
      });
    } else {
      commit(Types.POST_CALCPRICE_FAILD);
    }
    return result || {};
  },
  async postChangePrice({commit}, payload) {
    commit(Types.POST_CHANGEPRICE_REQUEST);
    const result = await this.$api.get('/api/ufo/sellerOrder/batchAdjustPrice', payload);

    if (result && result.code === 200) {
      commit(Types.POST_CHANGEPRICE_SUCCESS, {
        order: result.data
      });
    } else {
      commit(Types.POST_CHANGEPRICE_FAILD);
    }
    return result || {};
  }
};