<!--添加客户-->
<template>
  <view class="assemble">
    <view class="search_box">
      <view class="input_box">
        <input type="text" v-model="student_name" placeholder="请输入客户名称">
      </view>
      <view class="btn" @click="clientList()">查重</view>
    </view>
    <view class="form-style">
      <fui-form ref="form" top="0" :model="formData" :show="false">

        <view class="title" style="margin-top: 20rpx;">基础信息</view>
        <view class="input-style">
          <fui-form-item label="线索标题" asterisk asteriskPosition="right" labelSize='26' prop="title"
                         background='#434544' labelColor='#fff' :bottomBorder='false'>
            <view class="input-title" style="margin-right:14rpx;">
              <fui-input :borderBottom="false" :padding="[0]" placeholder="点击填写" v-model="formData.title"
                         backgroundColor="#434544" size="26" color="#fff"></fui-input>
            </view>
          </fui-form-item>

          <fui-form-item label="来源渠道"  asteriskPosition="right" labelSize='26' prop="" background='#434544'
                         labelColor='#fff' :bottomBorder='false'>
            <view class="input-title" style="margin-right:14rpx;">

              <view class="input-title" style="margin-right:14rpx;" @click="selectCon(`source_channel`)"
                    v-if="!formData.source_channel">点击选择
              </view>
              <view class="input-title" style="margin-right:14rpx;" @click="selectCon(`source_channel`)" v-else>
                {{str_source_channel}}
              </view>

            </view>
          </fui-form-item>

          <fui-form-item label="客户来源"  asteriskPosition="right" labelSize='26' prop="" background='#434544'
                         labelColor='#fff' :bottomBorder='false'>
            <view class="input-title" style="margin-right:14rpx;">

              <view class="input-title" style="margin-right:14rpx;" @click="selectCon(`customer_source`)"
                    v-if="!formData.customer_source">点击选择
              </view>
              <view class="input-title" style="margin-right:14rpx;" @click="selectCon(`customer_source`)" v-else>
                {{ str_customer_source }}
              </view>

            </view>
          </fui-form-item>

          <fui-form-item label="顾问" asterisk asteriskPosition="right" labelSize='26' prop="" background='#434544'
                         labelColor='#fff' :bottomBorder='false'>
            <view class="input-title" style="margin-right:14rpx;">

              <view class="input-title" style="margin-right:14rpx;" @click="selectCon('add_staff_id')"
                    v-if="!formData.add_staff_id">点击选择
              </view>
              <view class="input-title" style="margin-right:14rpx;" @click="selectCon('add_staff_id')" v-else>{{str_add_staff_id}}
              </view>

            </view>
          </fui-form-item>

          <fui-form-item label="学员姓名" asterisk asteriskPosition="right" labelSize='26' prop="student_name"
                         background='#434544' labelColor='#fff' :bottomBorder='false'>
            <view class="input-title" style="margin-right:14rpx;">
              <fui-input :borderBottom="false" :padding="[0]" placeholder="点击填写" v-model="formData.student_name"
                         backgroundColor="#434544" size="26" color="#fff"></fui-input>
            </view>
          </fui-form-item>

          <fui-form-item label="年龄" labelSize='26' asterisk asteriskPosition="right" prop="age" background='#434544'
                         labelColor='#fff' :bottomBorder='false'>
            <view class="input-title" style="margin-right:14rpx;">
              <fui-input-number signColor="#FFF" :min="1" :max="100" v-model="formData.age"></fui-input-number>
            </view>
          </fui-form-item>

          <fui-form-item label="性别" labelSize='26' asterisk asteriskPosition="right" prop="age" background='#434544'
                         labelColor='#fff' :bottomBorder='false'>
            <view class="input-title" style="margin-right:14rpx;">
              <fui-radio-group name="radio" v-model="formData.sex" @change="changeSex">
                <view class="fui-list__item" style="display: flex;justify-content: flex-end;">
                  <fui-label>
                    <view class="fui-align__center">
                      <fui-radio value="1" checked></fui-radio>
                      <text class="fui-text">男</text>
                    </view>
                  </fui-label>
                  <fui-label :margin="['0','0','0','40rpx']">
                    <view class="fui-align__center">
                      <fui-radio value="2"></fui-radio>
                      <text class="fui-text">女</text>
                    </view>
                  </fui-label>
                </view>
              </fui-radio-group>
            </view>
          </fui-form-item>


          <fui-form-item label="电话" asterisk asteriskPosition="right" labelSize='26' prop="student_phone"
                         background='#434544' labelColor='#fff' :bottomBorder='false'>
            <view class="input-title" style="margin-right:14rpx;">
              <fui-input :borderBottom="false" :padding="[0]" placeholder="点击填写" v-model="formData.student_phone"
                         backgroundColor="#434544" size="26" color="#fff"></fui-input>
            </view>
          </fui-form-item>

        </view>



        <view class="title" style="margin-top: 20rpx;">跟进任务</view>
        <view class="input-style">
          <fui-form-item
              label="转交跟进任务"
              labelSize='26'
              asterisk
              asteriskPosition="right"
              prop="mobile"
              background='#434544'
              labelColor='#fff'
              :bottomBorder='false'>
            <fui-switch
                :checked="is_follow"
                @change="changeIsFollow"
            ></fui-switch>
          </fui-form-item>

          <view v-if="is_follow">
            <fui-form-item label="跟进类型" asterisk asteriskPosition="right" labelSize='26' prop="" background='#434544'
                           labelColor='#fff' :bottomBorder='false'>
              <view class="input-title" style="margin-right:14rpx;">

                <view class="input-title" style="margin-right:14rpx;" @click="selectCon('entry_type')"
                      v-if="!formData.entry_type">点击选择
                </view>
                <view class="input-title" style="margin-right:14rpx;" @click="selectCon('entry_type')" v-else>{{str_entry_type}}
                </view>

              </view>
            </fui-form-item>

            <fui-form-item label="跟进人员" asterisk asteriskPosition="right" labelSize='26' prop="" background='#434544'
                           labelColor='#fff' :bottomBorder='false'>
              <view class="input-title" style="margin-right:14rpx;">

                <view class="input-title" style="margin-right:14rpx;" @click="selectCon('staff_id')"
                      v-if="!formData.staff_id">点击选择
                </view>
                <view class="input-title" style="margin-right:14rpx;" @click="selectCon('staff_id')" v-else>{{str_staff_id}}
                </view>

              </view>
            </fui-form-item>

            <fui-form-item label="跟进时间" asterisk asteriskPosition="right" labelSize='26' prop="" background='#434544'
                           labelColor='#fff' :bottomBorder='false'>
              <view class="input-title" style="margin-right:14rpx;">

                <view class="input-title" style="margin-right:14rpx;" @click="selectCon('follow_up_time')"
                      v-if="!formData.follow_up_time">点击选择
                </view>
                <view class="input-title" style="margin-right:14rpx;" @click="selectCon('follow_up_time')" v-else>{{formData.follow_up_time}}
                </view>

              </view>
            </fui-form-item>

            <fui-form-item label="备注" labelSize='26'  asteriskPosition="right" prop="mobile"
                           background='#434544' labelColor='#fff' :bottomBorder='false'>
              <fui-input :borderBottom="false" :padding="[0]" placeholder="点击填写" v-model="formData.follow_up_content"
                         backgroundColor="#434544" size="26" color="#fff"></fui-input>
            </fui-form-item>

          </view>
        </view>
      </fui-form>
    </view>

    <view class="fui-btn__box">
      <fui-button background="#434544" color="#24BA9F" borderColor="#24BA9F" @click="submit">保存</fui-button>
    </view>

    <!-- 年月日-选择时间 -->
    <fui-date-picker :show="show_date" type="3" @change="change_date" @cancel="cancel_date"></fui-date-picker>

    <!-- 选择器 -->
    <fui-picker :linkage='linkage' :options="options" :layer="1" :show="show" @change="change"
                @cancel="cancel"></fui-picker>

