You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1563 lines
44 KiB
1563 lines
44 KiB
<!--添加客户-->
|
|
<template>
|
|
<view class="assemble">
|
|
<fui-segmented-control
|
|
style="padding-top: 30rpx;"
|
|
:values="optionTable"
|
|
:current="(Number(optionTableId))"
|
|
type="text"
|
|
activeColor="#29d3b4"
|
|
color="#fff"
|
|
@click="segmented">
|
|
</fui-segmented-control>
|
|
|
|
|
|
<!-- 添加客户-->
|
|
<view style="margin-top: 20rpx;" v-if="optionTableId == 0">
|
|
<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="姓名"
|
|
labelSize='26'
|
|
asterisk asteriskPosition="right"
|
|
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.name"
|
|
backgroundColor="#434544"
|
|
size="26"
|
|
color="#fff"
|
|
></fui-input>
|
|
</view>
|
|
</fui-form-item>
|
|
<!--联系电话-->
|
|
<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.phone_number"
|
|
backgroundColor="#434544"
|
|
size="26"
|
|
color="#fff"
|
|
@blur="handlePhoneBlur"
|
|
></fui-input>
|
|
</view>
|
|
</fui-form-item>
|
|
|
|
<!--校区-->
|
|
<fui-form-item
|
|
label="校区"
|
|
labelSize='26'
|
|
prop="campus"
|
|
asterisk asteriskPosition="right"
|
|
background='#434544'
|
|
labelColor='#fff'
|
|
:bottomBorder='false'
|
|
>
|
|
<view class="input-title" style="margin-right:14rpx;">
|
|
<view
|
|
class="input-title"
|
|
style="margin-right:14rpx;"
|
|
@click="openCicker(`campus`)">
|
|
{{ (formData.campus) ? picker_config.campus.text : '点击选择' }}
|
|
</view>
|
|
</view>
|
|
</fui-form-item>
|
|
|
|
|
|
<!--来源-->
|
|
<fui-form-item
|
|
label="来源"
|
|
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="openCicker(`source`)">
|
|
{{ (formData.source) ? picker_config.source.text : '点击选择' }}
|
|
</view>
|
|
</view>
|
|
</fui-form-item>
|
|
|
|
<!--来源渠道-->
|
|
<fui-form-item
|
|
v-if="formData.source == 1"
|
|
label="来源渠道"
|
|
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="openCicker(`source_channel`)">
|
|
{{ (formData.source_channel) ? picker_config.source_channel.text : '点击选择' }}
|
|
</view>
|
|
</view>
|
|
</fui-form-item>
|
|
|
|
<!--顾问-->
|
|
<!--
|
|
<fui-form-item
|
|
label="顾问"
|
|
|
|
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="openCicker(`consultant`)">
|
|
{{ (formData.consultant) ? picker_config.consultant.text : '点击选择' }}
|
|
</view>
|
|
</view>
|
|
</fui-form-item>
|
|
-->
|
|
<fui-form-item
|
|
v-show="false"
|
|
label="顾问"
|
|
labelSize='26'
|
|
prop="title"
|
|
background='#434544'
|
|
labelColor='#fff'
|
|
:bottomBorder='false'>
|
|
<view class="input-title" style="margin-right:14rpx;">
|
|
<fui-input
|
|
:borderBottom="false"
|
|
:padding="[0]"
|
|
:disabled="true"
|
|
placeholder="点击填写"
|
|
v-model="picker_config.consultant.text"
|
|
backgroundColor="#434544"
|
|
size="26"
|
|
color="#808080"
|
|
></fui-input>
|
|
</view>
|
|
</fui-form-item>
|
|
|
|
<!--年龄-->
|
|
<fui-form-item
|
|
label="年龄"
|
|
labelSize='26'
|
|
prop="age"
|
|
background='#434544'
|
|
labelColor='#fff'
|
|
:bottomBorder='false'>
|
|
<view class="input-title" style="margin-right:14rpx;">
|
|
<fui-input-number signColor="#FFF" :min="3" :max="18" v-model="formData.age"></fui-input-number>
|
|
</view>
|
|
</fui-form-item>
|
|
<!--性别-->
|
|
<fui-form-item
|
|
label="性别"
|
|
labelSize='26'
|
|
prop="age"
|
|
background='#434544'
|
|
labelColor='#fff'
|
|
:bottomBorder='false'>
|
|
<view class="input-title" style="margin-right:14rpx;">
|
|
<fui-radio-group name="radio" v-model="formData.gender" @change="changeSex">
|
|
<view class="fui-list__item" style="display: flex;justify-content: flex-end;">
|
|
<fui-label>
|
|
<view class="fui-align__center">
|
|
<fui-radio value="male" 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="female"></fui-radio>
|
|
<text class="fui-text">女</text>
|
|
</view>
|
|
</fui-label>
|
|
</view>
|
|
</fui-radio-group>
|
|
</view>
|
|
</fui-form-item>
|
|
|
|
<!--需求-->
|
|
<fui-form-item
|
|
label="需求"
|
|
|
|
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.demand"
|
|
backgroundColor="#434544"
|
|
size="26"
|
|
color="#fff"
|
|
></fui-input>
|
|
</view>
|
|
</fui-form-item>
|
|
<!--决策人-->
|
|
<fui-form-item
|
|
label="决策人"
|
|
|
|
labelSize='26'
|
|
prop="title"
|
|
background='#434544'
|
|
labelColor='#fff'
|
|
:bottomBorder='false'>
|
|
<view class="input-title" style="margin-right:14rpx;">
|
|
<view
|
|
class="input-title"
|
|
style="margin-right:14rpx;"
|
|
@click="openCicker(`decision_maker`)">
|
|
{{ (formData.decision_maker) ? picker_config.decision_maker.text : '点击选择' }}
|
|
</view>
|
|
</view>
|
|
</fui-form-item>
|
|
<!--客户初步意向度-->
|
|
<fui-form-item
|
|
label="客户初步意向度"
|
|
|
|
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="openCicker(`initial_intent`)">
|
|
{{ (formData.initial_intent) ? picker_config.initial_intent.text : '点击选择' }}
|
|
</view>
|
|
</view>
|
|
</fui-form-item>
|
|
<!--客户状态-->
|
|
<fui-form-item
|
|
v-show="false"
|
|
label="客户状态"
|
|
|
|
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="openCicker(`status`)">
|
|
{{ (formData.status) ? picker_config.status.text : '点击选择' }}
|
|
</view>
|
|
</view>
|
|
</fui-form-item>
|
|
</view>
|
|
</fui-form>
|
|
</view>
|
|
|
|
<view class="fui-btn__box">
|
|
<fui-button background="#434544" color="#24BA9F" borderColor="#24BA9F" @click="nextStep('1')">下一步</fui-button>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 添加六要素-->
|
|
<view style="margin-top: 20rpx;" v-if="optionTableId == 1">
|
|
<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="购买力"
|
|
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="openCicker(`purchasing_power`)">
|
|
{{ (formData.purchasing_power) ? picker_config.purchasing_power.text : '点击选择' }}
|
|
</view>
|
|
</view>
|
|
</fui-form-item>
|
|
<!--认知理念-->
|
|
<fui-form-item
|
|
label="认知理念"
|
|
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="openCicker(`cognitive_idea`)">
|
|
{{ (formData.cognitive_idea) ? picker_config.cognitive_idea.text : '点击选择' }}
|
|
</view>
|
|
</view>
|
|
</fui-form-item>
|
|
<!--可选上课时间-->
|
|
<fui-form-item
|
|
label="可选上课时间"
|
|
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="openDate(`optional_class_time`)">
|
|
{{ (formData.optional_class_time) ? formData.optional_class_time : '点击选择' }}
|
|
</view>
|
|
</view>
|
|
</fui-form-item>
|
|
<!--承诺到访时间-->
|
|
<fui-form-item
|
|
label="承诺到访时间"
|
|
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="openDate(`promised_visit_time`)">
|
|
{{ (formData.promised_visit_time) ? formData.promised_visit_time : '点击选择' }}
|
|
</view>
|
|
</view>
|
|
</fui-form-item>
|
|
<!--距离-->
|
|
<fui-form-item
|
|
label="距离"
|
|
labelSize='26'
|
|
prop="title"
|
|
background='#434544'
|
|
labelColor='#fff'
|
|
:bottomBorder='false'>
|
|
<view class="input-title" style="margin-right:14rpx;">
|
|
<view
|
|
class="input-title"
|
|
style="margin-right:14rpx;"
|
|
@click="openCicker(`distance`)">
|
|
{{ (formData.distance) ? picker_config.distance.text : '点击选择' }}
|
|
</view>
|
|
</view>
|
|
|
|
</fui-form-item>
|
|
<!--沟通备注-->
|
|
<fui-form-item
|
|
label="沟通备注"
|
|
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.communication"
|
|
backgroundColor="#434544"
|
|
size="26"
|
|
color="#fff"
|
|
></fui-input>
|
|
</view>
|
|
</fui-form-item>
|
|
</view>
|
|
</fui-form>
|
|
</view>
|
|
<view class="fui-btn__box">
|
|
<fui-button background="#434544" color="#24BA9F" borderColor="#24BA9F" @click="submit">保存</fui-button>
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 年月日-选择时间 -->
|
|
<fui-date-picker :show="date_picker_show" type="3" @change="change_date" @cancel="cancel_date"></fui-date-picker>
|
|
|
|
<!-- 选择器 -->
|
|
<fui-picker
|
|
:linkage='picker_linkage'
|
|
:options="picker_options"
|
|
:layer="1"
|
|
:show="picker_show"
|
|
@change="changeCicker"
|
|
@cancel="cancelCicker">
|
|
</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="$util.img('/uniapp_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" @click="openViewClueInfo(v)">
|
|
<view class="left_box">
|
|
<view class="box_1">
|
|
<image
|
|
class="img"
|
|
:src="$util.img('/uniapp_src/static/images/index/myk.png')"></image>
|
|
<view class="name">{{v.name}}</view>
|
|
<!-- <view class="tag">{{ v.is_status == 1 ? '试听' : '成交' }}</view>-->
|
|
</view>
|
|
<view class="box_2">
|
|
<view class="left">
|
|
<view class="name">首选联系人:{{v.decision_maker}}</view>
|
|
<!-- <view class="call">妈妈</view>-->
|
|
</view>
|
|
</view>
|
|
<view class="box_2">
|
|
<view class="left">
|
|
<view class="name">联系电话:{{v.phone_number || ''}}</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="box_3">
|
|
<view class="left">
|
|
{{ $util.formatToDateTime((v.updated_at || ''), 'm-d H:i') }} 跟进
|
|
</view>
|
|
<view class="right">
|
|
|
|
<image
|
|
v-if="v.initial_intent == 'high'"
|
|
:src="$util.img('/uniapp_src/static/images/index/intention3.png')"
|
|
class="img"
|
|
></image>
|
|
<image
|
|
v-else-if="v.initial_intent == 'medium'"
|
|
:src="$util.img('/uniapp_src/static/images/index/intention2.png')"
|
|
class="img"
|
|
></image>
|
|
<image
|
|
v-else
|
|
:src="$util.img('/uniapp_src/static/images/index/intention1.png')"
|
|
class="img"
|
|
></image>
|
|
|
|
<view>意向:{{ v.initial_intent_name || '' }}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="right_box">
|
|
<!-- <image v-if="v.member_id" class="img" :src="$util.img('/uniapp_src/static/images/index/message.png')" @click="openViewMyMessage(v)"></image>-->
|
|
<!-- <image v-if="v.phone_number" class="img" :src="$util.img('/uniapp_src/static/images/index/phone.png')" @click="dialTel(v)"></image>-->
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
</scroll-view>
|
|
|
|
</view>
|
|
</fui-bottom-popup>
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import apiRoute from '@/api/apiRoute.js';
|
|
import commonApi from '@/api/common.js';
|
|
import marketApi from '@/api/market.js';
|
|
import memberApi from '@/api/member.js';
|
|
import util from '@/common/util.js';
|
|
import dictUtil from '@/common/dictUtil.js';
|
|
import dictUtilSimple from '@/common/dictUtilSimple.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: {
|
|
// 客户基础信息
|
|
source_channel:'',//来源渠道
|
|
source:'',//来源
|
|
consultant:'',//顾问
|
|
name:'',//姓名
|
|
age:'',//年龄
|
|
gender:'male',//性别|male-男性, female-女性, other-其他
|
|
phone_number:'',//联系电话
|
|
demand:'',//需求
|
|
decision_maker:'',//决策人
|
|
initial_intent:'',//客户初步意向度: high-高, medium-中, low-低
|
|
status:'pending',//客户状态: active-活跃, inactive-不活跃, pending-待定
|
|
|
|
//六要素信息
|
|
purchasing_power:'',//购买力
|
|
cognitive_idea:'',//认知理念
|
|
communication:'',//沟通备注
|
|
promised_visit_time:'',//承诺到访时间
|
|
staff_id:'',//人员ID
|
|
distance:'',//距离
|
|
optional_class_time:'',//可选上课时间
|
|
campus:''
|
|
},
|
|
campus_list:[],
|
|
//下拉选择器相关
|
|
picker_input_name:'',//下拉组件的input_name
|
|
picker_show:false,//下拉组件是否展示
|
|
picker_linkage:true,//选择器是否为联动选择
|
|
picker_options:[
|
|
// {
|
|
// text:'张三',
|
|
// value:'1'
|
|
// },
|
|
],//选择器可选值列表
|
|
picker_config:{
|
|
//来源渠道
|
|
source_channel:{
|
|
text:'',//回显中文名字
|
|
options:[
|
|
// {
|
|
// text:'张三',
|
|
// value:'1'
|
|
// }
|
|
],//可选值列表
|
|
},
|
|
//来源
|
|
source:{
|
|
text:'',
|
|
options:[],
|
|
},
|
|
//顾问
|
|
consultant:{
|
|
text:'',
|
|
options:[],
|
|
},
|
|
//购买力
|
|
purchasing_power:{
|
|
text:'',
|
|
options:[],
|
|
},
|
|
//认知理念
|
|
cognitive_idea:{
|
|
text:'',
|
|
options:[],
|
|
},
|
|
//客户初步意向度
|
|
initial_intent:{
|
|
text:'',
|
|
options:[],
|
|
},
|
|
//决策人
|
|
decision_maker:{
|
|
text:'',
|
|
options:[],
|
|
},
|
|
//所属校区
|
|
campus:{
|
|
text:'',
|
|
options:[],
|
|
},
|
|
//客户状态
|
|
status:{
|
|
text:'',
|
|
options:[],
|
|
},
|
|
//距离
|
|
distance:{
|
|
text:'',
|
|
options:[],
|
|
},
|
|
},//选择器选项配置
|
|
|
|
// 年月日选择组件
|
|
data_picker_input_name:'',//时间组件的input_name
|
|
date_picker_show:false,//时间选择器是否展示
|
|
|
|
|
|
//地区三级联动
|
|
show_area: false,
|
|
options_area: [],
|
|
|
|
//登录用户信息
|
|
userInfo:{},
|
|
|
|
// 查重相关
|
|
student_name:'',//检索关键字
|
|
clientUserList:[],//查重用户列表
|
|
showDuplicateCheck:false,//是否显示查重弹出层
|
|
|
|
|
|
//tab切换
|
|
optionTableId:0,
|
|
optionTable: [
|
|
{
|
|
id: 0,
|
|
name: '添加客户'
|
|
},
|
|
{
|
|
id: 1,
|
|
name: '添加六要素'
|
|
}
|
|
],
|
|
}
|
|
},
|
|
onLoad() {
|
|
// 预加载字典数据
|
|
this.preloadDictData()
|
|
},
|
|
onShow() {
|
|
this.init()
|
|
},
|
|
methods: {
|
|
// 预加载字典数据
|
|
async preloadDictData() {
|
|
const dictKeys = [
|
|
'SourceChannel', 'source', 'customer_purchasing_power',
|
|
'preliminarycustomerintention', 'cognitive_concept',
|
|
'kh_status', 'decision_maker', 'distance'
|
|
]
|
|
|
|
// 静默预加载,不阻塞页面显示
|
|
// 暂时使用简化版本进行测试
|
|
dictUtilSimple.getBatchDict(dictKeys).catch(error => {
|
|
console.warn('字典预加载失败:', error)
|
|
})
|
|
},
|
|
|
|
//初始化
|
|
async init() {
|
|
//获取登录用户信息
|
|
await this.getUserInfo()
|
|
|
|
// 使用批量获取字典数据,提升性能
|
|
await this.getBatchDictData()
|
|
|
|
// this.getStaffList()//获取人员列表
|
|
// this.getAreaTree()//获取地区树形结构
|
|
},
|
|
|
|
// 批量获取字典数据
|
|
async getBatchDictData() {
|
|
try {
|
|
// 定义需要的字典keys
|
|
const dictKeys = [
|
|
'SourceChannel', // 来源渠道
|
|
'source', // 来源
|
|
'customer_purchasing_power', // 购买力
|
|
'preliminarycustomerintention', // 客户初步意向度
|
|
'cognitive_concept', // 认知理念
|
|
'kh_status', // 客户状态
|
|
'decision_maker', // 决策人
|
|
'distance' // 距离
|
|
]
|
|
|
|
// 批量获取字典数据(静默获取,不显示加载提示)
|
|
// 暂时使用简化版本进行测试
|
|
const dictData = await dictUtilSimple.getBatchDict(dictKeys)
|
|
|
|
// 处理字典数据
|
|
this.processDictData(dictData)
|
|
|
|
console.log('批量获取字典数据成功:', dictData)
|
|
|
|
} catch (error) {
|
|
console.error('批量获取字典数据失败:', error)
|
|
|
|
// 如果批量获取失败,回退到单个获取
|
|
await this.fallbackGetDict()
|
|
}
|
|
},
|
|
|
|
// 处理批量获取的字典数据
|
|
processDictData(dictData) {
|
|
// 字典key与本地配置的映射关系
|
|
const keyMapping = {
|
|
'SourceChannel': 'source_channel',
|
|
'source': 'source',
|
|
'customer_purchasing_power': 'purchasing_power',
|
|
'preliminarycustomerintention': 'initial_intent',
|
|
'cognitive_concept': 'cognitive_idea',
|
|
'kh_status': 'status',
|
|
'decision_maker': 'decision_maker',
|
|
'distance': 'distance'
|
|
}
|
|
|
|
// 处理每个字典数据
|
|
Object.keys(keyMapping).forEach(dictKey => {
|
|
const localKey = keyMapping[dictKey]
|
|
const dictItems = dictData[dictKey] || []
|
|
|
|
if (Array.isArray(dictItems) && dictItems.length > 0) {
|
|
const formattedOptions = dictItems.map(item => ({
|
|
text: item.name || '',
|
|
value: item.value || ''
|
|
}))
|
|
|
|
// 设置到picker配置中
|
|
if (this.picker_config[localKey]) {
|
|
this.picker_config[localKey].options = formattedOptions
|
|
}
|
|
}
|
|
})
|
|
},
|
|
|
|
// 回退方案:单个获取字典(兼容原有逻辑)
|
|
async fallbackGetDict() {
|
|
console.log('使用回退方案获取字典数据')
|
|
try {
|
|
await this.getDict('source_channel')
|
|
await this.getDict('source')
|
|
await this.getDict('purchasing_power')
|
|
await this.getDict('initial_intent')
|
|
await this.getDict('cognitive_idea')
|
|
await this.getDict('status')
|
|
await this.getDict('decision_maker')
|
|
await this.getDict('distance')
|
|
} catch (error) {
|
|
console.error('回退方案也失败了:', error)
|
|
}
|
|
},
|
|
async get_campus_list(){
|
|
|
|
let res = await apiRoute.common_getCampusesList({})
|
|
if (res.code != 1) {
|
|
uni.showToast({
|
|
title: res.msg,
|
|
icon: 'none'
|
|
})
|
|
return
|
|
}
|
|
|
|
this.campus_list = res.data
|
|
|
|
|
|
let arr = []
|
|
this.campus_list.forEach((v,k)=>{
|
|
arr.push({
|
|
text: v.campus_name,
|
|
value: v.id,
|
|
})
|
|
})
|
|
|
|
this.picker_config['campus'].options = arr
|
|
|
|
},
|
|
//获取用户信息
|
|
async getUserInfo(){
|
|
let res = await apiRoute.getPersonnelInfo({})
|
|
if (res.code != 1) {
|
|
uni.showToast({
|
|
title: res.msg,
|
|
icon: 'none'
|
|
})
|
|
return
|
|
}
|
|
|
|
this.userInfo = res.data
|
|
|
|
this.formData.consultant = res.data.id//顾问id
|
|
this.formData.staff_id = res.data.id//人员ID
|
|
this.picker_config['consultant'].text = res.data.name//顾问名字
|
|
|
|
await this.get_campus_list()//获取校区
|
|
},
|
|
|
|
//获取字典-课程id选择
|
|
async getDict_courses_id(){
|
|
let res = await marketApi.selectCourseList({})
|
|
if(res.code != 1){
|
|
uni.showToast({
|
|
title: res.msg,
|
|
icon: 'none'
|
|
})
|
|
return
|
|
}
|
|
|
|
let dictionary = res.data
|
|
let arr = []
|
|
dictionary.forEach((v,k)=>{
|
|
arr.push({
|
|
text: v.name,
|
|
value: v.id,
|
|
})
|
|
})
|
|
this.options_courses_id = arr
|
|
},
|
|
|
|
|
|
//获取人员列表
|
|
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(inputName){
|
|
let key = ''
|
|
switch (inputName){
|
|
case 'source_channel': key = 'SourceChannel'; break;
|
|
case 'source': key = 'source'; break;
|
|
case 'purchasing_power': key = 'customer_purchasing_power'; break;
|
|
case 'cognitive_idea': key = 'cognitive_concept'; break;
|
|
case 'decision_maker': key = 'decision_maker'; break;
|
|
case 'initial_intent': key = 'preliminarycustomerintention'; break;
|
|
case 'status': key = 'kh_status'; break;
|
|
case 'distance': key = 'distance'; break;
|
|
}
|
|
if(!key){ return }
|
|
// 使用 util.getDict 获取并缓存字典
|
|
let dictionary = await util.getDict(key)
|
|
if(!dictionary || !Array.isArray(dictionary) || dictionary.length === 0){
|
|
uni.showToast({ title: '暂无选项', icon: 'none' })
|
|
return
|
|
}
|
|
let arr = []
|
|
// 处理接口返回的数据结构 [{name: "抖音", value: "1", sort: 0, memo: ""}, ...]
|
|
dictionary.forEach((v) => {
|
|
arr.push({ text: v.name, value: v.value })
|
|
})
|
|
this.picker_config[inputName].options = arr
|
|
},
|
|
|
|
//##### 查重相关 #####
|
|
//客户列表--查重
|
|
async clientList(){
|
|
|
|
if(!this.student_name){
|
|
uni.showToast({
|
|
title: '请输入检索关键字',
|
|
icon: 'none'
|
|
})
|
|
return
|
|
}
|
|
|
|
this.clientUserList = []
|
|
|
|
let param = {
|
|
name:this.student_name
|
|
}
|
|
let res = await apiRoute.xs_getAllCustomerResources(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 resource_sharing_id = '';
|
|
if (item.resourceSharingHasMany && item.resourceSharingHasMany.length > 0) {
|
|
resource_sharing_id = item.resourceSharingHasMany[0].id; // 共享资源表id
|
|
}
|
|
|
|
if (!resource_sharing_id) {
|
|
uni.showToast({
|
|
title: '暂时无法查看',
|
|
icon: 'none'
|
|
});
|
|
return;
|
|
}
|
|
|
|
this.$navigateTo({
|
|
url: `/pages/market/clue/clue_info?resource_sharing_id=${resource_sharing_id}`
|
|
})
|
|
},
|
|
|
|
//跳转页面-我的消息
|
|
openViewMyMessage(item) {
|
|
let from_id = this.userInfo.id//发送者的id
|
|
let to_id = item.customerResource.id//接收者ID
|
|
this.$navigateTo({
|
|
url: `/pages/common/im_chat_info?from_id=${from_id}&to_id=${to_id}`
|
|
})
|
|
},
|
|
|
|
//拨打电话
|
|
async dialTel(item) {
|
|
|
|
let tel = item.phone_number
|
|
|
|
if (!tel) {
|
|
uni.showToast({
|
|
title: '电话号码为空',
|
|
icon: 'none'
|
|
});
|
|
return;
|
|
}
|
|
|
|
|
|
let param = {
|
|
staff_id: this.userInfo.id,//员工id
|
|
resource_id: item.id,//资源ID
|
|
resource_type: '',//资源类型(如设备、文件、系统等)
|
|
communication_type: 'phone',//沟通类型: phone-电话, email-邮件, meeting-会议, other-其他
|
|
communication_result: 'success',//沟通结果: success-成功, failure-失败, pending-待定
|
|
remarks: null,//备注
|
|
tag: null,//标签
|
|
}
|
|
|
|
let res = await apiRoute.xs_communicationRecordsAdd(param)//添加通过记录
|
|
if (res.code != 1) {
|
|
uni.showToast({
|
|
title: res.msg,
|
|
icon: 'none'
|
|
})
|
|
return
|
|
}
|
|
|
|
uni.makePhoneCall({
|
|
phoneNumber: tel
|
|
})
|
|
},
|
|
|
|
|
|
|
|
//联系电话失去焦点时间
|
|
async handlePhoneBlur(){
|
|
if(!this.formData.phone_number){
|
|
return
|
|
}
|
|
|
|
this.clientUserList = []
|
|
|
|
let param = {
|
|
phone_number:this.formData.phone_number
|
|
}
|
|
let res = await apiRoute.xs_getAllCustomerResources(param)
|
|
if(res.code != 1){
|
|
if(res.msg == '暂无数据'){
|
|
return
|
|
}
|
|
uni.showToast({
|
|
title: res.msg,
|
|
icon: 'none'
|
|
})
|
|
return
|
|
}
|
|
console.log('查重',res)
|
|
this.clientUserList = res.data
|
|
this.openDuplicateCheck()
|
|
},
|
|
|
|
|
|
|
|
//多选客户标签-选中后回调
|
|
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]}`
|
|
},
|
|
|
|
//开关选择
|
|
switchChange(e) {
|
|
if (e.detail.value) {
|
|
this.switchChange_type = 1
|
|
} else {
|
|
this.switchChange_type = 2
|
|
}
|
|
},
|
|
|
|
//性别选择器
|
|
changeSex(e){
|
|
this.formData.gender = 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 = ''//备注
|
|
}
|
|
},
|
|
|
|
|
|
//切换tag列表
|
|
async segmented(e) {
|
|
console.log(e)
|
|
//e.id|0=基础信息 1=六要素
|
|
let status = e.id
|
|
this.optionTableId = String(status)
|
|
},
|
|
|
|
|
|
//######-----下拉选择器组件相关-----######
|
|
//打开下拉选择器
|
|
openCicker(input_name, linkage = true) {
|
|
this.picker_options = []
|
|
|
|
this.picker_input_name = input_name
|
|
|
|
let arr = this.picker_config[input_name]?.options || []
|
|
|
|
if (!arr.length) {
|
|
uni.showToast({ title: '暂无选项', icon: 'none' })
|
|
return
|
|
}
|
|
|
|
this.picker_options =arr
|
|
this.picker_linkage = linkage
|
|
// 使用 nextTick 确保数据更新后再打开 picker
|
|
this.$nextTick(() => {
|
|
this.picker_show = true
|
|
})
|
|
},
|
|
//监听-下拉选择器
|
|
changeCicker(e) {
|
|
console.log('监听-下拉选择器', this.picker_input_name, e,this.formData)
|
|
let input_name = this.picker_input_name
|
|
this.formData[input_name] = e.value
|
|
this.picker_config[input_name]['text'] = e.text
|
|
|
|
if(input_name == 'source'){
|
|
if(e.value != 1){
|
|
this.formData.source_channel = '0'//0=线下
|
|
}else{
|
|
this.formData.source_channel = ''//线下
|
|
}
|
|
}
|
|
|
|
this.cancelCicker()
|
|
},
|
|
//关闭下拉选择器
|
|
cancelCicker() {
|
|
this.picker_show = false
|
|
this.picker_input_name = ''
|
|
this.picker_options = []
|
|
},
|
|
|
|
|
|
//######-----时间选择器组件相关-----######
|
|
//打开下拉选择器
|
|
openDate(input_name) {
|
|
this.date_picker_show = true
|
|
this.data_picker_input_name = input_name
|
|
},
|
|
//选择跟进时间
|
|
change_date(e) {
|
|
//跟进时间
|
|
let val = (e.result ?? '')
|
|
if(val){
|
|
val = val
|
|
}
|
|
|
|
let input_name = this.data_picker_input_name
|
|
this.formData[input_name] = val
|
|
|
|
this.cancel_date()
|
|
},
|
|
//关闭选择跟进时间
|
|
cancel_date() {
|
|
this.date_picker_show = false
|
|
},
|
|
|
|
//下一步 index|0=添加客户,1六要素
|
|
async nextStep(index) {
|
|
this.optionTableId = String(index)
|
|
},
|
|
//表单验证
|
|
async validatorForm(data) {
|
|
//姓名
|
|
if(!data.name){
|
|
uni.showToast({
|
|
title: '学生姓名必填',
|
|
icon: 'none'
|
|
})
|
|
this.nextStep('0')
|
|
return false
|
|
}
|
|
//电话
|
|
if(!data.phone_number){
|
|
uni.showToast({
|
|
title: '电话必填',
|
|
icon: 'none'
|
|
})
|
|
this.nextStep('0')
|
|
return false
|
|
}
|
|
//校区必填
|
|
if(!data.campus){
|
|
uni.showToast({
|
|
title: '校区必填',
|
|
icon: 'none'
|
|
})
|
|
this.nextStep('0')
|
|
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 apiRoute.xs_addCustomerResources(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.redirectTo({
|
|
url: `/pages/market/clue/index`
|
|
})
|
|
}, 1000)
|
|
},
|
|
}
|
|
}
|
|
</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>
|