<!-- 信息管理 - 会员信息 -->
<template>
  <div class="page">
    <topBar
      v-if="topList.length > 0"
      :top-list="topList"
      :moren="moren"
    />
    <div class="thetopbox">
      <el-form label-width="100px">
        <el-row>
          <el-col :span="4">
            <el-form-item :label="'会员编号'" prop="memberCode">
              <el-input
                v-model="queryParams.memberCode"
                clearable
                :placeholder="'请输入'"
              />
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="'会员姓名'" prop="memberName">
              <el-input
                v-model="queryParams.memberName"
                clearable
                :placeholder="'请输入'"
              />
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="'联系方式'" prop="phone">
              <el-input
                v-model="queryParams.phone"
                clearable
                :placeholder="'请输入'"
              />
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="'变更次数'" prop="changeNumber">
              <el-input
                v-model="queryParams.changeNumber"
                clearable
                :placeholder="'请输入'"
              />
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="'注册等级'" prop="pkRegisterGrade">
              <el-select
                v-model="queryParams.pkRegisterGrade"
                clearable
                :placeholder="'请选择'"
              >
                <el-option
                  v-for="item in gradeRangList"
                  :key="item.pkId"
                  :label="item.gradeName"
                  :value="item.pkId"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="'结算等级'" prop="pkMaxAwards">
              <el-select
                v-model="queryParams.pkSettleGrade"
                clearable
                :placeholder="'请选择'"
              >
                <el-option
                  v-for="item in gradeRangList"
                  :key="item.pkId"
                  :label="item.gradeName"
                  :value="item.pkId"
                />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="4">
            <el-form-item :label="$t('当月奖衔')" prop="pkAwards">
              <el-select
                v-model="queryParams.pkAwards"
                clearable
                :placeholder="'请选择'"
              >
                <el-option
                  v-for="item in awardsList"
                  :key="item.pkId"
                  :label="item.awardsName"
                  :value="item.pkId"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="$t('荣誉奖衔')" prop="pkMaxAwards">
              <el-select
                v-model="queryParams.pkMaxAwards"
                clearable
                :placeholder="'请选择'"
              >
                <el-option
                  v-for="item in awardsList"
                  :key="item.pkId"
                  :label="item.awardsName"
                  :value="item.pkId"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="'隶属体系'" prop="vertexId">
              <el-select
                v-model="queryParams.vertexId"
                clearable
                :placeholder="'请选择'"
              >
                <el-option
                  v-for="item in vertexList"
                  :key="item.pkId"
                  :label="item.vertexName"
                  :value="item.pkId"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="'隶属团队'" prop="teamId">
              <el-select
                v-model="queryParams.teamId"
                clearable
                :placeholder="'请选择'"
              >
                <el-option
                  v-for="item in memberteamList"
                  :key="item.pkId"
                  :label="item.teamName"
                  :value="item.pkId"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="'收益状态'" prop="incomeStatus">
              <el-select
                v-model="queryParams.incomeStatus"
                clearable
                :placeholder="'请选择'"
                @change="getSel"
              >
                <el-option
                  v-for="item in incomeStatusListd"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="4">
            <el-form-item :label="'账户状态'" prop="accountStatus">
              <el-select
                v-model="queryParams.accountStatus"
                clearable
                :placeholder="'请选择'"
              >
                <el-option
                  v-for="item in accountStatus"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="'钱包状态'" prop="memberAccount">
              <el-select
                v-model="queryParams.memberAccount"
                clearable
                :placeholder="'请选择'"
              >
                <el-option
                  v-for="item in salletStatus"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="'实名认证'" prop="isRealName">
              <el-select
                v-model="queryParams.isRealName"
                clearable
                :placeholder="'请选择'"
              >
                <el-option
                  v-for="item in tattestation"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="'订单类型'" prop="orderSource">
              <el-select
                v-model="queryParams.orderSource"
                clearable
                :placeholder="'请选择'"
              >
                <el-option
                  v-for="item in orderStatusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="'推荐编号'" prop="parMemberCode">
              <el-input
                v-model="queryParams.parMemberCode"
                clearable
                :placeholder="'请输入'"
              />
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="'推荐姓名'" prop="parMemberName">
              <el-input
                v-model="queryParams.parMemberName"
                clearable
                :placeholder="'请输入'"
              />
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="'修改直推次数'" prop="directPushNumber">
              <el-input
                v-model="queryParams.directPushNumber"
                clearable
                type="number"
                :placeholder="'请输入'"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-collapse-transition>
          <div v-show="isActive">
            <el-row>
              <el-col :span="4">
                <el-form-item :label="$t('是否激活')" prop="isActivate">
                  <el-select
                    v-model="queryParams.isActivate"
                    clearable
                    :placeholder="'请选择'"
                  >
                    <el-option
                      v-for="item in ActivateList"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item :label="$t('收益地址')" prop="accountStatus">
                  <el-cascader
                    v-model="address"
                    class="area"
                    :options="areaData"
                    :placeholder="'请选择省市区'"
                    :props="regionParams"
                    @change="flChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item :label="'创建日期'" prop="code">
                  <el-date-picker
                    v-model="queryParams.cjsj"
                    type="daterange"
                    range-separator="——"
                    :start-placeholder="'开始时间'"
                    :end-placeholder="'结束日期'"
                    value-format="yyyy-MM-dd"
                    :unlink-panels="true"
                    @change="changeTime1"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item :label="'支付日期'" prop="code">
                  <el-date-picker
                    v-model="queryParams.zfsj"
                    type="daterange"
                    range-separator="——"
                    :start-placeholder="'开始时间'"
                    :end-placeholder="'结束日期'"
                    value-format="yyyy-MM-dd"
                    :unlink-panels="true"
                    @change="changeTime2"
                  />
                </el-form-item>
              </el-col>
              <!-- <el-col :span="8">
                <el-form-item label="有效期" prop="code">
                  <el-date-picker
                    v-model="queryParams.dqsj"
                    type="daterange"
                    @change="changeTime3"
                    range-separator="——"
                    :start-placeholder="'开始时间'"
                    :end-placeholder="'结束日期'"
                    value-format="yyyy-MM-dd"
                    :unlink-panels="true"
                  >
                  </el-date-picker>
                </el-form-item>
              </el-col> -->
            </el-row>
          </div>
        </el-collapse-transition>
        <el-row style="margin-left: 20px">
          <el-col :span="4">
            <div class="searchbox">
              <el-button class="searchbtn" @click="getMemberList">
                {{ '搜索' }}</el-button>
              <el-button @click="reChongzhi"> {{ '重置' }}</el-button>
            </div>
          </el-col>
          <div class="openClose" @click="changeActive">
            <i
              :class="isActive ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
            />
            <div>{{ isActive ? '点击收起' : '点击展开' }}</div>
          </div>
        </el-row>
      </el-form>
    </div>
    <div class="maintop">
      <div class="mainbtn">
        <el-button
          v-hasButtons="['MemberExport']"
          size="small"
          class="thebtn2"
          @click="handleExport"
        >
          {{ '导出' }}</el-button>
        <el-button
          v-hasButtons="['memberDown']"
          size="small"
          style="background-color: #009b58; color: #fff; margin-left: 15px"
          class="thebtn2"
          @click="importTemplate"
        >
          {{ '下载模板' }}</el-button>
        <el-button
          v-hasButtons="['memberImport']"
          size="small"
          class="thebtn2"
          style="background-color: #ff6723; color: #fff"
          @click="handleImport"
        >
          {{ '导入' }}</el-button>
      </div>
      <div style="padding-right: 0px">
        <el-dropdown :hide-on-click="false" style="width: 120px">
          <span class="el-dropdown-link kuang">
            {{ '筛选字段'
            }}<i class="el-icon-arrow-down el-icon--right" />
          </span>
          <el-dropdown-menu slot="dropdown" style="">
            <el-dropdown-item v-for="item in menuList" :key="item.id">
              <el-checkbox
                v-model="item.checked"
                @change="getMenu($event, item.id)"
              >{{ item.text }}</el-checkbox></el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
    </div>
    <div class="main">
      <div class="maintable">
        <el-table
          ref="table"
          :data="tableData"
          :height="isActive ? '480px' : '630px'"
        >
          v-loading="loading" style="width: 100%" :header-cell-style="{
          background: '#EEEEEE' }" :row-class-name="tableRowClassName"
          @selection-change="handleSelectionChange" >
          <el-table-column type="selection" />
          <el-table-column
            v-if="allTxt.memberCode"
            align="center"
            prop="memberCode"
            :label="'会员编号'"
            width="180"
          />
          <el-table-column
            v-if="allTxt.memberName"
            align="center"
            prop="memberName"
            :label="'会员姓名'"
            width="180"
          />

          <el-table-column
            v-if="allTxt.phone"
            align="center"
            prop="phone"
            :label="'联系方式'"
            width="180"
          />
          <el-table-column
            v-if="menuList[1].checked == true && allTxt.parMemberCode"
            align="center"
            prop="parMemberCode"
            :label="'推荐编号'"
            width="180"
          />
          <el-table-column
            v-if="menuList[2].checked == true && allTxt.parMemberName"
            align="center"
            prop="parMemberName"
            :label="'推荐姓名'"
            width="180"
          />
          <el-table-column
            v-if="allTxt.pkAwardsVal"
            align="center"
            prop="pkAwardsVal"
            :label="$t('当月奖衔')"
            width="160"
          />
          <el-table-column
            align="center"
            prop="pkRangeAwardsVal"
            :label="$t('分红奖衔')"
            width="160"
          />
          <el-table-column
            align="center"
            prop="pkMaxAwardsVal"
            :label="$t('荣誉奖衔')"
            width="160"
          />
          <el-table-column
            v-if="allTxt.orderSourceVal"
            align="center"
            prop="orderSourceVal"
            :label="'订单类型'"
            width="180"
          />
          <el-table-column
            v-if="menuList[3].checked == true && allTxt.pkRegisterGradeVal"
            align="center"
            prop="pkRegisterGradeVal"
            :label="'注册等级'"
            width="180"
          />
          <el-table-column
            v-if="menuList[4].checked == true && allTxt.pkSettleGradeVal"
            align="center"
            prop="pkSettleGradeVal"
            :label="'结算等级'"
            width="180"
          />
          <el-table-column
            v-if="menuList[5].checked == true && allTxt.consumeMoney"
            align="center"
            prop="consumeMoney"
            :label="'注册金额' + `(${isLocalSymbol()})`"
            width="180"
          >
            <template slot-scope="scope">
              {{ scope.row.consumeMoney | numberToCurrency }}
            </template>
          </el-table-column>
          <el-table-column
            v-if="menuList[6].checked == true && allTxt.consumeAchieve"
            align="center"
            :label="`${'注册业绩'}` + `(${isLocals()})`"
            prop="consumeAchieve"
            width="180"
          >
            <template slot-scope="scope">
              {{ scope.row.consumeAchieve | numberToCurrency }}
            </template>
          </el-table-column>
          <el-table-column
            v-if="menuList[7].checked == true && allTxt.vertexName"
            align="center"
            prop="vertexName"
            :label="'隶属体系'"
            width="180"
          />
          <!-- <el-table-column
            v-if="menuList[8].checked == true && allTxt.registerAuthorityVal"
            align="center"
            prop="registerAuthorityVal"
            :label="'注册权限'"
            width="180"
          ></el-table-column> -->
          <el-table-column
            v-if="menuList[11].checked == true && allTxt.teamName"
            align="center"
            prop="teamName"
            label="隶属团队"
            width="180"
          />
          <el-table-column
            v-if="menuList[8].checked == true && allTxt.isRealNameVal"
            align="center"
            prop="isRealNameVal"
            :label="'实名认证'"
            width="180"
          >
            <template slot-scope="scope">
              <span
                v-if="scope.row.isRealName == 0"
                style="color: #009b58"
              >已认证</span>
              <span
                v-if="scope.row.isRealName == 1"
                style="color: #c8161d"
              >未认证</span>
            </template>
          </el-table-column>
          <el-table-column
            v-if="menuList[9].checked == true && allTxt.accountStatusVal"
            align="center"
            prop="accountStatusVal"
            :label="'账户状态'"
            width="180"
          />
          <el-table-column
            v-if="menuList[10].checked == true && allTxt.memberAccountVal"
            align="center"
            prop="memberAccountVal"
            :label="'钱包状态'"
            width="180"
          />
          <el-table-column
            align="center"
            prop="giftProvince"
            :label="$t('收益区省')"
            width="180"
          />
          <el-table-column
            align="center"
            prop="giftCity"
            :label="$t('收益区市')"
            width="180"
          />
          <el-table-column
            align="center"
            prop="giftCounty"
            :label="$t('收益区县（区）')"
            width="180"
          />

          <el-table-column
            v-if="allTxt.incomeStatusVal"
            align="center"
            prop="incomeStatusVal"
            :label="'收益状态'"
            width="180"
          />
          <el-table-column
            v-if="allTxt.creationTime"
            align="center"
            prop="creationTime"
            :label="'创建日期'"
            width="180"
          />
          <el-table-column
            v-if="allTxt.payTime"
            align="center"
            prop="payTime"
            :label="'支付日期'"
            width="180"
          />
          <el-table-column
            v-if="allTxt.changeNumber"
            align="center"
            prop="changeNumber"
            :label="'变更次数'"
            width="180"
          />
          <el-table-column
            v-if="allTxt.directPushNumber"
            align="center"
            prop="directPushNumber"
            :label="'修改直推次数'"
            width="180"
          />
          <el-table-column
            align="center"
            prop="categoryVal"
            :label="'会员类型'"
            width="180"
          />
          <el-table-column
            align="center"
            prop="isActivateVal"
            :label="$t('是否激活')"
          />
          <el-table-column
            align="center"
            prop="time"
            :label="'操作'"
            width="130"
            fixed="right"
          >
            <template slot-scope="scope">
              <div style="white-space: nowrap">
                <el-button
                  v-has-buttons="['memberLogin']"
                  :disabled="scope.row.category != 0"
                  type="text"
                  size="small"
                  style="padding: 8px 0px"
                  @click="toLogin(scope.row)"
                >
                  {{ '登录' }}
                </el-button>
                <!-- <el-button
                  v-has-buttons="['tmpMemberLogin']"
                  type="text"
                  size="small"
                  style="padding: 8px 0px"
                  @click="toLogin1(scope.row)"
                >
                  {{ $t("临时登录") }}
                </el-button> -->
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getMemberList"
    />

    <el-dialog
      :title="upload.title"
      :close-on-click-modal="false"
      :visible.sync="upload.open"
      width="600px"
      append-to-body
    >
      <el-upload
        ref="upload"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="upload.url"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :on-exceed="handleExceed"
        :auto-upload="false"
        drag
      >
        <i class="el-icon-upload" />
        <div class="el-upload__text">
          {{ '将文件拖到此处，或' }}
          <em>{{ '点击上传' }}</em>
        </div>
        <div slot="tip" class="el-upload__tip" style="color: red">
          {{ '提示：仅允许导入“xls”或“xlsx”格式文件！' }}
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">{{
          '确认'
        }}</el-button>
        <el-button @click="upload.open = false">{{
          '取消'
        }}</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import topBar from '@/components/topBar'
