Browse Source

refactor(market): 重构线索添加页面

- 优化了表单结构和字段名称
- 添加了来源渠道、跟进类型等新字段
- 重构了选择器组件的使用方式
- 优化了数据验证逻辑
-调整了字典数据的获取和展示
master
liutong 12 months ago
parent
commit
7bf742fc00
  1. 457
      pages/market/clue/add_clues.vue

457
pages/market/clue/add_clues.vue

@ -20,29 +20,29 @@
</view>
</fui-form-item>
<fui-form-item label="来源渠道" asterisk asteriskPosition="right" labelSize='26' prop="" background='#434544'
<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(1)"
v-if="result_customer_source == ''">点击选择
<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(1)" v-else>
{{ result_customer_source }}
<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="客户来源" asterisk asteriskPosition="right" labelSize='26' prop="" background='#434544'
<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(1)"
v-if="result_customer_source == ''">点击选择
<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(1)" v-else>
{{ result_customer_source }}
<view class="input-title" style="margin-right:14rpx;" @click="selectCon(`customer_source`)" v-else>
{{ str_customer_source }}
</view>
</view>
@ -52,12 +52,10 @@
labelColor='#fff' :bottomBorder='false'>
<view class="input-title" style="margin-right:14rpx;">
<view class="input-title" style="margin-right:14rpx;" @click="selectCon(2)"
v-if="result_add_staff_id == ''">点击选择
<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(2)" v-else>{{
result_add_staff_id
}}
<view class="input-title" style="margin-right:14rpx;" @click="selectCon('add_staff_id')" v-else>{{str_add_staff_id}}
</view>
</view>
@ -131,36 +129,48 @@
</fui-form-item>
<view v-if="is_follow">
<fui-form-item label="跟进类型" labelSize='26' asterisk asteriskPosition="right" prop="mobile"
background='#434544' labelColor='#fff' :bottomBorder='false'>
<fui-input :borderBottom="false" :padding="[0]" placeholder="点击填写" v-model="formData.community_name"
backgroundColor="#434544" size="26" color="#fff"></fui-input>
<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(2)"
v-if="result_add_staff_id == ''">点击选择
<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>{{
result_add_staff_id
}}
<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="跟进时间" labelSize='26' asterisk asteriskPosition="right" prop="mobile"
background='#434544' labelColor='#fff' :bottomBorder='false'>
<fui-input :borderBottom="false" :padding="[0]" placeholder="请选择跟进时间" v-model="formData.follow_up_time"
backgroundColor="#434544" size="26" color="#fff" @click="selectCon(6)"></fui-input>
<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' asterisk asteriskPosition="right" prop="mobile"
<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.community_name"
<fui-input :borderBottom="false" :padding="[0]" placeholder="点击填写" v-model="formData.follow_up_content"
backgroundColor="#434544" size="26" color="#fff"></fui-input>
</fui-form-item>
@ -340,34 +350,91 @@ export default {
//
formData: {
title:'',//线
sex:'1',//|0=,1=,2=
student_name: '',//*
student_phone: '',//*
age: '',//*
school_name: '',//
grade: '',//
class_name: '',//
customer_source: '',//*
add_staff_id: '',//id*
contact_name: '',//*
province_id: '',//-
city_id: '',//-
district_id: '',//-
full_address: '',//
community_name: '',//
customer_tags_name: '',//,,
customer_tags: ['2', '3'],//
is_follow:'1',// 1 2
follow_up_time:'',//*
follow_up_content:'',//
staff_id:'',//id*
is_warn:'2',// 1 2
reminder_method:'',//1=,2=,3=
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: [
// {
// 'value': 1,
// 'text': '1'
// }
],
str_staff_id:'',//-
//-
show_date: false,
@ -381,10 +448,9 @@ export default {
result_renwu: '',
result_fangshi: '',
show: false,
options: [],
linkage: true,
options_type: undefined,
options_leixing: [{
'value': 1,
'text': '类型1'
@ -452,25 +518,8 @@ export default {
result_customer_source: '',//
options_customer_source: [
{
'value': 1,
'text': '渠道1'
},
{
'value': 2,
'text': '渠道2'
}
],//
//(add_staff_id,id)
result_add_staff_id: '',//
staff_id_name:'',//
options_add_staff_id: [
// {
// 'value': 1,
// 'text': ''
// },
],//
//
show_customer_tags: false,
@ -503,6 +552,7 @@ export default {
async init() {
//
this.getUserInfo()
this.getDict_source_channel()//-
this.getDict_customer_source()//-
this.getDict_customer_tags()//-
this.getStaffList()//
@ -521,9 +571,13 @@ export default {
}
this.userInfo = res.data
console.log(111,res.data)
this.formData.staff_id = res.data.staff_id
this.result_add_staff_id = res.data.name
this.formData.add_staff_id = res.data.staff_id//id
this.str_add_staff_id = res.data.name//
this.formData.staff_id = res.data.staff_id//id
this.str_staff_id = res.data.name//
},
@ -538,12 +592,15 @@ export default {
return
}
let arr = []
res.data.forEach((v,k)=>{
this.options_add_staff_id.push({
arr.push({
text: v.name,
value: v.id,
})
})
this.options_add_staff_id = arr
this.options_staff_id = arr
},
//
@ -559,6 +616,29 @@ export default {
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')
@ -642,6 +722,7 @@ export default {
this.showDuplicateCheck = false
},
//-
openViewClueInfo(item) {
let id = item.id
@ -670,6 +751,7 @@ export default {
//
async validatorForm(data) {
//线
if(!data.title){
uni.showToast({
title: '线索标题必填',
@ -677,20 +759,15 @@ export default {
})
return false
}
//
if(!data.student_name){
uni.showToast({
title: '学员姓名必填',
icon: 'none'
})
return false
}
if(!data.student_phone){
uni.showToast({
title: '电话必填',
title: '学生姓名必填',
icon: 'none'
})
return false
}
//
if(!data.age){
uni.showToast({
title: '年龄必填',
@ -698,28 +775,49 @@ export default {
})
return false
}
if(!data.customer_source){
//
if(!data.sex){
uni.showToast({
title: '客户来源必填',
title: '性别必填',
icon: 'none'
})
return false
}
if(!data.staff_id){
//
if(!data.student_phone){
uni.showToast({
title: '顾问必填',
title: '电话必填',
icon: 'none'
})
return false
}
if(!data.contact_name){
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
},
@ -729,7 +827,7 @@ export default {
let data = {...this.formData}
//
let validatorForm = await this.validatorForm(data)
console.log(123123,validatorForm)
console.log('验证结果',validatorForm)
if(!validatorForm){
return
}
@ -765,97 +863,92 @@ export default {
},
//
selectCon(type) {
if (type == 1) {
//
this.options_type = 1
this.options = this.options_customer_source
this.show = true
this.linkage = true
} else if (type == 2) {
//id
this.options_type = 2
this.options = this.options_add_staff_id
this.show = true
this.linkage = true
} else if (type == 3) {
this.options_type = 3
this.options = this.options_student
this.show = true
this.linkage = true
} else if (type == 4) {
this.options_type = 4
this.options = this.options_status
this.show = true
this.linkage = true
} else if (type == 5) {
this.options_type = 5
this.options = this.options_intention
this.show = true
this.linkage = true
} else if (type == 6) {
//
this.options_date_type = 6
this.show_date = true
} else if (type == 7) {
//
this.options_type = 7
this.options = this.options_renwu
this.show = true
this.linkage = true
} else if (type == 8) {
//
this.options_type = 8
this.options = this.options_fangshi
this.show = true
this.linkage = true
}else if (type == 'staff_id') {
//
this.options_type = 2
this.options = this.options_add_staff_id
this.show = true
this.linkage = true
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':
this.options = this.options_staff_id
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
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) {
if (this.options_date_type == 1) {
this.show_date = false
this.result_date = e.result ?? ''
} else if (this.options_date_type == 6) {
//
this.show_date = false
this.result_dates = e.result ?? ''
this.formData.follow_up_time = e.result ?? ''
}
//
this.show_date = false
this.formData.follow_up_time = e.result ?? ''
},
//
cancel_date() {
this.show_date = false
},
//
change(e) {
this.show = false
console.log(e)
if (this.options_type == 1) {
//
this.result_customer_source = e.result
this.formData.customer_source = e.value
} else if (this.options_type == 2) {
//(id)
this.result_add_staff_id = e.result
this.formData.add_staff_id = e.value
} else if (this.options_type == 3) {
this.result_student = e.result
} else if (this.options_type == 4) {
this.result_status = e.result
} else if (this.options_type == 5) {
this.result_intention = e.result
} else if (this.options_type == 7) {
this.result_renwu = e.result
} else if (this.options_type == 8) {
this.result_fangshi = e.result
}
},
//-
onConfirmCustomerTags(e) {
@ -917,10 +1010,10 @@ export default {
//2
this.formData.is_follow = '2'
// this.formData. = ''//
this.formData.entry_type = ''//
this.formData.staff_id = ''//
this.formData.follow_up_time = ''//
// this.formData. = ''//
this.formData.follow_up_content = ''//
}
},
}

Loading…
Cancel
Save