detail.vue 3.18 KB
<template>
  <div class="container">
    <div class="global-title">任务详情</div>
    <div class="main">
      <GLTable :pageSizes="pageSizes" ref="tableRef" :pageConf="pageConf" :searchForm="searchForm" :tableParams="tableParams" :beforeSearchFn="beforeSearchFn" :getListApi="getListApi">
        <div slot="shelfStatusSlot" slot-scope="scope">
          <span class="status" :style="{ 'background-color': detailShelfStatusEnum[scope.scope.shelfStatus].color }"></span>
          {{ detailShelfStatusEnum[scope.scope.shelfStatus] ? detailShelfStatusEnum[scope.scope.shelfStatus].label : '--' }}
        </div>
        <div slot="taskStatusSlot" slot-scope="scope">
          <span class="status" :style="{ 'background-color': detailTaskStatusEnum[scope.scope.taskStatus].color }"></span>
          {{ detailTaskStatusEnum[scope.scope.taskStatus] ? detailTaskStatusEnum[scope.scope.taskStatus].label : '--' }}
        </div>
      </GLTable>
    </div>
  </div>
</template>
<script>
import util from '@/util/util'
import { detailShelfStatusEnum, detailTaskStatusEnum } from './constant'
export default {
  name: 'index',
  data() {
    return {
      size: 'small',
      detailTaskStatusEnum,
      detailShelfStatusEnum,
      getListApi: this.$apis.task.getDetailApi,
      pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
      pageSizes: [10, 20, 30, 40, 50],
      searchForm: {},
      tableParams: {
        listName: 'list',
        tableOption: null,
        tableColumns: [
          {
            label: '门店名称',
            prop: 'merchantName',
            width: 200,
            line: 1
          },
          {
            label: '门店ID',
            prop: 'merchantId'
          },
          {
            label: '产品编号',
            prop: 'skuCode',
            width: 200
          },
          {
            label: '产品名称',
            prop: 'skuName',
            width: 200,
            line: 1
          },
          {
            label: '数量',
            prop: 'orderCount'
          },
          {
            label: '单价(元)',
            prop: 'unitPrice',
            formatter: cell => {
              return cell.unitPrice ? (cell.unitPrice / 100).toFixed(0) : 0
            }
          },
          {
            label: '商品状态',
            addHtml: 'shelfStatusSlot'
          },
          {
            label: '商品状态描述',
            prop: 'failReason',
            width: 200,
            line: 1
          },
          {
            label: '任务状态',
            addHtml: 'taskStatusSlot'
          },
          {
            label: '任务状态描述',
            prop: 'taskFailReason',
            width: 200,
            line: 1
          }
        ]
      }
    }
  },
  methods: {
    beforeSearchFn() {
      return new Promise(resolve => {
        this.searchForm = { taskId: this.$route.params.id }
        resolve()
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.container {
  background-color: #fff;
  .main {
    padding: 20px;
  }
}
.status {
  width: 6px;
  height: 6px;
  display: inline-block;
  border-radius: 50%;
  background-color: antiquewhite;
  margin-right: 8px;
  vertical-align: middle;
}
</style>