import {
  getMemberList,
  getvertexValue,
  getaccountStatus,
  getsalletStatus,
  getattestation,
  getYesnouploadsList,
  getorderStatus,
  passwordFree,
  passwordFreeLen,
  incomeStatusList,
  serviceStatus,
  getExpirestatus,
  copyPwd
} from '@/api/member'
import {
  getgradeRanglist,
  getAwardsListChiose,
  getRegistration
} from '@/api/level'
import { teamList } from '@/api/business'
import { getRoleMenu } from '@/api/notice'
import { getToken } from '@/utils/auth'
import { areaList } from '@/api/site'
import { isLocals, isLocalSymbol } from '@/utils/numberToCurrency'
export default {
  name: 'Jcyw',
  components: {
    topBar
  },
  data() {
    return {
      loading: false,
      allTxt: {},
      ActivateList: [
        {
          value: 0,
          label: '是'
        },
        {
          value: 1,
          label: '否'
        }
      ],
      regionParams: {
        label: 'name',
        value: 'id',
        children: 'children',
        expandTrigger: 'hover'
      },
      menuList: [
        {
          id: 0,
          text: '全选',
          checked: false
        },
        {
          id: 1,
          text: '推荐编号',
          checked: true,
          prop: 'parMemberCode'
        },
        {
          id: 2,
          text: '推荐姓名',
          checked: true,
          prop: 'parMemberName'
        },
        {
          id: 3,
          text: '注册等级',
          checked: true,
          prop: 'pkRegisterGradeVal'
        },
        {
          id: 4,
          text: '结算等级',
          checked: true,
          prop: 'pkSettleGradeVal'
        },
        {
          id: 5,
          text: '注册金额',
          checked: true,
          prop: 'consumeMoney'
        },
        {
          id: 6,
          text: '注册业绩',
          checked: true,
          prop: 'consumeAchieve'
        },
        {
          id: 7,
          text: '隶属体系',
          checked: true,
          prop: 'vertexName'
        },
        {
          id: 11,
          text: '隶属团队',
          checked: true,
          prop: 'teamName'
        },
        {
          id: 8,
          text: '实名认证',
          checked: true,
          prop: 'isRealNameVal'
        },
        {
          id: 9,
          text: '账户状态',
          checked: true,
          prop: 'accountStatusVal'
        },
        {
          id: 10,
          text: '钱包状态',
          checked: true,
          prop: 'memberAccountVal'
        }
      ],
      upload: {
        // 是否显示弹出层（物流导入）
        open: false,
        // 弹出层标题（物流导入）
        title: '',
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的物流数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: { Authorization: 'Bearer ' + getToken() },
        // 上传的地址
        url:
          process.env.VUE_APP_BASE_API +
          '/member/manager/member/batch-importData'
      },
      moren: 'jcyw',
      topList: [
        {
          name: '会员信息',
          path: 'jcyw'
        }
        // {
        //   name: '订单业务',
        //   path: "ddyw",
        // },
        // {
        //   name: "审核业务",
        //   path: "shyw",
        // },
        // {
        //   name: "在线签呈",
        //   path: "zxqc",
        // },
      ],
      colums: [],
      checkLabels: [],
      checkList: [],
      multipleSelection: [],
      incomeStatusListd: [],
      address: '',
      queryParams: {
        pageNum: 1,
        pageSize: 50,
        memberCode: '', // 会员编号
        memberName: '', // 会员姓名
        phone: '', // 联系方式
        changeNumber: '', // 变更次数
        pkRegisterGrade: '', // 注册等级
        pkSettleGrade: '', // 结算等级
        pkAwards: '', // 真实奖衔
        vertexId: '', // 隶属体系
        teamId: '', // 隶属团队
        registerAuthority: '', // 注册权限
        accountStatus: '', // 账户状态
        memberAccount: '', // 钱包状态
        isRealName: '', // 实名认证
        isBusLicense: '', // 营业执照
        orderSource: '', // 订单状态
        centerMemberCode: '', // 服务中心编号
        centerMemberName: '', // 服务中心姓名
        parMemberCode: '', // 推荐编号
        parMemberName: '', // 推荐姓名
        placeMemberCode: '', // 安置编号
        placeMemberName: '', // 安置姓名
        startDate: '', // 创建时间-开始
        endDate: '', // 创建时间-结束
        startDatePay: '', // 支付时间-开始
        endDatePay: '', // 支付时间-结束
        agentGrade: '', // 代理等级
        incomeStatus: ''
      },
      tableData: [],
      // 折叠搜索框
      isActive: false,
      total: 0,
      gradeRangList: [], // 注册等级
      awardsList: [], // 真实奖衔
      vertexList: [], // 隶属体系
      memberteamList: [], // 隶属团队
      registerList: [], // 注册权限
      accountStatus: [], // 账户状态
      salletStatus: [], // 钱包状态
      tattestation: [], // 实名认证 是否认证
      serviceList: [], // 服务协议
      yesnouploadsList: [], // 营业执照 是否上传
      orderStatusList: [], // 订单状态
      directPushNumber: '', // 修改直推次数
      expireList: []
    }
  },
  computed: {
    canDo() {
      return this.checkList.length > 0
    }
  },
  created() {
    // 查询会员信息
    this.getMemberList()
    this.getgradeRanglist()

    this.getAwardsListChiose()
    this.getvertexValue()
    this.getmemberTeamList()
    this.getRegistration()
    this.getaccountStatus()
    this.getsalletStatus()
    this.getattestation()
    this.getYesnouploadsList()
    this.getorderStatus()
    this.incomeStatusList()
    this.serviceStatus()
    this.getAllArea()
    // 初始化表头
    // this.checkLabels = JSON.parse(
    //   JSON.stringify(Object.keys(this.tableData[0]))
    // )
    // this.colums = JSON.parse(JSON.stringify(Object.keys(this.tableData[0])))
  },
  mounted() {
    this.getUserRole()
  },
  methods: {
    getAllArea() {
      areaList().then((res) => {
        this.areaData = res.data
      })
    },
    flChange(value) {
      this.queryParams.county = ''
      this.queryParams.province = ''
      this.queryParams.city = ''

      this.queryParams.province = value[0]
      this.queryParams.city = value[1]
      this.queryParams.county = value[2]
    },
    getSel(e) {
      console.log(
        '%c [ e ]-1002',
        'font-size:13px; background:#6f02a8; color:#b346ec;',
        e
      )
      // this.$forceUpdate()
      this.$set(this.queryParams, 'incomeStatus', e)
    },
    changeTime1(val) {
      this.queryParams.startDate = val ? val[0] : ''
      this.queryParams.endDate = val ? val[1] : ''
    },
    changeTime2(val) {
      this.queryParams.startDatePay = val ? val[0] : ''
      this.queryParams.endDatePay = val ? val[1] : ''
    },
    changeTime3(val) {
      this.queryParams.startExpireDate = val ? val[0] : ''
      this.queryParams.endExpireDate = val ? val[1] : ''
    },
    getUserRole() {
      getRoleMenu('Member').then((res) => {
        const obj = {}
        res.data.forEach((item) => {
          obj[item] = 1
        })
        this.allTxt = obj
        this.$nextTick(() => {
          this.$refs.table.doLayout()
        })
      })
    },
    // 导出
    handleExport() {
      this.$confirm('是否确认导出所有数据项?', '警告', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then((_) => {
        this.download(
          '/member/manager/member/export',
          { ...this.queryParams },
          `${'会员信息'}}${new Date().getTime()}.xlsx`
        )
      })
    },
    isLocalSymbol,
    isLocals,
    toLogin(row) {
      console.log(row, '......row')
      if (row.systemType == 2) {
        passwordFree({
          memberCode: row.memberCode
        }).then((res) => {
          if (res.code == 200) {
            const href =
              process.env.VUE_APP_ADDRESS1 +
              '?token=' +
              res.data.access_token
            window.open(href, '_blank')
          }
        })
      }
    },
    toLogin1(row) {
      copyPwd({
        pkId: row.pkId
      }).then((res) => {
        if (res.code === 200) {
          const msg = res.data
          this.$confirm('确认删除?', this.$t('提示'), {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            message: msg,
            dangerouslyUseHTMLString: true,
            type: 'info'
          }).then(() => {})
        }
      })
    },
    getMenu(e, id) {
      if (e && id == 0) {
        this.menuList.forEach((item) => {
          this.$set(item, 'checked', true)
        })
      } else if (!e && id == 0) {
        this.menuList.forEach((item) => {
          this.$set(item, 'checked', false)
        })
      }
    },

    // 查询会员信息
    getMemberList() {
      this.loading = true
      getMemberList(this.queryParams).then((res) => {
        this.loading = false
        this.total = res.total
        this.tableData = res.rows
      })
    },
    // 订单状态
    getorderStatus() {
      getorderStatus().then((res) => {
        this.orderStatusList = res.data
      })
    },
    // 营业执照-是否上传
    getYesnouploadsList() {
      getYesnouploadsList().then((res) => {
        this.yesnouploadsList = res.data
      })
    },
    // 认证下拉选
    getattestation() {
      getattestation().then((res) => {
        this.tattestation = res.data
      })
      getExpirestatus().then((res) => {
        this.expireList = res.data
      })
    },
    // 服务协议
    serviceStatus() {
      serviceStatus().then((res) => {
        this.serviceList = res.data
      })
    },
    // 钱包状态下拉选
    getsalletStatus() {
      getsalletStatus().then((res) => {
        this.salletStatus = res.data
      })
    },
    // 账户状态下拉选
    getaccountStatus() {
      getaccountStatus().then((res) => {
        this.accountStatus = res.data
      })
    },
    // 注册权限下拉选
    getRegistration() {
      getRegistration().then((res) => {
        this.registerList = res.data
      })
    },
    // 隶属团队下拉选
    getmemberTeamList() {
      teamList().then((res) => {
        this.memberteamList = res.data
      })
    },
    // 隶属体系下拉选 取pkid和name
    getvertexValue() {
      getvertexValue().then((res) => {
        this.vertexList = res.data
      })
    },
    // 真实奖衔下拉选
    getAwardsListChiose() {
      getAwardsListChiose().then((res) => {
        this.awardsList = res.rows
      })
    },
    // 注册等级下拉
    getgradeRanglist() {
      getgradeRanglist().then((res) => {
        this.gradeRangList = res.data
      })
    },
    // 收益状态
    incomeStatusList() {
      incomeStatusList().then((res) => {
        this.incomeStatusListd = res.data
      })
    },

    // 展开折叠
    changeActive() {
      this.isActive = !this.isActive
    },
    // 重置
    reChongzhi() {
      this.queryParams = {
        pageNum: 1,
        pageSize: 50
      }
      this.address = ''
      this.getMemberList()
    },
    handleSelectionChange(val) {
      this.multipleSelection = val
    },
    /** 导入按钮操作 */
    handleImport() {
      this.upload.title = '批量查询'
      this.upload.open = true
    },
    // 下载模板
    importTemplate() {
      this.download(
        '/member/manager/member/download',
        {},
        `${'会员信息'}${new Date().getTime()}.xlsx`
      )
    },
    // 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true
    },
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      var fileName = response.fileName
      if (fileName != undefined && fileName != '') {
      }
      if (response.code == 200) {
        this.download(
          '/member/manager/member/export',
          { memberCodeStr: response.msg },
          `${'会员信息'}}${new Date().getTime()}.xlsx`
        )
      }
      this.upload.open = false
      this.upload.isUploading = false
      this.$refs.upload.clearFiles()
      const str = ''
      //  let data = response.msg.split(',')
      //  data.forEach((item) => {
      //        item = item + ";";
      //        str += `<div>${item}</div>`;
      //    });
      this.$alert('', '上传成功', {
        dangerouslyUseHTMLString: true
      })
      // this.getList();
    },
    // 上传文件数量超出后的动作
    handleExceed() {
      this.upload.isUploading = false
      this.msgInfo('仅可上传一个文件哦')
    },
    // 提交上传文件
    submitFileForm() {
      this.$refs.upload.submit()
    },
    tableRowClassName({ row, rowIndex }) {
      if (rowIndex % 2 == 1) {
        return 'warning-row'
      } else if (rowIndex % 2 == 0) {
        return 'success-row'
      }
      return ''
    }
  }
}
</script>

