智慧教务系统UniApp前端项目(使用中2025-0517)
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.
 
 
 
 
 

1382 lines
38 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="姓名" 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.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=""
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 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>
</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(`initial_intent`)">
{{ (formData.initial_intent) ? picker_config.initial_intent.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(`status`)">
{{ (formData.status) ? picker_config.status.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(`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>
<!--一访情况-->
<fui-form-item label="一访情况" asteriskPosition="right" labelSize='26' prop="title"
background='#434544' labelColor='#fff' :bottomBorder='false'>
<view class="input-title" style="margin-right:14rpx;">
<fui-textarea placeholder="点击填写" style="text-align: left;"
v-model="formData.first_visit_status"></fui-textarea>
</view>
</fui-form-item>
<!--二访情况-->
<fui-form-item label="二访情况" asteriskPosition="right" labelSize='26' prop="title"
background='#434544' labelColor='#fff' :bottomBorder='false'>
<view class="input-title" style="margin-right:14rpx;">
<fui-textarea placeholder="点击填写" borderColor="#292929" style="text-align: left;"
v-model="formData.second_visit_status"></fui-textarea>
</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.efficacious" @change="changeEfficacious">
<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>
</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" :value="default_date_value"></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">
<view class="left_box" @click="openViewClueInfo(v)">
<view class="box_1">
<image class="img" :src="$util.img('/uniapp_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="$util.img('/uniapp_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="$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.follow && v.follow.initial_customer_intent || '' }}</view>
</view>
</view>
</view>
<view class="right_box">
<image class="img" :src="$util.img('/uniapp_src/static/images/index/message.png')"
@click="openViewMyMessage(v)"></image>
<image 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';
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=不可提交
resource_sharing_id: '', //resource_sharing_id(资源共享表id)
//表单
formData: {
// 客户基础信息
source_channel: '', //来源渠道
source: '', //来源
consultant: '', //顾问
name: '', //姓名
age: '', //年龄
gender: 'male', //性别|male-男性, female-女性, other-其他
phone_number: '', //联系电话
demand: '', //需求
decision_maker: '', //决策人
initial_intent: '', //客户初步意向度: high-高, medium-中, low-低
status: '', //客户状态: active-活跃, inactive-不活跃, pending-待定
//六要素信息
purchasing_power: '', //购买力
cognitive_idea: '', //认知理念
communication: '', //沟通备注
promised_visit_time: '', //承诺到访时间
staff_id: '', //人员ID
distance: '', //距离
optional_class_time: '', //可选上课时间
first_visit_status: '', //一访情况
second_visit_status: '', //二访情况
efficacious:''
},
//下拉选择器相关
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: [],
},
//所属校区
campus: {
text: '',
options: [],
},
//客户状态
status: {
text: '',
options: [],
},
//决策人
decision_maker: {
text: '',
options: [],
},
//距离
distance: {
text: '',
options: [],
},
}, //选择器选项配置
// 年月日选择组件
data_picker_input_name: '', //时间组件的input_name
date_picker_show: false, //时间选择器是否展示
default_date_value: '', // 添加默认日期值
//地区三级联动
show_area: false,
options_area: [],
//登录用户信息
userInfo: {},
// 查重相关
student_name: '', //检索关键字
clientUserList: [], //查重用户列表
showDuplicateCheck: false, //是否显示查重弹出层
//tab切换
optionTableId: 0,
optionTable: [{
id: 0,
name: '编辑客户'
},
{
id: 1,
name: '编辑六要素'
}
],
}
},
onLoad(options) {
this.resource_sharing_id = options.resource_sharing_id //共享资源表id
},
onShow() {
this.init()
},
methods: {
//初始化
async init() {
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') //获取字典-距离
// this.getStaffList()//获取人员列表
// this.getAreaTree()//获取地区树形结构
await this.getInfo() //获取资源共享-详情(客户资源详情)
},
//获取资源共享-详情(客户资源详情)
async getInfo() {
let params = {
resource_sharing_id: this.resource_sharing_id
}
let res = await apiRoute.xs_resourceSharingInfo(params) //资源共享-详情(客户资源详情)
if (res.code != 1) {
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
let customerResource = res.data.customerResource || {} //客户资源详情
let sixSpeed = res.data.customerResource.sixSpeed || {} //六要素详情
console.log('12313', sixSpeed)
console.log('详情', res.data)
this.formData = {
resource_sharing_id: this.resource_sharing_id, //资源共享表id
// 客户基础信息
id: customerResource.id || '', //客户资源表id
source_channel: customerResource.source_channel || '', //来源渠道
source: customerResource.source || '', //来源
name: customerResource.name || '', //姓名
age: customerResource.age || '', //年龄
gender: customerResource.gender || '', //性别|male-男性, female-女性, other-其他
phone_number: customerResource.phone_number || '', //联系电话
demand: customerResource.demand || '', //需求
decision_maker: customerResource.decision_maker || '', //决策人
initial_intent: customerResource.initial_intent || '', //客户初步意向度: high-高, medium-中, low-低
status: customerResource.status || '', //客户状态: active-活跃, inactive-不活跃, pending-待定
//六要素信息
purchasing_power: sixSpeed.purchase_power || '', //购买力
cognitive_idea: sixSpeed.concept_awareness || '', //认知理念
communication: sixSpeed.communication || '', //沟通备注
staff_id: sixSpeed.staff_id || '', //人员ID
distance: sixSpeed.distance || '', //距离
promised_visit_time: sixSpeed.promised_visit_time || '', //承诺到访时间
optional_class_time: sixSpeed.preferred_class_time || '', //可选上课时间
first_visit_status: sixSpeed.first_visit_status || '', //一访情况
second_visit_status: sixSpeed.second_visit_status || '', //二访情况
efficacious : sixSpeed.efficacious
}
this.formData.promised_visit_time = this.$util.formatToDateTime(sixSpeed.promised_visit_time,
'Y-m-d'); //格式化时间(Y-m-d H:i)
this.formData.optional_class_time = this.$util.formatToDateTime(sixSpeed.promised_visit_time,
'Y-m-d'); //格式化时间(Y-m-d H:i)
//下拉窗文本回显
this.picker_config.source_channel.text = customerResource.source_channel_name || '点击选择' //来源渠道
this.picker_config.source.text = customerResource.source_name || '点击选择' //来源
this.picker_config.consultant.text = customerResource.consultant_name || '点击选择' //顾问
this.picker_config.initial_intent.text = customerResource.initial_intent_name || '点击选择' //客户初步意向度
this.picker_config.status.text = customerResource.status_name || '点击选择' //客户状态
this.picker_config.decision_maker.text = customerResource.decision_maker || '点击选择' //决策人
//六要素相关
this.picker_config.purchasing_power.text = sixSpeed.purchase_power_name || '点击选择' //购买力
this.picker_config.cognitive_idea.text = sixSpeed.concept_awareness_name || '点击选择' //认知理念
this.picker_config.distance.text = sixSpeed.distance || '点击选择' //距离
},
//获取字典-课程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
}
let res = await apiRoute.common_Dictionary({
key: key
})
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,
})
})
if (inputName == 'source_channel') {
//插入到arr的头部
arr.unshift({
text: '线下',
value: '0',
})
}
if (inputName == 'status') {
//插入到arr的头部
console.log(arr)
}
this.picker_config[inputName].options = 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
this.$navigateTo({
url: `/pages/market/clue/clue_info?id=${id}`
})
},
//跳转页面-我的消息
openViewMyMessage(item) {
let hair_staff_id = item.hair_staff_id
this.$navigateTo({
url: `/pages/common/im_chat_info?hair_staff_id=${hair_staff_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 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
if (this.clientUserList.length == 1) {
if (this.clientUserList[0].id == this.formData.id) {
//查重后的手机号是自己,就不展示查重结果了
return
}
}
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
}
},
changeEfficacious(e) {
this.formData.efficacious = e.detail.value
},
//性别选择器
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)
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
// 设置默认日期值
if (this.formData[input_name]) {
// 如果有值,使用当前值
this.default_date_value = this.formData[input_name]
} else {
// 如果没有值,使用当天日期
const today = new Date()
const year = today.getFullYear()
const month = String(today.getMonth() + 1).padStart(2, '0')
const day = String(today.getDate()).padStart(2, '0')
this.default_date_value = `${year}-${month}-${day}`
}
},
//选择跟进时间
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) {
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_editCustomerResources(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/clue_info?resource_sharing_id=${this.resource_sharing_id}`
})
}, 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>