From e1426f55444f41e10c912586a018e60270f62d4c Mon Sep 17 00:00:00 2001 From: liutong <836164388@qq.com> Date: Thu, 17 Apr 2025 15:07:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(market):=20=E9=94=80=E5=94=AE=E7=AB=AF?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=B7=BB=E5=8A=A0=E8=AF=BE=E7=A8=8B=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 add_clues.vue 中添加课程选择功能 - 在 market.js 中添加 selectCourseList 方法获取课程列表- 优化表单验证,增加课程选择的必填校验- 更新数据结构,增加课程选择相关的属性和方法 --- api/market.js | 10 +++++ pages/market/clue/add_clues.vue | 68 +++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/api/market.js b/api/market.js index aa1bb49..e4f0a7a 100644 --- a/api/market.js +++ b/api/market.js @@ -141,6 +141,16 @@ export default { }) }, + //销售端首页 + selectCourseList(data = {}) { + let url = '/member/select_course_list' + return http.get(url, data).then(res => { + return res; + }) + }, + + + diff --git a/pages/market/clue/add_clues.vue b/pages/market/clue/add_clues.vue index 2a75992..ad36153 100644 --- a/pages/market/clue/add_clues.vue +++ b/pages/market/clue/add_clues.vue @@ -12,6 +12,21 @@ 基础信息 + + + + 点击选择 + + + {{str_courses_id}} + + + + + + @@ -349,6 +364,7 @@ export default { //表单 formData: { + courses_id:'',//课程id title:'',//线索标题 source_channel:'',//来源渠道 customer_source:'',//客户来源 @@ -371,6 +387,16 @@ export default { linkage: true,//是否联动选择 options: [],//下拉选择器可选值列表 + //课程id选择-相关 + //字典-课程选择 + options_courses_id: [ + // { + // 'value': 1, + // 'text': '类型1' + // } + ],//课程id选择列表 + str_courses_id:'',//文本显示-课程id选择 + //来源渠道-相关 //字典-来源渠道 options_source_channel: [ @@ -558,6 +584,7 @@ export default { async init() { //获取登录用户信息 this.getUserInfo() + this.getDict_courses_id()//获取字典-课程id选择 this.getDict_source_channel()//获取字典-来源渠道 this.getDict_customer_source()//获取字典-客户来源 this.getDict_customer_tags()//获取字典-客户标签 @@ -589,6 +616,28 @@ export default { this.str_add_staff_id = res.data.name//顾问名字 }, + //获取字典-课程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() { @@ -811,6 +860,14 @@ export default { //表单验证 async validatorForm(data) { + //课程id + if(!data.courses_id){ + uni.showToast({ + title: '请选择课程', + icon: 'none' + }) + return false + } //线索标题 if(!data.title){ uni.showToast({ @@ -925,6 +982,12 @@ export default { selectCon(type) { this.options_type = type switch (type) { + //课程id选择 + case 'courses_id': + this.options = this.options_courses_id + this.show = true + this.linkage = true + break; //来源渠道 case 'source_channel': this.options = this.options_source_channel @@ -980,6 +1043,11 @@ export default { this.show = false let type = this.options_type switch (type) { + //课程id选择 + case 'courses_id': + this.str_courses_id = e.text//选中的text值 + this.formData.courses_id = e.value//选中value值 + break; //来源渠道 case 'source_channel': this.str_source_channel = e.text//选中的text值