order-logistics.js 851 Bytes
/* eslint-disable operator-linebreak */
export default function() {
  return {
    namespaced: true,
    state: {
      logisticInfo: {},
    },
    mutations: {
      initData: (state, data) => {
        state.logisticInfo = data;
      },
    },
    getters: {
      stageImgUrl: ({ logisticInfo: { stage } }) => {
        return stage
          ? require(`../../statics/image/order/logistics_progress_${stage}@3x.png`)
          : '';
      },
    },
    actions: {
      // 获取物流信息
      async fetchLogisticInfo({ commit }, { owner, code } = {}) {
        const res = await this.$api.get('/api/order/express', {
          tabType: owner,
          orderCode: +code,

          // Todo 删除
          uid: 600043484,
        });

        if (res.code === 200) {
          commit('initData', res.data);
        }
      },
    },
  };
}