<!--    查重弹出层-->
    <fui-bottom-popup :show="showDuplicateCheck" @close="closeDuplicateCheck">
      <view class="fui-scroll__wrap">
        <view class="title_box">
          <view></view>
          <view class="title">查重结果</view>
          <view class="close" @tap="closeDuplicateCheck">
            <fui-icon name="close" :size="48"></fui-icon>
          </view>
        </view>

        <scroll-view scroll-y class="section_ul">
          <!--暂无数据时展示-->
          <view class="not_list" v-if="clientUserList.length == 0">
            <image src="@/static/images/index/zan_wu.png" class="img"></image>
            <view class="title">暂无重复客户</view>
          </view>

          <!--数据列表-->
          <view class="ul" v-else>
            <view class="li" v-for="(v,k) in clientUserList" :key="k">
              <view class="left_box" @click="openViewClueInfo(v)">
                <view class="box_1">
                  <image
                      class="img"
                      src="@/static/images/index/myk.png"></image>
                  <view class="name">{{v.student_name}}</view>
                  <view class="tag">{{ v.is_status == 1 ? '试听' : '成交' }}</view>
                </view>
                <view class="box_2">
                  <view class="left">
                    <view class="name">首选联系人：{{v.contact_name}}</view>
<!--                    <view class="call">妈妈</view>-->
                  </view>
                </view>
                <view class="box_3">
                  <view class="left">
                    {{ $util.formatToDateTime((v.follow && v.follow.follow_up_time || ''), 'm-d H:i') }} 跟进
                  </view>
                  <view class="right">

                    <image
                        v-if="['A+','A','A-'].includes(v.follow && v.follow.initial_customer_intent || '')"
                        src="@/static/images/index/intention3.png"
                        class="img"
                    ></image>
                    <image
                        v-else-if="['B+','B','B-'].includes(v.follow && v.follow.initial_customer_intent || '')"
                        src="@/static/images/index/intention2.png"
                        class="img"
                    ></image>
                    <image
                        v-else
                        src="@/static/images/index/intention1.png"
                        class="img"
                    ></image>

                    <view>意向：{{ v.follow && v.follow.initial_customer_intent || '' }}</view>
                  </view>
                </view>
              </view>
              <view class="right_box">
                <image class="img" src="@/static/images/index/message.png" @click="openViewMyMessage(v)"></image>
                <image class="img" src="@/static/images/index/phone.png" @click="dialTel(v)"></image>
              </view>
            </view>
          </view>

        </scroll-view>

      </view>
    </fui-bottom-popup>

  </view>
