Merge remote-tracking branch 'origin/driver' into driver
This commit is contained in:
commit
959f232733
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<!-- 对话框(添加 / 修改) -->
|
<!-- 对话框(添加 / 修改) -->
|
||||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="50%" v-dialogDrag append-to-body>
|
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="70%" v-dialogDrag append-to-body>
|
||||||
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
|
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -22,14 +22,16 @@
|
|||||||
label="驾证类型"
|
label="驾证类型"
|
||||||
prop="type">
|
prop="type">
|
||||||
<el-select v-model="formData.type" placeholder="请选择驾证类型">
|
<el-select v-model="formData.type" placeholder="请选择驾证类型">
|
||||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.DRIVE_COURSE_TYPE)" :key="dict.value" :label="dict.label"
|
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.DRIVE_COURSE_TYPE)" :key="dict.value"
|
||||||
:value="dict.value" />
|
:label="dict.label"
|
||||||
|
:value="dict.value"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="价格" prop="price">
|
<el-form-item label="价格" prop="price">
|
||||||
<el-input-number v-model="formData.price" placeholder="请输入价格" :precision="2" :step="0.1" ></el-input-number>
|
<el-input-number v-model="formData.price" placeholder="请输入价格" :precision="2"
|
||||||
|
:step="0.1"></el-input-number>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -37,12 +39,14 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="订金" prop="reserveMoney">
|
<el-form-item label="订金" prop="reserveMoney">
|
||||||
<el-input-number v-model="formData.reserveMoney" placeholder="请输入订金" :precision="2" :step="0.1" ></el-input-number>
|
<el-input-number v-model="formData.reserveMoney" placeholder="请输入订金" :precision="2"
|
||||||
|
:step="0.1"></el-input-number>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="优惠" prop="favour">
|
<el-form-item label="优惠" prop="favour">
|
||||||
<el-input-number v-model="formData.favour" placeholder="请输入订金" :precision="2" :step="0.1" :max="1"></el-input-number>
|
<el-input-number v-model="formData.favour" placeholder="请输入订金" :precision="2" :step="0.1"
|
||||||
|
:max="1"></el-input-number>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -74,19 +78,19 @@
|
|||||||
<el-col>
|
<el-col>
|
||||||
<el-form-item label="教练">
|
<el-form-item label="教练">
|
||||||
<el-button size="mini" type="primary" @click="openCoachDraw">选择</el-button>
|
<el-button size="mini" type="primary" @click="openCoachDraw">选择</el-button>
|
||||||
<el-tag type="success" v-if="formData.coachListText !== ''">{{formData.coachListText}}</el-tag>
|
<el-tag type="success" v-if="formData.coachListText !== ''">{{ formData.coachListText }}</el-tag>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<!-- <el-row>-->
|
<!-- <el-row>-->
|
||||||
<!-- <el-col>-->
|
<!-- <el-col>-->
|
||||||
<!-- <el-form-item label="课程简介" prop="remark">-->
|
<!-- <el-form-item label="课程简介" prop="remark">-->
|
||||||
<!-- <el-input type="textarea" :rows="2" v-model="formData.remark" placeholder="请输入课程简介"/>-->
|
<!-- <el-input type="textarea" :rows="2" v-model="formData.remark" placeholder="请输入课程简介"/>-->
|
||||||
<!-- </el-form-item>-->
|
<!-- </el-form-item>-->
|
||||||
<!-- </el-col>-->
|
<!-- </el-col>-->
|
||||||
<!-- </el-row>-->
|
<!-- </el-row>-->
|
||||||
|
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col>
|
<el-col>
|
||||||
@ -96,6 +100,34 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col>
|
||||||
|
<el-form-item label="提成配置" prop="photo">
|
||||||
|
<el-table
|
||||||
|
:data="formData.deductList"
|
||||||
|
style="width: 100%">
|
||||||
|
<el-table-column
|
||||||
|
prop="label"
|
||||||
|
label="科目"
|
||||||
|
width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{getLabelByValue(scope.row.courseSubject)}}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="deduct"
|
||||||
|
label="提成金额"
|
||||||
|
width="280">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input-number v-model="scope.row.deduct" placeholder="请输入提成金额" :precision="2"
|
||||||
|
:step="0.1"></el-input-number>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col>
|
<el-col>
|
||||||
@ -118,12 +150,13 @@
|
|||||||
:before-close="handleClose">
|
:before-close="handleClose">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col v-for="(item,index) in initCoachList" :span="8">
|
<el-col v-for="(item,index) in initCoachList" :span="8">
|
||||||
<el-card >
|
<el-card>
|
||||||
<div slot="header" class="clearfix">
|
<div slot="header" class="clearfix">
|
||||||
<span>{{item.name}}</span>
|
<span>{{ item.name }}</span>
|
||||||
</div>
|
</div>
|
||||||
<el-checkbox-group v-model="item.checkedSubject" @change="handleCheckedChange($event,index)">
|
<el-checkbox-group v-model="item.checkedSubject" @change="handleCheckedChange($event,index)">
|
||||||
<el-checkbox v-for="subject in subjectList" :label="subject" :key="subject">科目{{subject}}</el-checkbox>
|
<el-checkbox v-for="subject in subjectList" :label="subject" :key="subject">科目{{ subject }}
|
||||||
|
</el-checkbox>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -137,6 +170,8 @@
|
|||||||
import * as DlDriveSchoolCourseApi from '@/views/drivingSchool/schoolCourse/courseApi';
|
import * as DlDriveSchoolCourseApi from '@/views/drivingSchool/schoolCourse/courseApi';
|
||||||
import {listCoach} from "../../drivingSchoolCar/api/car";
|
import {listCoach} from "../../drivingSchoolCar/api/car";
|
||||||
import Editor from "@/components/Editor/index.vue";
|
import Editor from "@/components/Editor/index.vue";
|
||||||
|
import {listDeduct} from "@/views/drivingSchool/DriveSchoolDeduct/api/deduct";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "DlDriveSchoolCourseForm",
|
name: "DlDriveSchoolCourseForm",
|
||||||
components: {Editor},
|
components: {Editor},
|
||||||
@ -149,7 +184,7 @@ export default {
|
|||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
formLoading: false,
|
formLoading: false,
|
||||||
chooed:[],
|
chooed: [],
|
||||||
// 表单参数
|
// 表单参数
|
||||||
formData: {
|
formData: {
|
||||||
tittle: undefined,
|
tittle: undefined,
|
||||||
@ -162,20 +197,60 @@ export default {
|
|||||||
remark: undefined,
|
remark: undefined,
|
||||||
reserveMoney: undefined,
|
reserveMoney: undefined,
|
||||||
favour: undefined,
|
favour: undefined,
|
||||||
coachList:[],
|
coachList: [],
|
||||||
coachListText:'',
|
coachListText: '',
|
||||||
|
subject: [
|
||||||
|
{
|
||||||
|
label: '科目一',
|
||||||
|
courseSubject: '1',
|
||||||
|
deduct: 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: '科目二',
|
||||||
|
courseSubject: '2',
|
||||||
|
deduct: 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '科目三',
|
||||||
|
courseSubject: '3',
|
||||||
|
deduct: 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '科目四',
|
||||||
|
courseSubject: '4',
|
||||||
|
deduct: 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
subjectStr: [
|
||||||
|
{
|
||||||
|
label: '科目一',
|
||||||
|
value: '1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '科目二',
|
||||||
|
value: '2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '科目三',
|
||||||
|
value: '3',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '科目四',
|
||||||
|
value: '4',
|
||||||
|
}],
|
||||||
|
defaultFormData: [],
|
||||||
//教练集合
|
//教练集合
|
||||||
initCoachList:[],
|
initCoachList: [],
|
||||||
subjectList:['1','2','3','4'],
|
subjectList: ['1', '2', '3', '4'],
|
||||||
// 表单校验
|
// 表单校验
|
||||||
formRules: {
|
formRules: {
|
||||||
type: [{ required: true, message: '驾证类型不能为空', trigger: 'blur' }],
|
type: [{required: true, message: '驾证类型不能为空', trigger: 'blur'}],
|
||||||
name: [{ required: true, message: '课程名称不能为空', trigger: 'blur' }],
|
name: [{required: true, message: '课程名称不能为空', trigger: 'blur'}],
|
||||||
tittle: [{ required: true, message: '小程序标题不能为空', trigger: 'blur' }],
|
tittle: [{required: true, message: '小程序标题不能为空', trigger: 'blur'}],
|
||||||
price: [{ required: true, message: '价格不能为空', trigger: 'blur' }],
|
price: [{required: true, message: '价格不能为空', trigger: 'blur'}],
|
||||||
dayStart: [{ required: true, message: '开始时间不能为空', trigger: 'blur' }],
|
dayStart: [{required: true, message: '开始时间不能为空', trigger: 'blur'}],
|
||||||
dayEnd: [{ required: true, message: '结束时间不能为空', trigger: 'blur' }],
|
dayEnd: [{required: true, message: '结束时间不能为空', trigger: 'blur'}],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -185,21 +260,47 @@ export default {
|
|||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
this.reset();
|
this.reset();
|
||||||
this.getCoachList()
|
this.getCoachList()
|
||||||
|
this.formData.deductList = [
|
||||||
|
{
|
||||||
|
label: '科目一',
|
||||||
|
courseSubject: '1',
|
||||||
|
deduct: 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '科目二',
|
||||||
|
courseSubject: '2',
|
||||||
|
deduct: 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '科目三',
|
||||||
|
courseSubject: '3',
|
||||||
|
deduct: 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '科目四',
|
||||||
|
courseSubject: '4',
|
||||||
|
deduct: 0
|
||||||
|
}
|
||||||
|
]
|
||||||
// 修改时,设置数据
|
// 修改时,设置数据
|
||||||
if (id) {
|
if (id) {
|
||||||
this.formLoading = true;
|
this.formLoading = true;
|
||||||
try {
|
try {
|
||||||
const res = await DlDriveSchoolCourseApi.getDlDriveSchoolCourse(id);
|
const res = await DlDriveSchoolCourseApi.getDlDriveSchoolCourse(id);
|
||||||
this.formData = res.data;
|
this.formData = res.data;
|
||||||
|
console.log(this.formData)
|
||||||
this.title = "修改驾校课程分类";
|
this.title = "修改驾校课程分类";
|
||||||
|
return
|
||||||
} finally {
|
} finally {
|
||||||
this.formLoading = false;
|
this.formLoading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
await this.getDeduct()
|
||||||
this.title = "新增驾校课程分类";
|
this.title = "新增驾校课程分类";
|
||||||
|
console.log(this.formData)
|
||||||
},
|
},
|
||||||
|
|
||||||
openCoachDraw(){
|
openCoachDraw() {
|
||||||
this.drawerOpen = true
|
this.drawerOpen = true
|
||||||
// 将initCoachList的initCoachList回显
|
// 将initCoachList的initCoachList回显
|
||||||
console.log(this.formData.coachList)
|
console.log(this.formData.coachList)
|
||||||
@ -207,8 +308,30 @@ export default {
|
|||||||
item.checkedSubject = item.data.coachList
|
item.checkedSubject = item.data.coachList
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getLabelByValue( value) {
|
||||||
|
const subject = this.subjectStr.find(item => item.value === value);
|
||||||
|
return subject ? subject.label : null;
|
||||||
|
},
|
||||||
|
|
||||||
handleClose(){
|
// 查询默认提成配置
|
||||||
|
async getDeduct() {
|
||||||
|
const data = {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 1000
|
||||||
|
}
|
||||||
|
const res = await listDeduct(data)
|
||||||
|
// 循环subject 根据科目分配默认提成
|
||||||
|
this.formData.deductList.map(item => {
|
||||||
|
const deduct = res.data.records.find(subject => subject.courseSubject === item.courseSubject)
|
||||||
|
if (deduct) {
|
||||||
|
item.deduct = deduct.deduct
|
||||||
|
} else {
|
||||||
|
item.deduct = 0
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
handleClose() {
|
||||||
this.drawerOpen = false
|
this.drawerOpen = false
|
||||||
this.formData.coachList = []
|
this.formData.coachList = []
|
||||||
this.formData.coachListText = ''
|
this.formData.coachListText = ''
|
||||||
@ -216,7 +339,7 @@ export default {
|
|||||||
let coachText = ''
|
let coachText = ''
|
||||||
this.initCoachList.map(item => {
|
this.initCoachList.map(item => {
|
||||||
if (item.checkedSubject.length > 0) {
|
if (item.checkedSubject.length > 0) {
|
||||||
coachText = coachText+item.name+'['
|
coachText = coachText + item.name + '['
|
||||||
item.checkedSubject.forEach(subject => {
|
item.checkedSubject.forEach(subject => {
|
||||||
const coachInfo = {
|
const coachInfo = {
|
||||||
coachId: item.userId,
|
coachId: item.userId,
|
||||||
@ -224,7 +347,7 @@ export default {
|
|||||||
coachPhone: item.phone,
|
coachPhone: item.phone,
|
||||||
subject: subject
|
subject: subject
|
||||||
};
|
};
|
||||||
coachText = coachText + '科目'+subject + ' '
|
coachText = coachText + '科目' + subject + ' '
|
||||||
saveCoachList.push(coachInfo);
|
saveCoachList.push(coachInfo);
|
||||||
});
|
});
|
||||||
coachText = coachText + ']'
|
coachText = coachText + ']'
|
||||||
@ -236,17 +359,17 @@ export default {
|
|||||||
console.log(this.formData.coachList)
|
console.log(this.formData.coachList)
|
||||||
},
|
},
|
||||||
|
|
||||||
handleCheckedChange(e,index){
|
handleCheckedChange(e, index) {
|
||||||
this.$forceUpdate()
|
this.$forceUpdate()
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 查询教练信息(不分页)*/
|
/** 查询教练信息(不分页)*/
|
||||||
getCoachList(){
|
getCoachList() {
|
||||||
listCoach({}).then(res => {
|
listCoach({}).then(res => {
|
||||||
this.initCoachList = res.data;
|
this.initCoachList = res.data;
|
||||||
this.initCoachList.map((item,index) =>{
|
this.initCoachList.map((item, index) => {
|
||||||
item.checkedSubject=[]
|
item.checkedSubject = []
|
||||||
this.$set(this.initCoachList,index,item)
|
this.$set(this.initCoachList, index, item)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -289,6 +412,7 @@ export default {
|
|||||||
remark: undefined,
|
remark: undefined,
|
||||||
reserveMoney: undefined,
|
reserveMoney: undefined,
|
||||||
favour: undefined,
|
favour: undefined,
|
||||||
|
deductList: []
|
||||||
};
|
};
|
||||||
this.resetForm("formRef");
|
this.resetForm("formRef");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user