order-logistics.js 995 Bytes
/* eslint-disable operator-linebreak */
export default function() {
  return {
    namespaced: true,
    state: {
      logisticInfo: {},
    },
    mutations: {
      initData: (state, data) => {
        state.logisticInfo = data;
      },
    },
    actions: {
      /**
       * 获取物流信息
       * @param {*} param0
       * @param {*}
       * @returns ts ILogisticsInfo
       */
      async fetchLogisticInfo({ commit }, { owner, code } = {}) {
        const res = await this.$api.get('/api/order/express', {
          tabType: owner,
          orderCode: +code,
        });

        if (res.code === 200) {
          commit('initData', res.data);
        }
      },
      async flawReject({commit}, {orderCode} = {}) {
        return  this.$api.get('/api/order/flawreject', {
          orderCode
        })
      },

      async flawAccept({commit}, {orderCode} = {}) {
        return this.$api.get('/api/order/flawaccept', {
          orderCode
        })
      }
    },
  };
}