</template>

<script>
import commonApi from '@/api/common.js';
import marketApi from '@/api/market.js';
import memberApi from '@/api/member.js';


const rules = [
  {
    name: "student_name",
    rule: ["required"],
    msg: ["请输入学员姓名"]
  },
  {
    name: "title",
    rule: ["required"],
    msg: ["请输入线索标题"]
  },
  {
    name: "student_phone",
    rule: ["required", "isMobile"],
    msg: ["请输入电话", "请输入正确的手机号"]
  },
  {
    name: "age",
    rule: ["required", "isNumber"],
    msg: ["请输入年龄", "请输入正确的数字"]
  },
  {
    name: "school_name",
    rule: ["required"],
    msg: ["请输入学校"]
  },
  {
    name: "grade",
    rule: ["required"],
    msg: ["请输入年级"]
  },
  {
    name: "class_name",
    rule: ["required"],
    msg: ["请输入班级"]
  },
  {
    name: "customer_source",
    rule: ["required"],
    msg: ["请选择客户来源"]
  },
  {
    name: "add_staff_id",
    rule: ["required"],
    msg: ["请选择顾问"]
  },
  {
    name: "contact_name",
    rule: ["required"],
    msg: ["请输入联系人"]
  },
  {
    name: "full_address",
    rule: ["required"],
    msg: ["请选择所在地区"]
  },
  {
    name: "community_name",
    rule: ["required"],
    msg: ["请输入小区"]
  },
  {
    name: "customer_tags_name",
    rule: ["required"],
    msg: ["请选择客户标签"]
  }
];
export default {
  data() {
    return {
      switchChange_type: 1,
      rules,

      is_submit: true,//是否提交(防止重复提交)|true=可提交,false=不可提交

      //表单
      formData: {
        title:'',//线索标题
        source_channel:'',//来源渠道
        customer_source:'',//客户来源
        add_staff_id:'',//顾问id(添加这条数据的工作人员id)
        student_name:'',//学生姓名
        age:'',//学生年龄
        sex:'',//性别|0=保密,1=男,2=女
        student_phone:'',//学生电话
        //### 跟进任务
        is_follow:'',//是否跟进任务|1跟进 2不跟进
        entry_type:'',//跟进类型
        staff_id:'',//跟进人员id
        follow_up_time:'',//跟进时间
        follow_up_content:'',//备注
      },

      //选择器组件
      options_type: undefined,//选择器类型
      show: false,//是否显示下拉选择器
      linkage: true,//是否联动选择
      options: [],//下拉选择器可选值列表

      //来源渠道-相关
      //字典-来源渠道
      options_source_channel: [
        // {
        //   'value': 1,
        //   'text': '类型1'
        // }
      ],
      str_source_channel:'',//文本显示-来源渠道


      //客户来源-相关
      //字典-客户来源
      options_customer_source: [
        // {
        //   'value': 1,
        //   'text': '类型1'
        // }
      ],
      str_customer_source:'',//文本显示-客户来源


      //顾问-相关
      //字典-顾问
      options_add_staff_id: [
        // {
        //   'value': 1,
        //   'text': '类型1'
        // }
      ],
      str_add_staff_id:'',//文本显示-顾问


      is_follow:true,//是否创建跟进任务

      //跟进类型-相关
      //字典-跟进类型
      options_entry_type: [
        {
          'value': 1,
          'text': '市场人员'
        },
        {
          'value': 2,
          'text': '销售人员'
        }
      ],
      str_entry_type:'',//文本显示-跟进类型


      //跟进人员-相关
      //字典-跟进人员
      options_staff_id_5: [
        // {
        //   'value': 1,
        //   'text': '类型1'
        // }
      ],//市场人员列表
      options_staff_id_6: [
        // {
        //   'value': 1,
        //   'text': '类型1'
        // }
      ],//销售人员列表
      str_staff_id:'',//文本显示-跟进人员


      //跟进时间-相关




      show_date: false,
      result_date: '',
      result_leixing: '',
      result_student: '',
      result_status: '',
      result_intention: '',

      result_dates: '',
      result_renwu: '',
      result_fangshi: '',




      options_leixing: [{
        'value': 1,
        'text': '类型1'
      }, {
        'value': 2,
        'text': '类型2'
      }, {
        'value': 3,
        'text': '类型3'
      }],
      options_student: [{
        'value': 1,
        'text': '张三'
      }, {
        'value': 2,
        'text': '李四'
      }, {
        'value': 3,
        'text': '王五'
      }],
      options_status: [{
        'value': 1,
        'text': '状态1'
      }, {
        'value': 2,
        'text': '状态2'
      }, {
        'value': 3,
        'text': '状态3'
      }],
      options_intention: [{
        'value': 1,
        'text': '张三1'
      }, {
        'value': 2,
        'text': '李四2'
      }, {
        'value': 3,
        'text': '王五3'
      }],
      options_kehu: [{
        'value': 1,
        'text': '张三'
      }, {
        'value': 2,
        'text': '李四'
      }, {
        'value': 3,
        'text': '王五'
      }],
      options_renwu: [{
        'value': 1,
        'text': '是'
      }, {
        'value': 2,
        'text': '否'
      }],
      options_fangshi: [{
        'value': 1,
        'text': '短信'
      }, {
        'value': 2,
        'text': '微信'
      }],


      result_customer_source: '',//选中项的中文名称
      result_add_staff_id: '',//选中项的中文名称
      staff_id_name:'',//跟进人员的名字

      //客户标签
      show_customer_tags: false,
      options_customer_tags: [
        // {
        //   text: '标签3',
        //   value: '3',
        //   checked: false,//是否选中
        // }
      ],//客户标签可选值

      //地区三级联动
      show_area: false,
      options_area: [],

      //登录用户信息
      userInfo:{},

      // 查重相关
      student_name:'',//检索关键字
      clientUserList:[],//查重用户列表
      showDuplicateCheck:false,//是否显示查重弹出层
    }
  },
  onShow() {
    this.init()
  },
  methods: {
    //初始化
    async init() {
      //获取登录用户信息
      this.getUserInfo()
      this.getDict_source_channel()//获取字典-来源渠道
      this.getDict_customer_source()//获取字典-客户来源
      this.getDict_customer_tags()//获取字典-客户标签

      this.getStaffList()//获取人员列表

      this.getRoleStaffList(5)//获取市场人员列表
      this.getRoleStaffList(6)//获取销售人员列表

      this.getAreaTree()//获取地区树形结构


    },

    async getUserInfo(){
      let res = await marketApi.member({})
      if (res.code != 1) {
        uni.showToast({
          title: res.msg,
          icon: 'none'
        })
        return
      }

      this.userInfo = res.data
      console.log(111,res.data)

      this.formData.add_staff_id = res.data.staff_id//顾问id
      this.str_add_staff_id = res.data.name//顾问名字
    },


    //获取人员列表
    async getStaffList() {
      let res = await memberApi.staffList({type: 2})
      if (res.code != 1) {
        uni.showToast({
          title: res.msg,
          icon: 'none'
        })
        return
      }

      let arr = []
      res.data.forEach((v,k)=>{
        arr.push({
          text: v.name,
          value: v.id,
        })
      })
      this.options_add_staff_id = arr
    },

    //获取人员列表 role_id|5=市场,6=销售
    async getRoleStaffList(role_id) {
      let res = await memberApi.staffList({
        type: 2,
        role_id:role_id
      })
      if (res.code != 1) {
        uni.showToast({
          title: res.msg,
          icon: 'none'
        })
        return
      }

      let arr = []
      res.data.forEach((v,k)=>{
        arr.push({
          text: v.name,
          value: v.id,
        })
      })

      if(role_id == 5){
        this.options_staff_id_5 = arr
        console.log('市场',arr)
      }else{
        this.options_staff_id_6 = arr
        console.log('销售',arr)
      }
    },

    //获取地区树形结构
    async getAreaTree() {
      let res = await commonApi.getAreaTree()
      if (res.code != 1) {
        uni.showToast({
          title: res.msg,
          icon: 'none'
        })
        return
      }
      this.options_area = res.data
    },

    //获取字典-来源渠道
    async getDict_source_channel(){
      let res = await commonApi.getDictionary('source_channel')
      if(res.code != 1){
        uni.showToast({
          title: res.msg,
          icon: 'none'
        })
        return
      }

      let dictionary =  res.data.dictionary
      let arr = []
      dictionary.forEach((v,k)=>{
        arr.push({
          text: v.name,
          value: v.value,
        })
      })
      this.options_source_channel = arr
    },


    //获取字典-客户来源
    async getDict_customer_source(){
      let res = await commonApi.getDictionary('customer_source')
      if(res.code != 1){
        uni.showToast({
          title: res.msg,
          icon: 'none'
        })
        return
      }

      let dictionary =  res.data.dictionary
      let arr = []
      dictionary.forEach((v,k)=>{
        arr.push({
          text: v.name,
          value: v.value,
        })
      })
      this.options_customer_source = arr
    },

    //获取字典-客户标签
    async getDict_customer_tags(){
      let res = await commonApi.getDictionary('customer_tags')
      if(res.code != 1){
        uni.showToast({
          title: res.msg,
          icon: 'none'
        })
        return
      }

      let dictionary =  res.data.dictionary
      let arr = []
      dictionary.forEach((v,k)=>{
        arr.push({
          text: v.name,
          value: String(v.value),
          checked: false,
        })
      })
      this.options_customer_tags = arr
    },

    //##### 查重相关 #####
    //客户列表--查重
    async clientList(){

      if(!this.student_name){
        uni.showToast({
          title: '请输入检索关键字',
          icon: 'none'
        })
        return
      }

      this.clientUserList = []

      let param = {
        student_name:this.student_name
      }
      let res = await marketApi.clientList(param)
      if(res.code != 1){
        uni.showToast({
          title: res.msg,
          icon: 'none'
        })
        return
      }
      console.log('查重',res)
      this.clientUserList = res.data
      this.openDuplicateCheck()
    },
    //打开结果列表
    openDuplicateCheck(){
      this.showDuplicateCheck = true
    },
    //关闭结果列表
    closeDuplicateCheck(e){
      this.showDuplicateCheck = false
    },


    //跳转页面-客户详情
    openViewClueInfo(item) {
      let id = item.id
      uni.navigateTo({
        url: `/pages/market/clue/clue_info?id=${id}`
      })
    },

    //跳转页面-我的消息
    openViewMyMessage(item) {
      let user_id = item.user_id
      uni.navigateTo({
        url: `/pages/common/my_message?user_id=${user_id}`
      })
    },

    //拨打电话
    async dialTel(item) {
      let tel = item.student_phone

      if (!tel) {
        uni.showToast({
          title: '电话号码为空',
          icon: 'none'
        });
        return;
      }

      let param = {
        sales_id: item.id//线索id
      }
      let res = await marketApi.setCallUp(param)//添加通过记录
      if (res.code != 1) {
        uni.showToast({
          title: res.msg,
          icon: 'none'
        })
        return
      }

      uni.makePhoneCall({
        phoneNumber: tel
      })
    },



    //表单验证
    async validatorForm(data) {
      //线索标题
      if(!data.title){
        uni.showToast({
          title: '线索标题必填',
          icon: 'none'
        })
        return false
      }
      //学生姓名
      if(!data.student_name){
        uni.showToast({
          title: '学生姓名必填',
          icon: 'none'
        })
        return false
      }
      //年龄
      if(!data.age){
        uni.showToast({
          title: '年龄必填',
          icon: 'none'
        })
        return false
      }
      //性别
      if(!data.sex){
        uni.showToast({
          title: '性别必填',
          icon: 'none'
        })
        return false
      }
      //电话
      if(!data.student_phone){
        uni.showToast({
          title: '电话必填',
          icon: 'none'
        })
        return false
      }
      //##### 跟进 #####
      if(data.is_follow == 1){
        //跟进类型
        if(!data.entry_type){
          uni.showToast({
            title: '跟进类型必填',
            icon: 'none'
          })
          return false
        }
        //跟进人员
        if(!data.staff_id){
          uni.showToast({
            title: '跟进人员必填',
            icon: 'none'
          })
          return false
        }
        //跟进时间
        if(!data.follow_up_time){
          uni.showToast({
            title: '跟进时间必填',
            icon: 'none'
          })
          return false
        }
      }
      return true
    },

    //提交
    async submit() {
      console.log('提交',this.formData)
      let data = {...this.formData}
      //表单验证
      let validatorForm = await this.validatorForm(data)
      console.log('验证结果',validatorForm)
      if(!validatorForm){
        return
      }

      //防止重复提交
      if (!this.is_submit) {
          return
      }
      this.is_submit = false

      let res = await marketApi.setSales(data)

      this.is_submit = true

      if(res.code != 1){
        uni.showToast({
          title: res.msg,
          icon: 'none'
        })
        return
      }
      uni.showToast({
        title: res.msg,
        icon: 'success'
      })
      //延迟1s执行
      setTimeout(() => {
        //跳转页面-线索列表
        uni.navigateTo({
          url: `/pages/market/clue/index`
        })
      }, 1000)
    },
    //选择弹窗
    selectCon(type) {
      this.options_type = type
      switch (type) {
          //来源渠道
        case 'source_channel':
          this.options = this.options_source_channel
          this.show = true
          this.linkage = true
          break;
          //客户来源
        case 'customer_source':
          this.options = this.options_customer_source
          this.show = true
          this.linkage = true
          break;
          //顾问
        case 'add_staff_id':
          this.options = this.options_add_staff_id
          this.show = true
          this.linkage = true
          break;
          // 跟进类型
        case 'entry_type':
          this.options = this.options_entry_type
          this.show = true
          this.linkage = true
          break;
          // 跟进人员
        case 'staff_id':
          if(!this.formData.entry_type){
            uni.showToast({
              title: '请先选择跟进类型',
              icon: 'none'
            })
            return
          }
          if(this.formData.entry_type == 1){
            //市场人员列表
            this.options = this.options_staff_id_5
          }else{
            //销售人员列表
            this.options = this.options_staff_id_6
          }
          this.show = true
          this.linkage = true
          break;
          //跟进时间
        case 'follow_up_time':
          this.show_date = true
          break;
      }
    },
    //监听选择框
    change(e) {
      console.log('选择器选中',e)
      this.show = false
      let type = this.options_type
      switch (type) {
          //来源渠道
        case 'source_channel':
          this.str_source_channel = e.text//选中的text值
          this.formData.source_channel = e.value//选中value值
          break;
          //客户来源
        case 'customer_source':
          this.str_customer_source = e.text//选中的text值
          this.formData.customer_source = e.value//选中value值
          break;
          //顾问
        case 'add_staff_id':
          this.str_add_staff_id = e.text//选中的text值
          this.formData.add_staff_id = e.value//选中value值
          break;
          // 跟进类型
        case 'entry_type':
          this.str_entry_type = e.text//选中的text值
          this.formData.entry_type = e.value//选中value值

          //清空跟进人员选择
          this.formData.staff_id = ''
          this.str_staff_id = ''
          break;
          // 跟进人员
        case 'staff_id':
          this.str_staff_id = e.text//选中的text值
          this.formData.staff_id = e.value//选中value值
          break;
          //跟进时间
        case 'follow_up_time':
          break;
      }
    },

    //选择跟进时间
    change_date(e) {
      //跟进时间
      this.show_date = false
      this.formData.follow_up_time = e.result ?? ''
    },
    //关闭选择跟进时间
    cancel_date() {
      this.show_date = false
    },


    //多选客户标签-选中后回调
    onConfirmCustomerTags(e) {
      console.log('多选客户标签', e)
      this.show_customer_tags = false
      let customer_tags_name_arr = []
      let customer_tags_arr = []
      e.options.forEach((v, k) => {
        customer_tags_arr.push(v.value)
        customer_tags_name_arr.push(v.text)
        //根据v.value 设置this.options_customer_tags中对应元素的checked属性为true
        this.options_customer_tags.forEach((v, k) => {
          if (v.value == v.value) {
            v.checked = true
          }
        })
      })

      this.formData.customer_tags_name = customer_tags_name_arr.join(',')//数组转字符串
      this.formData.customer_tags = customer_tags_arr//数组转字符串
    },

    //地区选择相关
    changeArea(e) {
      this.show_area = false
      console.log('地区选择', e)
      this.formData.province_id = e.value[0]
      this.formData.city_id = e.value[1]
      this.formData.district_id = e.value[2]
      this.formData.full_address = `${e.text[0]}-${e.text[1]}-${e.text[2]}`
    },

    //关闭选择框
    cancel() {
      this.show = false
    },
    //开关选择
    switchChange(e) {
      if (e.detail.value) {
        this.switchChange_type = 1
      } else {
        this.switchChange_type = 2
      }
    },

    //性别选择器
    changeSex(e){
      this.formData.sex = e.detail.value
    },

    //监听-是否创建跟进任务
    changeIsFollow(e) {
      console.log(111, e.detail.value)
      this.is_follow = e.detail.value
      //是否创建跟进任务 1跟进
      if (this.is_follow) {
        this.formData.is_follow = '1'
      } else {
        //2不跟进
        this.formData.is_follow = '2'

        this.formData.entry_type = ''//跟进类型
        this.formData.staff_id = ''//跟进人员
        this.formData.follow_up_time = ''//跟进时间
        this.formData.follow_up_content = ''//备注
      }
    },
  }
}
</script>

