Commit 9f6265b4 authored by 罗超's avatar 罗超

1

parent 31f962d6
...@@ -219,7 +219,7 @@ export function saveChapter(data) { ...@@ -219,7 +219,7 @@ export function saveChapter(data) {
* 保存课程章节 * 保存课程章节
* @param {JSON参数} data * @param {JSON参数} data
*/ */
export function getCourseRate(data) { export function getCourseRate(data) {
return request({ return request({
url: "/Course/GetCourseRateEnumList", url: "/Course/GetCourseRateEnumList",
method: 'post', method: 'post',
...@@ -231,7 +231,7 @@ export function saveChapter(data) { ...@@ -231,7 +231,7 @@ export function saveChapter(data) {
* 保存课程章节 * 保存课程章节
* @param {JSON参数} data * @param {JSON参数} data
*/ */
export function deleteChapters(data) { export function deleteChapters(data) {
return request({ return request({
url: "/Course/BatchRemoveChapter", url: "/Course/BatchRemoveChapter",
method: 'post', method: 'post',
...@@ -243,7 +243,7 @@ export function saveChapter(data) { ...@@ -243,7 +243,7 @@ export function saveChapter(data) {
* 保存课程章节 * 保存课程章节
* @param {JSON参数} data * @param {JSON参数} data
*/ */
export function setChaptersRate(data) { export function setChaptersRate(data) {
return request({ return request({
url: "/Course/BatchSetChapterRate", url: "/Course/BatchSetChapterRate",
method: 'post', method: 'post',
...@@ -255,7 +255,7 @@ export function saveChapter(data) { ...@@ -255,7 +255,7 @@ export function saveChapter(data) {
* 批量更新章节编号和ID * 批量更新章节编号和ID
* @param {JSON参数} data * @param {JSON参数} data
*/ */
export function batchUpdateChapterNo(data) { export function batchUpdateChapterNo(data) {
return request({ return request({
url: "/Course/SetBatchChapterNo", url: "/Course/SetBatchChapterNo",
method: 'post', method: 'post',
...@@ -267,7 +267,7 @@ export function saveChapter(data) { ...@@ -267,7 +267,7 @@ export function saveChapter(data) {
* 修改章节名称 * 修改章节名称
* @param {JSON参数} data * @param {JSON参数} data
*/ */
export function updateChapterName(data) { export function updateChapterName(data) {
return request({ return request({
url: "/Course/SetChapterName", url: "/Course/SetChapterName",
method: 'post', method: 'post',
...@@ -391,22 +391,22 @@ export function saveCourseOfferCustomerStatus(data) { ...@@ -391,22 +391,22 @@ export function saveCourseOfferCustomerStatus(data) {
* 报价单转订单 * 报价单转订单
*/ */
export function saveOfferToOrder(data) { export function saveOfferToOrder(data) {
return request({ return request({
url: "/CourseOffer/OfferTransOrder", url: "/CourseOffer/OfferTransOrder",
method: 'post', method: 'post',
data data
}) })
} }
/** /**
* 报价单申请改价 * 报价单申请改价
*/ */
export function SetApplyModifyPrice(data) { export function SetApplyModifyPrice(data) {
return request({ return request({
url: "/CourseOffer/SetApplyModifyPrice", url: "/CourseOffer/SetApplyModifyPrice",
method: 'post', method: 'post',
data data
}) })
} }
/** /**
...@@ -534,8 +534,4 @@ export function SetImportCourse(data) { ...@@ -534,8 +534,4 @@ export function SetImportCourse(data) {
method: 'post', method: 'post',
data data
}) })
} }
\ No newline at end of file
\ No newline at end of file
<template> <template>
<q-dialog v-model="persistent" persistent content-class="bg-grey-1" transition-show="scale" transition-hide="scale"> <q-dialog
<q-card style="width: 800px;max-width:900px;"> 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> <q-card-section>
<div class="text-h6"> <div class="text-h6">
{{ objOption.CourseId == 0 ? "新增课程信息" : "修改课程信息" }} {{ objOption.CourseId == 0 ? "新增课程信息" : "修改课程信息" }}
...@@ -9,368 +15,625 @@ ...@@ -9,368 +15,625 @@
<q-card-section class="q-pt-none scroll" style="max-height: 70vh"> <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 q-px-md text-grey-6">基本设置</div>
<div class="row wrap"> <div class="row wrap">
<q-input filled stack-label :dense="false" v-model="objOption.CourseName" ref="CourseName" <q-input
class="col-6 q-pr-lg q-pb-lg" label="课程名称" :rules="[val => !!val || '请填写课程名称']" /> filled
<q-select filled stack-label option-value="TId" option-label="TeacherName" v-model="chooseTeacher" stack-label
ref="Teacher_Id" :options="TeacherList" label="教师团队" :dense="false" class="col-6 q-pr-lg q-pb-lg" emit-value :dense="false"
map-options multiple /> 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>
<div class="row wrap"> <div class="row wrap">
<div class="col-6 q-pb-lg q-pr-lg"> <div class="col-6 q-pb-lg q-pr-lg">
<q-uploader :style="{ backgroundImage: 'url(' + objOption.CoverImg + ')' }" style="width:auto;height:139px" <q-uploader
flat hide-upload-btn max-files="1" label="课程封面" accept=".jpg, image/*" :factory="uploadFile" auto-upload> :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> </q-uploader>
</div> </div>
<div class="col-6 q-pr-lg q-pb-lg"> <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> </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" <q-toggle
:true-value="1" v-model="objOption.IsOpenStepPrice" /> style="float: right"
size="md"
left-label
label="阶梯定价"
color="primary"
:false-value="0"
:true-value="1"
v-model="objOption.IsOpenStepPrice"
/>
</div> </div>
<div class="row wrap" v-if="isShowPrice == 1"> <div class="row wrap" v-if="isShowPrice == 1">
<div class="col-6"> <div class="col-6">
<q-input filled stack-label :dense="false" v-model="objOption.OriginalPrice" ref="OriginalPrice" <q-input
class="col-6 q-pr-lg q-pb-lg" label="原价" @keyup.native="checkPrice(objOption, 'OriginalPrice')" filled
:rules="[val => !!val || '请填写原价']" /> 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>
<div class="col-6"> <div class="col-6">
<q-input filled stack-label :dense="false" v-model="objOption.SellPrice" ref="SellPrice" <q-input
class="col-6 q-pr-lg q-pb-lg" label="卖价" @keyup.native="checkPrice(objOption, 'SellPrice')" filled
:rules="[val => !!val || '请填写卖价']" /> 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> </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"> <div class="col-6">
<q-btn v-if="objOption.IsOpenStepPrice == 1" size="10px" @click="addStepPrice()" round color="primary" <q-btn
icon="iconfont icon-img_haha" /> v-if="objOption.IsOpenStepPrice == 1"
size="10px"
@click="addStepPrice()"
round
color="primary"
icon="iconfont icon-img_haha"
/>
</div> </div>
</div> </div>
<template v-if="objOption.IsOpenStepPrice == 1 && isShowPrice == 1"> <template v-if="objOption.IsOpenStepPrice == 1 && isShowPrice == 1">
<div class="row wrap" v-for="(item, index) in ladderPriceList" :key="index"> <div
class="row wrap"
v-for="(item, index) in ladderPriceList"
:key="index"
>
<div class="col-6"> <div class="col-6">
<q-input filled stack-label v-model="item.PersionNum" @keyup.native="checkInteger(item, 'PersionNum')" <q-input
:dense="false" class="col-6 q-pr-lg q-pb-lg" label="人" /> 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>
<div class="col-6" style="position:relative;"> <div class="col-6" style="position: relative">
<q-input filled stack-label v-model="item.PersionPrice" @keyup.native="checkPrice(item, 'PersionPrice')" <q-input
:dense="false" class="col-6 q-pr-lg q-pb-lg" label="价格" /> filled
<q-btn style="position:absolute;right:-5px;top:20px;" size="6px" @click="delStepPrice(index)" round stack-label
color="red" icon="iconfont icon-guanbi1" /> 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>
</div> </div>
</template> </template>
<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" <q-toggle
:true-value="1" v-model="objOption.IsRenew" /> style="float: right"
size="md"
left-label
label="可续费课程"
color="primary"
:false-value="0"
:true-value="1"
v-model="objOption.IsRenew"
/>
</div> </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"> <div class="col-6">
<q-input filled stack-label :dense="false" v-model="objOption.RenewOgPrice" ref="RenewOgPrice" <q-input
class="col-6 q-pr-lg q-pb-lg" label="续费原价" @keyup.native="checkPrice(objOption, 'RenewOgPrice')" filled
:rules="[val => !!val || '请填写续费原价']" /> 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>
<div class="col-6"> <div class="col-6">
<q-input filled stack-label :dense="false" v-model="objOption.RenewSlPrice" ref="RenewSlPrice" <q-input
class="col-6 q-pr-lg q-pb-lg" label="续费售价" @keyup.native="checkPrice(objOption, 'RenewSlPrice')" filled
:rules="[val => !!val || '请填写续费售价']" /> 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> </div>
<div class="row wrap"> <div class="row wrap">
<div class="col-6"> <div class="col-6">
<q-input filled stack-label :disable="!isHaveCourseHoursEdit" @keyup.native="checkPrice(objOption, 'ClassHours')" reverse-fill-mask <q-input
v-model="objOption.ClassHours" ref="ClassHours" class="col-6 q-pr-lg q-pb-lg" label="课时数量" filled
:rules="[val => !!val || '请填写课时信息']" /> stack-label
:disable="!isHaveCourseHoursEdit"
@keyup.native="checkPrice(objOption, 'ClassHours')"
reverse-fill-mask
v-model="objOption.ClassHours"
ref="ClassHours"
class="col-6 q-pr-lg q-pb-lg"
label="课时数量"
:rules="[(val) => !!val || '请填写课时信息']"
/>
</div> </div>
<div class="col-6"> <div class="col-6">
<q-select filled stack-label option-value="CateId" option-label="CateName" v-model="objOption.CateId" <q-select
ref="CateId" :options="TreeCategoryList" label="所属系列" class="col-6 q-pr-lg q-pb-lg" emit-value map-options filled
:rules="[val => !!val || '请选择课程所属系列']" /> stack-label
option-value="CateId"
option-label="CateName"
v-model="objOption.CateId"
ref="CateId"
:options="TreeCategoryList"
label="所属系列"
class="col-6 q-pr-lg q-pb-lg"
emit-value
map-options
:rules="[(val) => !!val || '请选择课程所属系列']"
/>
</div> </div>
</div> </div>
<div class="text-caption q-my-md q-px-xs text-grey-6">课程介绍</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> <ext-editor
:defaultMsg="objOption.CourseIntro"
classStr="col-12"
@getEditValue="getEditValue"
></ext-editor>
<div class="row wrap"> <div class="row wrap">
<div class="col-6"> <div class="col-9">
<span>上架端口:</span> <span>上架端口:</span>
<template v-for="(item, index) in SaleplatList"> <template v-for="(item, index) in SaleplatList">
<q-checkbox v-model="choosePlat" :label="item.Name" :val="item.Id" /> <q-checkbox
v-model="choosePlat"
:label="item.Name"
:val="item.Id"
:key="index"
/>
</template> </template>
</div> </div>
<div class="col-6"> <div class="col-3">
<q-toggle style="float:right;" size="md" left-label label="K12课程" color="primary" :false-value="0" <q-toggle
:true-value="1" v-model="objOption.IsKCourse" /> style="float: right"
size="md"
left-label
label="K12课程"
color="primary"
:false-value="0"
:true-value="1"
v-model="objOption.IsKCourse"
/>
</div> </div>
</div> </div>
<div class="row col-12" v-if="choosePlat.find((e) => e == 4)">
<span class="q-mb-sm">选择分类:</span>
<q-card class="full-width">
<q-tree
class="col-sm-6"
:nodes="goodClassify"
node-key="Id"
label-key="Name"
children-key="ChildList"
tick-strategy="strict"
:ticked.sync="chooseGoodsClassify"
default-expand-all
@update:ticked="handleCheckChange"
/>
</q-card>
</div>
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
<q-card-actions align="right" class="bg-white"> <q-card-actions align="right" class="bg-white">
<q-btn label="取消" flat color="grey-10" style="font-weight:400 !important" @click="closeCourseForm" /> <q-btn
<q-btn label="立即提交" color="accent q-px-md" style="font-weight:400 !important" :loading="saveCourseLoading" label="取消"
@click="saveCourse" /> 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-actions>
</q-card> </q-card>
</q-dialog> </q-dialog>
</template> </template>
<script> <script>
import { import {
queryCourseCategoryTree, queryCourseCategoryTree,
saveCourseInfo, saveCourseInfo,
queryCourseInfo, queryCourseInfo,
querySaleplatList querySaleplatList,
} from "../../api/course/index"; } from "../../api/course/index";
import { import { getTeacherDropDownList } from "../../api/school/index";
getTeacherDropDownList import { UploadSelfFile } from "../../api/common/common";
} from "../../api/school/index"; import extEditor from "../common/ext-editor";
import { import { mapState } from "vuex";
UploadSelfFile export default {
} from "../../api/common/common"; components: {
import extEditor from "../common/ext-editor"; extEditor,
import { },
mapState props: {
} from "vuex"; saveObj: {
export default { type: Object,
components: { default: null,
extEditor
}, },
props: { },
saveObj: { data() {
type: Object, return {
default: null persistent: true,
objOption: {
CourseId: 0, //课程编号
CoverImg: "", //课程封面图
CourseName: "", //课程名称
CourseIntro: "", //课程介绍
CateId: 0, //课程编号
School_Id: 0, //校区编号
Teacher_Ids: "", //教学团队
CourseFeature: "", //课程特色
OriginalPrice: 0, //原价
SellPrice: 0, //售价
IsOpenStepPrice: 0, //是否开启阶梯定价(1-开启)
IsRenew: 0, //是否可续费课程(1-是)
RenewOgPrice: 0, //续费原价
RenewSlPrice: 0, //续费售价
Saleplat: "", //销售平台
IsKCourse: 0, //是否是K12课程(1-是)
ClassHours: 0,
CategoryList: [],
},
optionTitle: "",
defaultArray: [],
ladderPriceList: [], //阶梯定价数组
saveCourseLoading: false,
TreeCategoryList: [], //课程分类树形列表
TeacherList: [], //关联教师下拉数据
SaleplatList: [], //销售端口
choosePlat: [], //选择的平台
chooseTeacher: [], //选择老师
isShowPrice: 0, //是否显示价格【hk2021-03-05新增】
goodClassify: [], //商品分类列表
chooseGoodsClassify: [], //选中的商品分类
modifyClassifyList: [], //修改时返回的分类列表
};
},
created() {
this.GetTeacherList();
this.getSaleplat();
this.getGoodsClassify();
},
computed: mapState({
isHaveCourseHoursEdit(state) {
if (
state.user.userInfo &&
state.user.userInfo.ActionMenuList &&
state.user.userInfo.ActionMenuList.length > 0
) {
let action = state.user.userInfo.ActionMenuList.find((x) => {
if (x.FunctionCode == "Edit_CourseClassHours") {
return x;
}
});
if (action) {
return true;
}
} }
return false;
}, },
data() { }),
return { mounted() {
persistent: true, this.initObj();
objOption: { },
CourseId: 0, //课程编号 methods: {
CoverImg: "", //课程封面图 //获取教师下拉
CourseName: "", //课程名称 GetTeacherList() {
CourseIntro: "", //课程介绍 getTeacherDropDownList({}).then((res) => {
CateId: 0, //课程编号 if (res.Code == 1) {
School_Id: 0, //校区编号 this.TeacherList = res.Data;
Teacher_Ids: "", //教学团队 }
CourseFeature: "", //课程特色 });
OriginalPrice: 0, //原价
SellPrice: 0, //售价
IsOpenStepPrice: 0, //是否开启阶梯定价(1-开启)
IsRenew: 0, //是否可续费课程(1-是)
RenewOgPrice: 0, //续费原价
RenewSlPrice: 0, //续费售价
Saleplat: "", //销售平台
IsKCourse: 0, //是否是K12课程(1-是)
ClassHours: 0
},
optionTitle: "",
defaultArray: [],
ladderPriceList: [], //阶梯定价数组
saveCourseLoading: false,
TreeCategoryList: [], //课程分类树形列表
TeacherList: [], //关联教师下拉数据
SaleplatList: [], //销售端口
choosePlat: [], //选择的平台
chooseTeacher: [], //选择老师
isShowPrice: 0, //是否显示价格【hk2021-03-05新增】
};
}, },
created() { //获取销售端口列表
this.GetTeacherList(); getSaleplat() {
this.getSaleplat(); querySaleplatList().then((res) => {
this.SaleplatList = res.Data;
});
}, },
computed: mapState({ //获取编辑器值
isHaveCourseHoursEdit(state) { getEditValue(obj) {
if (state.user.userInfo && state.user.userInfo.ActionMenuList && state.user.userInfo.ActionMenuList.length > this.objOption.CourseIntro = obj;
0) { },
let action = state.user.userInfo.ActionMenuList.find(x => { getChild(obj) {
if (x.FunctionCode == "Edit_CourseClassHours") { if (obj == "") {
return x; this.objOption.CateId = 0;
} } else {
}); this.objOption.CateId = obj;
if(action){ }
return true },
} uploadFile(files) {
UploadSelfFile("course", files[0], (res) => {
if (res.Code == 1) {
this.objOption.CoverImg = res.FileUrl;
} }
return false; });
},
getCategorytree() {
this.TreeCategoryList = [];
var qMsg = {};
queryCourseCategoryTree(qMsg).then((res) => {
this.TreeCategoryList = res.Data;
});
},
//新增阶梯定价
addStepPrice() {
var obj = {
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;
} }
}), this.ladderPriceList.push(obj);
mounted() { },
this.initObj(); //删除阶梯定价
delStepPrice(index) {
this.ladderPriceList.splice(index, 1);
}, },
methods: { //初始化表单
//获取教师下拉 initObj() {
GetTeacherList() { this.defaultArray = [];
getTeacherDropDownList({}).then(res => { if (this.saveObj && this.saveObj.CourseId > 0) {
if (res.Code == 1) { queryCourseInfo({
this.TeacherList = res.Data; CourseId: this.saveObj.CourseId,
}).then((res) => {
this.objOption.CourseId = res.Data.CourseId;
this.objOption.CoverImg = res.Data.CoverImg;
this.objOption.CourseName = res.Data.CourseName;
this.objOption.CourseIntro = res.Data.CourseIntro;
this.objOption.CateId = res.Data.CateId;
this.objOption.School_Id = res.Data.School_Id;
this.objOption.Teacher_Ids = res.Data.Teacher_Ids;
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.IsOpenStepPrice = res.Data.IsOpenStepPrice;
this.objOption.IsRenew = res.Data.IsRenew;
this.objOption.RenewOgPrice = res.Data.RenewOgPrice;
this.objOption.RenewSlPrice = res.Data.RenewSlPrice;
this.objOption.Saleplat = res.Data.Saleplat;
this.objOption.IsKCourse = res.Data.IsKCourse;
if (res.Data.StepPriceList && res.Data.StepPriceList.length > 0) {
this.ladderPriceList = res.Data.StepPriceList;
} }
}); if (res.Data.TeacherIdList && res.Data.TeacherIdList.length > 0) {
}, this.chooseTeacher = res.Data.TeacherIdList;
//获取销售端口列表
getSaleplat() {
querySaleplatList().then(res => {
this.SaleplatList = res.Data;
});
},
//获取编辑器值
getEditValue(obj) {
this.objOption.CourseIntro = obj;
},
getChild(obj) {
if (obj == "") {
this.objOption.CateId = 0;
} else {
this.objOption.CateId = obj;
}
},
uploadFile(files) {
UploadSelfFile("course", files[0], res => {
if (res.Code == 1) {
this.objOption.CoverImg = res.FileUrl;
} }
if (res.Data.SalePlatList && res.Data.SalePlatList.length > 0) {
this.choosePlat = res.Data.SalePlatList;
}
if (res.Data.CategoryList && res.Data.CategoryList.length > 0) {
this.modifyClassifyList = res.Data.CategoryList;
this.chooseGoodsClassify = res.Data.CategoryList.map((e) => {
return e.CategoryId;
});
}
this.defaultArray.push(res.Data.CateId);
this.getCategorytree();
this.handleCheckChange();
}); });
}, this.optionTitle = "修改课程信息";
getCategorytree() { } else {
this.TreeCategoryList = []; this.optionTitle = "新增课程";
var qMsg = {}; this.objOption.CourseId = 0;
queryCourseCategoryTree(qMsg).then(res => { this.objOption.CoverImg = "";
this.TreeCategoryList = res.Data; this.objOption.CourseName = "";
this.objOption.CourseIntro = "";
}); this.objOption.CateId = 0;
}, this.objOption.School_Id = 0;
//新增阶梯定价 this.objOption.Teacher_Ids = "";
addStepPrice() { this.objOption.CourseFeature = "";
var obj = { this.objOption.OriginalPrice = 0;
ClassStepPriceId: 0, this.objOption.SellPrice = 0;
PersionNum: 2, this.objOption.ClassHours = 0;
PersionPrice: 0 this.objOption.IsOpenStepPrice = 0;
}; this.objOption.IsRenew = 0;
if (this.ladderPriceList && this.ladderPriceList.length > 0) { this.objOption.RenewOgPrice = 0;
var _index = this.ladderPriceList.length - 1; this.objOption.RenewSlPrice = 0;
obj.PersionNum = parseInt(this.ladderPriceList[_index].PersionNum) + 1; this.objOption.Saleplat = "";
this.objOption.IsKCourse = 0;
this.getCategorytree();
}
},
//关闭弹窗
closeCourseForm() {
this.$emit("close");
this.persistent = false;
},
//保存菜单
saveCourse() {
this.$refs.CourseName.validate();
this.$refs.ClassHours.validate();
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;
});
} }
this.ladderPriceList.push(obj); if (Teacher_Ids != "") {
}, Teacher_Ids = Teacher_Ids.substring(1);
//删除阶梯定价 }
delStepPrice(index) { var salePlat = "";
this.ladderPriceList.splice(index, 1); if (this.choosePlat && this.choosePlat.length > 0) {
}, this.choosePlat.forEach((item) => {
//初始化表单 salePlat += "," + item;
initObj() {
this.defaultArray = [];
if (this.saveObj && this.saveObj.CourseId > 0) {
queryCourseInfo({
CourseId: this.saveObj.CourseId
}).then(res => {
this.objOption.CourseId = res.Data.CourseId;
this.objOption.CoverImg = res.Data.CoverImg;
this.objOption.CourseName = res.Data.CourseName;
this.objOption.CourseIntro = res.Data.CourseIntro;
this.objOption.CateId = res.Data.CateId;
this.objOption.School_Id = res.Data.School_Id;
this.objOption.Teacher_Ids = res.Data.Teacher_Ids;
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.IsOpenStepPrice = res.Data.IsOpenStepPrice;
this.objOption.IsRenew = res.Data.IsRenew;
this.objOption.RenewOgPrice = res.Data.RenewOgPrice;
this.objOption.RenewSlPrice = res.Data.RenewSlPrice;
this.objOption.Saleplat = res.Data.Saleplat;
this.objOption.IsKCourse = res.Data.IsKCourse;
if (res.Data.StepPriceList && res.Data.StepPriceList.length > 0) {
this.ladderPriceList = res.Data.StepPriceList;
}
if (res.Data.TeacherIdList && res.Data.TeacherIdList.length > 0) {
this.chooseTeacher = res.Data.TeacherIdList;
}
if (res.Data.SalePlatList && res.Data.SalePlatList.length > 0) {
this.choosePlat = res.Data.SalePlatList;
}
this.defaultArray.push(res.Data.CateId);
this.getCategorytree();
}); });
this.optionTitle = "修改课程信息";
} else {
this.optionTitle = "新增课程";
this.objOption.CourseId = 0;
this.objOption.CoverImg = "";
this.objOption.CourseName = "";
this.objOption.CourseIntro = "";
this.objOption.CateId = 0;
this.objOption.School_Id = 0;
this.objOption.Teacher_Ids = "";
this.objOption.CourseFeature = "";
this.objOption.OriginalPrice = 0;
this.objOption.SellPrice = 0;
this.objOption.ClassHours = 0;
this.objOption.IsOpenStepPrice = 0;
this.objOption.IsRenew = 0;
this.objOption.RenewOgPrice = 0;
this.objOption.RenewSlPrice = 0;
this.objOption.Saleplat = "";
this.objOption.IsKCourse = 0;
this.getCategorytree();
} }
if (salePlat != "") {
}, salePlat = salePlat.substring(1);
//关闭弹窗 }
closeCourseForm() { this.objOption.StepPriceList = this.ladderPriceList;
this.$emit("close"); this.objOption.Teacher_Ids = Teacher_Ids;
this.persistent = false; this.objOption.Saleplat = salePlat;
}, saveCourseInfo(this.objOption)
//保存菜单 .then((res) => {
saveCourse() { this.saveCourseLoading = false;
this.$refs.CourseName.validate(); this.$q.notify({
this.$refs.ClassHours.validate(); icon: "iconfont icon-chenggong",
this.$refs.CateId.validate(); color: "accent",
if (!this.$refs.CourseName.hasError && !this.$refs.ClassHours.hasError && !this.$refs.CateId.hasError) { timeout: 2000,
this.saveCourseLoading = true; message: "数据保存成功!",
var Teacher_Ids = ""; position: "top",
if (this.chooseTeacher && this.chooseTeacher.length > 0) {
this.chooseTeacher.forEach(item => {
Teacher_Ids += "," + item;
});
}
if (Teacher_Ids != "") {
Teacher_Ids = Teacher_Ids.substring(1);
}
var salePlat = "";
if (this.choosePlat && this.choosePlat.length > 0) {
this.choosePlat.forEach(item => {
salePlat += "," + item;
}); });
this.$emit("success");
this.closeSaveForm();
})
.catch(() => {
this.saveCourseLoading = false;
});
}
},
//获取商品分类
getGoodsClassify() {
let msg1 = {
Id: 0,
Name: "",
Tier: 0,
ParentId: 0,
Enabled: 1,
IsShow: 1,
CategoryPageType: 0,
};
this.apipostDS("/api/product/GetProductCategoryTreeList", msg1, (res) => {
if (res.data.resultCode === 1) {
this.goodClassify = res.data.data;
}
});
},
//处理选中后的商品分类参数
handleCheckChange() {
this.objOption.CategoryList = [];
this.chooseGoodsClassify.forEach((list) => {
this.goodClassify.forEach((item) => {
if (list == item.Id) {
let newItem = JSON.parse(JSON.stringify(item));
newItem.CategoryId = item.Id;
newItem.Id = 0;
//查找已提交的分类的id,否则为0
let findId = this.modifyClassifyList.find(
(e) => e.CategoryId === newItem.CategoryId
);
if (findId) {
newItem.Id = findId.Id;
}
this.objOption.CategoryList.push(newItem);
} }
if (salePlat != "") { item.ChildList.forEach((item2) => {
salePlat = salePlat.substring(1); if (list == item2.Id) {
} let newItem2 = JSON.parse(JSON.stringify(item2));
this.objOption.StepPriceList = this.ladderPriceList; newItem2.CategoryId = item2.Id;
this.objOption.Teacher_Ids = Teacher_Ids; newItem2.Id = 0;
this.objOption.Saleplat = salePlat; let findId2 = this.modifyClassifyList.find(
saveCourseInfo(this.objOption) (e) => e.CategoryId === newItem2.CategoryId
.then(res => { );
this.saveCourseLoading = false; if (findId2) {
this.$q.notify({ newItem2.Id = findId2.Id;
icon: "iconfont icon-chenggong", }
color: "accent", this.objOption.CategoryList.push(newItem2);
timeout: 2000, }
message: "数据保存成功!", item2.ChildList.forEach((item3) => {
position: "top" if (list == item3.Id) {
}); let newItem3 = JSON.parse(JSON.stringify(item3));
this.$emit("success"); newItem3.CategoryId = item2.Id;
this.closeSaveForm(); newItem3.Id = 0;
}) let findId3 = this.modifyClassifyList.find(
.catch(() => { (e) => e.CategoryId === newItem3.CategoryId
this.saveCourseLoading = false; );
if (findId3) {
newItem3.Id = findId3.Id;
}
this.objOption.CategoryList.push(newItem3);
}
}); });
} });
} });
} });
}; },
},
};
</script> </script>
...@@ -3,34 +3,88 @@ ...@@ -3,34 +3,88 @@
<div class="page-search row items-center"> <div class="page-search row items-center">
<div class="col row wrap q-mr-lg q-col-gutter-md"> <div class="col row wrap q-mr-lg q-col-gutter-md">
<div class="col-3"> <div class="col-3">
<q-input @input="resetSearch" clearable standout="bg-primary text-white" v-model="msg.CourseName" label="课程名称" <q-input
@clear="resetSearch" maxlength="20" /> @input="resetSearch"
clearable
standout="bg-primary text-white"
v-model="msg.CourseName"
label="课程名称"
@clear="resetSearch"
maxlength="20"
/>
</div> </div>
<div class="col-3"> <div class="col-3">
<select-tree :treeData="TreeCategoryList" :defaultArray="returnString" nodeKey="CateId" :multiple="true" <select-tree
labelKey="CateName" childrenKey="ChildList" tipText="课程系列" @getChild="getChild"></select-tree> :treeData="TreeCategoryList"
:defaultArray="returnString"
nodeKey="CateId"
:multiple="true"
labelKey="CateName"
childrenKey="ChildList"
tipText="课程系列"
@getChild="getChild"
></select-tree>
</div> </div>
<div class="col-3"> <div class="col-3">
<q-select @input="resetSearch" standout="bg-primary text-white" v-model="msg.Status" :options="ShowOpts" <q-select
emit-value map-options label="状态" /> @input="resetSearch"
standout="bg-primary text-white"
v-model="msg.Status"
:options="ShowOpts"
emit-value
map-options
label="状态"
/>
</div>
<div class="col-3">
<q-select
@input="resetSearch"
standout="bg-primary text-white"
v-model="msg.Saleplat"
:options="platOpts"
option-label="Name"
option-value="Id"
emit-value
map-options
label="上架渠道"
/>
</div> </div>
</div> </div>
</div> </div>
<div class="page-content"> <div class="page-content">
<q-table :pagination="msg" :loading="loading" no-data-label="暂无相关数据" flat <q-table
class="sticky-tow-column-table sticky-right-column-table" separator="none" :data="data" :columns="columns" :pagination="msg"
row-key="name"> :loading="loading"
no-data-label="暂无相关数据"
flat
class="sticky-tow-column-table sticky-right-column-table"
separator="none"
:data="data"
:columns="columns"
row-key="name"
>
<template v-slot:top="props"> <template v-slot:top="props">
<div class="col-2 q-table__title">课程信息</div> <div class="col-2 q-table__title">课程信息</div>
<q-space /> <q-space />
<div class="page-option"> <div class="page-option">
<q-btn color="accent" size="sm" class="q-mr-md" icon="add" label="新增课程" @click="EditCourse(null, 1)" /> <q-btn
color="accent"
size="sm"
class="q-mr-md"
icon="add"
label="新增课程"
@click="EditCourse(null, 1)"
/>
</div> </div>
</template> </template>
<template v-slot:body-cell-CoverImg="props"> <template v-slot:body-cell-CoverImg="props">
<q-td :props="props"> <q-td :props="props">
<q-img :src="props.value" spinner-color="white" style="height: 54px; max-width: 100px" <q-img
class="rounded-borders"> :src="props.value"
spinner-color="white"
style="height: 54px; max-width: 100px"
class="rounded-borders"
>
</q-img> </q-img>
</q-td> </q-td>
</template> </template>
...@@ -40,19 +94,19 @@ ...@@ -40,19 +94,19 @@
</q-td> </q-td>
</template> </template>
<template v-slot:body-cell-PreferentialList="props"> <template v-slot:body-cell-PreferentialList="props">
<q-td :props="props" style="padding-right:0px"> <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"> <div class="border-bottom" v-if="x.PriceDiscountType == 1">
{{ x.BuyNum }}{{ x.SendNum }} {{ x.BuyNum }}{{ x.SendNum }}
</div> </div>
<div class="border-bottom" v-if="x.PriceDiscountType == 2"> <div class="border-bottom" v-if="x.PriceDiscountType == 2">
单人报名享优惠{{x.PriceMoney }}% 单人报名享优惠{{ x.PriceMoney }}%
</div> </div>
<div class="border-bottom" v-if="x.PriceDiscountType == 3"> <div class="border-bottom" v-if="x.PriceDiscountType == 3">
双人报名优惠{{x.PriceMoney }}% 双人报名优惠{{ x.PriceMoney }}%
</div> </div>
<div class="border-bottom" v-if="x.PriceDiscountType == 4"> <div class="border-bottom" v-if="x.PriceDiscountType == 4">
续费享优惠{{x.PriceMoney }}% 续费享优惠{{ x.PriceMoney }}%
</div> </div>
<div class="remark-font" v-if="x.PriceDiscountType == 0"> <div class="remark-font" v-if="x.PriceDiscountType == 0">
暂无优惠政策 暂无优惠政策
...@@ -64,10 +118,14 @@ ...@@ -64,10 +118,14 @@
</q-td> </q-td>
</template> </template>
<template v-slot:body-cell-PreferentialListSellCommission="props"> <template v-slot:body-cell-PreferentialListSellCommission="props">
<q-td :props="props" style="padding-right:0px;padding-left:0px"> <q-td :props="props" style="padding-right: 0px; padding-left: 0px">
<div v-for="x in props.value"> <div v-for="x in props.value">
<div class="border-bottom" style="padding-left: 16px;padding-right: 16px" <div
:class="{ 'text-red': x.SaleCommissionType == 1 }" v-if="x.PriceDiscountType != 0"> 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.SaleCommissionType == 1 ? "¥" : ""
}}{{ x.SaleCommissionMoney }}{{ x.SaleCommissionMoney
}}{{ x.SaleCommissionType == 0 ? "%" : "" }} }}{{ x.SaleCommissionType == 0 ? "%" : "" }}
...@@ -82,10 +140,14 @@ ...@@ -82,10 +140,14 @@
</q-td> </q-td>
</template> </template>
<template v-slot:body-cell-PreferentialListB2BCommission="props"> <template v-slot:body-cell-PreferentialListB2BCommission="props">
<q-td :props="props" style="padding-left:0px"> <q-td :props="props" style="padding-left: 0px">
<div v-for="x in props.value"> <div v-for="x in props.value">
<div class="border-bottom" style="padding-left: 16px" :class="{ 'text-red': x.B2BCommissionType == 1 }" <div
v-if="x.PriceDiscountType != 0"> class="border-bottom"
style="padding-left: 16px"
:class="{ 'text-red': x.B2BCommissionType == 1 }"
v-if="x.PriceDiscountType != 0"
>
{{ x.B2BCommissionType == 1 ? "¥" : "" {{ x.B2BCommissionType == 1 ? "¥" : ""
}}{{ x.B2BCommissionMoney }}{{ x.B2BCommissionMoney
}}{{ x.B2BCommissionType == 0 ? "%" : "" }} }}{{ x.B2BCommissionType == 0 ? "%" : "" }}
...@@ -100,10 +162,14 @@ ...@@ -100,10 +162,14 @@
</q-td> </q-td>
</template> </template>
<template v-slot:body-cell-EducationCommission="props"> <template v-slot:body-cell-EducationCommission="props">
<q-td :props="props" style="padding-left:0px"> <q-td :props="props" style="padding-left: 0px">
<div v-for="x in props.value"> <div v-for="x in props.value">
<div class="border-bottom" style="padding-left: 16px" :class="{ 'text-red': x.EduCommissionType == 1 }" <div
v-if="x.PriceDiscountType != 0"> class="border-bottom"
style="padding-left: 16px"
:class="{ 'text-red': x.EduCommissionType == 1 }"
v-if="x.PriceDiscountType != 0"
>
{{ x.EduCommissionType == 1 ? "¥" : "" {{ x.EduCommissionType == 1 ? "¥" : ""
}}{{ x.EduCommissionMoney }}{{ x.EduCommissionMoney
}}{{ x.EduCommissionType == 0 ? "%" : "" }} }}{{ x.EduCommissionType == 0 ? "%" : "" }}
...@@ -117,34 +183,83 @@ ...@@ -117,34 +183,83 @@
</div> </div>
</q-td> </q-td>
</template> </template>
<template v-slot:body-cell-plat="props">
<q-td :props="props">
<q-badge
color="green"
label="小程序"
v-if="props.row.Saleplat.includes(4)"
/>
</q-td>
</template>
<template v-slot:body-cell-Status="props"> <template v-slot:body-cell-Status="props">
<q-td :props="props"> <q-td :props="props">
<q-badge :color="props.value == 1 ? 'negative' : 'primary'" :label="props.value == 0 ? '正常' : '删除'" /> <q-badge
:color="props.value == 1 ? 'negative' : 'primary'"
:label="props.value == 0 ? '正常' : '删除'"
/>
</q-td> </q-td>
</template> </template>
<template v-slot:bottom> <template v-slot:bottom>
<q-pagination class="full-width justify-end" v-model="msg.pageIndex" color="primary" :max="pageCount" <q-pagination
:input="true" @input="changePage" /> class="full-width justify-end"
v-model="msg.pageIndex"
color="primary"
:max="pageCount"
:input="true"
@input="changePage"
/>
</template> </template>
<template v-slot:body-cell-optioned="props"> <template v-slot:body-cell-optioned="props">
<q-td :props="props"> <q-td :props="props">
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" label="编辑" <q-btn
@click="EditCourse(props.row, 1)" /> flat
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" label="价格设置" size="xs"
@click="EditCourse(props.row, 2)" v-if="isHavePriceAction" /> icon="edit"
<q-btn-dropdown flat size="xs" color="dark" label="更多" style="margin-left:10px;"> color="accent"
style="font-weight: 400"
label="编辑"
@click="EditCourse(props.row, 1)"
/>
<q-btn
flat
size="xs"
icon="edit"
color="accent"
style="font-weight: 400"
label="价格设置"
@click="EditCourse(props.row, 2)"
v-if="isHavePriceAction"
/>
<q-btn-dropdown
flat
size="xs"
color="dark"
label="更多"
style="margin-left: 10px"
>
<q-list> <q-list>
<q-item clickable v-close-popup @click="DeleteCourse(props.row,1)" v-if="props.row.Status==0"> <q-item
clickable
v-close-popup
@click="DeleteCourse(props.row, 1)"
v-if="props.row.Status == 0"
>
<q-item-section> <q-item-section>
<q-item-label>删除</q-item-label> <q-item-label>删除</q-item-label>
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item clickable v-close-popup @click="DeleteCourse(props.row,0)" v-if="props.row.Status==1"> <q-item
clickable
v-close-popup
@click="DeleteCourse(props.row, 0)"
v-if="props.row.Status == 1"
>
<q-item-section> <q-item-section>
<q-item-label>恢复</q-item-label> <q-item-label>恢复</q-item-label>
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item clickable v-close-popup @click="goMycourse(props.row)"> <q-item clickable v-close-popup @click="goMycourse(props.row)">
<q-item-section> <q-item-section>
<q-item-label>课程详情</q-item-label> <q-item-label>课程详情</q-item-label>
</q-item-section> </q-item-section>
...@@ -154,324 +269,357 @@ ...@@ -154,324 +269,357 @@
</q-td> </q-td>
</template> </template>
</q-table> </q-table>
<course-form v-if="isShowCourseForm" :save-obj="courseObjOption" @close="closeMenuSaveForm" <course-form
@success="refreshPage"> v-if="isShowCourseForm"
:save-obj="courseObjOption"
@close="closeMenuSaveForm"
@success="refreshPage"
>
</course-form> </course-form>
<courseprice-form v-if="isShowCoursePriceForm" :save-obj="courseObjOption" @close="closeMenuSaveForm" <courseprice-form
@success="refreshPage"> v-if="isShowCoursePriceForm"
:save-obj="courseObjOption"
@close="closeMenuSaveForm"
@success="refreshPage"
>
</courseprice-form> </courseprice-form>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { import {
queryCoursePage, queryCoursePage,
queryCourseCategoryTree, queryCourseCategoryTree,
deleteCourseInfo deleteCourseInfo,
} from "../../api/course/index"; querySaleplatList,
import courseForm from "../../components/course/course-form"; } from "../../api/course/index";
import coursepriceForm from "../../components/course/courseprice-form"; import courseForm from "../../components/course/course-form";
import selectTree from "../../components/common/select-tree"; import coursepriceForm from "../../components/course/courseprice-form";
import { openURL } from "quasar"; import selectTree from "../../components/common/select-tree";
import { import { openURL } from "quasar";
mapState import { mapState } from "vuex";
} from "vuex"; export default {
export default { meta: {
meta: { title: "课程管理",
title: "课程管理" },
}, components: {
components: { courseForm,
courseForm, selectTree,
selectTree, coursepriceForm,
coursepriceForm },
}, data() {
data() { return {
return { currentUrl: "",
currentUrl: "", columns: [
columns: [{ {
name: "CoverImg", name: "CoverImg",
label: "课程封面", label: "课程封面",
field: "CoverImg", field: "CoverImg",
align: "left" align: "left",
}, },
{ {
name: "CourseName", name: "CourseName",
required: true, required: true,
label: "课程名称", label: "课程名称",
align: "left", align: "left",
field: row => row.CourseName field: (row) => row.CourseName,
},
{
name: "CateName",
required: true,
label: "系列",
align: "left",
field: row => row.CateName
},
{
name: "OriginalPrice",
required: true,
label: "原价",
align: "left",
field: row => row.OriginalPrice.toFixed(2)
},
{
name: "SellPrice",
required: true,
label: "售价",
align: "left",
field: row => row.SellPrice.toFixed(2)
},
{
name: "PreferentialList",
required: true,
label: "优惠政策",
align: "left",
field: row => row.PreferentialList
},
{
name: "PreferentialListSellCommission",
required: true,
label: "销售佣金",
align: "left",
field: row => row.PreferentialList
},
{
name: "PreferentialListB2BCommission",
required: true,
label: "同行佣金",
align: "left",
field: row => row.PreferentialList
},
{
name: "EducationCommission",
required: true,
label: "教育同行佣金",
align: "left",
field: row => row.PreferentialList
},
{
name: "ClassHours",
label: "课时长度",
field: "ClassHours",
align: "left",
format: (val, row) => `${val}课时`
},
{
name: "CreateByName",
label: "创建人",
field: "CreateByName",
align: "left"
},
{
name: "UpdateTimeStr",
label: "更新时间",
field: "UpdateTimeStr",
align: "left"
},
{
name: "Status",
label: "状态",
align: "left",
field: "Status"
},
{
name: "optioned",
label: "操作",
field: "CourseId"
}
],
data: [],
loading: true,
ShowOpts: [{
label: "全部",
value: "-1"
},
{
label: "正常",
value: "0"
},
{
label: "删除",
value: "1"
}
],
msg: {
pageIndex: 1,
pageSize: 12,
rowsPerPage: 12,
CourseName: "",
QCateIds: "",
IsQPrice: 1,
Status: "0"
}, },
//课程分类树形列表 {
TreeCategoryList: [], name: "CateName",
returnString: [], //默认值 required: true,
pageCount: 0, label: "系列",
isShowCourseForm: false, //是否显示课程表单 align: "left",
isShowCoursePriceForm: false, //是否显示课程价格表单 field: (row) => row.CateName,
courseObjOption: null, //课程对象 },
isShowPriceEditBtn: 1 //是否显示价格设置 {
}; name: "OriginalPrice",
}, required: true,
computed: mapState({ label: "原价",
isHavePriceAction(state) { align: "left",
if (state.user.userInfo && state.user.userInfo.ActionMenuList && state.user.userInfo.ActionMenuList.length > field: (row) => row.OriginalPrice.toFixed(2),
0) { },
let action = state.user.userInfo.ActionMenuList.find(x => { {
if (x.FunctionCode == "Edit_CoursePrice") { name: "SellPrice",
return x; required: true,
} label: "售价",
}); align: "left",
return action && action.FunctionCode; field: (row) => row.SellPrice.toFixed(2),
} },
return false; {
} name: "PreferentialList",
}), required: true,
mounted() { label: "优惠政策",
if(this.$route.query && this.$route.query.Name){//从订单完成统计跳转过来的带的参数 align: "left",
this.msg.CourseName = decodeURI(this.$route.query.Name) field: (row) => row.PreferentialList,
},
{
name: "PreferentialListSellCommission",
required: true,
label: "销售佣金",
align: "left",
field: (row) => row.PreferentialList,
},
{
name: "PreferentialListB2BCommission",
required: true,
label: "同行佣金",
align: "left",
field: (row) => row.PreferentialList,
},
{
name: "EducationCommission",
required: true,
label: "教育同行佣金",
align: "left",
field: (row) => row.PreferentialList,
},
{
name: "ClassHours",
label: "课时长度",
field: "ClassHours",
align: "left",
format: (val, row) => `${val}课时`,
},
{
name: "plat",
label: "上架渠道",
field: "plat",
align: "left",
},
{
name: "CreateByName",
label: "创建人",
field: "CreateByName",
align: "left",
},
{
name: "UpdateTimeStr",
label: "更新时间",
field: "UpdateTimeStr",
align: "left",
},
{
name: "Status",
label: "状态",
align: "left",
field: "Status",
},
{
name: "optioned",
label: "操作",
field: "CourseId",
},
],
data: [],
loading: true,
ShowOpts: [
{
label: "全部",
value: "-1",
},
{
label: "正常",
value: "0",
},
{
label: "删除",
value: "1",
},
],
platOpts: [], //上架渠道
msg: {
pageIndex: 1,
pageSize: 12,
rowsPerPage: 12,
CourseName: "",
QCateIds: "",
IsQPrice: 1,
Status: "0",
Saleplat: 0,
},
//课程分类树形列表
TreeCategoryList: [],
returnString: [], //默认值
pageCount: 0,
isShowCourseForm: false, //是否显示课程表单
isShowCoursePriceForm: false, //是否显示课程价格表单
courseObjOption: null, //课程对象
isShowPriceEditBtn: 1, //是否显示价格设置
};
},
computed: mapState({
isHavePriceAction(state) {
if (
state.user.userInfo &&
state.user.userInfo.ActionMenuList &&
state.user.userInfo.ActionMenuList.length > 0
) {
let action = state.user.userInfo.ActionMenuList.find((x) => {
if (x.FunctionCode == "Edit_CoursePrice") {
return x;
}
});
return action && action.FunctionCode;
} }
this.getCategorytree(); return false;
this.currentUrl = this.$route.path;
this.getcourselist();
}, },
methods: { }),
//删除课程 mounted() {
DeleteCourse(item, status) { if (this.$route.query && this.$route.query.Name) {
let delMsg = { //从订单完成统计跳转过来的带的参数
CourseId: item.CourseId, this.msg.CourseName = decodeURI(this.$route.query.Name);
Status: status }
}; this.getSaleplat();
var message = "是否要删除该课程?"; this.getCategorytree();
if (status == 0) { this.currentUrl = this.$route.path;
message = "是否要恢复该课程?"; this.getcourselist();
} },
this.$q.dialog({ methods: {
title: '提示信息', //删除课程
DeleteCourse(item, status) {
let delMsg = {
CourseId: item.CourseId,
Status: status,
};
var message = "是否要删除该课程?";
if (status == 0) {
message = "是否要恢复该课程?";
}
this.$q
.dialog({
title: "提示信息",
message: message, message: message,
cancel: true, cancel: true,
persistent: true, persistent: true,
ok: "确定", ok: "确定",
cancel: "取消", cancel: "取消",
}).onOk(() => { })
deleteCourseInfo(delMsg).then(res => { .onOk(() => {
deleteCourseInfo(delMsg).then((res) => {
if (res.Code == 1) { if (res.Code == 1) {
this.$q.notify({ this.$q.notify({
icon: 'iconfont icon-chenggong', icon: "iconfont icon-chenggong",
color: 'accent', color: "accent",
timeout: 2000, timeout: 2000,
message: '删除成功!', message: "删除成功!",
position: 'top' position: "top",
}) });
this.getcourselist(); this.getcourselist();
} else { } else {
this.$q.notify({ this.$q.notify({
icon: 'iconfont icon-chenggong', icon: "iconfont icon-chenggong",
color: 'accent', color: "accent",
timeout: 2000, timeout: 2000,
message: res.Message, message: res.Message,
position: 'top' position: "top",
}) });
} }
})
}).onCancel(() => {
});
},
gotoSub(obj, routeStr) {
var tempStr = "/course/" + routeStr + "?CourseId=" + obj.CourseId;
this.$router.push({
path: tempStr
});
},
//分类改变
getChild(cateObj) {
var tempStr = "";
if (cateObj && cateObj != "") {
tempStr = cateObj;
}
this.msg.QCateIds = tempStr;
this.msg.pageIndex = 1;
this.getcourselist();
},
getCategorytree() {
this.TreeCategoryList = [];
var qMsg = {};
queryCourseCategoryTree(qMsg).then(res => {
this.TreeCategoryList = res.Data;
});
},
//重新查询
resetSearch() {
this.msg.pageIndex = 1;
this.getcourselist();
},
//翻页
changePage(val) {
this.msg.pageIndex = val;
this.getcourselist();
},
//获取菜单分页列表
getcourselist() {
this.loading = true;
queryCoursePage(this.msg)
.then(res => {
this.loading = false;
this.data = res.Data.PageData;
this.pageCount = res.Data.PageCount;
})
.catch(() => {
this.loading = false;
}); });
}, })
//刷新页面 .onCancel(() => {});
refreshPage() { },
this.isShowCourseForm = false; gotoSub(obj, routeStr) {
this.isShowCoursePriceForm = false; var tempStr = "/course/" + routeStr + "?CourseId=" + obj.CourseId;
this.getcourselist(); this.$router.push({
}, path: tempStr,
//新增修改课程及价格 });
EditCourse(obj, type) { },
if (obj) { //分类改变
this.courseObjOption = obj; getChild(cateObj) {
} else { var tempStr = "";
this.courseObjOption = null; if (cateObj && cateObj != "") {
} tempStr = cateObj;
if (type == 1) {
this.isShowCourseForm = true;
} else {
this.isShowCoursePriceForm = true;
}
},
//关闭弹窗
closeMenuSaveForm() {
this.isShowCourseForm = false;
this.isShowCoursePriceForm = false;
},
//跳转至我的课程
goMycourse(obj) {
var tempStr = window.location.origin +"/#/course/courseinfo?CourseId=" + obj.CourseId;
// this.$router.push({
// path: tempStr
// });
openURL(tempStr)
} }
} this.msg.QCateIds = tempStr;
}; this.msg.pageIndex = 1;
this.getcourselist();
},
getCategorytree() {
this.TreeCategoryList = [];
var qMsg = {};
queryCourseCategoryTree(qMsg).then((res) => {
this.TreeCategoryList = res.Data;
});
},
//重新查询
resetSearch() {
this.msg.pageIndex = 1;
this.getcourselist();
},
//翻页
changePage(val) {
this.msg.pageIndex = val;
this.getcourselist();
},
//获取菜单分页列表
getcourselist() {
this.loading = true;
queryCoursePage(this.msg)
.then((res) => {
this.loading = false;
this.data = res.Data.PageData;
this.pageCount = res.Data.PageCount;
})
.catch(() => {
this.loading = false;
});
},
//刷新页面
refreshPage() {
this.isShowCourseForm = false;
this.isShowCoursePriceForm = false;
this.getcourselist();
},
//新增修改课程及价格
EditCourse(obj, type) {
if (obj) {
this.courseObjOption = obj;
} else {
this.courseObjOption = null;
}
if (type == 1) {
this.isShowCourseForm = true;
} else {
this.isShowCoursePriceForm = true;
}
},
//关闭弹窗
closeMenuSaveForm() {
this.isShowCourseForm = false;
this.isShowCoursePriceForm = false;
},
//跳转至我的课程
goMycourse(obj) {
var tempStr =
window.location.origin +
"/#/course/courseinfo?CourseId=" +
obj.CourseId;
// this.$router.push({
// path: tempStr
// });
openURL(tempStr);
},
//获取销售端口列表
getSaleplat() {
querySaleplatList().then((res) => {
this.platOpts = res.Data;
this.platOpts.unshift({
Name: "不限",
Id: 0,
});
});
},
},
};
</script> </script>
<style scoped> <style scoped>
.border-bottom { .border-bottom {
border-bottom: 1px dashed #EEE; border-bottom: 1px dashed #eee;
padding-bottom: 5px; padding-bottom: 5px;
margin-bottom: 5px; margin-bottom: 5px;
} }
</style> </style>
<style lang="sass"> <style lang="sass">
@import url('~assets/css/table.sass') @import url('~assets/css/table.sass')
</style> </style>
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