<!--商户管理-->
<template>
    <div class="app-container merchantManagement">
      <div class="page-container merchantManagementPage">
        <div class="page-form-title-box">
          <el-form :model="queryParams" class="form-box" ref="queryForm"
                   :inline="true" style="width:100%;">
            <el-form-item label="名称" prop="fileName" label-width="60px">
              <el-input
                maxLength="30"
                v-model="queryParams.fileName"
                placeholder="名称"
                clearable
                style="width: 200px"
              />
            </el-form-item>
            <el-form-item label="状态" prop="category" label-width="60px">
              <el-select v-model="queryParams.category" clearable placeholder="请选择分类" style="width: 200px">
                <el-option
                  v-for="item in optionList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
            <p class="page-inquire-common-style-button" @click="handleQuery">查询</p>
            <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
            <p class="page-submit-common-style-button"
               style="float: right;"
               @click="dialogOpen"
            >新增</p>
          </el-form>
        </div>
        <div class="page-content-box">
          <el-table class="table-box" v-loading="loading" border :data="tableList" ref="multipleTable">
            <el-table-column label="编号" align="center" prop="fileName" show-overflow-tooltip width="80"/>
            <el-table-column label="名称" align="center" prop="fileType" show-overflow-tooltip/>
            <el-table-column label="简称" align="center" prop="fileSize" show-overflow-tooltip width="80"/>
            <el-table-column label="省" align="center" prop="fileUrl" show-overflow-tooltip width="80"/>
            <el-table-column label="市" align="center" prop="fileUrl" show-overflow-tooltip width="80"/>
            <el-table-column label="详细地址" align="center" prop="fileUrl" show-overflow-tooltip width="200"/>
            <el-table-column label="联系人" align="center" prop="createTime" show-overflow-tooltip width="100"/>
            <el-table-column label="联系电话" align="center" prop="userName" show-overflow-tooltip width="160"/>
            <el-table-column label="状态" align="center" prop="userName" show-overflow-tooltip width="80"/>
            <el-table-column label="创建时间" align="center" prop="userName" show-overflow-tooltip width="200"/>
            <el-table-column label="操作" align="center" prop="deptName" width="170">
              <template slot-scope="scope">
                <div class="table-button-box">
                  <p class="table-button-null"></p>
                  <p class="table-button-p" @click="tableButton(1,scope.row)">编辑</p>
                  <p class="table-button-p" @click="tableButton(2,scope.row)">删除</p>
                  <p class="table-button-null"></p>
                </div>
              </template>
            </el-table-column>
          </el-table>
          <pagination :page-sizes="[20, 30, 40, 50]"
                      v-show="total>0"
                      :total="total"
                      :page.sync="queryParams.page"
                      :limit.sync="queryParams.pageSize"
                      @pagination="getList"
          />
        </div>
      </div>
      <!--新增弹窗-->
      <el-dialog class="trainingCourseAddDialog" :title='dialogTitle' width="540px" append-to-body
                 :visible.sync="dialogType" v-if="dialogType" @close="dialogOff()"
                  :close-on-click-modal="false" :close-on-press-escape="false">

        <div slot="footer" class="dialog-footer dialog-footer-box">
          <p class="dialog-footer-button-null"></p>
          <p class="dialog-footer-button-info" @click="dialogOff()">取消</p>
          <p class="dialog-footer-button-primary" @click="dialogSubmit">提交</p>
          <p class="dialog-footer-button-null"></p>
        </div>
      </el-dialog>
    </div>
</template>

<script>
  import { tenantList } from "@/api/serviceCenter/index";
  import { tenantDropList } from "@/api/commonality/permission";
  export default {
    name: 'merchantManagement',
    data(){
      return{
        loading:false,
        optionList:[{label:"启用",value:true},{label:"禁用",value:false}],
        queryParams:{
          page:1,
          pageSize:20,
          category:"",
          fileName:"",
        },
        dateRange:[],
        tableList:[],
        total:0,
        //dialog弹层数据
        dialogTitle:"",
        dialogType:false,
      }
    },
    created(){

    },
    mounted(){
      this.getList();
    },
    methods:{
      //弹层关闭
      dialogOff(){
        this.$set(this,'dialogType',false);
      },
      //弹层开启
      dialogOpen(){
        this.$set(this,'dialogTitle','新增');
        this.$set(this,'dialogType',true);
      },
      //弹层确定
      dialogSubmit(){
        this.$set(this,'dialogType',false);
      },
      handleQuery(){
        this.$set(this.queryParams,'page',1);
        this.getList();
      },
      resetQuery(){
        this.$set(this,'dateRange',[])
        this.$set(this,'queryParams',{
          page:1,
          pageSize:20,
          category:"",
          fileName:"",
        });
        this.getList();
      },
      //获取数据列表
      getList(){
        this.$set(this,'loading',true);
        let obj = JSON.parse(JSON.stringify(this.queryParams))
        if(this.dateRange[0]){
          obj.startTime = this.dateRange[0]+'T00:00:00'
          obj.endTime = this.dateRange[1]+'T23:59:59'
        }else{
          obj.startTime = "";
          obj.endTime = "";
        }
        tenantList(obj).then(response => {
          this.$set(this,'loading',false);
          this.$set(this,'tableList',response.data.records);
          this.$set(this,'total',response.data.total);
        });
      },
      //预览
      tableButton(){

      },
    },
  }
</script>

<style scoped lang="scss">
  .merchantManagement{
    .merchantManagementPage{

    }
  }
</style>

