Browse Source

feat(market): 销售端首页添加课程选择功能

- 在 add_clues.vue 中添加课程选择功能
- 在 market.js 中添加 selectCourseList 方法获取课程列表- 优化表单验证,增加课程选择的必填校验- 更新数据结构,增加课程选择相关的属性和方法
master
liutong 12 months ago
parent
commit
e1426f5544
  1. 10
      api/market.js
  2. 68
      pages/market/clue/add_clues.vue

10
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;
})
},

68
pages/market/clue/add_clues.vue

@ -12,6 +12,21 @@
<view class="title" style="margin-top: 20rpx;">基础信息</view>
<view class="input-style">
<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(`courses_id`)"
v-if="!formData.courses_id">点击选择
</view>
<view class="input-title" style="margin-right:14rpx;" @click="selectCon(`courses_id`)" v-else>
{{str_courses_id}}
</view>
</view>
</fui-form-item>
<fui-form-item label="线索标题" asterisk asteriskPosition="right" labelSize='26' prop="title"
background='#434544' labelColor='#fff' :bottomBorder='false'>
<view class="input-title" style="margin-right:14rpx;">
@ -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

Loading…
Cancel
Save