<style>
  .page-content p {
    margin: 0 !important;
  }

  .quetion_Title {
    background: transparent !important;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    width: 400px;
  }
</style>
<template>
  <div class="page-body">
    <div class="page-search row items-center">
      <div class="col row wrap q-mr-lg q-col-gutter-md">
        <div class="col-3">
          <q-input @input="resetSearch" dense filled clearable v-model="msg.CustomerName" label="联系人" maxlength="20" />
        </div>
        <div class="col-3">
          <q-input @input="resetSearch" dense filled clearable v-model="msg.ContactNumber" label="联系电话" maxlength="20" />
        </div>
        <div class="col-3">
          <q-select @input="resetSearch" dense clearable filled v-model="msg.QApproveState" :options="ApproveStateList"
            emit-value map-options label="审核状态" />
        </div>
      </div>
    </div>
    <div class="page-content">
      <b2bcustomlist :dataList="dataList" :authObj="authObj" :loading="loading" @success="getList"
        :visibleColumns="visibleColumns" sticky="sticky-tow-column-table sticky-right-column-table"></b2bcustomlist>
      <q-pagination class="full-width justify-end" v-model="msg.pageIndex" color="primary" :max="pageCount"
        :input="true" @input="changePage" />
    </div>
  </div>
</template>
<script>
  import {
    GetCustomerPage,
    RemoveCustomer
  } from "../../api/sale/peemanagement";
  import b2bcustomlist from "../../components/sale/b2bcustomlist";
  export default {
    meta: {
      title: "同行审批"
    },
    components: {
      b2bcustomlist
    },
    data() {
      return {
        pageCount: 0,
        msg: {
          pageIndex: 1,
          pageSize: 12,
          rowsPerPage: 12,
          CustomerName: "", //客户名称
          ContactNumber: "", //联系电话
          QApproveState: "3", //审核状态
          CustomerId: 0
        },
        loading: false,
        visibleColumns: [
          "CustomerName",
          "CustomerTypeName",
          "CategoryName",
          "ContactNumber",
          "StuNum",
          "OrderNum",
          "OrderSales",
          "ApproveStateStr",
          "CreateByName",
          "CreateTimeStr",
          "optioned",
          "QQ",
          "WeChatNo",
        ],
        //审核状态列表
        ApproveStateList: [{
            label: "待审核",
            value: "3"
          },
          {
            label: "通过",
            value: "1"
          },
          {
            label: "拒绝",
            value: "2"
          }
        ],
        dataList: [],
        //判断显示
        authObj: {
          isShowAudit: true
        }
      };
    },
    created() {},
    mounted() {
      if (this.$route.query.CustomerId) {
        this.msg.CustomerId = this.$route.query.CustomerId;
      }
      this.getList();
    },
    methods: {
      //重新查询
      resetSearch() {
        this.msg.pageIndex = 1;
        this.getList();
      },
      //翻页
      changePage(val) {
        this.msg.pageIndex = val;
        this.getList();
      },
      //获取分页数据
      getList() {
        this.loading = true;
        GetCustomerPage(this.msg)
          .then(res => {
            this.dataList = res.Data.PageData;
            this.loading = false;
            this.pageCount = res.Data.PageCount;
          })
          .catch(() => {
            this.loading = false;
          });
      }
    }
  };
</script>
<style lang="sass">
  @import url('~assets/css/table.sass')
</style>