<template>
  <div class="page-body">
    <div class="page-search row items-center">
      <div class="col row wrap q-col-gutter-md">
        <div class="col-3">
          <!-- <q-input @input="resetSearch" clearable filled v-model="msg.TaskName" label="任务名称" /> -->
        </div>
      </div>
    </div>
    <div class="page-content">
      <q-table :pagination="msg" :loading="loading" no-data-label="暂无相关数据" flat class="sticky-column-table"
        separator="none" :data="dataList" :columns="columns" row-key="name">
        <template v-slot:top>
          <div class="col-2 q-table__title">核销奖品</div>
          <q-space />
          <div class="page-option">
          </div>
        </template>
        <template v-slot:bottom>
          <q-pagination class="full-width justify-end" v-model="msg.pageIndex" color="primary" :max="pageCount"
            :input="true" @input="changePage" />
        </template>
      </q-table>
    </div>
  </div>
</template>
<script>
  import {
    queryCustomerFinishtaskDetailsPage
  } from '../../api/sale/peemanagement';

  export default {
    meta: {
      title: "任务完成情况"
    },
    components: {

    },
    data() {
      return {
        columns: [{
            name: 'FinishTypeStr',
            label: '兑换类型',
            align: 'left',
            field: 'FinishTypeStr'
          },
          {
            name: 'OrderId',
            label: '兑换订单',
            align: 'left',
            field: 'OrderId'
          },
          {
            name: 'FinishValue',
            label: '完成值',
            field: 'FinishValue',
            align: 'left',
          },
           
        ],
        dataList: [],
        loading: true,
        msg: {
          pageIndex: 1,
          pageSize: 12,
          rowsPerPage: 12,
          TaskId: "", //任务编号
          DetailsId: "", //任务详情编号
          CustomerId: "", //客户编号
          FinishId: "", //完成任务编号
        },
        pageCount: 0,
      }
    },
    created() {
      if (this.$route.query.TaskId) {
        this.msg.TaskId = this.$route.query.TaskId;
      }
      if (this.$route.query.DetailsId) {
        this.msg.DetailsId = this.$route.query.DetailsId;
      }
      if (this.$route.query.CustomerId) {
        this.msg.CustomerId = this.$route.query.CustomerId;
      }
      if (this.$route.query.FinishId) {
        this.msg.FinishId = this.$route.query.FinishId;
      }
    },
    mounted() {
      this.getList()
    },
    methods: {
      resetSearch() {
        this.loading = true;
        this.msg.pageIndex = 1;
        this.getList();
      },
      changePage(val) {
        this.msg.pageIndex = val;
        this.loading = true;
        this.getList();
      },
      //获取数据
      getList() {
        this.loading = true;
        queryCustomerFinishtaskDetailsPage(this.msg).then(res => {
          this.loading = false;
          if (res.Code == 1) {
            this.dataList = res.Data.PageData;
            this.pageCount = res.Data.PageCount;
          }
        }).catch(() => {
          this.loading = false
        })
      }
    },
  }
</script>

<style lang="sass">
  @import url('~assets/css/table.sass')
</style>
<style lang="scss">
  .otherTask {
    display: inline-block;
    width: 22px;
    height: 22px;
    text-align: center;
    border: 1px solid #2961FE;
    border-radius: 50%;
    cursor: pointer;
    color: #2961FE;
  }

  .saleTaskTable {
    width: 400px;
    text-align: center;
  }

  .saleTaskTable tr td {
    height: 40px;
  }

  .saleTaskTable tr th {
    height: 40px;
    background-color: rgb(238, 238, 239);
  }

  .border-bottom {
    border-bottom: 1px dashed #eee;
    padding-bottom: 5px;
    margin-bottom: 5px;
  }
</style>