Browse Source

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

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

409
pages/market/clue/add_clues.vue

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

Loading…
Cancel
Save