Commit 254acaaa authored by 罗超's avatar 罗超

修改课程相关信息

parent 722e86f8
<template>
<q-dialog v-model="persistent" persistent content-class="bg-grey-1" transition-show="scale" transition-hide="scale">
<q-dialog
v-model="persistent"
persistent
content-class="bg-grey-1"
transition-show="scale"
transition-hide="scale"
>
<q-card style="width: 800px;max-width:900px;">
<q-card-section>
<div class="text-h6">{{objOption.CourseId==0?'新增课程信息':'修改课程信息'}}</div>
<div class="text-h6">
{{ objOption.CourseId == 0 ? "新增课程信息" : "修改课程信息" }}
</div>
</q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="text-caption q-mb-lg q-px-md text-grey-6">基本设置</div>
<div class="row wrap">
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.CourseName" ref="CourseName"
class="col-6 q-pr-lg q-pb-lg" label="课程名称" :rules="[val => !!val || '请填写课程名称']" />
<selectTree v-if="TreeCategoryList&&TreeCategoryList.length>0" :treeData='TreeCategoryList'
:defaultArray="defaultArray" nodeKey="CateId" :multiple="false" labelKey="CateName" childrenKey="ChildList"
tipText="课程分类" @getChild="getChild" style="display:none"></selectTree>
<q-select filled stack-label option-value="TId" option-label="TeacherName" v-model="chooseTeacher"
ref="Teacher_Id" :options="TeacherList" label="教师团队" :dense="false" class="col-6 q-pr-lg q-pb-lg" emit-value
map-options multiple />
<q-input
filled
stack-label
:dense="false"
v-model="objOption.CourseName"
ref="CourseName"
class="col-6 q-pr-lg q-pb-lg"
label="课程名称"
:rules="[val => !!val || '请填写课程名称']"
/>
<q-select
filled
stack-label
option-value="TId"
option-label="TeacherName"
v-model="chooseTeacher"
ref="Teacher_Id"
:options="TeacherList"
label="教师团队"
:dense="false"
class="col-6 q-pr-lg q-pb-lg"
emit-value
map-options
multiple
/>
</div>
<div class="row wrap">
<div class="col-6 q-pb-lg q-pr-lg">
<q-uploader :style="{backgroundImage:'url(' + objOption.CoverImg + ')'}" style="width:auto;height:139px" flat hide-upload-btn max-files="1"
label="课程封面" accept=".jpg, image/*" :factory="uploadFile" auto-upload>
<q-uploader
:style="{ backgroundImage: 'url(' + objOption.CoverImg + ')' }"
style="width:auto;height:139px"
flat
hide-upload-btn
max-files="1"
label="课程封面"
accept=".jpg, image/*"
:factory="uploadFile"
auto-upload
>
</q-uploader>
</div>
<div class="col-6 q-pr-lg q-pb-lg">
<q-input v-model="objOption.CourseFeature" filled type="textarea" placeholder="课程特色" />
<q-input
v-model="objOption.CourseFeature"
filled
type="textarea"
placeholder="课程特色"
/>
</div>
</div>
<div class="text-caption q-mb-lg q-px-md text-grey-6" v-if="isShowPrice==1">
<div
class="text-caption q-mb-lg q-px-md text-grey-6"
v-if="isShowPrice == 1"
>
价格设置
<q-toggle style="float:right;" size="md" left-label label="阶梯定价" color="primary" :false-value="0"
:true-value="1" v-model="objOption.IsOpenStepPrice" />
<q-toggle
style="float:right;"
size="md"
left-label
label="阶梯定价"
color="primary"
:false-value="0"
:true-value="1"
v-model="objOption.IsOpenStepPrice"
/>
</div>
<div class="row wrap" v-if="isShowPrice==1">
<div class="row wrap" v-if="isShowPrice == 1">
<div class="col-6">
<q-input filled stack-label maxlength="8" :dense="false" v-model="objOption.OriginalPrice"
ref="OriginalPrice" class="col-6 q-pr-lg q-pb-lg" label="原价"
@keyup.native="checkPrice(objOption,'OriginalPrice')" :rules="[val => !!val || '请填写原价']" />
<q-input
filled
stack-label
:dense="false"
v-model="objOption.OriginalPrice"
ref="OriginalPrice"
class="col-6 q-pr-lg q-pb-lg"
label="原价"
@keyup.native="checkPrice(objOption, 'OriginalPrice')"
:rules="[val => !!val || '请填写原价']"
/>
</div>
<div class="col-6">
<q-input filled stack-label maxlength="8" :dense="false" v-model="objOption.SellPrice" ref="SellPrice"
class="col-6 q-pr-lg q-pb-lg" label="卖价" @keyup.native="checkPrice(objOption,'SellPrice')"
:rules="[val => !!val || '请填写卖价']" />
<q-input
filled
stack-label
:dense="false"
v-model="objOption.SellPrice"
ref="SellPrice"
class="col-6 q-pr-lg q-pb-lg"
label="卖价"
@keyup.native="checkPrice(objOption, 'SellPrice')"
:rules="[val => !!val || '请填写卖价']"
/>
</div>
</div>
<div class="row wrap" style="margin:20px 0;" v-if="isShowPrice==1">
<div class="row wrap" style="margin:20px 0;" v-if="isShowPrice == 1">
<div class="col-6">
<q-btn v-if="objOption.IsOpenStepPrice==1" size="10px" @click="addStepPrice()" round color="primary"
icon="iconfont icon-img_haha" />
<q-btn
v-if="objOption.IsOpenStepPrice == 1"
size="10px"
@click="addStepPrice()"
round
color="primary"
icon="iconfont icon-img_haha"
/>
</div>
</div>
<template v-if="objOption.IsOpenStepPrice==1 && isShowPrice==1">
<div class="row wrap" v-for="(item,index) in ladderPriceList" :key="index">
<template v-if="objOption.IsOpenStepPrice == 1 && isShowPrice == 1">
<div
class="row wrap"
v-for="(item, index) in ladderPriceList"
:key="index"
>
<div class="col-6">
<q-input filled stack-label maxlength="3" v-model="item.PersionNum"
@keyup.native="checkInteger(item,'PersionNum')" :dense="false" class="col-6 q-pr-lg q-pb-lg"
label="人" />
<q-input
filled
stack-label
v-model="item.PersionNum"
@keyup.native="checkInteger(item, 'PersionNum')"
:dense="false"
class="col-6 q-pr-lg q-pb-lg"
label="人"
/>
</div>
<div class="col-6" style="position:relative;">
<q-input filled stack-label maxlength="8" v-model="item.PersionPrice"
@keyup.native="checkPrice(item,'PersionPrice')" :dense="false" class="col-6 q-pr-lg q-pb-lg"
label="价格" />
<q-btn style="position:absolute;right:-5px;top:20px;" size="6px" @click="delStepPrice(index)" round
color="red" icon="iconfont icon-guanbi1" />
<q-input
filled
stack-label
v-model="item.PersionPrice"
@keyup.native="checkPrice(item, 'PersionPrice')"
:dense="false"
class="col-6 q-pr-lg q-pb-lg"
label="价格"
/>
<q-btn
style="position:absolute;right:-5px;top:20px;"
size="6px"
@click="delStepPrice(index)"
round
color="red"
icon="iconfont icon-guanbi1"
/>
</div>
</div>
</template>
<div class="text-caption q-mb-lg q-px-md text-grey-6" v-if="isShowPrice==1">可续费课程
<q-toggle style="float:right;" size="md" left-label label="可续费课程" color="primary" :false-value="0"
:true-value="1" v-model="objOption.IsRenew" />
<div
class="text-caption q-mb-lg q-px-md text-grey-6"
v-if="isShowPrice == 1"
>
可续费课程
<q-toggle
style="float:right;"
size="md"
left-label
label="可续费课程"
color="primary"
:false-value="0"
:true-value="1"
v-model="objOption.IsRenew"
/>
</div>
<div class="row wrap" v-if="objOption.IsRenew==1&&isShowPrice==1">
<div class="row wrap" v-if="objOption.IsRenew == 1 && isShowPrice == 1">
<div class="col-6">
<q-input filled stack-label maxlength="8" :dense="false" v-model="objOption.RenewOgPrice" ref="RenewOgPrice"
class="col-6 q-pr-lg q-pb-lg" label="续费原价" @keyup.native="checkPrice(objOption,'RenewOgPrice')"
:rules="[val => !!val || '请填写续费原价']" />
<q-input
filled
stack-label
:dense="false"
v-model="objOption.RenewOgPrice"
ref="RenewOgPrice"
class="col-6 q-pr-lg q-pb-lg"
label="续费原价"
@keyup.native="checkPrice(objOption, 'RenewOgPrice')"
:rules="[val => !!val || '请填写续费原价']"
/>
</div>
<div class="col-6">
<q-input filled stack-label maxlength="8" :dense="false" v-model="objOption.RenewSlPrice" ref="RenewSlPrice"
class="col-6 q-pr-lg q-pb-lg" label="续费售价" @keyup.native="checkPrice(objOption,'RenewSlPrice')"
:rules="[val => !!val || '请填写续费售价']" />
<q-input
filled
stack-label
:dense="false"
v-model="objOption.RenewSlPrice"
ref="RenewSlPrice"
class="col-6 q-pr-lg q-pb-lg"
label="续费售价"
@keyup.native="checkPrice(objOption, 'RenewSlPrice')"
:rules="[val => !!val || '请填写续费售价']"
/>
</div>
</div>
<div class="row wrap">
<div class="col-6">
<q-input filled stack-label maxlength="8" :dense="false" mask="#" fill-mask="0"
reverse-fill-mask v-model="objOption.ClassHours" ref="ClassHours"
class="col-6 q-pr-lg q-pb-lg" label="课时数量"
:rules="[val => !!val || '请填写课时信息']" />
<q-input
filled
stack-label
:dense="false"
mask="#"
fill-mask="0"
reverse-fill-mask
v-model="objOption.ClassHours"
ref="ClassHours"
class="col-6 q-pr-lg q-pb-lg"
label="课时数量"
:rules="[val => !!val || '请填写课时信息']"
/>
</div>
<div class="col-6">
<q-select
filled
stack-label
option-value="CateId"
option-label="CateName"
v-model="chosenCateId"
ref="CateId"
:options="TreeCategoryList"
label="所属系列"
class="col-6 q-pr-lg q-pb-lg"
emit-value
map-options
:rules="[val => !!val || '请选择课程所属系列']"
/>
</div>
<div class="text-caption q-my-md q-px-xs text-grey-6">课程介绍
</div>
<ext-editor :defaultMsg="objOption.CourseIntro" classStr="col-12" @getEditValue="getEditValue"></ext-editor>
<div class="text-caption q-my-md q-px-xs text-grey-6">课程介绍</div>
<ext-editor
:defaultMsg="objOption.CourseIntro"
classStr="col-12"
@getEditValue="getEditValue"
></ext-editor>
<div class="row wrap">
<div class="col-6">
<span>上架端口:</span>
<template v-for="(item,index) in SaleplatList">
<q-checkbox v-model="choosePlat" :label="item.Name" :val="item.Id" />
<template v-for="(item, index) in SaleplatList">
<q-checkbox
v-model="choosePlat"
:label="item.Name"
:val="item.Id"
/>
</template>
</div>
<div class="col-6">
<q-toggle style="float:right;" size="md" left-label label="K12课程" color="primary" :false-value="0"
:true-value="1" v-model="objOption.IsKCourse" />
<q-toggle
style="float:right;"
size="md"
left-label
label="K12课程"
color="primary"
:false-value="0"
:true-value="1"
v-model="objOption.IsKCourse"
/>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" flat color="grey-10" style="font-weight:400 !important" @click="closeCourseForm" />
<q-btn label="立即提交" color="accent q-px-md" style="font-weight:400 !important" :loading="saveCourseLoading"
@click="saveCourse" />
<q-btn
label="取消"
flat
color="grey-10"
style="font-weight:400 !important"
@click="closeCourseForm"
/>
<q-btn
label="立即提交"
color="accent q-px-md"
style="font-weight:400 !important"
:loading="saveCourseLoading"
@click="saveCourse"
/>
</q-card-actions>
</q-card>
</q-dialog>
</template>
<script>
import {
import {
queryCourseCategoryTree,
saveCourseInfo,
queryCourseInfo,
querySaleplatList,
} from '../../api/course/index'
import {
getTeacherDropDownList,
} from '../../api/school/index'
import {
UploadSelfFile
} from '../../api/common/common'
import selectTree from '../common/select-tree'
import extEditor from '../common/ext-editor'
export default {
querySaleplatList
} from "../../api/course/index";
import { getTeacherDropDownList } from "../../api/school/index";
import { UploadSelfFile } from "../../api/common/common";
import selectTree from "../common/select-tree";
import extEditor from "../common/ext-editor";
export default {
components: {
selectTree,
extEditor,
extEditor
},
props: {
saveObj: {
......@@ -161,7 +331,7 @@
RenewSlPrice: 0, //续费售价
Saleplat: "", //销售平台
IsKCourse: 0, //是否是K12课程(1-是)
ClassHours:0
ClassHours: 0
},
optionTitle: "",
defaultArray: [],
......@@ -172,8 +342,9 @@
SaleplatList: [], //销售端口
choosePlat: [], //选择的平台
chooseTeacher: [], //选择老师
isShowPrice: 0, //是否显示价格【hk2021-03-05新增】
}
chosenCateId: null,
isShowPrice: 0 //是否显示价格【hk2021-03-05新增】
};
},
created() {
this.GetTeacherList();
......@@ -181,7 +352,7 @@
},
mounted() {
this.getCategorytree();
this.initObj()
this.initObj();
},
methods: {
//获取教师下拉
......@@ -190,13 +361,13 @@
if (res.Code == 1) {
this.TeacherList = res.Data;
}
})
});
},
//获取销售端口列表
getSaleplat() {
querySaleplatList().then(res => {
this.SaleplatList = res.Data;
})
});
},
//获取编辑器值
getEditValue(obj) {
......@@ -210,18 +381,25 @@
}
},
uploadFile(files) {
UploadSelfFile('course', files[0], res => {
UploadSelfFile("course", files[0], res => {
if (res.Code == 1) {
this.objOption.CoverImg = res.FileUrl;
}
})
});
},
getCategorytree() {
this.TreeCategoryList = [];
var qMsg = {}
var qMsg = {};
queryCourseCategoryTree(qMsg).then(res => {
this.TreeCategoryList = res.Data;
if(this.objOption.CateId!=0){
this.TreeCategoryList.forEach(x=>{
if(x.CateId==this.objOption.CateId){
this.chosenCateId=x
}
})
}
});
},
//新增阶梯定价
addStepPrice() {
......@@ -229,7 +407,7 @@
ClassStepPriceId: 0,
PersionNum: 2,
PersionPrice: 0
}
};
if (this.ladderPriceList && this.ladderPriceList.length > 0) {
var _index = this.ladderPriceList.length - 1;
obj.PersionNum = parseInt(this.ladderPriceList[_index].PersionNum) + 1;
......@@ -257,7 +435,7 @@
this.objOption.CourseFeature = res.Data.CourseFeature;
this.objOption.OriginalPrice = res.Data.OriginalPrice;
this.objOption.SellPrice = res.Data.SellPrice;
this.objOption.ClassHours=res.Data.ClassHours;
this.objOption.ClassHours = res.Data.ClassHours;
this.objOption.IsOpenStepPrice = res.Data.IsOpenStepPrice;
this.objOption.IsRenew = res.Data.IsRenew;
this.objOption.RenewOgPrice = res.Data.RenewOgPrice;
......@@ -274,10 +452,10 @@
this.choosePlat = res.Data.SalePlatList;
}
this.defaultArray.push(res.Data.CateId);
})
this.optionTitle = "修改课程信息"
});
this.optionTitle = "修改课程信息";
} else {
this.optionTitle = "新增课程"
this.optionTitle = "新增课程";
this.objOption.CourseId = 0;
this.objOption.CoverImg = "";
this.objOption.CourseName = "";
......@@ -288,7 +466,7 @@
this.objOption.CourseFeature = "";
this.objOption.OriginalPrice = 0;
this.objOption.SellPrice = 0;
this.objOption.ClassHours=0
this.objOption.ClassHours = 0;
this.objOption.IsOpenStepPrice = 0;
this.objOption.IsRenew = 0;
this.objOption.RenewOgPrice = 0;
......@@ -299,22 +477,23 @@
},
//关闭弹窗
closeCourseForm() {
this.$emit('close')
this.persistent = false
this.$emit("close");
this.persistent = false;
},
//保存菜单
saveCourse() {
this.$refs.CourseName.validate();
this.$refs.ClassHours.validate();
if (!this.$refs.CourseName.hasError&&!this.$refs.ClassHours.hasError) {
this.$refs.CateId.validate();
if (!this.$refs.CourseName.hasError && !this.$refs.ClassHours.hasError && !this.$refs.CateId.hasError) {
this.saveCourseLoading = true;
var Teacher_Ids = "";
if (this.chooseTeacher && this.chooseTeacher.length > 0) {
this.chooseTeacher.forEach(item => {
Teacher_Ids += "," + item;
})
});
}
if (Teacher_Ids != '') {
if (Teacher_Ids != "") {
Teacher_Ids = Teacher_Ids.substring(1);
}
var salePlat = "";
......@@ -323,29 +502,32 @@
salePlat += "," + item;
});
}
if (salePlat != '') {
if (salePlat != "") {
salePlat = salePlat.substring(1);
}
this.objOption.StepPriceList = this.ladderPriceList;
this.objOption.Teacher_Ids = Teacher_Ids;
this.objOption.Saleplat = salePlat;
saveCourseInfo(this.objOption).then(res => {
this.saveCourseLoading = false
console.log(this.chosenCateId)
this.objOption.CateId=this.chosenCateId
saveCourseInfo(this.objOption)
.then(res => {
this.saveCourseLoading = false;
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
icon: "iconfont icon-chenggong",
color: "accent",
timeout: 2000,
message: '数据保存成功!',
position: 'top'
})
this.$emit("success")
this.closeSaveForm()
}).catch(() => {
this.saveCourseLoading = false
message: "数据保存成功!",
position: "top"
});
this.$emit("success");
this.closeSaveForm();
})
.catch(() => {
this.saveCourseLoading = false;
});
}
}
},
}
};
</script>
<template>
<q-dialog v-model="persistent" persistent content-class="bg-grey-1" transition-show="scale" transition-hide="scale">
<q-dialog
v-model="persistent"
persistent
content-class="bg-grey-1"
transition-show="scale"
transition-hide="scale"
>
<q-card style="width: 800px;max-width:900px;">
<q-card-section>
<div class="text-h6">设置课程价格</div>
</q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="text-caption q-mb-lg q-px-md text-grey-6">基础价格设置</div>
<div class="text-caption q-mb-lg text-grey-6">基础价格设置</div>
<div class="row wrap">
<div class="col-6">
<q-input filled stack-label maxlength="8" :dense="false" v-model="priceObj.courseObj.OriginalPrice"
ref="OriginalPrice" class="col-6 q-pr-lg q-pb-lg" label="基础收费"
@keyup.native="checkPrice(priceObj.courseObj,'OriginalPrice')" :rules="[val => !!val || '请填写基础收费']" />
<q-input
filled
stack-label
maxlength="8"
:dense="false"
v-model="priceObj.courseObj.OriginalPrice"
ref="OriginalPrice"
class="col-6 q-pr-lg q-pb-lg"
label="基础收费"
@keyup.native="checkPrice(priceObj.courseObj, 'OriginalPrice')"
:rules="[val => !!val || '请填写基础收费']"
/>
</div>
<div class="col-6">
<q-input filled stack-label maxlength="8" :dense="false" v-model="priceObj.courseObj.SellPrice"
ref="SellPrice" class="col-6 q-pr-lg q-pb-lg" label="卖价"
@keyup.native="checkPrice(priceObj.courseObj,'SellPrice')" :rules="[val => !!val || '请填写卖价']" />
<q-input
filled
stack-label
maxlength="8"
:dense="false"
v-model="priceObj.courseObj.SellPrice"
ref="SellPrice"
class="col-6 q-pr-lg q-pb-lg"
label="卖价"
@keyup.native="checkPrice(priceObj.courseObj, 'SellPrice')"
:rules="[val => !!val || '请填写卖价']"
/>
</div>
</div>
</q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="text-caption q-mb-lg q-px-md text-grey-6">优惠设置</div>
<table class="col-12">
<div class="q-pt-none scroll" style="max-height:60hv">
<table>
<thead>
<tr style="height:60px;">
<td colspan="5" style="text-align:right;">
<q-btn color="accent" size="sm" icon="add" label="新增优惠" @click="addPrice()" />
<q-btn
color="accent"
size="sm"
icon="add"
label="新增优惠"
@click="addPrice()"
/>
</td>
</tr>
<tr>
<td style="width:280px">
<td style="width:200px">
优惠类型
</td>
<td style="width:180px">
<td style="width:200px">
优惠条件
</td>
<td style="width:120px">
<td style="width:140px">
同行返佣
</td>
<td style="width:120px">
<td style="width:140px">
销售返佣
</td>
<td style="width:100px">
<td>
操作
</td>
</tr>
</thead>
<tbody v-for="(item,index) in priceObj.priceList">
<tbody v-for="(item, index) in priceObj.priceList">
<tr>
<td>
<q-select filled stack-label option-value="Id" option-label="Name" v-model="item.PriceDiscountType"
ref="PriceDiscountType_Id" :options="priceTypeList" label="优惠类型" :dense="false"
class="col-6 q-pr-lg q-pb-lg" emit-value map-options />
<td style="height:50px">
<q-select
filled
stack-label
option-value="Id"
option-label="Name"
v-model="item.PriceDiscountType"
ref="PriceDiscountType_Id"
:options="priceTypeList"
label="优惠类型"
style="width:160px"
dense
emit-value
map-options
/>
</td>
<td>
<!--买送-->
<template v-if="item.PriceDiscountType==1">
<q-input filled stack-label maxlength="3" :dense="false" v-model="item.BuyNum" ref="BuyNum"
class="col-6 q-pr-lg q-pb-lg" label="买" @keyup.native="checkPrice(item,'BuyNum')"
style="width:80px;display:inline-block;" suffix="" />
<q-input filled stack-label maxlength="3" :dense="false" v-model="item.SendNum" ref="SendNum"
class="col-6 q-pr-lg q-pb-lg" label="送" @keyup.native="checkPrice(item,'SendNum')"
style="width:80px;display:inline-block;" suffix="">
<template v-if="item.PriceDiscountType == 1">
<q-input
filled
stack-label
dense
v-model="item.BuyNum"
ref="BuyNum"
label="买"
@keyup.native="checkPrice(item, 'BuyNum')"
style="width:80px;display:inline-block;"
suffix=""
/>
<q-input
filled
stack-label
class="q-ml-xs"
v-model="item.SendNum"
ref="SendNum"
dense
label="送"
@keyup.native="checkPrice(item, 'SendNum')"
style="width:80px;display:inline-block;"
suffix=""
>
</q-input>
</template>
<!--刷卡分期-->
<template v-else-if="item.PriceDiscountType==5">
</template>
<template v-else-if="item.PriceDiscountType == 5"> </template>
<template v-else>
<q-input filled stack-label maxlength="4" :dense="false" v-model="item.PriceMoney" ref="PriceMoney"
class="q-pr-lg q-pb-lg" label="优惠" @keyup.native="checkPrice(item,'PriceMoney')" style="width:100px"
suffix="%" />
<q-input
filled
stack-label
dense
v-model="item.PriceMoney"
ref="PriceMoney"
label="优惠"
@keyup.native="checkPrice(item, 'PriceMoney')"
style="width:165px"
suffix="%"
/>
</template>
</td>
<td>
<q-input filled stack-label maxlength="4" :dense="false" v-model="item.B2BCommissionMoney"
ref="B2BCommissionMoney" class="q-pr-lg q-pb-lg" label="同行返佣"
@keyup.native="checkPrice(item,'B2BCommissionMoney')" style="width:100px" suffix="%" />
<q-input
filled
stack-label
dense
v-model="item.B2BCommissionMoney"
ref="B2BCommissionMoney"
label="同行返佣"
@keyup.native="checkPrice(item, 'B2BCommissionMoney')"
style="width:100px"
>
<template v-slot:append>
<div class="text-dark text-center text-dark cursor-pointer" style="width:30px;margin-right:-12px;height:100%;font-size:14px;border-left:1px solid #ddd;padding-top:15px;" >
<span>{{item.B2BCommissionType==0?'%':'¥'}}</span>
<q-menu auto-close>
<q-list>
<q-item clickable v-close-popup @click="item.B2BCommissionType=0">
<q-item-section>按百分比(%)</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="item.B2BCommissionType=1">
<q-item-section>按固定额度(¥)</q-item-section>
</q-item>
</q-list>
</q-menu>
</div>
</template>
</q-input>
</td>
<td>
<q-input filled stack-label maxlength="4" :dense="false" v-model="item.SaleCommissionMoney"
ref="SaleCommissionMoney" class="q-pr-lg q-pb-lg" label="销售返佣"
@keyup.native="checkPrice(item,'SaleCommissionMoney')" style="width:100px" suffix="%" />
<q-input
filled
stack-label
dense
v-model="item.SaleCommissionMoney"
ref="SaleCommissionMoney"
label="销售返佣"
@keyup.native="checkPrice(item, 'SaleCommissionMoney')"
class="q-pr-none"
style="width:100px"
>
<template v-slot:append>
<div class="text-dark text-center text-dark cursor-pointer" style="width:30px;margin-right:-12px;height:100%;font-size:14px;border-left:1px solid #ddd;padding-top:15px;" >
<span>{{item.SaleCommissionType==0?'%':'¥'}}</span>
<q-menu auto-close>
<q-list>
<q-item clickable v-close-popup @click="item.SaleCommissionType=0">
<q-item-section>按百分比(%)</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="item.SaleCommissionType=1">
<q-item-section>按固定额度(¥)</q-item-section>
</q-item>
</q-list>
</q-menu>
</div>
</template>
</q-input>
</td>
<td>
<q-btn flat size="xs" icon="iconfont icon-shanchu" title="删除" color="negative" style="font-weight:400"
class="q-mr-xs" label="" @click="delPrice(index)" />
<q-btn
flat
size="xs"
icon="iconfont icon-shanchu"
title="删除"
color="negative"
style="font-weight:400"
class="q-mr-xs"
label=""
@click="delPrice(index)"
/>
</td>
</tr>
</tbody>
</table>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" flat color="grey-10" style="font-weight:400 !important" @click="closeCourseForm" />
<q-btn label="立即提交" color="accent q-px-md" style="font-weight:400 !important" :loading="saveCourseLoading"
@click="saveCourse" />
<q-btn
label="取消"
flat
color="grey-10"
style="font-weight:400 !important"
@click="closeCourseForm"
/>
<q-btn
label="立即提交"
color="accent q-px-md"
style="font-weight:400 !important"
:loading="saveCourseLoading"
@click="saveCourse"
/>
</q-card-actions>
</q-card>
</q-dialog>
</template>
<script>
import {
import {
saveCoursePreferential,
queryCoursePreferentialList,
queryCourseInfo,
queryCoursePreferentialType,
} from '../../api/course/index'
export default {
queryCoursePreferentialType
} from "../../api/course/index";
export default {
components: {},
props: {
saveObj: {
......@@ -127,25 +257,25 @@
courseObj: {
CourseId: 0, //课程编号
OriginalPrice: 0, //原价
SellPrice: 0, //售价
SellPrice: 0 //售价
},
priceList: [], //价格列表
priceList: [] //价格列表
},
priceTypeList: [], //优惠类型列表
}
priceTypeList: [] //优惠类型列表
};
},
created() {
this.getTypeList();
},
mounted() {
this.initObj()
this.initObj();
},
methods: {
//获取优惠类型列表
getTypeList() {
queryCoursePreferentialType().then(res => {
this.priceTypeList = res.Data;
})
});
},
//新增价格
addPrice() {
......@@ -161,7 +291,7 @@
BuyNum: 0, //购买人数
SendNum: 0, //赠送人数
PriceType: 0, //优惠价格类型(0-百分比,1-固定金额)
PriceMoney: 0, //优惠金额
PriceMoney: 0 //优惠金额
};
this.priceObj.priceList.push(currentObj);
},
......@@ -178,17 +308,17 @@
this.priceObj.courseObj.CourseId = res.Data.CourseId;
this.priceObj.courseObj.OriginalPrice = res.Data.OriginalPrice;
this.priceObj.courseObj.SellPrice = res.Data.SellPrice;
})
});
queryCoursePreferentialList({
CourseId: this.saveObj.CourseId
}).then(res => {
if (res.Code == 1 && res.Data) {
this.priceObj.priceList = res.Data;
}
})
this.optionTitle = "修改课程优惠信息"
});
this.optionTitle = "修改课程优惠信息";
} else {
this.optionTitle = "新增课程优惠信息"
this.optionTitle = "新增课程优惠信息";
this.priceObj.courseObj.CourseId = 0;
this.priceObj.courseObj.OriginalPrice = 0;
this.priceObj.courseObj.SellPrice = 0;
......@@ -196,48 +326,48 @@
},
//关闭弹窗
closeCourseForm() {
this.$emit('close')
this.persistent = false
this.$emit("close");
this.persistent = false;
},
//保存菜单
saveCourse() {
this.saveCourseLoading = true;
if (this.priceObj.priceList && this.priceObj.priceList.length > 0) {
this.priceObj.priceList.forEach(item => {
if (item.BuyNum == '') {
if (item.BuyNum == "") {
item.BuyNum = 0;
}
if (item.SendNum == '') {
if (item.SendNum == "") {
item.SendNum = 0;
}
if (item.PriceMoney == '') {
if (item.PriceMoney == "") {
item.PriceMoney = 0;
}
if (item.B2BCommissionMoney == '') {
if (item.B2BCommissionMoney == "") {
item.B2BCommissionMoney = 0;
}
if (item.SaleCommissionMoney == '') {
if (item.SaleCommissionMoney == "") {
item.SaleCommissionMoney = 0;
}
})
});
}
saveCoursePreferential(this.priceObj).then(res => {
this.saveCourseLoading = false
saveCoursePreferential(this.priceObj)
.then(res => {
this.saveCourseLoading = false;
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
icon: "iconfont icon-chenggong",
color: "accent",
timeout: 2000,
message: '数据保存成功!',
position: 'top'
message: "数据保存成功!",
position: "top"
});
this.$emit("success");
this.closeSaveForm();
})
this.$emit("success")
this.closeSaveForm()
}).catch(() => {
this.saveCourseLoading = false
.catch(() => {
this.saveCourseLoading = false;
});
}
},
}
};
</script>
......@@ -3,19 +3,16 @@
<div class="page-search row items-center">
<div class="col row wrap q-mr-lg q-col-gutter-md">
<div class="col-3">
<q-input ref="filter" filled v-model="keyWords" label="分类名称">
<q-input ref="filter" filled v-model="keyWords" label="系列名称">
<template v-slot:append>
<q-icon v-if="keyWords !== ''" name="clear" class="cursor-pointer" @click="resetFilter" />
</template>
</q-input>
</div>
</div>
<div class="page-option">
<q-btn color="accent" class="q-mr-md" icon="add" label="新增分类" @click="EditCategory(null)" />
</div>
</div>
<div class="page-content">
<div class="q-pa-md q-gutter-sm">
<!--<div class="q-pa-md q-gutter-sm">
<q-tree v-if="isShow" :nodes="data" node-key="CateId" label-key="CateName" children-key="ChildList"
:filter="keyWords" :filter-method="myFilterMethod" default-expand-all no-results-label="暂无相关数据">
<template v-slot:default-header="prop">
......@@ -30,7 +27,31 @@
</div>
</template>
</q-tree>
</div>-->
<q-table :loading="loading" no-data-label="暂无相关数据" flat class="sticky-column-table"
separator="none" :data="data" :columns="columns" row-key="name">
<template v-slot:top="props">
<div class="col-2 q-table__title">系列信息</div>
<q-space />
<div class="page-option">
<q-btn color="accent" size="sm" class="q-mr-md" icon="add" label="新增系列" @click="EditCategory(null)" />
</div>
</template>
<template v-slot:body-cell-Status="props">
<q-td :props="props">
<q-badge :color="props.value==1?'negative':'primary'" :label="props.value==0?'正常':'禁用'" />
</q-td>
</template>
<template v-slot:body-cell-optioned="props">
<q-td :props="props">
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" label="编辑"
@click="EditCategory(props.row)" />
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400;display:none;" label="详情"
@click="deleteCategory(props.row.CateId)" />
</q-td>
</template>
</q-table>
<category-form v-if="isShowCategory" :save-obj="categoryObj" @close="closeCagegoryForm" @success="refreshPage">
</category-form>
</div>
......@@ -39,12 +60,12 @@
<script>
import {
queryCourseCategoryTree
queryCourseCategoryPage
} from '../../api/course/index'
import categoryForm from '../../components/course/category-form'
export default {
meta: {
title: "课程类"
title: "课程类"
},
components: {
categoryForm,
......@@ -57,6 +78,39 @@
isShowCategory: false,
isShow: false,
categoryObj: {},
loading:true,
columns: [
{
name: 'CateName',
label: '系列名称',
field: 'CateName',
align: 'left'
},
{
name: 'CourseCount',
label: '关联课程',
align: 'left',
field: row => row.CourseCount
},
{
name: 'Status',
label: '状态',
align: 'left',
field: row => row.Status
},
{
name: 'UpdateByName',
label: '修改人',
align: 'left',
field: row => row.UpdateByName
},
{
name: 'UpdateTimeStr',
label: '修改时间',
align: 'left',
field: row => row.UpdateTimeStr
}
],
}
},
mounted() {
......@@ -80,9 +134,13 @@
//获取课程分类树形结构
getcoursecategorytree() {
this.isShow = false;
queryCourseCategoryTree({}).then(res => {
queryCourseCategoryPage({
PageSize:50,
pageIndex:1
}).then(res => {
this.isShow = true;
this.data = res.Data;
this.loading=false;
this.data = res.Data.PageData;
})
},
//新增修改角色
......
......@@ -8,7 +8,7 @@
</div>
<div class="col-3">
<select-tree :treeData='TreeCategoryList' :defaultArray="returnString" nodeKey="CateId" :multiple="true"
labelKey="CateName" childrenKey="ChildList" tipText="课程分类" @getChild="getChild"></select-tree>
labelKey="CateName" childrenKey="ChildList" tipText="课程系列" @getChild="getChild"></select-tree>
</div>
<div class="col-3">
<q-select @input="resetSearch" standout="bg-primary text-white" v-model="msg.Status" :options="ShowOpts"
......@@ -44,25 +44,41 @@
</template>
<template v-slot:body-cell-PreferentialList="props">
<q-td :props="props" style="padding-right:0px">
<div v-for="x in props.value">
<div v-for="x in props.value" >
<div class="border-bottom" v-if="x.PriceDiscountType==1">{{x.BuyNum}}{{x.SendNum}}</div>
<div class="border-bottom" v-if="x.PriceDiscountType==2">单人报名享{{100-x.PriceMoney}}折优惠</div>
<div class="border-bottom" v-if="x.PriceDiscountType==3">双人报名享{{100-x.PriceMoney}}折优惠</div>
<div class="border-bottom" v-if="x.PriceDiscountType==4">续费享{{100-x.PriceMoney}}折优惠</div>
<div class="remark-font" v-if="x.PriceDiscountType==0">暂无优惠政策</div>
</div>
<div v-if="!props.value || props.value.length==0">
<div class="remark-font">暂无优惠政策</div>
</div>
</q-td>
</template>
<template v-slot:body-cell-PreferentialListSellCommission="props">
<q-td :props="props" style="padding-right:0px;padding-left:0px">
<div v-for="x in props.value">
<div class="border-bottom" style="padding-left: 16px;padding-right: 16px">{{x.SaleCommissionMoney}}%</div>
<div class="border-bottom" style="padding-left: 16px;padding-right: 16px" :class="{'text-red':x.SaleCommissionType==1}" v-if="x.PriceDiscountType!=0">{{x.SaleCommissionType==1?'¥':''}}{{x.SaleCommissionMoney}}{{x.SaleCommissionType==0?'%':''}}</div>
<div v-if="x.PriceDiscountType==0">
<div class="remark-font">暂无佣金信息</div>
</div>
</div>
<div v-if="!props.value || props.value.length==0">
<div class="remark-font">暂无佣金信息</div>
</div>
</q-td>
</template>
<template v-slot:body-cell-PreferentialListB2BCommission="props">
<q-td :props="props" style="padding-left:0px">
<div v-for="x in props.value">
<div class="border-bottom" style="padding-left: 16px">{{x.B2BCommissionMoney}}%</div>
<div class="border-bottom" style="padding-left: 16px" :class="{'text-red':x.B2BCommissionType==1}" v-if="x.PriceDiscountType!=0">{{x.B2BCommissionType==1?'¥':''}}{{x.B2BCommissionMoney}}{{x.B2BCommissionType==0?'%':''}}</div>
<div v-if="x.PriceDiscountType==0">
<div class="remark-font">暂无佣金信息</div>
</div>
</div>
<div v-if="!props.value || props.value.length==0">
<div class="remark-font">暂无佣金信息</div>
</div>
</q-td>
</template>
......@@ -135,6 +151,13 @@
align: 'left',
field: row => row.CourseName
},
{
name: 'CateName',
required: true,
label: '系列',
align: 'left',
field: row => row.CateName
},
{
name: 'OriginalPrice',
required: true,
......@@ -170,6 +193,14 @@
align: 'left',
field: row => row.PreferentialList
},
{
name: "ClassHours",
label: "课时长度",
field: "ClassHours",
align: "left",
format: (val, row) => `${val}课时`
},
{
name: 'CreateByName',
label: '创建人',
......@@ -177,9 +208,9 @@
align: 'left'
},
{
name: 'CreateTimeStr',
label: '创建时间',
field: 'CreateTimeStr',
name: 'UpdateTimeStr',
label: '更新时间',
field: 'UpdateTimeStr',
align: 'left'
},
{
......
......@@ -174,9 +174,6 @@ li {
>
</q-img>
</q-td>
<q-td v-else-if="col.name == 'CourseIntro'">
<span v-html="col.value"></span>
</q-td>
<q-td
v-else-if="col.name == 'PreferentialList'"
style="padding-right:0px"
......@@ -194,6 +191,12 @@ li {
<div class="border-bottom" v-if="x.PriceDiscountType == 4">
续费享{{ 100 - x.PriceMoney }}折优惠
</div>
<div class="remark-font" v-if="x.PriceDiscountType == 0">
暂无优惠政策
</div>
</div>
<div v-if="!col.value || col.value.length == 0">
<div class="remark-font">暂无优惠政策</div>
</div>
</q-td>
<q-td
......@@ -201,12 +204,13 @@ li {
style="padding-right:0px;padding-left:0px"
>
<div v-for="x in col.value">
<div
class="border-bottom"
style="padding-left: 16px;padding-right: 16px"
>
{{ x.SaleCommissionMoney }}%
<div class="border-bottom" style="padding-left: 16px;padding-right: 16px" :class="{'text-red':x.SaleCommissionType==1}" v-if="x.PriceDiscountType!=0">{{x.SaleCommissionType==1?'¥':''}}{{x.SaleCommissionMoney}}{{x.SaleCommissionType==0?'%':''}}</div>
<div v-if="x.PriceDiscountType == 0">
<div class="remark-font">暂无佣金信息</div>
</div>
</div>
<div v-if="!col.value || col.value.length==0">
<div class="remark-font">暂无佣金信息</div>
</div>
</q-td>
<q-td
......@@ -214,9 +218,14 @@ li {
style="padding-left:0px"
>
<div v-for="x in col.value">
<div class="border-bottom" style="padding-left: 16px">
{{ x.B2BCommissionMoney }}%
<div class="border-bottom" style="padding-left: 16px" :class="{'text-red':x.B2BCommissionType==1}" v-if="x.PriceDiscountType!=0">{{x.B2BCommissionType==1?'¥':''}}{{x.B2BCommissionMoney}}{{x.B2BCommissionType==0?'%':''}}</div>
<div v-if="x.PriceDiscountType == 0">
<div class="remark-font">暂无佣金信息</div>
</div>
</div>
<div v-if="!col.value || col.value.length==0">
<div class="remark-font">暂无佣金信息</div>
</div>
</q-td>
<q-td v-else-if="col.name == 'TeacherList'">
......@@ -230,6 +239,9 @@ li {
</q-chip>
</div>
</q-td>
<q-td v-else-if="col.name=='CourseIntro'">
<q-btn flat color="primary" label="查看详情" @click="showContentDialog(col.value)" />
</q-td>
<q-td
v-else-if="col.name != 'CourseFeature'"
:key="col.name"
......@@ -245,7 +257,10 @@ li {
<q-badge color="negative" class="q-mr-md">
课程特色
</q-badge>
<div v-html="props.row.CourseFeature" class="text-left col text-negative"></div>
<div
v-html="props.row.CourseFeature"
class="text-left col text-negative"
></div>
</div>
</q-td>
</q-tr>
......@@ -262,6 +277,16 @@ li {
</template>
</q-table>
</div>
<q-dialog v-model="carousel">
<q-card style="width: 600px;max-height:70vh;" class="q-px-sm q-pb-md scroll">
<q-card-section>
<div class="text-h6">课程详情</div>
</q-card-section>
<q-card-section>
<div v-html="showContent"></div>
</q-card-section>
</q-card>
</q-dialog>
</div>
</template>
<script>
......@@ -276,6 +301,8 @@ export default {
currentUrl: "",
data: [],
loading: true,
carousel:false,
showContent:'',
columns: [
{
name: "CourseFeature",
......@@ -302,6 +329,13 @@ export default {
align: "left",
field: row => row.CourseName
},
{
name: "CateName",
required: true,
label: "系列",
align: "left",
field: row => row.CateName
},
{
name: "OriginalPrice",
required: true,
......@@ -349,6 +383,18 @@ export default {
field: "ClassHours",
align: "left",
format: (val, row) => `${val}课时`
},
{
name: "CourseIntro",
label: "课程详情",
field: "CourseIntro",
align: "left"
},
{
name: "UpdateTimeStr",
label: "更新时间",
field: "UpdateTimeStr",
align: "left"
}
],
msg: {
......@@ -369,6 +415,10 @@ export default {
this.getcourselist();
},
methods: {
showContentDialog(content){
this.showContent=content;
this.carousel=true
},
//重新查询
resetSearch() {
this.msg.pageIndex = 1;
......@@ -387,8 +437,11 @@ export default {
this.loading = false;
res.Data.PageData.forEach(x => {
x.expand = false;
x.CourseFeature=x.CourseFeature.replace(new RegExp('\n',"gm"),'<br/>')
console.log(x.CourseFeature)
x.CourseFeature = x.CourseFeature.replace(
new RegExp("\n", "gm"),
"<br/>"
);
console.log(x.CourseFeature);
});
this.data = res.Data.PageData;
this.pageCount = res.Data.PageCount;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment