Commit 8064c62f authored by 黄奎's avatar 黄奎

课程页面修改

parent 89aab90c
...@@ -3,75 +3,34 @@ ...@@ -3,75 +3,34 @@
<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 <q-input @input="resetSearch" clearable standout="bg-primary text-white" v-model="msg.CourseName" label="课程名称"
@input="resetSearch" @clear="resetSearch" maxlength="20" />
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 <select-tree :treeData="TreeCategoryList" :defaultArray="returnString" nodeKey="CateId" :multiple="true"
:treeData="TreeCategoryList" labelKey="CateName" childrenKey="ChildList" tipText="课程系列" @getChild="getChild"></select-tree>
: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 <q-select @input="resetSearch" standout="bg-primary text-white" v-model="msg.Status" :options="ShowOpts"
@input="resetSearch" emit-value map-options label="状态" />
standout="bg-primary text-white"
v-model="msg.Status"
:options="ShowOpts"
emit-value
map-options
label="状态"
/>
</div> </div>
</div> </div>
</div> </div>
<div class="page-content"> <div class="page-content">
<q-table <q-table :pagination="msg" :loading="loading" no-data-label="暂无相关数据" flat
:pagination="msg" class="sticky-tow-column-table sticky-right-column-table" separator="none" :data="data" :columns="columns"
:loading="loading" row-key="name">
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 <q-btn color="accent" size="sm" class="q-mr-md" icon="add" label="新增课程" @click="EditCourse(null, 1)" />
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 <q-img :src="props.value" spinner-color="white" style="height: 54px; max-width: 100px"
:src="props.value" class="rounded-borders">
spinner-color="white"
style="height: 54px; max-width: 100px"
class="rounded-borders"
>
</q-img> </q-img>
</q-td> </q-td>
</template> </template>
...@@ -107,12 +66,8 @@ ...@@ -107,12 +66,8 @@
<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 <div class="border-bottom" style="padding-left: 16px;padding-right: 16px"
class="border-bottom" :class="{ 'text-red': x.SaleCommissionType == 1 }" v-if="x.PriceDiscountType != 0">
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 ? "%" : "" }}
...@@ -129,12 +84,8 @@ ...@@ -129,12 +84,8 @@
<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 <div class="border-bottom" style="padding-left: 16px" :class="{ 'text-red': x.B2BCommissionType == 1 }"
class="border-bottom" v-if="x.PriceDiscountType != 0">
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 ? "%" : "" }}
...@@ -150,325 +101,285 @@ ...@@ -150,325 +101,285 @@
</template> </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 <q-badge :color="props.value == 1 ? 'negative' : 'primary'" :label="props.value == 0 ? '正常' : '禁用'" />
: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 <q-pagination class="full-width justify-end" v-model="msg.pageIndex" color="primary" :max="pageCount"
class="full-width justify-end" :input="true" @input="changePage" />
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 <q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" label="编辑"
flat @click="EditCourse(props.row, 1)" />
size="xs" <q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" label="价格设置"
icon="edit" @click="EditCourse(props.row, 2)" v-if="isHavePriceAction" />
color="accent" <q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400;display:none;" label="详情"
style="font-weight:400" @click="goMycourse(props.row)" />
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
flat
size="xs"
icon="edit"
color="accent"
style="font-weight:400;display:none;"
label="详情"
@click="goMycourse(props.row)"
/>
</q-td> </q-td>
</template> </template>
</q-table> </q-table>
<course-form <course-form v-if="isShowCourseForm" :save-obj="courseObjOption" @close="closeMenuSaveForm"
v-if="isShowCourseForm" @success="refreshPage">
:save-obj="courseObjOption"
@close="closeMenuSaveForm"
@success="refreshPage"
>
</course-form> </course-form>
<courseprice-form <courseprice-form v-if="isShowCoursePriceForm" :save-obj="courseObjOption" @close="closeMenuSaveForm"
v-if="isShowCoursePriceForm" @success="refreshPage">
: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
} from "../../api/course/index"; } from "../../api/course/index";
import courseForm from "../../components/course/course-form"; import courseForm from "../../components/course/course-form";
import coursepriceForm from "../../components/course/courseprice-form"; import coursepriceForm from "../../components/course/courseprice-form";
import selectTree from "../../components/common/select-tree"; import selectTree from "../../components/common/select-tree";
import { mapState } from "vuex"; import {
export default { mapState
meta: { } from "vuex";
title: "课程管理" export default {
}, meta: {
components: { title: "课程管理"
courseForm, },
selectTree, components: {
coursepriceForm courseForm,
}, selectTree,
data() { coursepriceForm
return { },
currentUrl: "", data() {
columns: [ return {
{ currentUrl: "",
name: "CoverImg", columns: [{
label: "课程封面", name: "CoverImg",
field: "CoverImg", label: "课程封面",
align: "left" field: "CoverImg",
}, align: "left"
// { },
// name: 'CourseId',
// label: '课程编号',
// field: 'CourseId',
// align: 'left'
// },
{
name: "CourseName",
required: true,
label: "课程名称",
align: "left",
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: "ClassHours",
label: "课时长度",
field: "ClassHours",
align: "left",
format: (val, row) => `${val}课时`
},
{ {
name: "CreateByName", name: "CourseName",
label: "创建人", required: true,
field: "CreateByName", label: "课程名称",
align: "left" align: "left",
}, field: row => row.CourseName
{ },
name: "UpdateTimeStr", {
label: "更新时间", name: "CateName",
field: "UpdateTimeStr", required: true,
align: "left" label: "系列",
}, align: "left",
{ field: row => row.CateName
name: "Status", },
label: "状态", {
align: "left", name: "OriginalPrice",
field: "Status" required: true,
}, label: "原价",
{ align: "left",
name: "optioned", field: row => row.OriginalPrice.toFixed(2)
label: "操作", },
field: "CourseId" {
} name: "SellPrice",
], required: true,
data: [], label: "售价",
loading: true, align: "left",
ShowOpts: [ field: row => row.SellPrice.toFixed(2)
{ },
label: "全部", {
value: "-1" name: "PreferentialList",
}, required: true,
{ label: "优惠政策",
label: "正常", align: "left",
value: "0" field: row => row.PreferentialList
}, },
{ {
label: "删除", name: "PreferentialListSellCommission",
value: "1" required: true,
} label: "销售佣金",
], align: "left",
msg: { field: row => row.PreferentialList
pageIndex: 1, },
pageSize: 12, {
rowsPerPage: 12, name: "PreferentialListB2BCommission",
CourseName: "", required: true,
QCateIds: "", label: "同行佣金",
IsQPrice: 1, align: "left",
Status: "-1" field: row => row.PreferentialList
}, },
//课程分类树形列表 {
TreeCategoryList: [], name: "ClassHours",
returnString: [], //默认值 label: "课时长度",
pageCount: 0, field: "ClassHours",
isShowCourseForm: false, //是否显示课程表单 align: "left",
isShowCoursePriceForm: false, //是否显示课程价格表单 format: (val, row) => `${val}课时`
courseObjOption: null, //课程对象 },
isShowPriceEditBtn: 1 //是否显示价格设置
}; {
}, name: "CreateByName",
computed: mapState({ label: "创建人",
isHavePriceAction(state) { field: "CreateByName",
if (state.user.userInfo.ActionMenuList) { align: "left"
let action = state.user.userInfo.ActionMenuList.find(x => { },
if (x.FunctionCode == "Edit_CoursePrice") { {
return x; name: "UpdateTimeStr",
label: "更新时间",
field: "UpdateTimeStr",
align: "left"
},
{
name: "Status",
label: "状态",
align: "left",
field: "Status"
},
{
name: "optioned",
label: "操作",
field: "CourseId"
} }
}); ],
return action && action.FunctionCode; data: [],
} loading: true,
return false; ShowOpts: [{
} label: "全部",
}), value: "-1"
mounted() { },
this.getCategorytree(); {
this.currentUrl = this.$route.path; label: "正常",
this.getcourselist(); value: "0"
}, },
methods: { {
gotoSub(obj, routeStr) { label: "删除",
var tempStr = "/course/" + routeStr + "?CourseId=" + obj.CourseId; value: "1"
this.$router.push({ }
path: tempStr ],
}); msg: {
pageIndex: 1,
pageSize: 12,
rowsPerPage: 12,
CourseName: "",
QCateIds: "",
IsQPrice: 1,
Status: "-1"
},
//课程分类树形列表
TreeCategoryList: [],
returnString: [], //默认值
pageCount: 0,
isShowCourseForm: false, //是否显示课程表单
isShowCoursePriceForm: false, //是否显示课程价格表单
courseObjOption: null, //课程对象
isShowPriceEditBtn: 1 //是否显示价格设置
};
}, },
//分类改变 computed: mapState({
getChild(cateObj) { isHavePriceAction(state) {
var tempStr = ""; if (state.user.userInfo.ActionMenuList) {
if (cateObj && cateObj != "") { let action = state.user.userInfo.ActionMenuList.find(x => {
tempStr = cateObj; if (x.FunctionCode == "Edit_CoursePrice") {
return x;
}
});
return action && action.FunctionCode;
}
return false;
} }
this.msg.QCateIds = tempStr; }),
this.msg.pageIndex = 1; mounted() {
this.getCategorytree();
this.currentUrl = this.$route.path;
this.getcourselist(); this.getcourselist();
}, },
getCategorytree() { methods: {
this.TreeCategoryList = []; gotoSub(obj, routeStr) {
var qMsg = {}; var tempStr = "/course/" + routeStr + "?CourseId=" + obj.CourseId;
queryCourseCategoryTree(qMsg).then(res => { this.$router.push({
this.TreeCategoryList = res.Data; path: tempStr
}); });
}, },
//重新查询 //分类改变
resetSearch() { getChild(cateObj) {
this.msg.pageIndex = 1; var tempStr = "";
this.getcourselist(); if (cateObj && cateObj != "") {
}, tempStr = cateObj;
//翻页 }
changePage(val) { this.msg.QCateIds = tempStr;
this.msg.pageIndex = val; this.msg.pageIndex = 1;
this.getcourselist(); this.getcourselist();
}, },
//获取菜单分页列表 getCategorytree() {
getcourselist() { this.TreeCategoryList = [];
this.loading = true; var qMsg = {};
queryCoursePage(this.msg) queryCourseCategoryTree(qMsg).then(res => {
.then(res => { this.TreeCategoryList = res.Data;
this.loading = false; });
this.data = res.Data.PageData; },
this.pageCount = res.Data.PageCount; //重新查询
}) resetSearch() {
.catch(() => { this.msg.pageIndex = 1;
this.loading = false; 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 = "/course/courseinfo?CourseId=" + obj.CourseId;
this.$router.push({
path: tempStr
}); });
},
//刷新页面
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 = "/course/courseinfo?CourseId=" + obj.CourseId;
this.$router.push({
path: tempStr
});
} }
} };
};
</script> </script>
<style scoped>
.border-bottom {
border-bottom: 1px dashed #EEE;
padding-bottom: 5px;
margin-bottom: 5px;
}
</style>
<style lang="sass"> <style lang="sass">
@import url('~assets/css/table.sass') @import url('~assets/css/table.sass')
.border-bottom
border-bottom: 1px dashed #EEE
padding-bottom: 5px
margin-bottom: 5px
</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