<style lang="scss" scoped>
.kuang {
  padding: 5px 20px;
  background: rgba(255, 255, 255, 0);
  border-radius: 4px;
  border: 1px solid #cccccc;
}
.heji {
  margin-top: 10px;
  .dis {
    display: flex;
    justify-content: right;
    padding: 5px 10px;
    font-size: 14px;
    color: #333333;
    :nth-child(1) {
      font-size: 14px;
      font-weight: bold;
      color: #333333;
      margin-right: 20px;
    }
  }
}

::v-deep .el-input__inner {
  height: 32px;
  line-height: 32px;
}
::v-deep .el-date-editor .el-range__close-icon {
  margin-top: -10px;
}
::v-deep .el-date-editor .el-range-separator {
  margin-top: -10px;
}
::v-deep .el-date-editor .el-range__icon {
  margin-top: -10px;
}
::v-deep .el-button {
  padding: 8px 20px;
}
::v-deep .el-form-item {
  margin-bottom: 10px;
}
::v-deep .el-table .warning-row {
  background: #f9f9f9;
}

::v-deep .el-table .success-row {
  background: #ffffff;
}
::v-deep .el-table thead {
  color: #000000;
}
.openClose {
  margin-top: 10px;
  margin-right: 10px;
  color: #666666;
  text-align: center;
}
.page {
  padding: 10px 20px 0 20px;
  background: #f9f9f9;
  font-size: 14px;
  .thetopbox {
    padding: 0px 0;
    background: #ffffff;
    border-radius: 8px;
    .searchbox {
      display: flex;
      align-items: center;
      .searchtitle {
        margin-right: 10px;
      }
      .searchbtn {
        width: 68px;
        background: #c8161d;
        color: #ffffff;
      }
    }
  }
  .maintop {
    display: flex;
    padding: 0px 0;
    justify-content: space-between;
    align-items: center;
    .mainbtn {
      display: flex;
      // justify-content: space-between;
      align-content: center;
      width: 100%;
      .thebtn1 {
        color: #ffffff;
        background: #3181e5;
      }
      .thebtn2 {
        color: #ffffff;
        background: #ffad41;
      }
    }
  }
  .main {
    // margin-top: 20px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0px 2px 20px 0px rgba(238, 238, 238, 0.5);
    .maintable {
      overflow: auto;
    }
  }
}
::v-deep .el-date-editor.el-input,
.el-date-editor.el-input__inner {
  width: 100%;
}
</style>