<style lang="less" scoped>
.search_box{
  padding: 20rpx 40rpx;
  border-bottom: 1px solid #333333;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .input_box{
    width: 70%;
    input{
      width: 100%;
      height: 60rpx;
      color: #fff;
      font-size: 28rpx;
    }
  }
  .btn{
    font-size: 28rpx;
    color: #24BA9F;
  }
}

	.assemble {
		width: 100%;
		height: 100vh;
		background: #292929;
		overflow: auto;
	}

	.title {
		font-size: 26rpx;
		color: #fff;
		padding: 26rpx 0 26rpx 32rpx;
	}

	.input-title {
		font-size: 26rpx;
		color: #fff;
	}

	.form-style {
		width: 100%;
		// background: #434544;
	}

	.form-style-vid {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 12rpx 0;
	}

	.input-style {
		text-align: right !important;
	}

	.fui-btn__box {
		margin: 50rpx auto 120rpx;
		width: 92%;
	}

  //查重结构弹出层
  .fui-scroll__wrap{
    height: 60vh;
    .title_box{
      padding: 10rpx 20rpx;
      display: flex;
      justify-content: space-between;
      align-items: center;
      .title{
        font-size: 28rpx;
        color: #101010;
      }
    }
    .section_ul{
      margin-bottom: 100rpx;
      height: 98%;
      .not_list{
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        .img{
          width: 112rpx;
          height: 112rpx;
        }
        .title{
          padding: 0;
          margin-top: 10rpx;
          color: #101010;
          font-size: 28rpx;
          text-align: center;
        }
      }
      .ul{
        padding: 26rpx;
        padding-bottom: 100rpx;
        display: flex;
        flex-direction: column;
        .li{
          margin-bottom: 26rpx;
          padding: 26rpx;
          display: flex;
          justify-content: space-between;
          gap: 10rpx;

          border-radius: 18rpx;
          background-color: rgba(67,69,68,1);
          color: #fff;
          font-size: 28rpx;
          border: 0rpx solid rgba(121,121,121,1);
          .left_box{
            width: 80%;
            display: flex;
            flex-direction: column;
            gap: 20rpx;
            .box_1 {
              display: flex;
              align-items: center;
              .img {
                width: 48rpx;
                height: 48rpx;
                border-right: 50%;
              }
              .name{
                margin-left: 20rpx;
              }
              .tag{
                margin-left: 20rpx;
                width: 84rpx;
                height: 32rpx;
                line-height: 28rpx;
                border-radius: 0rpx 20rpx 20rpx 20rpx;
                background-color: rgba(236,128,141,0.3);
                color: rgba(240,90,90,1);
                font-size: 20rpx;
                text-align: center;
                border: 0rpx solid rgba(121,121,121,1);
              }
            }
            .box_2{
              display: flex;
              justify-content: space-between;
              align-items: center;
              .left{
                display: flex;
                align-items: flex-end;
                .name{
                  font-size: 28rpx;
                }
                .call{
                  margin-left: 10rpx;
                  font-size: 24rpx;
                  color: #ba7b30;
                }
              }
            }
            .box_3{
              display: flex;
              gap: 30rpx;
              .left{}
              .right{
                display: flex;
                align-items: center;
                gap: 10rpx;
                .img{
                  width: 16rpx;
                  height: 16rpx;
                  border-right: 50%;
                }
              }
            }
          }
          .right_box{
            width: 25%;
            display: flex;
            justify-content: space-between;
            align-items: center;
            .img{
              width: 70rpx;
              height: 70rpx;
              border-radius: 50%;
            }
          }
        }
      }
    }

  }
</style>