    <template>
      <div class="app-container calendar-list-container">
        <el-form label-position="right" label-width="100px"  style='width:100%;'>
          <el-row :gutter="24">
            <el-col :xs="23" :sm="23" :md="12" :lg="6" :xl="6">
              <div class="grid-content bg-purple" >
                <el-form-item  :label="$t('dc.wv_phone')" >
                  <div class="block">
                   <el-input style="width: 100%;" class="filter-item"
                      v-model="seachQuery.wv_phone" :maxlength = "20">
                  </el-input>
                  </div>
                </el-form-item>
              </div>
          </el-col>
          <el-col :xs="23" :sm="23" :md="11" :lg="6" :xl="6">
            <div class="grid-content bg-purple" >
              <el-form-item  :label="$t('dc.wv_gradeid')" >
                <div class="block">
                  <el-select class="filter-item" v-model="seachQuery.wv_gradeid" style="width: 100%;">
                    <el-option v-for="item in gradeOptions" :key="item.value" :label="item.label" :value="item.value">
                    </el-option>
                  </el-select>
                </div>
              </el-form-item>
            </div>
          </el-col>
          <el-col :xs="23" :sm="23" :md="12" :lg="6" :xl="6">
            <div class="grid-content bg-purple" >
              <el-form-item  :label="$t('dc.consultant')" >
                <div class="block">
                  <el-select class="filter-item" v-model="seachQuery.wv_consultant" style="width: 100%;">
                    <el-option v-for="item in consultantOptions" :key="item.id" :label="item.name" :value="item.id">
                    </el-option>
                  </el-select>
                </div>
              </el-form-item>
            </div>
          </el-col>
          <el-col :xs="23" :sm="23" :md="11" :lg="5" :xl="5">
              <div class="grid-content bg-purple" >
                <el-form-item  :label="$t('dc.dc_channel')" >
                  <div class="block">
                  <el-select class="filter-item" v-model="seachQuery.dc_channel" style="width: 100%;">
                    <el-option v-for="item in channelOptions" :key="item.id" :label="item.dc_name" :value="item.id">
                    </el-option>
                  </el-select>
                  </div>
                </el-form-item>
              </div>
          </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :xs="23" :sm="23" :md="12" :lg="6" :xl="6">
              <div class="grid-content bg-purple" >
                <el-form-item  :label="$t('table.truename')" >
                  <div class="block">
                   <el-input style="width: 100%;" class="filter-item"
                      v-model="seachQuery.wv_name" :maxlength = "20">
                  </el-input>
                  </div>
                </el-form-item>
              </div>
          </el-col>
          </el-row>
           <el-row :gutter="24" style="margin-bottom:15px;">
          <el-col :span="24">
              <div  align="center" > <el-button class="filter-item" type="primary" v-waves :loading ="buttonloading" icon="el-icon-search" @click="handleFilterfirst">
            {{$t('table.search')}}
          </el-button>
          <el-button class="filter-item" type="primary" v-waves icon="el-icon-delete" @click="handleref">
            {{$t('table.cancel')}}
          </el-button>
          <el-button class="filter-item" type="primary" icon="document" @click="handleDownload" :loading="downloadLoading">{{$t('excel.export')}} excel</el-button>
          <el-button class="filter-item" type="primary" icon="document" @click="auditingDCShow">介绍人开通</el-button>
          <span style="margin-left:8px;" v-if="openingDC == true">
            <el-button type="primary" :loading ="buttonloading" @click="addDCRelationShip">介绍人关联</el-button>
          </span>
          </div>
          </el-col>
          </el-row>
        </el-form>
        <el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="加载中......" border fit
                  highlight-current-row
                  style="width: 100%">
          <el-table-column align="center" :label="$t('dc.wv_phone')" width="110">
            <template slot-scope="scope">
                <a href="#" @click="infoshow(scope.row.wv_phone)"><span style="color:#409EFF">{{scope.row.wv_phone}}</span></a>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('table.truename')">
            <template slot-scope="scope">
              <span>{{scope.row.wv_name}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('dc.wv_gradeid')">
            <template slot-scope="scope">
              <span  v-if="scope.row.wv_gradeid === 1" >银牌</span>
              <span  v-else-if="scope.row.wv_gradeid === 2" >金牌</span>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('dc.wv_status')">
            <template slot-scope="scope">
              <span  v-if="scope.row.wv_status === 1" >正常</span>
              <span  v-else-if="scope.row.wv_status === 0" >停用</span>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('dc.dc_channel')">
            <template slot-scope="scope">
              <span>{{scope.row.dc_channel_name}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('dc.wv_Introduction_total')">
              <template slot-scope="scope" align="right">
              <div style="width:100%;text-align:right;"><span>{{scope.row.wv_Introduction_total|numFilter}}</span></div>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('dc.wv_Introduction_count')">
            <template slot-scope="scope">
              <span>{{scope.row.wv_Introduction_count}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('dc.wv_people_count')">
            <template slot-scope="scope">
              <span>{{scope.row.wv_people_count}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('dc.wv_register_count')">
            <template slot-scope="scope">
              <span>{{scope.row.wv_register_count}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('dc.wv_contract_count')">
            <template slot-scope="scope">
              <span>{{scope.row.wv_contract_count}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('dc.wv_finish_count')">
            <template slot-scope="scope">
              <span>{{scope.row.wv_finish_count}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('dc.wv_withdraw_total')">
            <template slot-scope="scope" align="right">
              <div style="width:100%;text-align:right;"><span>{{scope.row.wv_withdraw_total|numFilter}}</span></div>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('dc.wv_extract_count')">
            <template slot-scope="scope">
              <span>{{scope.row.wv_extract_count}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('dc.wv_consultant')" width="98">
            <template slot-scope="scope">
              <span>{{scope.row.wv_consultantname}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('table.actions')" width="70" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <a href="#" @click="hrefordertempedit(scope.row)"><el-tag >{{$t('table.edit')}}</el-tag></a>
          </template>
        </el-table-column>
        </el-table>
        <div class="pagination-container">
          <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
                        :current-page="page" :page-sizes="[10,300,500,1000]" :page-size="limit"
                        layout="total, sizes, prev, pager, next, jumper" :total="total">
          </el-pagination>
        </div>
        <!--介绍人编辑-->
        <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" :before-close="handleClose">
          <el-form ref="addForm" :model="updateIntroducer" label-position="left" label-width="100px"
                  style='width: 600px;margin-left:20px'>
          <el-row :gutter="16" style="margin-bottom: 15px;">
            <el-col :span="14">
              <div class="grid-content bg-purple">
                <el-form-item  :label="$t('dc.wv_phone')" prop="cm_phone">
                  <template>
                    <el-input v-model="updateIntroducer.wv_phone" ></el-input>
                  </template>
                </el-form-item>
              </div>
            </el-col>
          </el-row>
          <el-row :gutter="16" style="margin-bottom: 15px;">
            <el-col :span="14">
              <div class="grid-content bg-purple">
                <el-form-item  :label="$t('dc.wv_status')" prop="cm_phone">
                  <template>
                    <el-select class="filter-item" v-model="updateIntroducer.wv_status" style="width: 200px;">
                      <el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value">
                      </el-option>
                  </el-select>
                  </template>
                </el-form-item>
              </div>
            </el-col>
          </el-row>
            <el-row :gutter="16" style="margin-bottom: 15px;">
            <el-col :span="14">
              <div class="grid-content bg-purple">
                <el-form-item  :label="$t('dc.wv_account_number')" prop="cm_phone">
                <template>
                    <el-input :disabled="true" v-model="updateIntroducer.wv_account_number" ></el-input>
                  </template>
                </el-form-item>
              </div>
            </el-col>
            </el-row>
            <el-row :gutter="16" style="margin-bottom: 15px;">
            <el-col :span="14">
              <div class="grid-content bg-purple">
                <el-form-item  :label="$t('dc.wv_account_bank')" prop="cm_phone">
                <template>
                    <el-input :disabled="true" v-model="updateIntroducer.wv_account_bank" ></el-input>
                  </template>
                </el-form-item>
              </div>
            </el-col>
          </el-row>
            <el-row :gutter="16" style="margin-bottom: 15px;">
            <el-col :span="14">
              <div class="grid-content bg-purple">
                <el-form-item  :label="$t('dc.wv_consultant')" prop="cm_phone">
                <template>
                  <el-select class="filter-item" v-model="updateIntroducer.wv_consultant" style="width: 200px;">
                  <el-option v-for="item in consultantOptions" :key="item.id" :label="item.name" :value="item.id">
                  </el-option>
                </el-select>
                  </template>
                </el-form-item>
              </div>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="20">
              <div class="grid-content bg-purple">
                <el-form-item  :label="$t('dc.cardPhoto')" style="width: 710px;" >
                  <div class="block" style="width: 510px;">
                  <el-upload
                    :action="url"
                    ref="uploadReq"
                    class="avatar-uploader"
                    :class="{disabled:uploadDisabled}"
                    list-type="picture-card"
                    :data="datavoucher"
                    :on-preview="handlePictureCardPreview"
                    :file-list="fileListvoucher"
                    :before-upload="disButton"
                    :on-success="uploadSuccess"
                    :limit = "1"
                    :on-remove="handleRemovevoucher">
                    <i class="el-icon-plus"></i>
                  </el-upload>
                  <el-dialog :visible.sync="dialogVisible">
                    <img width="100%" :src="dialogImageUrl" alt="">
                  </el-dialog>
                  </div>
                </el-form-item>
              </div>
              </el-col>
            <el-col :span="6"><div class="grid-content bg-purple">&nbsp;</div></el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="20">
              <span style="color:red;">{{tips}}</span>
            </el-col>
          </el-row>
            </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button v-if="dis === 0" disabled type="primary" @click="approveGo" :loading ="dialogbuttonloading">{{$t('table.confirm')}}</el-button>
            <el-button v-else type="primary" @click="approveGo" :loading ="dialogbuttonloading">{{$t('table.confirm')}}</el-button>
            <el-button @click="resetForm('addForm')">{{$t('navbar.reset')}}</el-button>
          </div>
        </el-dialog>

        <el-dialog title="Reading statistics" :visible.sync="dialogPvVisible">
          <el-table :data="pvData" border fit highlight-current-row style="width: 100%">
            <el-table-column prop="key" label="Channel"></el-table-column>
            <el-table-column prop="pv" label="Pv"></el-table-column>
          </el-table>
          <span slot="footer" class="dialog-footer">
            <el-button type="primary" @click="dialogPvVisible = false">{{$t('table.confirm')}}</el-button>
          </span>
        </el-dialog>
        <el-dialog :title="textMap[dialogStatusRelationShip]" :visible.sync="dialogFormRelationShipVisible" :before-close="handleClose">
            <el-form :rules="rulesDC" ref="RelationShipForm" :model="addDCInfo" label-position="left" label-width="80px"
                    style='width: 600px;margin-left:20px'>
            <el-row :gutter="16" style="margin-bottom: 15px;">
              <el-col :span="14">
                <div class="grid-content bg-purple">
                  <el-form-item  :label="$t('order.cmphone')" prop="xul_phone">
                    <el-input v-model="addDCInfo.xul_phone" style="width: 220px;" ></el-input>
                  </el-form-item>
                  <el-form-item  :label="$t('order.introducer')" prop = "xul_introducer_phone">
                    <el-input v-model="addDCInfo.xul_introducer_phone" style="width: 220px;" ></el-input>
                  </el-form-item>
                </div>
              </el-col>
            </el-row> 
            </el-form>
             <div slot="footer" class="dialog-footer" >
              <el-button class="filter-item" type="primary" v-waves  @click="saveRelationShip()">保存</el-button>
            </div>
          </el-dialog>
        <el-dialog :title="textMap[dialogAuditing]" :visible.sync="dialogAuditingDC" :before-close="handleClose">
          <el-form  :rules="rules" ref="dialogAuditingForm" :model="auditingInfo" label-position="left" label-width="80px"
                  style='width: 600px;margin-left:20px'>
          <el-row :gutter="24" style="margin-bottom: 15px;">
            <el-col :span="24">
              <el-form-item  :label="$t('dc.wv_phone')"  style="width: 95%;" prop="phone">
                  <el-input v-model="auditingInfo.phone" style="width: 100%;" > </el-input>
                </el-form-item>
            </el-col>
          </el-row>
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button  :loading ="buttonsaveloading" type="primary" @click="saveDialogAuditingDC">{{$t('table.confirm')}}</el-button>
          </div>
          </el-dialog>
      </div>
    </template>
    <script>
      import { fetchPv, updateArticle } from '@/api/article'
      import { queryDcIntroducers, getConsultants, auditingDC, updateDcIntroducer, checkDcIntroducers, delAccountNumber, getDcChannels, insertDcIntroduceLog } from '@/api/dc'
      import waves from '@/directive/waves' // 水波纹指令
      import { parseTime } from '@/utils'
      import config from '@/utils/config'
      import regex from '@/utils/regex'
      // arr to obj ,such as { CN : "China", US : "USA" }
      export default {
        name: 'introducer',
        directives: {
          waves
        },
        computed: {
          uploadDisabled() {
            return this.fileListvoucher.length > 0
          }
        },
        filters: {
          numFilter(value) {
            return parseFloat(value).toFixed(2)
          }
        },
        data() {
          return {
            tableKey: 0,
            url: config.BASE_URL + '/getAccountNumber',
            fileListvoucher: [],
            channelOptions: [],
            list: null,
            dis: 1,
            total: null,
            page: 1,
            limit: 10,
            queryType: 'list',
            listLoading: true,
            openingDC: false,
            buttonloading: false,
            dialogbuttonloading: false,
            dialogImageUrl: undefined,
            listQuery: {
              importance: undefined,
              title: undefined,
              type: undefined,
              sort: '+id'
            },
            checkdate: {
              servant_code: undefined,
              stock_status: undefined,
              start_date: undefined,
              end_date: undefined
            },
            addDCInfo: {
              xul_phone: null,
              xul_introducer_phone: null,
              xul_event: 2
            },
            auditingInfo: {
              phone: undefined
            },
            datavoucher: {
              phone: null
            },
            seachQuery: {
              wv_phone: null,
              wv_name: null,
              wv_gradeid: null,
              wv_consultant: null,
              dc_channel: null,
              page: null,
              limit: null
            },
            buttonsaveloading: false,
            idcardquery: {
              idcard: null
            },
            ordertemepdel: {
              id: undefined
            },
            checksalt: {
              salt: undefined
            },
            pickerOptions1: {
              shortcuts: [{
                text: '今天',
                onClick(picker) {
                  picker.$emit('pick', new Date())
                }
              }, {
                text: '昨天',
                onClick(picker) {
                  const date = new Date()
                  date.setTime(date.getTime() - 3600 * 1000 * 24)
                  picker.$emit('pick', date)
                }
              }, {
                text: '一周前',
                onClick(picker) {
                  const date = new Date()
                  date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
                  picker.$emit('pick', date)
                }
              }]
            },
            sortOptions: [{ label: 'ID Ascending', key: '+id' }, { label: 'ID Descending', key: '-id' }],
            gradeOptions: [{ value: '1', label: '银牌' }, { value: '2', label: '金牌' }],
            statusOptions: [{ value: 1, label: '正常' }, { value: 0, label: '停用' }],
            rules: {
              phone: [{ required: true, message: '请输入手机号码！', trigger: 'blur' },
                { pattern: regex.REPHONE, message: '手机号格式错误！', trigger: 'blur' }]
            },
            rulesDC: {
              xul_introducer_phone: [{ required: true, message: '请输入手机号码！', trigger: 'blur' },
                { pattern: regex.REPHONE, message: '手机号格式错误！', trigger: 'blur' }],
              xul_phone: [{ required: true, message: '请输入手机号码！', trigger: 'blur' },
                { pattern: regex.REPHONE, message: '手机号格式错误！', trigger: 'blur' }]
            },
            consultantOptions: [],
            showReviewer: false,
            dialogVisible: false,
            tips: null,
            updateIntroducer: {
              id: null,
              wv_phone: null,
              wv_status: null,
              wv_phoneOld: null,
              wv_account_number: null,
              wv_account_bank: null,
              wv_account_number_path: null,
              wv_consultant: null,
              wv_qrcode: null
            },
            ethnicgroupptions: '',
            provinceoptions: '',
            dialogFormVisible: false,
            dialogFormRelationShipVisible: false,
            checkidcard: {
              idcard: undefined
            },
            dialogStatus: '',
            dialogStatusRelationShip: '',
            textMap: {
              update: 'Edit',
              create: '添加月嫂'
            },
            dialogPvVisible: false,
            dialogAuditingDC: false,
            dialogAuditing: '',
            pvData: [],
            updateStatus: {
              id: undefined,
              status: undefined
            },
            downloadLoading: false
          }
        },
        created() {
          if (this.$store.getters.roles[0] !== 3) {
            this.openingDC = true
          }
          this.getList()
          getConsultants().then(response5 => {
            this.consultantOptions = response5.data
          })
          getDcChannels().then(response => {
            this.channelOptions = response.data
          })
        },
        methods: {
          getList() {
            this.listQuery.page = this.page
            this.listQuery.limit = this.limit
            this.queryType = 'list'
            this.listLoading = true
            queryDcIntroducers(this.listQuery).then(response => {
              this.list = response.data.items
              this.total = response.data.total
              this.listLoading = false
            })
          },
          addDCRelationShip() {
            this.addDCInfo.xul_phone = null
            this.addDCInfo.xul_introducer_phone = null
            this.dialogStatus = 'create'
            this.dialogFormRelationShipVisible = true
            this.$nextTick(() => {
              this.$refs['RelationShipForm'].clearValidate()
            })
          },
          saveRelationShip() {
            this.$refs['RelationShipForm'].validate((valid) => {
              if (valid) {
                var checkInfo = {
                  wv_phone: this.addDCInfo.xul_introducer_phone
                }
                checkDcIntroducers(checkInfo).then(response => {
                  if (response.data !== null && response.data !== 'undefined' && response.data !== undefined && response.data !== '') {
                    insertDcIntroduceLog(this.addDCInfo).then(response => {
                      this.dialogFormRelationShipVisible = false
                      this.$message({
                        message: '添加成功！',
                        type: 'success'
                      })
                    })
                  } else {
                    this.addDCInfo.xul_introducer_phone = null
                    this.$message({
                      message: '该手机号是不介绍人手机号！',
                      type: 'warning'
                    })
                  }
                })
              }
            })
          },
          handleFilter() {
            this.seachQuery.page = this.page
            this.seachQuery.limit = this.limit
            this.queryType = 'query'
            this.listLoading = true
            queryDcIntroducers(this.seachQuery).then(response => {
              this.list = response.data.items
              this.total = response.data.total
              this.listLoading = false
            })
          },
          handleFilterfirst() {
            this.seachQuery.page = 1
            this.seachQuery.limit = 10
            this.queryType = 'query'
            this.listLoading = true
            this.buttonloading = true
            queryDcIntroducers(this.seachQuery).then(response => {
              this.list = response.data.items
              this.total = response.data.total
              this.listLoading = false
              this.buttonloading = false
            })
          },
          handleSizeChange(val) {
            this.limit = val
            if (this.queryType === 'list') {
              this.listQuery.limit = val
              this.listQuery.page = this.page
              this.getList()
            } else {
              this.seachQuery.limit = val
              this.seachQuery.page = this.page
              this.handleFilter()
            }
          },
          handleCurrentChange(val) {
            this.page = val
            if (this.queryType === 'list') {
              this.listQuery.limit = this.limit
              this.listQuery.page = val
              this.getList()
            } else {
              this.seachQuery.limit = this.limit
              this.seachQuery.page = val
              this.handleFilter()
            }
          },
          approveGo() {
            var reg = regex.REPHONE
            if (reg.test(this.updateIntroducer.wv_phone)) {
              if (this.updateIntroducer.wv_phone !== this.updateIntroducer.wv_phoneOld) {
                var checkQuery = {
                  wv_phone: this.updateIntroducer.wv_phone
                }
                checkDcIntroducers(checkQuery).then(response => {
                  if (response.data.length > 0) {
                    this.$message({ message: '手机号重复!', type: 'warning' })
                  } else {
                    this.$confirm('手机号有变化,系统将自动更新所有关联该介绍人的手机信息', '提示', {
                      confirmButtonText: '确定',
                      cancelButtonText: '取消',
                      type: 'warning'
                    }).then(() => {
                      this.dialogbuttonloading = true
                      updateDcIntroducer(this.updateIntroducer).then(response => {
                        this.dialogbuttonloading = false
                        if (response.data === 1) {
                          this.dialogFormVisible = false
                          this.$notify({
                            title: '成功',
                            message: '更新成功',
                            type: 'success',
                            duration: 2000
                          })
                          this.dialogFormVisible = false
                          this.getList()
                        }
                      })
                    })
                  }
                })
              } else {
                this.dialogbuttonloading = true
                updateDcIntroducer(this.updateIntroducer).then(response => {
                  this.dialogbuttonloading = false
                  if (response.data === 1) {
                    this.dialogFormVisible = false
                    this.$notify({
                      title: '成功',
                      message: '更新成功',
                      type: 'success',
                      duration: 2000
                    })
                    this.dialogFormVisible = false
                    this.getList()
                  }
                })
              }
            } else {
              this.$message({ message: '手机号错误!', type: 'warning' })
            }
          },
          handleModifyStatus(row, status) {
            this.$message({
              message: '操作成功',
              type: 'success'
            })
            row.status = status
          },
          handleClose(done) {
            this.$confirm('确认关闭？').then(_ => {
              done()
            }).catch(_ => {})
          },
          hrefordertempedit(row) {
            this.fileListvoucher = []
            this.updateIntroducer.id = row.id
            this.updateIntroducer.wv_phone = row.wv_phone
            this.updateIntroducer.wv_status = row.wv_status
            this.updateIntroducer.wv_phoneOld = row.wv_phone
            this.updateIntroducer.wv_account_number = row.wv_account_number
            this.updateIntroducer.wv_account_bank = row.wv_account_bank
            this.updateIntroducer.wv_account_number_path = row.wv_account_number_path
            this.updateIntroducer.wv_consultant = row.wv_consultant
            this.updateIntroducer.wv_qrcode = row.wv_qrcode
            this.datavoucher.phone = row.wv_phone
            if (row.wv_account_number_path !== null && row.wv_account_number_path !== undefined && row.wv_account_number_path !== '') {
              var bankCardImg = {
                name: row.wv_phone,
                url: row.wv_account_number_path
              }
              this.fileListvoucher.push(bankCardImg)
            }
            this.dialogFormVisible = true
            this.tips = ''
            this.$nextTick(() => {
              this.$refs['addForm'].clearValidate()
            })
          },
          updateData() {
            this.$refs['dataForm'].validate((valid) => {
              if (valid) {
                const tempData = Object.assign({}, this.temp)
                tempData.timestamp = +new Date(tempData.timestamp) // change Thu Nov 30 2017 16:41:05 GMT+0800 (CST) to 1512031311464
                updateArticle(tempData).then(() => {
                  for (const v of this.list) {
                    if (v.id === this.temp.id) {
                      const index = this.list.indexOf(v)
                      this.list.splice(index, 1, this.temp)
                      break
                    }
                  }
                  this.dialogFormVisible = false
                  this.$notify({
                    title: '成功',
                    message: '更新成功',
                    type: 'success',
                    duration: 2000
                  })
                })
              }
            })
          },
          handleDelete(row) {
            this.$notify({
              title: '成功',
              message: '删除成功',
              type: 'success',
              duration: 2000
            })
            const index = this.list.indexOf(row)
            this.list.splice(index, 1)
          },
          handleFetchPv(pv) {
            fetchPv(pv).then(response => {
              this.pvData = response.data.pvData
              this.dialogPvVisible = true
            })
          },
          handleDownload() {
            this.downloadLoading = true
            import('@/vendor/Export2Excel').then(excel => {
              const tHeader = ['手机号', '姓名', '等级', '状态', '渠道', '转介绍金额', '转介绍单数', '转介绍人数', '已注册人数', '已签约人数', '已完成单数', '提现金额', '提现单数', '介绍人顾问']
              const filterVal = ['wv_phone', 'wv_name', 'wv_gradename', 'wv_statusname', 'dc_channel_name', 'wv_Introduction_total', 'wv_Introduction_count', 'wv_people_count', 'wv_register_count', 'wv_contract_count', 'wv_finish_count', 'wv_withdraw_total', 'wv_extract_count', 'wv_consultantname']
              const list = this.list
              const data = this.formatJson(filterVal, list)
              excel.export_json_to_excel({
                header: tHeader,
                data,
                filename: '推荐人汇总表',
                autoWidth: this.autoWidth
              })
              this.downloadLoading = false
            })
          },
          handleref() {
            this.seachQuery.wv_phone = null
            this.seachQuery.wv_gradeid = null
            this.seachQuery.wv_consultant = null
            this.seachQuery.dc_channel = null
            this.seachQuery.wv_name = null
          },
          resetForm(formName) {
            this.$refs['uploadReq'].clearFiles()
            this.updateIntroducer.id = null
            this.updateIntroducer.wv_phone = null
            this.updateIntroducer.wv_account_number = null
            this.updateIntroducer.wv_account_bank = null
            this.updateIntroducer.wv_account_number_path = null
            this.updateIntroducer.wv_consultant = null
          },
          handlePictureCardPreview(file) {
            this.dialogImageUrl = file.url
            this.dialogVisible = true
          },
          disButton(file) {
            if (file.size > 1000000) {
              this.$message.error('上传照片大于1M！')
              return false
            }
            this.dis = 0
          },
          uploadSuccess(response, file, fileList) {
            this.updateIntroducer.wv_account_number = null
            this.updateIntroducer.wv_account_bank = null
            if (response !== 0) {
              this.updateIntroducer.wv_account_number = response.result.bank_card_number
              this.updateIntroducer.wv_account_bank = response.result.bank_name
              var IntroducerQuery = {
                wv_phone: this.updateIntroducer.wv_phone
              }
              checkDcIntroducers(IntroducerQuery).then(response => {
                var bankCardImg = {
                  name: response.data.wv_phone,
                  url: response.data.wv_account_number_path
                }
                this.fileListvoucher.push(bankCardImg)
                this.tips = '识别成功!'
                this.updateIntroducer.wv_account_number = response.data.wv_account_number
                this.updateIntroducer.wv_account_bank = response.data.wv_account_bank
                this.updateIntroducer.wv_account_number_path = response.data.wv_account_number_path
              })
            } else {
              this.tips = '识别失败,请上传更清晰的图片进行识别！'
            }
            this.dis = 1
          },
          handleRemovevoucher(file, fileList) {
            this.$refs['uploadReq'].clearFiles()
            this.fileListvoucher = []
            var delBankCard = {
              wv_phone: this.updateIntroducer.wv_phone
            }
            delAccountNumber(delBankCard).then(response9 => {
            })
          },
          infoshow(wv_phone) {
            this.$router.push({ name: 'introducershow', params: { wv_phone: wv_phone }})
          },
          auditingDCShow() {
            this.auditingInfo.dialogAuditing = 'create'
            this.auditingInfo.phone = ''
            this.dialogAuditingDC = true
            this.$nextTick(() => {
              this.$refs['dialogAuditingForm'].clearValidate()
            })
          },
          saveDialogAuditingDC() {
            this.$refs['dialogAuditingForm'].validate((valid) => {
              if (valid) {
                this.buttonsaveloading = true
                auditingDC(this.auditingInfo).then(response => {
                  this.buttonsaveloading = false
                  if (response.data === -9) {
                    this.$message.error('该用户还未在小程序中授权手机号！')
                  } else if (response.data === -99) {
                    this.$message.error('该用户已经是介绍人！')
                  } else if (response.data === 1) {
                    this.getList()
                    this.dialogAuditingDC = false
                    this.$message({
                      message: '开通成功！',
                      type: 'success'
                    })
                  } else {
                    this.$message.error('系统异常！')
                  }
                })
              }
            })
          },
          formatJson(filterVal, jsonData) {
            return jsonData.map(v => filterVal.map(j => {
              if (j === 'timestamp') {
                return parseTime(v[j])
              } else {
                return v[j]
              }
            }))
          }
        }
      }
    </script>
    <style>
    .el-form--label-left .el-form-item__label{
      text-align:right
    }
    .el-rate{
      line-height: 0;
      margin-top:8px;
    }
    .el-checkbox.el-checkbox {
        margin-left: 30px;
    }
    .disabled .el-upload--picture-card {
        display: none;
    }
    </style>
    