Browse Source

feat(market): 新增线索添加功能

- 添加学员姓名、手机号、年龄等基本信息输入框
- 实现客户来源、归属人员、客户标签等下拉选择功能- 集成地区三级联动选择
- 增加表单验证功能
- 实现提交表单后跳转到线索列表页面
master
liutong 1 year ago
parent
commit
e5de311d96
  1. 8
      api/member.js
  2. 244
      pages/market/clue/add_clues.vue

8
api/member.js

@ -116,6 +116,14 @@ export default {
})
},
//人员列表
staffList(data) {
let url = '/member/staff_list'
return http.get(url, data).then(res => {
return res;
})
},

244
pages/market/clue/add_clues.vue

@ -160,7 +160,7 @@
backgroundColor="#434544" size="26" color="#fff" @click="show_customer_tags=true"></fui-input>
<!--下拉多选-->
<fui-select :show="show_customer_tags" :options="options_customer_tags" title="请选择银行" multiple isReverse
<fui-select :show="show_customer_tags" :options="options_customer_tags" title="请选择客户标签" multiple isReverse
checkboxColor="#FFC529" btnBackground="#FFC529" btnColor="#1A1D26" closeColor="#6D758A"
@confirm="onConfirmCustomerTags" @close="show_customer_tags=false"></fui-select>
</fui-form-item>
@ -188,13 +188,71 @@
<script>
import commonApi from '@/api/common.js';
import marketApi from '@/api/market.js';
import memberApi from '@/api/member.js';
const rules = [{
name: "mobile",
const rules = [
{
name: "student_name",
rule: ["required"],
msg: ["请输入学员姓名"]
},
{
name: "student_phone",
rule: ["required", "isMobile"],
msg: ["请输入手机号", "请输入正确的手机号"]
}];
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 {
@ -327,39 +385,28 @@ export default {
//(add_staff_id,id)
result_add_staff_id: '',//
options_add_staff_id: [
{
'value': 1,
'text': '张三'
},
{
'value': 2,
'text': '李四'
}
// {
// 'value': 1,
// 'text': ''
// },
],//
//
show_customer_tags: false,
options_customer_tags: [
{
text: '标签1',
value: '1',
checked: false,//"true=,false=
},
{
text: '标签2',
value: '2',
checked: false,//
},
{
text: '标签3',
value: '3',
checked: false,//
}
// {
// text: '3',
// value: '3',
// checked: false,//
// }
],//
//
show_area: false,
options_area: [],
//
userInfo:{}
}
},
onShow() {
@ -368,9 +415,51 @@ export default {
methods: {
//
async init() {
//
this.getUserInfo()
this.getDict_customer_source()//-
this.getDict_customer_tags()//-
this.getStaffList()//
this.getAreaTree()//
},
async getUserInfo(){
let res = await marketApi.member({})
if (res.code != 1) {
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.userInfo = res.data
this.formData.staff_id = res.data.staff_id
this.result_add_staff_id = res.data.name
},
//
async getStaffList() {
let res = await memberApi.staffList({type: 2})
if (res.code != 1) {
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
res.data.forEach((v,k)=>{
this.options_add_staff_id.push({
text: v.name,
value: v.id,
})
})
},
//
async getAreaTree() {
let res = await commonApi.getAreaTree()
@ -384,20 +473,101 @@ export default {
this.options_area = res.data
},
//-
async getDict_customer_source(){
let res = await commonApi.getDictionary('customer_source')
if(res.code != 1){
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
//
submit() {
console.log(this.formData)
this.$refs.form.validator(null, null, true).then(res => {
console.log(res)
let dictionary = res.data.dictionary
let arr = []
dictionary.forEach((v,k)=>{
arr.push({
text: v.name,
value: v.value,
})
})
this.options_customer_source = arr
},
//-
async getDict_customer_tags(){
let res = await commonApi.getDictionary('customer_tags')
if(res.code != 1){
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
let dictionary = res.data.dictionary
let arr = []
dictionary.forEach((v,k)=>{
arr.push({
text: v.name,
value: String(v.value),
checked: false,
})
})
this.options_customer_tags = arr
},
//
async validatorForm() {
try {
const res = await this.$refs.form.validator(null, null, true);
console.log(res);
if (res.isPassed) {
console.log('校验通过!')
console.log('校验通过!');
return true;
} else {
console.log('向上滑动页面查看错误提示!')
console.log('向上滑动页面查看错误提示!');
return false;
}
}).catch(err => {
console.log(err)
} catch (err) {
console.log(err);
return false;
}
},
//
async submit() {
console.log(this.formData)
//
let validatorForm = await this.validatorForm()
console.log(123123,validatorForm)
if(!validatorForm){
return
}
let data = {...this.formData}
let res = await memberApi.setSales(data)
if(res.code != 1){
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
uni.showToast({
title: res.msg,
icon: 'success'
})
//1s
setTimeout(() => {
//-线
uni.navigateTo({
url: `/pages/market/clue/index`
})
}, 1000)
},
//
selectCon(type) {

Loading…
Cancel
Save