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

1

parent 31f962d6
......@@ -219,7 +219,7 @@ export function saveChapter(data) {
* 保存课程章节
* @param {JSON参数} data
*/
export function getCourseRate(data) {
export function getCourseRate(data) {
return request({
url: "/Course/GetCourseRateEnumList",
method: 'post',
......@@ -231,7 +231,7 @@ export function saveChapter(data) {
* 保存课程章节
* @param {JSON参数} data
*/
export function deleteChapters(data) {
export function deleteChapters(data) {
return request({
url: "/Course/BatchRemoveChapter",
method: 'post',
......@@ -243,7 +243,7 @@ export function saveChapter(data) {
* 保存课程章节
* @param {JSON参数} data
*/
export function setChaptersRate(data) {
export function setChaptersRate(data) {
return request({
url: "/Course/BatchSetChapterRate",
method: 'post',
......@@ -255,7 +255,7 @@ export function saveChapter(data) {
* 批量更新章节编号和ID
* @param {JSON参数} data
*/
export function batchUpdateChapterNo(data) {
export function batchUpdateChapterNo(data) {
return request({
url: "/Course/SetBatchChapterNo",
method: 'post',
......@@ -267,7 +267,7 @@ export function saveChapter(data) {
* 修改章节名称
* @param {JSON参数} data
*/
export function updateChapterName(data) {
export function updateChapterName(data) {
return request({
url: "/Course/SetChapterName",
method: 'post',
......@@ -396,7 +396,7 @@ export function saveOfferToOrder(data) {
method: 'post',
data
})
}
}
/**
* 报价单申请改价
......@@ -535,7 +535,3 @@ export function SetImportCourse(data) {
data
})
}
\ No newline at end of file
\ No newline at end of file
<template>
<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-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 ? "新增课程信息" : "修改课程信息" }}
......@@ -9,140 +15,315 @@
<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 :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 />
<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="col-6">
<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 || '请填写原价']" />
<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 :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">
<div
class="row wrap"
v-for="(item, index) in ladderPriceList"
:key="index"
>
<div class="col-6">
<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="人" />
<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 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 class="col-6" style="position: relative">
<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">
<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" />
<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="col-6">
<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 || '请填写续费原价']" />
<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 :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 :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 || '请填写课时信息']" />
<q-input
filled
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 class="col-6">
<q-select filled 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 || '请选择课程所属系列']" />
<q-select
filled
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 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="col-6">
<div class="col-9">
<span>上架端口:</span>
<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>
</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" />
<div class="col-3">
<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>
<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-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 extEditor from "../common/ext-editor";
import {
mapState
} from "vuex";
export default {
querySaleplatList,
} from "../../api/course/index";
import { getTeacherDropDownList } from "../../api/school/index";
import { UploadSelfFile } from "../../api/common/common";
import extEditor from "../common/ext-editor";
import { mapState } from "vuex";
export default {
components: {
extEditor
extEditor,
},
props: {
saveObj: {
type: Object,
default: null
}
default: null,
},
},
data() {
return {
......@@ -164,7 +345,8 @@
RenewSlPrice: 0, //续费售价
Saleplat: "", //销售平台
IsKCourse: 0, //是否是K12课程(1-是)
ClassHours: 0
ClassHours: 0,
CategoryList: [],
},
optionTitle: "",
defaultArray: [],
......@@ -176,27 +358,34 @@
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 (
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
if (action) {
return true;
}
}
return false;
}
},
}),
mounted() {
this.initObj();
......@@ -204,7 +393,7 @@
methods: {
//获取教师下拉
GetTeacherList() {
getTeacherDropDownList({}).then(res => {
getTeacherDropDownList({}).then((res) => {
if (res.Code == 1) {
this.TeacherList = res.Data;
}
......@@ -212,7 +401,7 @@
},
//获取销售端口列表
getSaleplat() {
querySaleplatList().then(res => {
querySaleplatList().then((res) => {
this.SaleplatList = res.Data;
});
},
......@@ -228,7 +417,7 @@
}
},
uploadFile(files) {
UploadSelfFile("course", files[0], res => {
UploadSelfFile("course", files[0], (res) => {
if (res.Code == 1) {
this.objOption.CoverImg = res.FileUrl;
}
......@@ -237,9 +426,8 @@
getCategorytree() {
this.TreeCategoryList = [];
var qMsg = {};
queryCourseCategoryTree(qMsg).then(res => {
queryCourseCategoryTree(qMsg).then((res) => {
this.TreeCategoryList = res.Data;
});
},
//新增阶梯定价
......@@ -247,7 +435,7 @@
var obj = {
ClassStepPriceId: 0,
PersionNum: 2,
PersionPrice: 0
PersionPrice: 0,
};
if (this.ladderPriceList && this.ladderPriceList.length > 0) {
var _index = this.ladderPriceList.length - 1;
......@@ -264,8 +452,8 @@
this.defaultArray = [];
if (this.saveObj && this.saveObj.CourseId > 0) {
queryCourseInfo({
CourseId: this.saveObj.CourseId
}).then(res => {
CourseId: this.saveObj.CourseId,
}).then((res) => {
this.objOption.CourseId = res.Data.CourseId;
this.objOption.CoverImg = res.Data.CoverImg;
this.objOption.CourseName = res.Data.CourseName;
......@@ -292,8 +480,15 @@
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 = "修改课程信息";
} else {
......@@ -317,7 +512,6 @@
this.objOption.IsKCourse = 0;
this.getCategorytree();
}
},
//关闭弹窗
closeCourseForm() {
......@@ -329,11 +523,15 @@
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) {
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 => {
this.chooseTeacher.forEach((item) => {
Teacher_Ids += "," + item;
});
}
......@@ -342,7 +540,7 @@
}
var salePlat = "";
if (this.choosePlat && this.choosePlat.length > 0) {
this.choosePlat.forEach(item => {
this.choosePlat.forEach((item) => {
salePlat += "," + item;
});
}
......@@ -353,14 +551,14 @@
this.objOption.Teacher_Ids = Teacher_Ids;
this.objOption.Saleplat = salePlat;
saveCourseInfo(this.objOption)
.then(res => {
.then((res) => {
this.saveCourseLoading = false;
this.$q.notify({
icon: "iconfont icon-chenggong",
color: "accent",
timeout: 2000,
message: "数据保存成功!",
position: "top"
position: "top",
});
this.$emit("success");
this.closeSaveForm();
......@@ -369,8 +567,73 @@
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);
}
item.ChildList.forEach((item2) => {
if (list == item2.Id) {
let newItem2 = JSON.parse(JSON.stringify(item2));
newItem2.CategoryId = item2.Id;
newItem2.Id = 0;
let findId2 = this.modifyClassifyList.find(
(e) => e.CategoryId === newItem2.CategoryId
);
if (findId2) {
newItem2.Id = findId2.Id;
}
};
this.objOption.CategoryList.push(newItem2);
}
item2.ChildList.forEach((item3) => {
if (list == item3.Id) {
let newItem3 = JSON.parse(JSON.stringify(item3));
newItem3.CategoryId = item2.Id;
newItem3.Id = 0;
let findId3 = this.modifyClassifyList.find(
(e) => e.CategoryId === newItem3.CategoryId
);
if (findId3) {
newItem3.Id = findId3.Id;
}
this.objOption.CategoryList.push(newItem3);
}
});
});
});
});
},
},
};
</script>
......@@ -3,34 +3,88 @@
<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 @input="resetSearch" clearable standout="bg-primary text-white" v-model="msg.CourseName" label="课程名称"
@clear="resetSearch" maxlength="20" />
<q-input
@input="resetSearch"
clearable
standout="bg-primary text-white"
v-model="msg.CourseName"
label="课程名称"
@clear="resetSearch"
maxlength="20"
/>
</div>
<div class="col-3">
<select-tree :treeData="TreeCategoryList" :defaultArray="returnString" nodeKey="CateId" :multiple="true"
labelKey="CateName" childrenKey="ChildList" tipText="课程系列" @getChild="getChild"></select-tree>
<select-tree
:treeData="TreeCategoryList"
:defaultArray="returnString"
nodeKey="CateId"
:multiple="true"
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"
emit-value map-options label="状态" />
<q-select
@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 class="page-content">
<q-table :pagination="msg" :loading="loading" no-data-label="暂无相关数据" flat
class="sticky-tow-column-table sticky-right-column-table" separator="none" :data="data" :columns="columns"
row-key="name">
<q-table
:pagination="msg"
: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">
<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="EditCourse(null, 1)" />
<q-btn
color="accent"
size="sm"
class="q-mr-md"
icon="add"
label="新增课程"
@click="EditCourse(null, 1)"
/>
</div>
</template>
<template v-slot:body-cell-CoverImg="props">
<q-td :props="props">
<q-img :src="props.value" spinner-color="white" style="height: 54px; max-width: 100px"
class="rounded-borders">
<q-img
:src="props.value"
spinner-color="white"
style="height: 54px; max-width: 100px"
class="rounded-borders"
>
</q-img>
</q-td>
</template>
......@@ -40,19 +94,19 @@
</q-td>
</template>
<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 class="border-bottom" v-if="x.PriceDiscountType == 1">
{{ x.BuyNum }}{{ x.SendNum }}
</div>
<div class="border-bottom" v-if="x.PriceDiscountType == 2">
单人报名享优惠{{x.PriceMoney }}%
单人报名享优惠{{ x.PriceMoney }}%
</div>
<div class="border-bottom" v-if="x.PriceDiscountType == 3">
双人报名优惠{{x.PriceMoney }}%
双人报名优惠{{ x.PriceMoney }}%
</div>
<div class="border-bottom" v-if="x.PriceDiscountType == 4">
续费享优惠{{x.PriceMoney }}%
续费享优惠{{ x.PriceMoney }}%
</div>
<div class="remark-font" v-if="x.PriceDiscountType == 0">
暂无优惠政策
......@@ -64,10 +118,14 @@
</q-td>
</template>
<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 class="border-bottom" style="padding-left: 16px;padding-right: 16px"
:class="{ 'text-red': x.SaleCommissionType == 1 }" v-if="x.PriceDiscountType != 0">
<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 ? "%" : "" }}
......@@ -82,10 +140,14 @@
</q-td>
</template>
<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 class="border-bottom" style="padding-left: 16px" :class="{ 'text-red': x.B2BCommissionType == 1 }"
v-if="x.PriceDiscountType != 0">
<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 ? "%" : "" }}
......@@ -100,10 +162,14 @@
</q-td>
</template>
<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 class="border-bottom" style="padding-left: 16px" :class="{ 'text-red': x.EduCommissionType == 1 }"
v-if="x.PriceDiscountType != 0">
<div
class="border-bottom"
style="padding-left: 16px"
:class="{ 'text-red': x.EduCommissionType == 1 }"
v-if="x.PriceDiscountType != 0"
>
{{ x.EduCommissionType == 1 ? "¥" : ""
}}{{ x.EduCommissionMoney
}}{{ x.EduCommissionType == 0 ? "%" : "" }}
......@@ -117,29 +183,78 @@
</div>
</q-td>
</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">
<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>
</template>
<template v-slot:bottom>
<q-pagination class="full-width justify-end" v-model="msg.pageIndex" color="primary" :max="pageCount"
:input="true" @input="changePage" />
<q-pagination
class="full-width justify-end"
v-model="msg.pageIndex"
color="primary"
:max="pageCount"
:input="true"
@input="changePage"
/>
</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="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-btn
flat
size="xs"
icon="edit"
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-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-label>删除</q-item-label>
</q-item-section>
</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-label>恢复</q-item-label>
</q-item-section>
......@@ -154,45 +269,53 @@
</q-td>
</template>
</q-table>
<course-form v-if="isShowCourseForm" :save-obj="courseObjOption" @close="closeMenuSaveForm"
@success="refreshPage">
<course-form
v-if="isShowCourseForm"
:save-obj="courseObjOption"
@close="closeMenuSaveForm"
@success="refreshPage"
>
</course-form>
<courseprice-form v-if="isShowCoursePriceForm" :save-obj="courseObjOption" @close="closeMenuSaveForm"
@success="refreshPage">
<courseprice-form
v-if="isShowCoursePriceForm"
:save-obj="courseObjOption"
@close="closeMenuSaveForm"
@success="refreshPage"
>
</courseprice-form>
</div>
</div>
</template>
<script>
import {
import {
queryCoursePage,
queryCourseCategoryTree,
deleteCourseInfo
} from "../../api/course/index";
import courseForm from "../../components/course/course-form";
import coursepriceForm from "../../components/course/courseprice-form";
import selectTree from "../../components/common/select-tree";
import { openURL } from "quasar";
import {
mapState
} from "vuex";
export default {
deleteCourseInfo,
querySaleplatList,
} from "../../api/course/index";
import courseForm from "../../components/course/course-form";
import coursepriceForm from "../../components/course/courseprice-form";
import selectTree from "../../components/common/select-tree";
import { openURL } from "quasar";
import { mapState } from "vuex";
export default {
meta: {
title: "课程管理"
title: "课程管理",
},
components: {
courseForm,
selectTree,
coursepriceForm
coursepriceForm,
},
data() {
return {
currentUrl: "",
columns: [{
columns: [
{
name: "CoverImg",
label: "课程封面",
field: "CoverImg",
align: "left"
align: "left",
},
{
......@@ -200,103 +323,111 @@
required: true,
label: "课程名称",
align: "left",
field: row => row.CourseName
field: (row) => row.CourseName,
},
{
name: "CateName",
required: true,
label: "系列",
align: "left",
field: row => row.CateName
field: (row) => row.CateName,
},
{
name: "OriginalPrice",
required: true,
label: "原价",
align: "left",
field: row => row.OriginalPrice.toFixed(2)
field: (row) => row.OriginalPrice.toFixed(2),
},
{
name: "SellPrice",
required: true,
label: "售价",
align: "left",
field: row => row.SellPrice.toFixed(2)
field: (row) => row.SellPrice.toFixed(2),
},
{
name: "PreferentialList",
required: true,
label: "优惠政策",
align: "left",
field: row => row.PreferentialList
field: (row) => row.PreferentialList,
},
{
name: "PreferentialListSellCommission",
required: true,
label: "销售佣金",
align: "left",
field: row => row.PreferentialList
field: (row) => row.PreferentialList,
},
{
name: "PreferentialListB2BCommission",
required: true,
label: "同行佣金",
align: "left",
field: row => row.PreferentialList
field: (row) => row.PreferentialList,
},
{
name: "EducationCommission",
required: true,
label: "教育同行佣金",
align: "left",
field: row => row.PreferentialList
field: (row) => row.PreferentialList,
},
{
name: "ClassHours",
label: "课时长度",
field: "ClassHours",
align: "left",
format: (val, row) => `${val}课时`
format: (val, row) => `${val}课时`,
},
{
name: "plat",
label: "上架渠道",
field: "plat",
align: "left",
},
{
name: "CreateByName",
label: "创建人",
field: "CreateByName",
align: "left"
align: "left",
},
{
name: "UpdateTimeStr",
label: "更新时间",
field: "UpdateTimeStr",
align: "left"
align: "left",
},
{
name: "Status",
label: "状态",
align: "left",
field: "Status"
field: "Status",
},
{
name: "optioned",
label: "操作",
field: "CourseId"
}
field: "CourseId",
},
],
data: [],
loading: true,
ShowOpts: [{
ShowOpts: [
{
label: "全部",
value: "-1"
value: "-1",
},
{
label: "正常",
value: "0"
value: "0",
},
{
label: "删除",
value: "1"
}
value: "1",
},
],
platOpts: [], //上架渠道
msg: {
pageIndex: 1,
pageSize: 12,
......@@ -304,7 +435,8 @@
CourseName: "",
QCateIds: "",
IsQPrice: 1,
Status: "0"
Status: "0",
Saleplat: 0,
},
//课程分类树形列表
TreeCategoryList: [],
......@@ -313,14 +445,17 @@
isShowCourseForm: false, //是否显示课程表单
isShowCoursePriceForm: false, //是否显示课程价格表单
courseObjOption: null, //课程对象
isShowPriceEditBtn: 1 //是否显示价格设置
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 (
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;
}
......@@ -328,12 +463,14 @@
return action && action.FunctionCode;
}
return false;
}
},
}),
mounted() {
if(this.$route.query && this.$route.query.Name){//从订单完成统计跳转过来的带的参数
this.msg.CourseName = decodeURI(this.$route.query.Name)
if (this.$route.query && this.$route.query.Name) {
//从订单完成统计跳转过来的带的参数
this.msg.CourseName = decodeURI(this.$route.query.Name);
}
this.getSaleplat();
this.getCategorytree();
this.currentUrl = this.$route.path;
this.getcourselist();
......@@ -343,48 +480,49 @@
DeleteCourse(item, status) {
let delMsg = {
CourseId: item.CourseId,
Status: status
Status: status,
};
var message = "是否要删除该课程?";
if (status == 0) {
message = "是否要恢复该课程?";
}
this.$q.dialog({
title: '提示信息',
this.$q
.dialog({
title: "提示信息",
message: message,
cancel: true,
persistent: true,
ok: "确定",
cancel: "取消",
}).onOk(() => {
deleteCourseInfo(delMsg).then(res => {
})
.onOk(() => {
deleteCourseInfo(delMsg).then((res) => {
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
icon: "iconfont icon-chenggong",
color: "accent",
timeout: 2000,
message: '删除成功!',
position: 'top'
})
message: "删除成功!",
position: "top",
});
this.getcourselist();
} else {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
icon: "iconfont icon-chenggong",
color: "accent",
timeout: 2000,
message: res.Message,
position: 'top'
})
position: "top",
});
}
})
}).onCancel(() => {
});
})
.onCancel(() => {});
},
gotoSub(obj, routeStr) {
var tempStr = "/course/" + routeStr + "?CourseId=" + obj.CourseId;
this.$router.push({
path: tempStr
path: tempStr,
});
},
//分类改变
......@@ -400,7 +538,7 @@
getCategorytree() {
this.TreeCategoryList = [];
var qMsg = {};
queryCourseCategoryTree(qMsg).then(res => {
queryCourseCategoryTree(qMsg).then((res) => {
this.TreeCategoryList = res.Data;
});
},
......@@ -418,7 +556,7 @@
getcourselist() {
this.loading = true;
queryCoursePage(this.msg)
.then(res => {
.then((res) => {
this.loading = false;
this.data = res.Data.PageData;
this.pageCount = res.Data.PageCount;
......@@ -453,25 +591,35 @@
},
//跳转至我的课程
goMycourse(obj) {
var tempStr = window.location.origin +"/#/course/courseinfo?CourseId=" + obj.CourseId;
var tempStr =
window.location.origin +
"/#/course/courseinfo?CourseId=" +
obj.CourseId;
// this.$router.push({
// path: tempStr
// });
openURL(tempStr)
}
}
};
openURL(tempStr);
},
//获取销售端口列表
getSaleplat() {
querySaleplatList().then((res) => {
this.platOpts = res.Data;
this.platOpts.unshift({
Name: "不限",
Id: 0,
});
});
},
},
};
</script>
<style scoped>
.border-bottom {
border-bottom: 1px dashed #EEE;
.border-bottom {
border-bottom: 1px dashed #eee;
padding-bottom: 5px;
margin-bottom: 5px;
}
}
</style>
<style lang="sass">
@import url('~assets/css/table.sass')
@import url('~assets/css/table.sass')
</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