<template>
  <div class="blindDateUsersList">
    <div class="head-title">
      用户管理

      <el-button @click="getCkedData" style="float: right; margin-top: -5px" size="small" type="primary">批量设置分组
      </el-button>
      <el-button @click="dialogVisible = true" style="float: right; margin: -5px 10px 0 0" size="small" type="primary">批量导出
      </el-button>
      <el-button @click="addusers()" style="float: right; margin-top: -5px; margin-right: 10px" size="small"
        type="primary">新增
      </el-button>
      <el-button @click="quanxian(0)" style="float: right; margin-top: -5px; margin-right: 10px" size="small"
        type="primary">发帖权限关闭
      </el-button>
      <el-button @click="quanxian(1)" style="float: right; margin-top: -5px; margin-right: 10px" size="small"
        type="primary">发帖权限开启
      </el-button>
    </div>
    <div class="content">
      <div style="display: flex; align-items: center; flex-wrap: wrap">
        <el-select class="w100" @change="(msg.pageIndex = 1), getList()" style="margin-right: 10px; margin-bottom: 10px"
          v-model="msg.MemberGrade" size="small" placeholder="请选择">
          <el-option label="全部会员" :value="0"></el-option>
          <el-option v-for="item in memberGradeList" :key="item.Id" :label="item.Name" :value="item.Id">
          </el-option>
        </el-select>
        <el-select class="w100" @change="(msg.pageIndex = 1), getList()" style="margin-right: 10px; margin-bottom: 10px"
          v-model="msg.Source" size="small" placeholder="请选择">
          <el-option label="全部平台" :value="0"></el-option>
          <el-option v-for="item in platList" :key="item.Id" :label="item.Name" :value="item.Id">
          </el-option>
        </el-select>
        <div class="searchInput" style="width: 150px">
          <el-input @keyup.enter.native="(msg.pageIndex = 1), getList()" @clear="(msg.pageIndex = 1), getList()"
            style="display: inline-block; width: 125px; height: 30px" placeholder="请输入ID" v-model="msg.Id" size="small"
            clearable>
          </el-input>
          <span @click="(msg.pageIndex = 1), getList()" class="el-icon-search" style="
              color: #979dad;
              font-size: 14px;
              position: relative;
              top: 1px;
            "></span>
        </div>
        <div class="searchInput" style="width: 150px">
          <el-input @keyup.enter.native="(msg.pageIndex = 1), getList()" @clear="(msg.pageIndex = 1), getList()"
            style="display: inline-block; width: 125px; height: 30px" placeholder="请输入昵称" v-model="msg.Name"
            size="small" clearable>
          </el-input>
          <span @click="(msg.pageIndex = 1), getList()" class="el-icon-search" style="
              color: #979dad;
              font-size: 14px;
              position: relative;
              top: 1px;
            "></span>
        </div>
        <div class="searchInput" style="width: 150px">
          <el-input @keyup.enter.native="(msg.pageIndex = 1), getList()" @clear="(msg.pageIndex = 1), getList()"
            style="display: inline-block; width: 125px; height: 30px" placeholder="请输入手机号" v-model="msg.Moblie"
            size="small" clearable>
          </el-input>
          <span @click="(msg.pageIndex = 1), getList()" class="el-icon-search" style="
              color: #979dad;
              font-size: 14px;
              position: relative;
              top: 1px;
            "></span>
        </div>
        <el-date-picker v-model="dateList" @change="(msg.pageIndex = 1), getList()"
          style="margin-bottom: 10px; margin-right: 20px" size="small" type="datetimerange" range-separator="至"
          value-format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期" end-placeholder="结束日期">
        </el-date-picker>
        <div style="
            display: flex;
            align-items: center;
            margin-bottom: 10px;
            margin-right: 20px;
          ">
          <span style="margin-right: 5px">学历</span>
          <el-select class="w100" @change="(msg.pageIndex = 1), getList()" style="margin-right: 10px"
            v-model="msg.EducationType" size="small" placeholder="请选择">
            <el-option label="不限" :value="0"></el-option>
            <el-option v-for="item in EducationList" :key="item.Id" :label="item.Name" :value="item.Id">
            </el-option>
          </el-select>
        </div>
        <div style="
            display: flex;
            align-items: center;
            margin-bottom: 10px;
            margin-right: 20px;
          ">
          <span style="margin-right: 5px">婚姻</span>
          <el-select class="w100" @change="(msg.pageIndex = 1), getList()" style="margin-right: 10px"
            v-model="msg.Marriage" size="small" placeholder="请选择">
            <el-option label="不限" :value="0"></el-option>
            <el-option v-for="item in MarriageList" :key="item.Id" :label="item.Name" :value="item.Id">
            </el-option>
          </el-select>
        </div>
        <div style="
            display: flex;
            align-items: center;
            margin-bottom: 10px;
            margin-right: 20px;
          ">
          <span style="margin-right: 5px">房产</span>
          <el-select class="w100" @change="(msg.pageIndex = 1), getList()" style="margin-right: 10px"
            v-model="msg.HouseInfo" size="small" placeholder="请选择">
            <el-option label="不限" :value="0"></el-option>
            <el-option v-for="item in HouseList" :key="item.Id" :label="item.Name" :value="item.Id">
            </el-option>
          </el-select>
        </div>
        <div style="
            display: flex;
            align-items: center;
            margin-bottom: 10px;
            margin-right: 20px;
          ">
          <span style="margin-right: 5px">车产</span>
          <el-select class="w100" @change="(msg.pageIndex = 1), getList()" style="margin-right: 10px"
            v-model="msg.CarInfo" size="small" placeholder="请选择">
            <el-option label="不限" :value="0"></el-option>
            <el-option v-for="item in CarInfoList" :key="item.Id" :label="item.Name" :value="item.Id">
            </el-option>
          </el-select>
        </div>
        <div style="display: flex;align-items: center;margin-bottom: 10px;margin-right: 20px;">
          <span style="margin-right: 5px">分组</span>
          <el-select v-model="msg.GroupIdList" @change="(msg.pageIndex = 1), getList()" multiple class="w300" size="small">
            <el-option v-for="item in groupArray" :key="item.GroupId" :label="item.GroupName" :value="item.GroupId">
            </el-option>
          </el-select>
        </div>
      </div>
      <div style="margin-top: 10px; display: flex; flex-wrap: wrap">
        <div style="display: flex; align-items: center">
          年龄{{ ages[0] }}-{{ ages[1] }}岁
          <div class="block" style="width: 200px; margin-left: 15px">
            <el-slider v-model="ages" range @change="(msg.pageIndex = 1), getList()" :max="100">
            </el-slider>
          </div>
        </div>
        <div style="display: flex; align-items: center; margin-left: 25px">
          身高{{ Heights[0] }}-{{ Heights[1] }}cm
          <div class="block" style="width: 200px; margin-left: 15px">
            <el-slider v-model="Heights" range @change="(msg.pageIndex = 1), getList()" :max="230">
            </el-slider>
          </div>
        </div>
        <div style="display: flex; align-items: center; margin-left: 25px">
          体重{{ Weights[0] }}-{{ Weights[1] }}kg
          <div class="block" style="width: 200px; margin-left: 15px">
            <el-slider v-model="Weights" range @change="(msg.pageIndex = 1), getList()" :max="200">
            </el-slider>
          </div>
        </div>
        <div style="display: flex; align-items: center; margin-left: 25px">
          年收入{{ YearMoeys[0] }}-{{ YearMoeys[1] }}万
          <div class="block" style="width: 300px; margin-left: 15px">
            <el-slider v-model="YearMoeys" range @change="(msg.pageIndex = 1), getList()" :max="500">
            </el-slider>
          </div>
        </div>
      </div>
      <el-table :data="tableData" v-loading="loading" border style="width: 100%; margin: 20px 0"
        @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55" :selectable="checkSelectable"></el-table-column>
        <el-table-column prop="Id" label="ID" width="100"> </el-table-column>
        <el-table-column prop="address" width="280" label="头像">
          <template slot-scope="scope">
            <div class="app-image" :style="{
                backgroundImage: 'url(' + scope.row.Photo + ')',
                backgroundSize: 'cover',
              }"></div>
            <div flex="dir:left cross:center">
              {{ scope.row.Name }}
              <span v-if="scope.row.AliasName && scope.row.AliasName != ''"
                class="remark_name">备注名:{{ scope.row.AliasName }}</span>
            </div>
            <img v-if="scope.row.Source == 1" style="width: 24px; height: 24px" src="../../assets/img/userman/wx.png"
              alt="" class="platform-img" />
            <button type="button" class="el-button el-button--success" style="float: right; padding: 5px !important">
              <span @click="ChangeOpenidState(scope.$index, scope.row)">显示OpenId</span>
            </button>
            <div v-show="scope.row.OpenIdState">{{ scope.row.OpenId }}</div>
            <div v-if="scope.row.WechatNo!=''">微信号:{{scope.row.WechatNo}}</div>
            <div v-if="scope.row.Moblie!=''">手机号码:{{scope.row.Moblie}}</div>
          </template>
        </el-table-column>
        <el-table-column label="会员类型">
          <template slot-scope="scope">
            <span>{{ scope.row.MemberGradeName }}
              <span>
                <el-tag v-if="scope.row.UserPageTypeStr == '全部'" size="mini">{{ scope.row.UserPageTypeStr }}</el-tag>
                <el-tag v-if="scope.row.UserPageTypeStr == '商城'" type="success" size="mini">
                  {{ scope.row.UserPageTypeStr }}</el-tag>
                <el-tag v-if="scope.row.UserPageTypeStr == '校园'" type="danger" size="mini">
                  {{ scope.row.UserPageTypeStr }}</el-tag>
              </span>
            </span>
          </template>
        </el-table-column>

        <el-table-column prop="SuperiorName" label="上级" width="150"></el-table-column>
        <el-table-column prop="BelongGroupList" label="所在分组" width="200">
          <template slot-scope="scope">
            <el-tag v-for="(item,index) in scope.row.BelongGroupList" style="margin-right:5px;" size="small" :key="index">{{item.GroupName}}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="LookGroupList" label="可以查看的分组" width="200">
          <template slot-scope="scope">
            <el-tag v-for="(item,index) in scope.row.LookGroupList" style="margin-right:5px;" size="small" :key="index">{{item.GroupName}}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="Age" label="基础资料" width="120">
          <template slot-scope="scope">
            <div>年龄:{{scope.row.Age}}岁</div>
            <div>身高:{{ scope.row.Height }}cm</div>
            <div>体重:{{ scope.row.Weight }}kg</div>
          </template>
        </el-table-column>

        <el-table-column prop="EducationTypeStr" label="学历"></el-table-column>
        <el-table-column prop="MarriageStr" label="婚姻"></el-table-column>
        <el-table-column prop="Age" label="资产" width="120">
          <template slot-scope="scope">
            <div>房产:{{scope.row.HouseInfoStr}}</div>
            <div>车产:{{ scope.row.CarInfoStr }}</div>
          </template>
        </el-table-column>
        <el-table-column prop="Age" label="是否认证">
          <template slot-scope="scope">
            <!-- <span v-if="scope.row.BaseInfoId>0" style="color:#409EFF">认证</span>
            <span v-if="scope.row.BaseInfoId==0" style="color:#F56C6C">未认证</span> -->
            <el-tag effect="dark" size="mini" v-if="scope.row.BaseInfoId>0">认证</el-tag>
            <el-tag type="danger" size="mini" effect="dark" v-if="scope.row.BaseInfoId==0">未认证</el-tag>
          </template>
        </el-table-column>
        <!-- <el-table-column prop="HouseInfoStr" label="房产"></el-table-column>
        <el-table-column prop="CarInfoStr" label="车产"></el-table-column> -->
        <el-table-column prop="Number" label="星星点数" style="font-size: 11px">
          <template slot-scope="scope">
            <div>
              <span style="font-size: 11px">
                {{ scope.row.PointNum }}
              </span>
              <el-tooltip class="item" effect="dark" content="修改星星点数" placement="top">
                <img @click="editGoods(scope.row, scope.$index)" src="../../assets/img/userman/edit1.png" alt="" />
              </el-tooltip>
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="CarInfoStr" label="发帖权限">

          <template slot-scope="scope">
            <el-switch v-model="scope.row.IsFaTie" @change="ChangeEnabled(scope.row)" active-color="#409EFF"
              :active-value="1" :inactive-value="0" :disabled='scope.row.BaseInfoId==0?true:false'>
            </el-switch>
            <!-- <div v-if="scope.row.IsFaTie==0">关闭</div>
            <div v-if="scope.row.IsFaTie==1">开启</div> -->
          </template>
        </el-table-column>

        <el-table-column prop="CreateDate" width="150" label="加入时间"></el-table-column>

        <el-table-column prop="address" width="140" label="操作" fixed="right">
          <template slot-scope="scope">
            <el-tooltip class="item" effect="dark" content="编辑" placement="top">
              <img @click="EditgoUrl(scope.row)" style="width: 32px; height: 32px"
                src="../../assets/img/userman/edit.png" alt="" />
            </el-tooltip>

            <el-tooltip class="item" effect="dark" content="二维码" placement="top">
              <img @click="showQRcode(scope.row)" style="width: 32px; height: 32px"
                src="../../assets/img/userman/QRcode.png" alt="" />
            </el-tooltip>

            <el-tooltip class="item" effect="dark" content="查看详情" placement="top">
              <img @click="showDetail(scope.row)" style="width: 32px; height: 32px"
                src="../../assets/img/userman/icon-show.png" alt="" />
            </el-tooltip>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination style="text-align: right" background @current-change="handleCurrentChange"
        :page-size="msg.pageSize" :current-page.sync="msg.pageIndex" layout="total,prev, pager, next" :total="total">
      </el-pagination>
    </div>
    <!-- 选择导出信息 -->
    <el-dialog title="选择导出信息" :visible.sync="dialogVisible" width="960px">
      <el-form style="border: 1px solid #f0f2f7" :model="addMsg" ref="addMsg" label-width="100px">
        <div style="
            box-sizing: border-box;
            background-color: #f3f5f6;
            width: 100%;
            padding-left: 20px;
            height: 50px;
            line-height: 50px;
          ">
          <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选
          </el-checkbox>
        </div>
        <div style="margin: 15px 0"></div>
        <div style="padding: 10px 25px 20px">
          <el-checkbox-group v-model="checkedCities" @change="handleCheckedCitiesChange">
            <el-checkbox style="margin-bottom: 10px; width: 135px" v-for="city in cities" :label="city.Id"
              :key="city.Name">
              {{ city.Name }}</el-checkbox>
          </el-checkbox-group>
        </div>
      </el-form>
      <div style="text-align: right; margin-top: 20px">
        <el-button size="small" type="primary" @click="Export">导出</el-button>
      </div>
    </el-dialog>

    <!-- 修改星星数 -->
    <el-dialog title="修改星星数" :visible.sync="Egoods" width="600px" :close-on-click-modal="false">
      <div>
        <el-form :model="modifyobj" :rules="rules" ref="modifyobj" label-width="150px">
          <el-form-item label="修改模式">
            <el-radio v-model="modifyobj.IsAdd" :label="1">增加</el-radio>
            <el-radio v-model="modifyobj.IsAdd" :label="2">减少</el-radio>
          </el-form-item>
          <el-form-item label="原始星星数">
            <span>{{ PNum }}</span>
          </el-form-item>
          <el-form-item label="修改星星数">
            <el-input v-model="modifyobj.PonitNum" style="width: 260px" size="small" :min="0" type="number"
              placeholder="请输入星星数"></el-input>
          </el-form-item>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="Egoods = false">关 闭</el-button>
        <el-button size="small" type="primary" @click="setUpdatePointNum()">修 改</el-button>
      </span>
    </el-dialog>
    <!-- 充值积分 -->
    <el-dialog title="二维码" :visible.sync="qrshow" width="600px">
      <div style="display: flex; align-items: center; justify-content: center">
        <el-image style="width: 200px; height: 200px" :src="qrcodeImg"></el-image>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="qrshow = false">关 闭</el-button>
      </span>
    </el-dialog>

    <el-dialog title="查看详情" :visible.sync="detailShow" width="800px">
      <detail :detailData="detailData" />
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="detailShow = false">关 闭</el-button>
      </span>
    </el-dialog>
    
    <!-- 批量设置分组 -->
    <el-dialog title="批量设置分组" :visible.sync="isShowGroup" width="400px">
      <el-form>
        <el-form-item label="分组">
          <el-select v-model="groupMsg.BelongGroupIdList" multiple style="width:320px" size="small">
            <el-option v-for="item in groupArray" :key="item.GroupId" :label="item.GroupName" :value="item.GroupId">
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="isShowGroup = false">关 闭</el-button>
        <el-button size="small" type="primary" @click="saveGroup()">保 存</el-button>
      </span>
    </el-dialog>
    
  </div>
