<template>
  <div class="app-container">
    <!-- 顶部操作区域 -->
    <div class="filter-container">
      <div class="filter-control">
        <span>商品名称:</span>
        <el-input
          v-model="listQuery.name"
          placeholder="商品名称"
          clearable
          @keyup.enter.native="getList"
          @clear="getList"
        />
      </div>
      <div class="filter-control">
        <span>商品属性:</span>
        <el-select v-model="listQuery.storeAttributes" placeholder="请选择商品属性" @change="getList">
          <el-option
            v-for="(i, index) in storeAttributes"
            :key="index"
            :label="i.value"
            :value="i.id"
          />
        </el-select>
      </div>
      <div class="filter-control">
        <span>商品分类:</span>
        <el-select v-model="listQuery.storeClass" placeholder="请选择商品分类" @change="getList">
          <el-option
            v-for="(i, index) in storeClass"
            :key="index"
            :label="i.value"
            :value="i.id"
            @change="getList"
          />
        </el-select>
      </div>
      <div class="filter-control">
        <el-button type="primary" @click="getList">查询</el-button>
        <el-button type="primary" @click="$router.push('/database/store-list/edit')">添加</el-button>
      </div>
    </div>

    <el-table
      ref="table"
      v-loading="isLoading"
      :data="list"
      border
      :default-sort="{ prop: 'frequency', order: 'descending' }"
    >
      <!--<el-table-column type="selection" width="55" align="center" />-->
      <el-table-column
        label="ID"
        type="index"
        sortable="custom"
        align="center"
        width="80"
      />
      <el-table-column prop="name" label="商品名称" align="center" />
      <el-table-column prop="serviceLevel" label="商品图片" align="center">
        <el-image src="" />
      </el-table-column>
      <el-table-column prop="serviceCategory" label="商品属性" align="center">
        <template slot-scope="scope">
          <div>
            {{ scope.row.serviceCategory == "1" ? "产品" : "仪器" }}
          </div>
        </template>
      </el-table-column>
      <el-table-column prop="serviceCategory" label="商品分类" align="center">
        <template slot-scope="scope">
          <div>
            {{ scope.row.serviceCategory == "1" ? "生美" : "医美" }}
          </div>
        </template>
      </el-table-column>
      <el-table-column prop="contractStartDate" label="添加时间" align="center" />
      <el-table-column label="操作" align="center" width="200">
        <template slot-scope="{ row }">
          <div class="labelCenter">
            <el-button
              type="primary"
              size="mini"
              @click="$router.push('/database/store-list/edit?id=' + row.id)"
            >编辑</el-button>
            <el-button
              type="primary"
              size="mini"
              @click="
                $router.push('/database/store-list/data-manage/list?id=' + row.id)
              "
            >资料管理</el-button>
          </div>
        </template>
      </el-table-column>
    </el-table>

    <!-- 页码 -->
    <pagination
      :total="total"
      :page.sync="listQuery.pageNum"
      :limit.sync="listQuery.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import databaseMixin from '../mixins/index'

export default {
  mixins: [databaseMixin],
  data() {
    return {
      listQuery: {},
      list: [
        {
          id: 1
        }
      ],
      total: 10,
      isLoading: false
    }
  },
  mounted() {},
  methods: {
    getList() {}
  }
}
</script>

<style lang="scss" scoped>

</style>
