<template>
  <div class="page">
    <topBar
      v-if="topList.length > 0"
      :topList="topList"
      :moren="moren"
    ></topBar>
    <div class="thetopbox">
      <el-form label-width="100px">
        <el-row>
          <el-col :span="4">
            <el-form-item :label="'会员编号'" prop="memberCode">
              <el-input clearable v-model="queryParams.memberCode"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="'会员姓名'" prop="memberName">
              <el-input clearable v-model="queryParams.memberName"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="4">
            <el-form-item :label="'联系方式'" prop="phone">
              <el-input clearable v-model="queryParams.phone"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="4">
            <el-form-item :label="'荣誉奖衔'" prop="oldLevel">
              <el-select
                clearable
                :placeholder="'请选择'"
                v-model="queryParams.oldLevel"
              >
                <el-option
                  v-for="item in awardsList"
                  :key="item.pkId"
                  :label="item.awardsName"
                  :value="item.pkId"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="'隶属体系'" prop="pkVertex">
              <el-select
                clearable
                :placeholder="'请选择'"
                v-model="queryParams.pkVertex"
              >
                <el-option
                  v-for="item in vertexList"
                  :key="item.pkId"
                  :label="item.vertexName"
                  :value="item.pkId"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="'隶属团队'" prop="pkTeamCode">
              <el-select
                clearable
                :placeholder="'请选择'"
                v-model="queryParams.pkTeamCode"
              >
                <el-option
                  v-for="item in memberTeamList"
                  :key="item.pkId"
                  :label="item.teamName"
                  :value="item.pkId"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="8">
              <el-form-item :label="'创建日期'" prop="teamCode">
                <el-date-picker
                  v-model="queryParams.creationTime"
                  type="datetimerange"
                  range-separator="——"
                  :start-placeholder="'开始日期'"
                  :end-placeholder="'结束日期'"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  :unlink-panels="true"
                >
                </el-date-picker>
              </el-form-item>
            </el-col> -->
          <el-col :span="4">
            <div class="searchbox">
              <el-button
                class="my_search"
                @click="
                  () => {
                    getSearch();
                    getCzNum();
                  }
                "
              >
                {{ '搜索' }}</el-button
              >
              <el-button class="my_reset" @click="reChongzhi">
                {{ '重置' }}</el-button
              >
            </div>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div class="main">
      <div class="maintop">
        <div class="mainbtn">
          <el-button size="small" class="thebtn1" @click="handleExport">
            {{ '导出' }}</el-button
          >
        </div>
      </div>
      <div class="maintable">
        <el-table
          :data="tableData"
          v-loading="loading"
          height="680px"
          style="width: 100%"
          :header-cell-style="{ background: '#EEEEEE' }"
          @selection-change="handleSelectionChange"
        >
          <el-table-column prop="colsele" type="selection" width="55">
          </el-table-column>

          <el-table-column
            align="center"
            prop="memberCode"
            :label="'会员编号'"
            min-width="120px"
          >
          </el-table-column>
          <el-table-column
            align="center"
            prop="memberName"
            :label="'会员姓名'"
            min-width="120px"
          >
          </el-table-column>
       
          <el-table-column
            align="center"
            prop="phone"
            :label="'联系方式'"
            min-width="120px"
          >
          </el-table-column>
          <el-table-column
            align="center"
            prop="vertexName"
            :label="'隶属体系'"
          >
          </el-table-column>
          <el-table-column
            align="center"
            prop="teamName"
            :label="'隶属团队'"
          >
          </el-table-column>
         
          <el-table-column
            align="center"
            prop="account2"
            min-width="100px"
            :label="'现金账户余额' + `(${isLocalSymbol()})`"
          >
          </el-table-column>
          <el-table-column
            align="center"
            prop="lockAccount2"
            min-width="100px"
            :label="'冻结现金账户' + `(${isLocalSymbol()})`"
          >
          </el-table-column>
            <el-table-column
            align="center"
            prop="withdrawAccount4"
            min-width="100px"
            :label="`可提现金账户余额(${isLocalSymbol()})`"
          >
          </el-table-column>
          <el-table-column
            align="center"
            prop="account4"
            min-width="100px"
            :label="'奖金账户余额' + `(${isLocalSymbol()})`"
          >
          </el-table-column>
          <el-table-column
            align="center"
            min-width="100px"
            prop="lockAccount4"
            :label="'冻结奖金账户' + `(${isLocalSymbol()})`"
          >
          </el-table-column>
          <el-table-column
            align="center"
            prop="account1"
            min-width="100px"
            :label="'消费账户余额' + `(${isLocalSymbol()})`"
          >
          </el-table-column>
          <el-table-column
            align="center"
            min-width="100px"
            prop="account3"
            :label="'政策账户余额' + `(${isLocalSymbol()})`"
          >
          </el-table-column>
          <el-table-column
            align="center"
            min-width="100px"
            prop="account5"
            :label="'重消账户余额' + `(${isLocalSymbol()})`"
          >
          </el-table-column>
          <el-table-column
            align="center"
            prop="account6"
            min-width="100px"
            :label="'积分账户余额'"
          >
          </el-table-column>
          <el-table-column
            align="center"
            prop="account7"
            min-width="100px"
            :label="'鼓励账户余额'"
          >
          </el-table-column>
          <el-table-column
            align="center"
            prop="account8"
            min-width="100px"
            :label="'复购券余额'"
          >
          </el-table-column>
        </el-table>
      </div>
    </div>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getSearch"
    />
  </div>