</template>
<script>
  import ChooseImg from "@/components/global/ChooseImg.vue";
  import detail from "./components/seeDetail";
  export default {
    components: {
      ChooseImg,
      detail,
    },
    data() {
      return {
        czType: 1,
        changeState: false,
        Egoods: false,
        loading: false,
        checkAll: false,
        checkedCities: [],
        cities: [],
        cityOptions: [],
        isIndeterminate: false,
        dialogVisible: false,
        value: "",
        options: [],
        tableData: [],
        msg: {
          pageIndex: 1,
          pageSize: 15,
          Name: "",
          Source: 0,
          MemberGrade: 0,
          Id: "",
          Moblie: "",
          StartTime: "",
          EndTime: "",
          Age: 0,
          EndAge: 0,
          Height: 0,
          EndHeight: 0,
          Weight: 0,
          EndWeight: 0,
          YearMoney: 0,
          EndYearMoney: 0,
          CarInfo: 0,
          HouseInfo: 0,
          EducationType: 0,
          Marriage: 0,
          GroupIdList:[]
        },
        ages: [0, 0], //年龄
        Heights: [0, 0], //身高
        Weights: [0, 0], //体重
        YearMoeys: [0, 0], //年收入
        total: 0,
        platList: [],
        memberGradeList: [],
        rules: {
          Type: [{
            required: true,
            message: "请选择类型",
            trigger: "change",
          }, ],
          Integral: [{
            required: true,
            message: "请输入积分",
            trigger: "blur",
          }, ],
        },
        addMsg: {
          MallBaseId: 0,
          Type: 1,
          UserId: 0,
          Integral: 0,
          Image: "",
          Description: "",
        },
        dateList: [],
        qrcodeImg: "",
        qrshow: false,
        //查看详情
        detailData: {},
        detailShow: false,
        EducationList: [], //学历
        MarriageList: [], //婚姻
        HouseList: [], //房子情况
        CarInfoList: [], //车子情况
        modifyobj: {
          UserId: 0,
          IsAdd: 1,
          PonitNum: 0,
        },
        PNum: 0,
        quanxianMsg: {
          UserIds: '',
          IsFaTie: 0,
        },
        groupArray:[],
        isShowGroup:false, //批量设置分组
        groupMsg:{
          BelongGroupIdList:[],
          UserIds:""
        },
        //选中的数据
        selectedData:[]
      };
    },
    created() {
      this.getList();
      this.getplat();
      this.getDown();
      this.GetMemberGradeList();
      this.addMsg.MallBaseId = this.getLocalStorage().MallBaseId;

      this.GetEducationTypeEnumList(); //学历
      this.GetMarriageEnumList(); //婚姻
      this.GetHouseInfoEnumList(); //房子情况
      this.GetCarInfoEnumList(); //车子情况
      this.getgroupList();
    },
    methods: {
      editGoods(obj, index) {
        this.Egoods = true;
        this.modifyobj.UserId = obj.Id;
        this.modifyobj.IsAdd = 1;
        this.modifyobj.PonitNum = 0;
        this.PNum = obj.PointNum;
      },
      setUpdatePointNum() {
        if (this.modifyobj.PonitNum == 0 || this.modifyobj.PonitNum == "") {
          this.Error("修改星星数量必须大于0");
          return;
        }
        if (this.modifyobj.IsAdd == 2 && this.modifyobj.PonitNum > this.PNum) {
          this.Error("减少数量不能大于原始数量");
          return;
        }
        this.apipost("/api/miai/UpdatePointNum", this.modifyobj, (res) => {
          if (res.data.resultCode == 1) {
            this.Success(res.data.message)
            this.getList();
            this.Egoods = false;
          } else {
            this.Error(res.data.message);
          }
        });
      },
      EditgoUrl(row) {
        this.$router.push({
          name: "blindDateUsersListEdit",
          query: {
            UserId: row.Id,
            blank: "y",
          },
        });
      },
      addusers() {
        this.$router.push({
          name: "addblindDateuser",
          query: {
            blank: "y",
          },
        });
      },

      showQRcode(row) {
        this.apipost(
          "/api/user/GetWeiXinQRCodeForHT", {
            Path: "/pages/index/index?user_id=" + row.Id,
            With: 212
          },
          (res) => {
            if (res.data.resultCode == 1) {
              if (res.data.data) {
                this.qrcodeImg = this.domainManager().DomainUrl + res.data.data;
                this.qrshow = true;
              }
            } else {
              this.Error(res.data.message);
            }
          }
        );
      },
      checkSelectable(row) { //判断是否可以选择
        return row.BaseInfoId > 0
      },
      handleSelectionChange(val) {
        let data = [];
        this.quanxianMsg.UserIds = '',
          val.map(x => {
            data.push(x.Id)
          })
        this.quanxianMsg.UserIds = data.join(',')
        this.selectedData = val;
      },
      quanxian(type) {
        if (this.quanxianMsg.UserIds == '') {
          this.Error('选择要设置的用户')
          return
        }
        this.apipost(
          "/api/Miai/UpdateFaTie", {
            UserIds: this.quanxianMsg.UserIds,
            IsFaTie: type
          },
          (res) => {
            if (res.data.resultCode == 1) {
              this.Success(res.data.message)
              this.getList();
            } else {
              this.Error(res.data.message);
            }
          }
        );

      },
      ChangeEnabled(row) {
        this.apipost(
          "/api/Miai/UpdateFaTie", {
            UserIds: row.Id,
            IsFaTie: row.IsFaTie
          },
          (res) => {
            if (res.data.resultCode == 1) {
              this.Success(res.data.message)
              this.getList();
            } else {
              this.Error(res.data.message);
              this.getList();
            }
          }
        );
      },

      openChangeDig() {
        this.changeState = true;
        setTimeout(() => {
          this.$refs.mychild.InitData(this.czType);
        }, 10);
      },
      Export() {
        this.msg.ExcelEnumIds = this.checkedCities;
        let msg = JSON.parse(JSON.stringify(this.msg));
        if (!msg.Id || msg.Id == "") {
          msg.Id = 0;
        }
        this.GetLocalFile(
          "/api/MiAi/GetMemberUserListToExcel",
          msg,
          "用户管理.xls"
        );
      },
      ChangeOpenidState(index, row) {
        this.tableData[index].OpenIdState = !this.tableData[index].OpenIdState;
      },
      getList() {
        this.loading = true;
        let msg = JSON.parse(JSON.stringify(this.msg));
        if (!msg.Id || msg.Id == "") {
          msg.Id = 0;
        }

        if (this.dateList && this.dateList.length > 0) {
          msg.StartTime = this.dateList[0];
          msg.EndTime = this.dateList[1];
          this.msg.StartTime = this.dateList[0];
          this.msg.EndTime = this.dateList[1];
        } else {
          msg.StartTime = "";
          msg.EndTime = "";
          this.msg.StartTime = "";
          this.msg.EndTime = "";
        }
        msg.Age = this.ages[0];
        msg.EndAge = this.ages[1];

        msg.Height = this.Heights[0];
        msg.EndHeight = this.Heights[1];

        msg.Weight = this.Weights[0];
        msg.EndWeight = this.Weights[1];

        msg.YearMoney = this.YearMoeys[0];
        msg.EndYearMoney = this.YearMoeys[1];
        this.apipost("/api/Miai/GetMemberUserPageList", msg, (res) => {
          this.loading = false;
          if (res.data.resultCode == 1) {
            this.total = res.data.data.count;
            let pageData = res.data.data.pageData;
            pageData.forEach((item) => {
              item.OpenIdState = false;
            });
            this.tableData = pageData;
          }
        });
      },
      getDown() {
        this.cityOptions = [];
        this.apipost("/api/MiAi/GetMiAiUserExportList", {}, (res) => {
          this.cities = res.data.data;
          let data = res.data.data;
          data.forEach((item) => {
            this.cityOptions.push(item.Id);
          });
        });
      },
      GetMemberGradeList() {
        let msg = {
          Grade: 0,
          Name: "",
          Enabled: 1,
        };
        this.apipost("/api/user/GetMemberGradeList", msg, (res) => {
          this.memberGradeList = res.data.data;
        });
      },
      getplat() {
        this.apipost("/api/user/GetMemberUserSourceEnumList", {}, (res) => {
          this.platList = res.data.data;
        });
      },
      GetEducationTypeEnumList() {
        //学历
        this.apipost("/api/Miai/GetEducationTypeEnumList", {}, (res) => {
          this.EducationList = res.data.data;
        });
      },
      GetMarriageEnumList() {
        //婚姻
        this.apipost("/api/Miai/GetMarriageEnumList", {}, (res) => {
          this.MarriageList = res.data.data;
        });
      },
      GetHouseInfoEnumList() {
        //房子情况
        this.apipost("/api/Miai/GetHouseInfoEnumList", {}, (res) => {
          this.HouseList = res.data.data;
        });
      },
      GetCarInfoEnumList() {
        //车子情况
        this.apipost("/api/Miai/GetCarInfoEnumList", {}, (res) => {
          this.CarInfoList = res.data.data;
        });
      },
      handleCheckAllChange(val) {
        this.checkedCities = val ? this.cityOptions : [];
        this.isIndeterminate = false;
      },
      handleCheckedCitiesChange(value) {
        let checkedCount = value.length;
        this.checkAll = checkedCount === this.cities.length;
        this.isIndeterminate =
          checkedCount > 0 && checkedCount < this.cities.length;
      },
      handleCurrentChange(val) {
        this.msg.pageIndex = val;
        this.getList();
      },
      //详情页
      showDetail(row) {
        let msg = {
          UserId: row.Id,
        };
        this.apipost("/api/Miai/GetMiAiBaseIfo", msg, (res) => {
          if (res.data.resultCode == 1) {
            this.detailData = res.data.data;
            this.detailShow = true;
          } else {
            this.$message({
              message: res.data.message,
              type: "warning",
            });
          }
        });
      },
      //获取分组下来列表
      getgroupList() {
        this.apipost("/api/User/GetMemberGroupList", {}, res => {
          if (res.data.resultCode == 1) {
            this.groupArray = res.data.data;
          }
        });
      },
      //点击批量设置分组
      getCkedData(){
        if(this.selectedData.length==0){
          this.Error('请选择需要设置的数据');
        }else{
          this.isShowGroup=true;
          this.groupMsg.BelongGroupIdList=[];
        }
      },
      //批量保存分组
      saveGroup(){
        let data = [];
        this.groupMsg.UserIds = '',
          this.selectedData.map(x => {
            data.push(x.Id)
          })
        this.groupMsg.UserIds = data.join(',')
        this.apipost("/api/Miai/BatchSetMemberGroup", this.groupMsg , res => {
          if (res.data.resultCode == 1) {
            this.Success(res.data.message);
            this.getList();
            this.isShowGroup=false;
          }
        });
      }
    },
    mounted() {},
  };

</script>
<style>
  .blindDateUsersList .remark_name {
    color: #888888;
    font-size: 12px;
    margin-left: 10px;
    float: right;
  }

  .blindDateUsersList .app-image {
    background-position: center center;
    width: 50px;
    height: 50px;
    border-radius: 0%;
    float: left;
    margin-right: 8px;
  }

  .blindDateUsersList .blue {
    color: #409eff;
  }

  .blindDateUsersList .content .searchInput {
    border: 1px solid #dcdfe6;
    border-radius: 4px;
  }

  .blindDateUsersList .content .searchInput .el-input__inner {
    border: none;
    outline: none;
    height: 30px;
    line-height: 30px;
  }

  .blindDateUsersList .content .searchInput {
    line-height: normal;
    display: inline-table;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    width: 250px;
    margin-right: 20px;
    margin-bottom: 10px;
  }

  .blindDateUsersList .content {
    background: #fff;
    margin-top: 10px;
    padding: 20px;
    box-sizing: border-box;
  }

</style>