<template>
  <div id="newsInfo">
    <el-row>
      <el-col :span="24">
        <template>
          <el-tabs v-model="activeName" @tab-click="handleClicks">
            <el-tab-pane label="未发布" name="first">
              <el-col :span="24" class="info">
                <el-col :span="10" class="input">
                  <el-input placeholder="请输入产品名称" v-model="input"> </el-input>
                </el-col>
                <el-col :span="2" class="btn">
                  <el-button type="primary" icon="el-icon-search" circle></el-button>
                </el-col>
              </el-col>
              <el-table ref="debtTable" :data="debtTable" style="width: 100%" border>
                <el-table-column type="index" label="序号" width="50" align="center"> </el-table-column>
                <el-table-column property="name" label="产品名称" align="center"> </el-table-column>

                <el-table-column label="图片" align="center">
                  <template slot-scope="scope">
                    <span style="margin-left: 10px"> <el-image :src="scope.row.pic"></el-image></span>
                  </template>
                </el-table-column>

                <el-table-column label="状态" align="center">
                  <template slot-scope="scope">
                    <span style="margin-left: 10px">{{ scope.row.status === '0' ? '未发布' : scope.row.status === '1' ? '发布' : '下架' }}</span>
                  </template>
                </el-table-column>

                <el-table-column fixed="right" label="操作" align="center">
                  <template slot-scope="scope">
                    <el-button @click="handleClick(scope.row)" type="text"><i class="el-icon-view"></i></el-button>
                    <el-button @click="clickRest(scope.row)" type="text"><i class="el-icon-refresh"></i></el-button>
                  </template>
                </el-table-column>
              </el-table>
              <el-col class="page" :span="24">
                <el-pagination
                  @size-change="handleSizeChange"
                  @current-change="handleCurrentChange"
                  :current-page="currentPage"
                  layout="total,  prev, pager, next, jumper"
                  :total="total"
                >
                </el-pagination>
              </el-col>
            </el-tab-pane>
            <el-tab-pane label="发布" name="second">
              <el-col :span="24" class="info">
                <el-col :span="10" class="input">
                  <el-input placeholder="请输入产品名称" v-model="input"> </el-input>
                </el-col>
                <el-col :span="2" class="btn">
                  <el-button type="primary" icon="el-icon-search" circle></el-button>
                </el-col>
              </el-col>
              <el-table ref="shenheTable" :data="shenheTable" style="width: 100%" border>
                <el-table-column type="index" label="序号" width="50" align="center"> </el-table-column>
                <el-table-column property="name" label="产品名称" align="center"> </el-table-column>

                <el-table-column label="图片" align="center">
                  <template slot-scope="scope">
                    <span style="margin-left: 10px"> <el-image :src="scope.row.pic"></el-image></span>
                  </template>
                </el-table-column>

                <el-table-column label="状态" align="center">
                  <template slot-scope="scope">
                    <span style="margin-left: 10px">{{ scope.row.status === '0' ? '未发布' : scope.row.status === '1' ? '发布' : '下架' }}</span>
                  </template>
                </el-table-column>

                <el-table-column fixed="right" label="操作" align="center">
                  <template slot-scope="scope">
                    <el-button @click="handleClick(scope.row)" type="text"><i class="el-icon-view"></i></el-button>
                    <el-button @click="clickRest(scope.row)" type="text"><i class="el-icon-refresh"></i></el-button>
                  </template>
                </el-table-column>
              </el-table>
              <el-col class="page" :span="24">
                <el-pagination
                  @size-change="handleSizeChange"
                  @current-change="handleCurrentChange"
                  :current-page="currentPage"
                  layout="total,  prev, pager, next, jumper"
                  :total="total"
                >
                </el-pagination>
              </el-col>
            </el-tab-pane>
            <el-tab-pane label="下架" name="third">
              <el-col :span="24" class="info">
                <el-col :span="10" class="input">
                  <el-input placeholder="请输入产品名称" v-model="input"> </el-input>
                </el-col>
                <el-col :span="2" class="btn">
                  <el-button type="primary" icon="el-icon-search" circle></el-button>
                </el-col>
              </el-col>
              <el-table ref="noshenhetable" :data="noshenhetable" style="width: 100%" border>
                <el-table-column type="index" label="序号" width="50" align="center"> </el-table-column>
                <el-table-column property="name" label="产品名称" align="center"> </el-table-column>

                <el-table-column label="图片" align="center">
                  <template slot-scope="scope">
                    <span style="margin-left: 10px"> <el-image :src="scope.row.pic"></el-image></span>
                  </template>
                </el-table-column>

                <el-table-column label="状态" align="center">
                  <template slot-scope="scope">
                    <span style="margin-left: 10px">{{ scope.row.status === '0' ? '未发布' : scope.row.status === '1' ? '发布' : '下架' }}</span>
                  </template>
                </el-table-column>

                <el-table-column fixed="right" label="操作" align="center">
                  <template slot-scope="scope">
                    <el-button @click="handleClick(scope.row)" type="text"><i class="el-icon-view"></i></el-button>
                  </template>
                </el-table-column>
              </el-table>
              <el-col class="page" :span="24">
                <el-pagination
                  @size-change="handleSizeChange"
                  @current-change="handleCurrentChange"
                  :current-page="currentPage"
                  layout="total,  prev, pager, next, jumper"
                  :total="total"
                >
                </el-pagination>
              </el-col>
            </el-tab-pane>
          </el-tabs>
        </template>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: 'newsInfo',
  props: {
    debtTable: null,
    shenheTable: null,
    noshenhetable: null,
    total: null,
  },
  components: {},
  data: () => ({
    currentPage: 1,
    activeName: 'first',
    input: '',
  }),
  created() {},
  computed: {
    status() {
      return this.$route.params.status;
    },
  },
  methods: {
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
    handleClicks(tab, event) {
      console.log(tab, event);
    },
    handleClick(id) {
      let newid = id.id;

      this.$emit('handleClick', newid);
    },
  },
};
</script>

<style lang="less" scoped>
.info {
  padding: 15px 0;
}
.info .input {
  padding: 6px 0;
}
.info .btn {
  text-align: center;
}
/deep/.el-input__inner {
  height: 30px;
  line-height: 30px;
}
</style>