</template>
  
 <script>
import topBar from "@/components/topBar";
import * as sta from "@/api/statistics";
import { getAwardsListChiose } from "@/api/level";
import { getvertexValue, getmemberTeamList } from "@/api/financialCase";
import { isLocals, isLocalSymbol } from "@/utils/numberToCurrency";
export default {
  name: "UnderBalance",
  components: {
    topBar,
  },
  data() {
    return {
      moren: "underBalance",
      topList: [
        {
          name: '伞下账户余额',
          path: "underBalance",
        },
      ],
      tableData: [],
      loading:false,
      queryParams: {
        pageNum: 1,
        pageSize: 50,
      },
      total: 0,
      multipleSelection: [],
      awardsList: [],
      memberTeamList: [],
      vertexList: [],
    };
  },
  created() {
    this.getSearch();
    this.getOthers();
  },
  methods: {
    isLocalSymbol,
    isLocals,
    getOthers() {
      getAwardsListChiose().then((res) => {
        this.awardsList = res.rows;
      });
      getmemberTeamList().then((res) => {
        this.memberTeamList = res.rows;
      });
      getvertexValue().then((res) => {
        this.vertexList = res.data;
      });
    },
    //导出
    handleExport() {
      this.$confirm('是否确认导出所有数据项?', '警告', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: "warning",
      }).then((_) => {
        this.download(
          "/report/manager/member-brolly/export-umbrella",
          { ...this.queryParams },
          `${'伞下账户余额'}${new Date().getTime()}.xlsx`
        );
      });
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    reChongzhi() {
      this.queryParams = {
        pageNum: 1,
        pageSize: 50,
      };
      this.getSearch();
    },
    getSearch() {
      this.loading = true
      sta.getUmbrellaList(this.queryParams).then((res) => {
        this.tableData = res.rows;
        this.total = res.total;
        this.loading = false
      });
    },
    getCzNum() {
      this.queryParams.pageNum = 1;
    },
  },
};
</script>
  
  <style lang="scss" scoped>
::v-deep .el-image-viewer__close {
  right: 500px;
}
::v-deep .dizhi .el-cascader {
  width: 100%;
}
::v-deep .el-range-editor.el-input__inner {
  width: 100%;
}
::v-deep .el-table thead {
  color: #000000;
}
::v-deep .el-table .warning-row {
  background: #f9f9f9;
}
.page {
  padding: 10px 20px;
  background: #f9f9f9;
  font-size: 14px;
  .thetopbox {
    padding: 15px 20px 15px 0;
    background: #ffffff;
    border-radius: 8px;
    .searchbox {
      display: flex;
      align-items: center;
      margin-left: 40px;
    }
    .searchtitle {
      margin-right: 10px;
    }
    .searchbtn {
      background: #08143f;
      color: #ffffff;
    }
  }
  .main {
    //margin-top: 20px;
    background: #f9f9f9;
    //border-radius: 8px;
    //box-shadow: 0px 2px 20px 0px rgba(238, 238, 238, 0.5);

    .maintop {
      display: flex;
      // padding: 10px 0;
      justify-content: space-between;
      align-items: center;
      .mainbtn {
        .thebtn1 {
          color: #ffffff;
          background: #ffad41;
          width: 68px;
          height: 32px;
        }
        .thebtn2 {
          color: #ffffff;
          background: #009b58;
          width: 68px;
          height: 32px;
        }
        .thebtn3 {
          color: #ffffff;
          background: #c8161d;
          width: 68px;
          height: 32px;
        }
      }
    }
  }
}
</style>
  