<template>
  <div>
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>数据</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <el-tabs type="border-card">
      <el-tab-pane label="门店评分">
        <!-- 查询和其他操作 -->
        <div class="filter-container">
          <el-form :inline="true" size="small" v-model="listQuery">



            <el-form-item label="加盟商名称">
              <el-input v-model="listQuery.fraName" clearable placeholder="请输入加盟商名称" />
            </el-form-item>

            <el-form-item label="门店名称">
              <el-input v-model="listQuery.shopName" clearable placeholder="请输入门店名称" />
            </el-form-item>

            <el-form-item label="门店POI">
              <el-input v-model="listQuery.poiId" clearable placeholder="请输入POI" />
            </el-form-item>


            <el-form-item>
              <el-button class="filter-item" type="primary" icon="el-icon-search" @click="getList(false)">查找</el-button>
              <el-button :loading="listLoading" class="filter-item" type="primary" icon="el-icon-download"
                @click="getList(true)">导出</el-button>
            </el-form-item>
          </el-form>
        </div>

        <!-- 查询结果 -->
        <el-table :data="list" element-loading-text="正在查询中。。。" border fit highlight-current-row>
          <el-table-column align="center" label="门店POI" prop="shopPoiId" />
          <el-table-column align="center" label="门店名称" prop="shopName" />
          <el-table-column align="center" label="加盟商id" prop="fraId" />
          <el-table-column align="center" label="加盟名称" prop="fraName" />

          <el-table-column align="center" label="门店评分" prop="score" />
          <el-table-column align="center" label="评价数量" prop="evaCount" />
          <el-table-column align="center" label="上月评价数量" prop="evaLastMonthCount" />
          <el-table-column align="center" label="上月好评数" prop="evaLastGoods" />
          <el-table-column align="center" label="上月差评数" prop="evaLastBad" />

          <el-table-column align="center" label="抖音评价更新时间" prop="evaUpdateTime" />

        </el-table>

        <pagination v-show="total > 0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit"
          @pagination="getList(false)" />
      </el-tab-pane>


    </el-tabs>

  </div>
</template>

<script>
import Pagination from "./../common/Pagination";
import service from "../../script/api/service";
import "@/script/table2excel";

export default {
  name: "douyinFiance",
  components: { Pagination },
  data() {
    return {
      listLoading: false,
      timeArray: [
        this.formateDay(new Date(new Date() - 3600 * 1000 * 24 * 7)),
        this.formateDay(new Date()),
      ],
      salesTimeArray: [],
      list: [],
      total: 0,
      listLoading: false,
      listQuery: {
        page: 1,
        limit: 50,
        fraName:'',
        shopName:'',
        poiId:'',

      },
    };
  },
  computed: {},
  created() {
  },
  methods: {
    getList(isExport) {


      if (isExport == false) {
        this.listQuery.isExport=false;
        service
          .$axiosGetStoreComment(this.listQuery)
          .then((response) => {
            this.list = response.data.data.list;
            this.total = response.data.data.total;
          })
          .catch(() => {
            this.list = [];
            this.total = 0;
          });
      }
      else {
        this.listQuery.isExport=true;
        service.$axiosGetStoreCommentExport(this.listQuery);
      }

    },
    handleFilter() {
      this.listQuery.page = 1;
      this.getList();
    },
  },
};
</script>

<style>
.detail-container {
  width: 80%;
  padding: 20px 20px 20px 20px;
  margin: 20px auto;
}

.panel-group {
  display: flex;
  flex-flow: wrap;
}

.panel-group .card-panel {
  min-height: 130px;
  border-radius: 6px;
  padding: 10px 10px 0px;
  cursor: pointer;
  font-size: 12px;
  position: relative;
  overflow: hidden;
  color: #666;
  background: #fff;
  -webkit-box-shadow: 2px 2px 10px rgb(0 0 0 / 10%);
  box-shadow: 2px 2px 10px rgb(0 0 0 / 10%);
  border-color: rgba(0, 0, 0, .05);
  margin: 10px
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  border-bottom: 1px solid #ccc;
  /*dashed*/
  padding: 10px 0;
}

.card-data {
  display: flex;
  flex-direction: column;
  padding-top: 10px;
}

.card-item {
  display: flex;
  line-height: 20px;
  font-size: 13px;
}

.card-sub-item {
  margin-right: 20px;
  border-right: 1px dashed #ccc;
  width: 150px;
}

.card-sub-item .title {
  font-weight: 600;
}

.card-footer {
  height: 40px;
  line-height: 40px;
  border-top: 1px dashed #ccc;
  text-align: center;
  margin-top: 10px;
  color: #36a3f7;
}
</style>
