diff --git a/pages/market/clue/writing_followUp.vue b/pages/market/clue/writing_followUp.vue index 26324a6..f97cd2b 100644 --- a/pages/market/clue/writing_followUp.vue +++ b/pages/market/clue/writing_followUp.vue @@ -359,6 +359,9 @@ export default { data() { return { rules, + + is_submit: true,//是否提交(防止重复提交)|true=可提交,false=不可提交 + //表单数据 formData:{ //##### 基础表单 ##### @@ -651,11 +654,116 @@ export default { } }, - //验证表单 + //表单验证 async validatorForm(data) { + //线索标题 + if(!data.title){ + uni.showToast({ + title: '线索标题必填', + icon: 'none' + }) + return false + } + //学生姓名 + if(!data.student_name){ + uni.showToast({ + title: '学生姓名必填', + icon: 'none' + }) + return false + } + //年龄 + if(!data.age){ + uni.showToast({ + title: '年龄必填', + icon: 'none' + }) + return false + } + //性别 + if(!data.sex){ + uni.showToast({ + title: '性别必填', + icon: 'none' + }) + return false + } + //电话 + if(!data.student_phone){ + 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 }, - //提交表单 + //提交 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 marketApi.setSales(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.navigateTo({ + url: `/pages/market/clue/index` + }) + }, 1000) }, @@ -663,38 +771,62 @@ export default { selectCon(type) { this.options_type = type switch (type) { - //来源渠道 - case 'source_channel': + //选择线索 + case 'sales_id': this.options = this.options_source_channel this.show = true this.linkage = true break; - //客户来源 - case 'customer_source': + //跟进人员 + case 'staff_id': this.options = this.options_customer_source this.show = true this.linkage = true break; - //顾问 - case 'add_staff_id': + //跟进时间 + case 'follow_up_time': this.options = this.options_add_staff_id this.show = true this.linkage = true break; - // 跟进类型 - case 'entry_type': + //购买力 + case 'purchasing_power': this.options = this.options_entry_type this.show = true this.linkage = true break; - // 跟进人员 - case 'staff_id': + //认知理念 + case 'cognitive_concept': this.options = this.options_staff_id this.show = true this.linkage = true break; - //跟进时间 - case 'follow_up_time': + //可选上课时间 + case 'schooltime': + this.show_date = true + break; + //情感粘度 + case 'emotional_intensity': + this.show_date = true + break; + //意向分类 + case 'initial_customer_intent': + this.show_date = true + break; + //意向度 + case 'initial_relationship_intent': + this.show_date = true + break; + //跟进类型 + case 'entry_type': + this.show_date = true + break; + //跟进人员 + case 'follow_staff_id': + this.show_date = true + break; + //跟进任务-跟进时间(跟进任务) + case 'reminder_time': this.show_date = true break; } @@ -710,28 +842,64 @@ export default { 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值 + //选择线索 + case 'sales_id': + this.str_source_channel = e.text//选中的text值 + this.formData.source_channel = e.value//选中value值 break; - // 跟进人员 + //跟进人员 case 'staff_id': - this.str_staff_id = e.text//选中的text值 - this.formData.staff_id = e.value//选中value值 + this.str_source_channel = e.text//选中的text值 + this.formData.source_channel = e.value//选中value值 break; //跟进时间 case 'follow_up_time': + this.str_source_channel = e.text//选中的text值 + this.formData.source_channel = e.value//选中value值 + break; + //购买力 + case 'purchasing_power': + this.str_source_channel = e.text//选中的text值 + this.formData.source_channel = e.value//选中value值 + break; + //认知理念 + case 'cognitive_concept': + this.str_source_channel = e.text//选中的text值 + this.formData.source_channel = e.value//选中value值 + break; + //可选上课时间 + case 'schooltime': + this.str_source_channel = e.text//选中的text值 + this.formData.source_channel = e.value//选中value值 + break; + //情感粘度 + case 'emotional_intensity': + this.str_source_channel = e.text//选中的text值 + this.formData.source_channel = e.value//选中value值 + break; + //意向分类 + case 'initial_customer_intent': + this.show_date = true + break; + //意向度 + case 'initial_relationship_intent': + this.str_source_channel = e.text//选中的text值 + this.formData.source_channel = e.value//选中value值 + break; + //跟进类型 + case 'entry_type': + this.str_source_channel = e.text//选中的text值 + this.formData.source_channel = e.value//选中value值 + break; + //跟进人员 + case 'follow_staff_id': + this.str_source_channel = e.text//选中的text值 + this.formData.source_channel = e.value//选中value值 + break; + //跟进任务-跟进时间(跟进任务) + case 'reminder_time': + this.str_source_channel = e.text//选中的text值 + this.formData.source_channel = e.value//选中value值 break; } },