<template>
  <div class="goods-list bg_c_white radius_10">
    <toptitle name="功能反馈">
      <el-button type="primary"> 
        <router-link :to="{path:'/help/feedbackadd'}">我要反馈</router-link>
      </el-button>
    </toptitle>
    <div class="search-wrap">
      <div class="search-box">
        <div class="search-item">
           <span class="label">类型：</span>
           <el-select class="input" clearable v-model="params.type" placeholder="请选择类型">
            <el-option
              v-for="item in statusList"
              :key="item.id"
              :label="item.type"
              :value="item.id"
            ></el-option>
          </el-select>
        </div>

        <el-button class="search-item" type="primary" @click="onSearch">查询</el-button>
        <el-button class="search-item" type="" @click="reset">重置</el-button>
      </div>
    </div>

    <div>
      <el-table
        ref="multipleTable"
        :data="tableData"
        tooltip-effect="dark"
        style="width: 100%"
      >
        <el-table-column
          type="index"
          width="100"
          align="center"
          label="反馈ID">
        </el-table-column>
        <el-table-column prop="funType" label="反馈类型" align="center"></el-table-column>
        <el-table-column prop="funTontent" label="内容" align="center" width="280px"></el-table-column>
         <el-table-column prop="imgs" label="图片" align="center" width="300px">
          <template slot-scope="scope">
            <div class="rows">
              <span class="row_img" 
                v-for="(item,index) in scope.row.imgs" 
                :key="index" 
              >
                <image-alert :image="item" height="50"></image-alert>
              </span>
           
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="addTime" label="时间" align="center"></el-table-column>

      </el-table>
       <div class="pagination-box">
        <pagination
          @eventSizeChange="eventSizeChange"
          @eventCurrentChange="eventCurrentChange"
          :total="total"
          :pageSize="params.pageSize"
          :pageNum="params.pageNum"
        ></pagination>
      </div>
    </div>

  </div>
</template>

<script>
import {_getStorage,_saveStorage,_removeStorage } from '@/utils/utils'
import pagination from "@/components/common/pagination"
import toptitle from '@/components/common/topTitle'
import imageAlert from "@/components/common/imageAlert"
export default {
  name:'feedBack',
  data() {
    return {
      params: {
        pageNum: 1,
        pageSize: 10,
        type:'',
        status:1
      },
      tableData: [],
      total:0,
       statusList: [
        {
          value: 1,
          label: "功能反馈"
        },
        {
          value: 2,
          label: "优化反馈"
        },
        {
          value: 3,
          label: "销售规格"
        },
        {
          value: 4,
          label: "类目标签"
        },
        {
          value: 5,
          label: "其他反馈"
        }
      ],
    };
  },
  computed: {

  },
  mounted() {
    this.getType()
    this.getList()
  },
  methods: {
    getType() {

      this.$axios.get("/feedBack/typeList").then(r => {
        let { code, data,msg } = r.data;
        if(code == 200){
          this.statusList = data;
        }else{
          this.$message.error(msg)
        }
      })
    },
    getList(){
      let { brandId } = _getStorage('info');
      this.params.brandId =brandId;
      this.$axios.get("/feedBack/list",{
        params:this.params
      }).then(r => {
        let { code, data,msg } = r.data;
        if(code == 200){
          if(data && data.list.length>0){
            data.list.forEach(el => {
              let arr = [];
              if(el.img){
                  arr = el.img.split(',')
              }
              el.imgs = arr
            })
          }
          this.tableData = data.list
          this.total = parseInt(data.total)
        }else{
          this.$message.error(msg)
        }
      })
    },
    onSearch(){
      this.params.pageNum = 1;
      this.getList();
    },
    reset(){
      this.params.pageNum = 1;
      this.params.type=''
      this.getList();
    },
    eventCurrentChange(e) {
      this.params.pageNum = e;
      this.getList();
    },
    eventSizeChange(e){
      this.params.pageSize = e;
      this.getList();
    },
  },
  components: {
    pagination,
    toptitle,
    imageAlert
  }
};
</script>

<style lang="scss" scoped>
>>>.resTip .el-input__inner{
  color: red;
}
.goods-list {
  color: #333333;
  padding: 20px;
}

.search-wrap {
  .search-box {
    overflow: hidden;
    flex-wrap: wrap;
    display: flex;
    transition: max-height 0.15s ease-in-out;
    .search-item {
      margin-right: 15px;
      margin-bottom: 15px;
      .label {
        font-size: 14px;
      }
      .input {
        width: 250px;
      }
    }
  }
  .search-btn-box {
    // margin-top: 15px;

    display: flex;
    align-items: center;
    .icon-arrow {
      margin-left: 4px;
      transition: transform 0.25s ease-in-out;
    }
    .more {
      color: #46b791;
      margin-left: 10px;
      cursor: pointer;
      line-height: 33px;
    }
  }
}
.edit {
  // color: #2491A2;
  // a{
  //   color: #2491A2;
  // }
  span {
    cursor: pointer;
    margin: 0 4px;
  }
}
.pagination-box {
  // display: flex;
  // align-items: center;
  // justify-content: space-between;
}
.rows{
  display: flex;
  align-items: center;
  justify-content: center;
  .row_img{
    margin:0 2px;
  }
  .row_info{
    display: inline-block;
    text-align: left;
    color:#BBBBBB;
    padding-left: 5px;
    .row_ruand{
      font-size: 20px;
    }
  }
}

</style>
