<template>
  <div>
    <el-table :data="dataList" style="width: 100%">
      <el-table-column prop="Id" label="ID" width="100">
      </el-table-column>
      <el-table-column prop="Name" label="名称">
      </el-table-column>
      <el-table-column prop="address" label="操作" width="100">
        <template slot-scope="scope">
          <el-button @click="getModel(scope.row)" size="mini">选择</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination background @current-change="handleCurrentChange" :page-size="qMsg.pageSize"
      layout="prev, pager, next" :total="total">
    </el-pagination>
  </div>
</template>
<script>
  export default {
    data() {
      return {
        dataList: [],
        total: 0,
        qMsg: {
          pageIndex: 1,
          pageSize: 20,
          Name: ""
        }
      }
    },
    methods: {
      handleCurrentChange(val) {
        this.qMsg.pageIndex = val;
        this.getList();
      },
      //获取数据
      getList() {
        this.apipost("/api/MContent/GetStoresPageList", this.qMsg, res => {
          if (res.data.resultCode == 1) {
            this.dataList = res.data.data.pageData;
            this.total = res.data.data.count;
          } else {
            this.Info(res.data.message);
          }
        })
      },
      //选择
      getModel(item) {
        var obj = {
          Id: item.Id,
          Name: item.Name,
          Tel:item.Tel,
          CoverImg:item.CoverImg
        }
        this.$emit('getStore', obj)
      },
    },
    mounted() {
      this.getList();
    }
  }

</script>
