26 Commits

Author SHA1 Message Date
liuyuan
ec76caf424 update .gitignore 2024-11-10 22:56:44 +08:00
wangjinlei
a680f19222 update 2024-11-08 17:59:15 +08:00
wangjinlei
ed06b15e70 Merge branch 'ly-test' 2024-11-08 17:27:54 +08:00
wangjinlei
618a8bc2e0 update 2024-11-08 17:26:41 +08:00
liuyuan
f369993880 增加VIP管理模块 2024-11-08 16:42:02 +08:00
wangjinlei
3bd2e85f01 Merge branch 'master' of https://gitee.com/wjl2008_admin/nuttyreading-master-html 2024-11-04 18:07:04 +08:00
8a0b0aae88 vip金额 2024-11-04 18:05:31 +08:00
wangjinlei
4ecf713414 Merge branch 'master' of https://gitee.com/wjl2008_admin/nuttyreading-master-html 2024-11-01 17:02:49 +08:00
10125160d3 提交 2024-11-01 16:53:13 +08:00
wangjinlei
b208def4cf Merge branch 'master' of https://gitee.com/wjl2008_admin/nuttyreading-master-html 2024-10-30 17:49:39 +08:00
36564630cc 优惠券修改 2024-10-30 15:29:21 +08:00
wangjinlei
6a6ead9995 Merge branch 'master' of https://gitee.com/wjl2008_admin/nuttyreading-master-html 2024-10-30 14:02:25 +08:00
wangjinlei
8400759adc index 2024-10-30 14:02:17 +08:00
25be4ddd57 优惠券 2024-10-29 16:42:27 +08:00
d9b202e6bd Merge branch 'coupon' of https://gitee.com/wjl2008_admin/nuttyreading-master-html 2024-10-29 16:42:06 +08:00
b3a05def01 用户课程列表刷新 2024-10-21 13:28:34 +08:00
1af3692c69 Merge branch 'master' of https://gitee.com/wjl2008_admin/nuttyreading-master-html 2024-10-19 15:08:10 +08:00
06b6abdea7 tab切换路由有缓存 2024-10-19 15:07:53 +08:00
@fawn-nine
69f1a1a96e 修改或略文件 2024-10-17 11:01:41 +08:00
@fawn-nine
80948d6d59 课程添加自考开关 2024-10-16 13:06:15 +08:00
be61850df2 评论管理 2024-10-15 15:32:55 +08:00
cd13e8635a 修改 2024-10-14 18:03:14 +08:00
6d86045a40 评论 2024-10-14 17:28:32 +08:00
36c5476b36 评论管理 2024-10-14 17:27:10 +08:00
@fawn-nine
efa7981828 2 2024-09-27 13:30:02 +08:00
@fawn-nine
c4e7dce7e3 小修改 2024-09-27 13:13:33 +08:00
18 changed files with 3988 additions and 1547 deletions

4
.gitignore vendored
View File

@@ -19,4 +19,6 @@ selenium-debug.log
# common # common
common/common.vue common/common.vue
dist.zip /src/views/common/common.vue
package-lock.json
config/index.js

View File

@@ -23,7 +23,7 @@ module.exports = {
}, },
// Various Dev Server settings // Various Dev Server settings
host: '192.168.110.162', // can be overwritten by process.env.HOST host: 'localhost', // can be overwritten by process.env.HOST
port: 8001, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined port: 8001, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: true, autoOpenBrowser: true,
errorOverlay: true, errorOverlay: true,

2153
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
<script type="text/javascript"> <script type="text/javascript">
const baseUrl = "http://192.168.110.100:9200/pb"; //张川川后端 // const baseUrl = "http://192.168.110.100:9200/pb"; //张川川后端
// const baseUrl = 'http://59.110.212.44:9100/pb' // const baseUrl = 'http://59.110.212.44:9100/pb'
// const baseUrl = "https://testapi.nuttyreading.com"; // const baseUrl = "https://testapi.nuttyreading.com";
// const baseUrl = 'https://api.nuttyreading.com' const baseUrl = 'https://api.nuttyreading.com'
// function commonFun() { // function commonFun() {
// console.log("公共方法") // console.log("公共方法")
// } // }

View File

@@ -0,0 +1,258 @@
<template>
<div style="width: 100%;height: 100%;">
<el-form
:inline="true"
:model="query"
@keyup.enter.native="getList()"
style="position: relative;"
>
<el-form-item label="评论内容">
<el-input
style="width: 100%;"
v-model="query.content"
placeholder="请输入评论内容"
clearable
></el-input>
</el-form-item>
<el-form-item style="width: 120px;">
<el-button
@click="
pageIndex = 1;
getList();
"
>查询</el-button
>
</el-form-item>
<el-button
v-if="tableData.length > 0"
style="position: absolute;right: 0;"
type="danger"
size="small"
@click="deleteHandle('all')"
>批量删除</el-button
>
<!-- <el-button type="text"
@click="changeDefalutExpand()"
style="position: absolute;right: 0;"
:style="`color:${defaultExpand?'#17B3A3':'#333'}`"
>{{ !defaultExpand ? "收起" : "展开" }}全部评论
<i class="el-icon-s-comment" ></i
></el-button> -->
</el-form>
<!-- -->
<el-table
row-key="id"
v-if="refreshTable"
:default-expand-all="defaultExpand"
:data="tableData"
style="width: 100%"
height="calc(100% - 40px)"
@selection-change="handleSelectionChange"
:default-sort="{ prop: 'date', order: 'descending' }"
>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column
fixed
prop="createTime"
label="日期"
width="200"
sortable
>
</el-table-column>
<el-table-column prop="name" label="姓名" width="120">
<template slot-scope="scope">
<div>
<el-tooltip placement="top" v-if="scope.row.user">
<div slot="content">
<div>
<p v-if="scope.row.user.nickname">
昵称{{ scope.row.user.nickname }}
</p>
<p v-if="scope.row.user.name">
姓名{{ scope.row.user.name }}
</p>
<p v-if="scope.row.user.email">
邮箱{{ scope.row.user.email }}
</p>
<p v-if="scope.row.user.tel">
手机号{{ scope.row.user.tel }}
</p>
</div>
</div>
<div class="avatar">
<img
:src="scope.row.user ? scope.row.user.avatar : ''"
alt=""
v-if="scope.row.user && scope.row.user.avatar"
/>
</div>
</el-tooltip>
<div class="avatar" v-else></div>
<span></span>
</div>
</template>
</el-table-column>
<el-table-column prop="content" label="评论内容">
<template slot-scope="scope">
<div v-html="scope.row.content"></div>
</template>
</el-table-column>
<el-table-column label="操作" width="60">
<template slot-scope="scope">
<span
style="color: red;cursor: pointer;"
@click="deleteHandle('one', scope.row.id)"
>
删除
</span>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
style="padding: 30px 0; text-align: center;"
layout="total, sizes, prev, pager, next, jumper"
>
</el-pagination>
</div>
</template>
<script>
export default {
props: ["courseId"],
data() {
return {
tableData: [],
selectData: [],
query: {
content: ""
},
pageIndex: 1,
defaultExpand: false,
refreshTable: true,
pageSize: 10,
totalPage: 0
};
},
created() {},
methods: {
handleSelectionChange(data) {
console.log("data at line 141:", data);
this.selectData = data;
},
changeDefalutExpand() {
this.refreshTable = false;
this.$nextTick(() => {
this.refreshTable = true;
this.defaultExpand = !this.defaultExpand;
});
this.$forceUpdate();
},
init() {
this.getList();
},
sizeChangeHandle(val) {
this.pageSize = val;
this.pageIndex = 1;
this.getList();
},
// 当前页
currentChangeHandle(val) {
this.pageIndex = val;
this.getList();
},
getList() {
this.$http({
url: this.$http.adornUrl(
"/master/courseGuestbook/getCourseGuestbookList"
),
method: "post",
data: this.$http.adornData({
limit: this.pageSize,
page: this.pageIndex,
type: 0, //类型0课程1章节
courseId: this.courseId ? this.courseId : "",
chapterId: "",
content: this.query.content //内容
})
}).then(res => {
console.log("res at line 68:", res);
if (res.data.code == 0 && res.data.page.records.length > 0) {
this.tableData = res.data.page.records ? res.data.page.records : [];
this.totalPage = res.data.page.total;
this.$forceUpdate();
} else {
this.tableData = [];
this.totalPage = 0;
this.$forceUpdate();
}
// console.log(row, "row" , res.data.resList,this.resList);
});
},
deleteHandle(type, id) {
if (type == "all") {
if (this.selectData.length == 0) {
this.$message.error("请至少选择一条评论");
return false;
}
}
this.$confirm(`请确认是否${type == "all" ? "批量" : ""}删除?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
var ids = this.selectData.map(e => e.id).join(",");
console.log("ids at line 205:", ids);
this.$http({
url: this.$http.adornUrl(
`/master/courseGuestbook/delCourseGuestbook`
),
method: "post",
data: this.$http.adornData({
ids: type == "all" ? ids : id
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getList();
}
});
} else {
this.$message.error(data.msg);
}
});
});
}
}
};
</script>
<style lang="less" scoped>
.avatar {
width: 40px;
height: 40px;
border-radius: 40px;
overflow: hidden;
background-color: #f0f0f0;
img {
width: 100%;
height: 100%;
}
}
</style>

View File

@@ -5,7 +5,8 @@
:default-active="menuActiveName || 'home'" :default-active="menuActiveName || 'home'"
:collapse="sidebarFold" :collapse="sidebarFold"
:collapseTransition="false" :collapseTransition="false"
class="site-sidebar__menu"> class="site-sidebar__menu"
>
<el-menu-item index="home" @click="$router.push({ name: 'home' })"> <el-menu-item index="home" @click="$router.push({ name: 'home' })">
<icon-svg name="shouye" class="site-sidebar__menu-icon"></icon-svg> <icon-svg name="shouye" class="site-sidebar__menu-icon"></icon-svg>
<span slot="title">首页</span> <span slot="title">首页</span>
@@ -28,7 +29,8 @@
v-for="menu in menuList" v-for="menu in menuList"
:key="menu.menuId" :key="menu.menuId"
:menu="menu" :menu="menu"
:dynamicMenuRoutes="dynamicMenuRoutes"> :dynamicMenuRoutes="dynamicMenuRoutes"
>
</sub-menu> </sub-menu>
</el-menu> </el-menu>
</div> </div>
@@ -36,77 +38,114 @@
</template> </template>
<script> <script>
import SubMenu from './main-sidebar-sub-menu' import SubMenu from "./main-sidebar-sub-menu";
import { isURL } from '@/utils/validate' import { isURL } from "@/utils/validate";
export default { export default {
data () { data() {
return { return {
dynamicMenuRoutes: [] dynamicMenuRoutes: []
};
},
components: {
SubMenu
},
computed: {
sidebarLayoutSkin: {
get() {
return this.$store.state.common.sidebarLayoutSkin;
} }
}, },
components: { sidebarFold: {
SubMenu get() {
}, return this.$store.state.common.sidebarFold;
computed: {
sidebarLayoutSkin: {
get () { return this.$store.state.common.sidebarLayoutSkin }
},
sidebarFold: {
get () { return this.$store.state.common.sidebarFold }
},
menuList: {
get () { return this.$store.state.common.menuList },
set (val) { this.$store.commit('common/updateMenuList', val) }
},
menuActiveName: {
get () { return this.$store.state.common.menuActiveName },
set (val) { this.$store.commit('common/updateMenuActiveName', val) }
},
mainTabs: {
get () { return this.$store.state.common.mainTabs },
set (val) { this.$store.commit('common/updateMainTabs', val) }
},
mainTabsActiveName: {
get () { return this.$store.state.common.mainTabsActiveName },
set (val) { this.$store.commit('common/updateMainTabsActiveName', val) }
} }
}, },
watch: { menuList: {
$route: 'routeHandle' get() {
return this.$store.state.common.menuList;
},
set(val) {
this.$store.commit("common/updateMenuList", val);
}
}, },
created () { menuActiveName: {
this.menuList = JSON.parse(sessionStorage.getItem('menuList') || '[]') get() {
this.dynamicMenuRoutes = JSON.parse(sessionStorage.getItem('dynamicMenuRoutes') || '[]') return this.$store.state.common.menuActiveName;
this.routeHandle(this.$route) },
set(val) {
this.$store.commit("common/updateMenuActiveName", val);
}
}, },
methods: { mainTabs: {
// 路由操作 get() {
routeHandle (route) { return this.$store.state.common.mainTabs;
if (route.meta.isTab) { },
// tab选中, 不存在先添加 set(val) {
var tab = this.mainTabs.filter(item => item.name === route.name)[0] this.$store.commit("common/updateMainTabs", val);
if (!tab) { }
if (route.meta.isDynamic) { },
route = this.dynamicMenuRoutes.filter(item => item.name === route.name)[0] mainTabsActiveName: {
if (!route) { get() {
return console.error('未能找到可用标签页!') return this.$store.state.common.mainTabsActiveName;
} },
set(val) {
this.$store.commit("common/updateMainTabsActiveName", val);
}
}
},
watch: {
$route: "routeHandle"
},
created() {
this.menuList = JSON.parse(sessionStorage.getItem("menuList") || "[]");
this.dynamicMenuRoutes = JSON.parse(
sessionStorage.getItem("dynamicMenuRoutes") || "[]"
);
this.routeHandle(this.$route);
},
methods: {
// 路由操作
routeHandle(route) {
console.log("route at line 12384:", route);
if (route.meta.isTab) {
// tab选中, 不存在先添加
var tab = this.mainTabs.filter(item => item.name === route.name)[0];
var tabIndex = this.mainTabs.findIndex(item => item.name === route.name);
console.log('tabIndex at line 113:', tabIndex)
if (!tab) {
if (route.meta.isDynamic) {
route = this.dynamicMenuRoutes.filter(
item => item.name === route.name
)[0];
if (!route) {
return console.error("未能找到可用标签页!");
} }
tab = {
menuId: route.meta.menuId || route.name,
name: route.name,
title: route.meta.title,
type: isURL(route.meta.iframeUrl) ? 'iframe' : 'module',
iframeUrl: route.meta.iframeUrl || '',
params: route.params,
query: route.query
}
this.mainTabs = this.mainTabs.concat(tab)
} }
this.menuActiveName = tab.menuId + '' tab = {
this.mainTabsActiveName = tab.name menuId: route.meta.menuId || route.name,
name: route.name,
title: route.meta.title,
type: isURL(route.meta.iframeUrl) ? "iframe" : "module",
iframeUrl: route.meta.iframeUrl || "",
params: route.params,
query: route.query
};
this.mainTabs = this.mainTabs.concat(tab);
} else {
// this.mainTabs = this.mainTabs.concat({
// ...tab,
// params: route.params,
// query: route.query
// });
this.mainTabs[tabIndex].query=route.query
this.mainTabs[tabIndex].params=route.query
console.log("at line 107:", "存在先添加",tab);
} }
this.menuActiveName = tab.menuId + "";
this.mainTabsActiveName = tab.name;
} }
} }
} }
};
</script> </script>

View File

@@ -1,280 +1,312 @@
<template> <template>
<div v-loading.fullscreen.lock="getCouponInfoLoad"> <div v-loading.fullscreen.lock="getCouponInfoLoad">
<el-dialog <el-dialog
:title="!dataForm.id ? '新增' : '修改'" :title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false" :close-on-click-modal="false"
:visible.sync="visible" :visible.sync="visible"
width="900px" width="900px"
@close="closeDia" @close="closeDia"
>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="100px"
> >
<el-row :gutter="10"> <el-form
<el-col :span="8"> :model="dataForm"
<el-form-item label="优惠卷类型" prop="couponType"> :rules="dataRule"
<!-- <el-input v-model="dataForm.type" placeholder="优惠卷类型"></el-input> --> ref="dataForm"
<el-select v-model="dataForm.couponType" placeholder="请选择"> @keyup.enter.native="dataFormSubmit()"
<el-option label-width="100px"
v-for="item in options" >
:key="item.value" <el-row :gutter="10">
:label="item.label" <el-col :span="8">
:value="item.value" <el-form-item label="优惠卷类型" prop="couponType">
<!-- <el-input v-model="dataForm.type" placeholder="优惠卷类型"></el-input> -->
<el-select
v-model="dataForm.couponType"
placeholder="请选择"
:disabled="!isEdit"
> >
</el-option> <el-option
</el-select> v-for="item in options"
</el-form-item> :key="item.value"
</el-col> :label="item.label"
<el-col :span="8" :value="item.value"
><el-form-item label="使用门槛" prop="useLevel"> >
<el-input </el-option>
v-model="dataForm.useLevel" </el-select>
placeholder="" </el-form-item>
oninput="value=value.replace(/[^\d.]/g,'')" </el-col>
> <el-col :span="8"
<template slot="append"></template> ><el-form-item label="使用门槛" prop="useLevel">
</el-input> <el-input
</el-form-item> :disabled="!isEdit"
</el-col> v-model="dataForm.useLevel"
<el-col :span="8"> placeholder=""
<el-form-item label="面额:" prop="couponAmount"> oninput="value=value.replace(/[^\d.]/g,'')"
<el-input
v-model="dataForm.couponAmount"
placeholder="面额"
oninput="value=value.replace(/[^\d.]/g,'')"
>
<template slot="append"></template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="8">
<el-form-item label="优惠券名称" prop="couponName">
<el-input
v-model="dataForm.couponName"
placeholder="名称"
></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="总发行量" prop="totalCirculation">
<el-input
v-model="dataForm.totalCirculation"
placeholder="发行数量"
oninput="value=value.replace(/[^\d.]/g,'')"
>
<template slot="append"></template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="每人限领:" prop="limitedCollar">
<el-input
v-model="dataForm.limitedCollar"
oninput="value=value.replace(/[^\d.]/g,'')"
placeholder=""
>
<template slot="append"></template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row ::gutter="10"> </el-row>
<el-row ::gutter="10">
<el-col :span="8">
<el-form-item label="优惠卷范围" prop="couponRange">
<!-- <el-input v-model="dataForm.type" placeholder="优惠卷类型"></el-input> -->
<el-select
v-model="dataForm.couponRange"
placeholder="请选择"
@change="changeRange"
>
<el-option
v-for="item in rangList"
:key="item.value"
:label="item.label"
:value="item.value"
> >
</el-option> <template slot="append"></template>
</el-select> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="16" v-if="dataForm.couponRange == 2"> <el-col :span="8">
<el-form-item label="绑定类目" prop="rangeInfo" width="100%"> <el-form-item label="面额:" prop="couponAmount">
<!-- <el-input v-model="dataForm.type" placeholder="优惠卷类型"></el-input> --> <el-input
<!-- {{cateSelectLinkList}} --> :disabled="!isEdit"
<el-select v-model="dataForm.couponAmount"
v-model="cateSelectLinkList" placeholder="面额"
multiple oninput="value=value.replace(/[^\d.]/g,'')"
placeholder="请选择课程类目"
@change="changeCate"
>
<el-option
v-for="item in courseCateList"
:key="item.id"
:label="item.title"
:value="item.id"
> >
</el-option> <template slot="append"></template>
</el-select> </el-input>
<span v-if="showCateError" style="color:red; font-size:12px">请选择绑定类目</span> </el-form-item>
</el-form-item> </el-col>
</el-col> </el-row>
<el-col :span="24" v-if="dataForm.couponRange == 1"> <el-row :gutter="10">
<el-form-item label="" prop="rangeInfo" width="100%"> <el-col :span="8">
<div class="flexBox"> <el-form-item label="优惠券名称" prop="couponName">
<el-table v-if="proSelectLinkList.length > 0" :data="proSelectLinkList"> <el-input
<el-table-column label="课程名称"> :disabled="!isEdit"
<template slot-scope="scope"> v-model="dataForm.couponName"
{{ scope.row.title }} placeholder="名称"
</template> ></el-input>
</el-table-column> </el-form-item>
<el-table-column label="封面"> </el-col>
<template slot-scope="scope"> <el-col :span="8">
<div <el-form-item label="总发行量" prop="totalCirculation">
v-if="scope.row.image" <el-input
style="width:100%;display: flex; v-model="dataForm.totalCirculation"
placeholder="发行数量"
oninput="value=value.replace(/[^\d.]/g,'')"
>
<template slot="append"></template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="每人限领:" prop="limitedCollar">
<el-input
v-model="dataForm.limitedCollar"
oninput="value=value.replace(/[^\d.]/g,'')"
placeholder=""
>
<template slot="append"></template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row ::gutter="10"> </el-row>
<el-row ::gutter="10">
<el-col :span="8">
<el-form-item label="优惠卷范围" prop="couponRange">
<!-- <el-input v-model="dataForm.type" placeholder="优惠卷类型"></el-input> -->
<el-select
:disabled="!isEdit"
v-model="dataForm.couponRange"
placeholder="请选择"
@change="changeRange"
>
<el-option
v-for="item in rangList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="16" v-if="dataForm.couponRange == 2">
<el-form-item label="绑定类目" prop="rangeInfo" width="100%">
<!-- <el-input v-model="dataForm.type" placeholder="优惠卷类型"></el-input> -->
<!-- {{cateSelectLinkList}} -->
<el-select
v-model="cateSelectLinkList"
multiple
placeholder="请选择课程类目"
@change="changeCate"
>
<el-option
v-for="item in courseCateList"
:key="item.id"
:label="item.title"
:value="item.id"
>
</el-option>
</el-select>
<span v-if="showCateError" style="color:red; font-size:12px"
>请选择绑定类目</span
>
</el-form-item>
</el-col>
<el-col :span="24" v-if="dataForm.couponRange == 1">
<el-form-item label="" prop="rangeInfo" width="100%">
<div class="flexBox">
<el-table
v-if="proSelectLinkList.length > 0"
:data="proSelectLinkList"
>
<el-table-column label="课程名称">
<template slot-scope="scope">
{{ scope.row.title }}
</template>
</el-table-column>
<el-table-column label="封面">
<template slot-scope="scope">
<div
v-if="scope.row.image"
style="width:100%;display: flex;
align-items: center;justify-content: center;" align-items: center;justify-content: center;"
> >
<img :src="scope.row.image" alt="" width="40px" height="40px" /> <img
</div> :src="scope.row.image"
</template> alt=""
</el-table-column> width="40px"
<el-table-column label="操作" width="100px"> height="40px"
<template slot-scope="scope"> />
<el-button type="danger" @click="delCourse(scope.row.id)" size="mini" </div>
>删除</el-button </template>
> </el-table-column>
</template> <el-table-column label="操作" width="100px">
</el-table-column> <template slot-scope="scope">
</el-table> <el-button
<div type="danger"
style="text-align:center; margin-top: 20px" @click="delCourse(scope.row.id)"
size="mini"
> >删除</el-button
<el-button type="primary" @click="addLinkPro">添加绑定</el-button> >
</template>
</el-table-column>
</el-table>
<div style="text-align:center; margin-top: 20px">
<el-button type="primary" @click="addLinkPro"
>添加绑定</el-button
>
</div>
</div> </div>
</div> </el-form-item>
</el-form-item> </el-col>
</el-col> </el-row>
</el-row> <el-row ::gutter="10">
<el-row ::gutter="10"> <el-col :span="24">
<el-col :span="24"> <el-form-item label="生效方式" prop="effectType">
<el-form-item label="生效方式" prop="effectType"> <el-radio-group v-model="dataForm.effectType" :disabled="!isEdit">
<el-radio-group v-model="dataForm.effectType"> <el-radio :label="0">长期有效</el-radio>
<el-radio :label="0">长期有</el-radio> <el-radio :label="1">领取生</el-radio>
<el-radio :label="1">领取生效</el-radio> <el-radio :label="2">自定义</el-radio>
<el-radio :label="2">自定义</el-radio> </el-radio-group>
</el-radio-group> </el-form-item>
</el-form-item> </el-col>
</el-col> </el-row>
</el-row> <el-row :gutter="10">
<el-row :gutter="10"> <el-col :span="12">
<el-col :span="12"> <el-form-item
<el-form-item label="开始时间"
label="开始时间" prop="effectTime"
prop="effectTime" v-if="dataForm.effectType == '2'"
v-if="dataForm.effectType == '2'"
>
<el-date-picker
v-model="dataForm.effectTime"
@change="datePicked"
type="datetime"
value-format="timestamp"
placeholder="选择日期时间"
default-time="12:00:00"
> >
</el-date-picker> <el-date-picker
</el-form-item> :disabled="!isEdit"
</el-col> v-model="dataForm.effectTime"
<el-col :span="12"> @change="datePicked"
<el-form-item type="datetime"
label="结束时间" value-format="timestamp"
prop="expireTime" placeholder="选择日期时间"
v-if="dataForm.effectType == '2'" default-time="12:00:00"
> >
<el-date-picker </el-date-picker>
v-model="dataForm.expireTime" </el-form-item>
@change="datePicked" </el-col>
type="datetime" <el-col :span="12">
value-format="timestamp" <el-form-item
placeholder="选择日期时间" label="结束时间"
default-time="12:00:00" :disabled="!isEdit"
prop="expireTime"
v-if="dataForm.effectType == '2'"
> >
</el-date-picker> <el-date-picker
</el-form-item> v-model="dataForm.expireTime"
</el-col> @change="datePicked"
<el-col :span="8" v-show="dataForm.effectType == '1'"> type="datetime"
<el-form-item label="时效" prop="validity"> value-format="timestamp"
<el-input placeholder="选择日期时间"
placeholder="" default-time="12:00:00"
v-model="dataForm.validity" >
oninput="value=value.replace(/[^\d.]/g,'')" </el-date-picker>
> </el-form-item>
<template slot="append"></template> </el-col>
</el-input> <el-col :span="8" v-show="dataForm.effectType == '1'">
</el-form-item> <el-form-item label="时效" prop="validity">
</el-col> <el-input
</el-row> :disabled="!isEdit"
<el-row :gutter="10"> placeholder=""
<el-col :span="24"> v-model="dataForm.validity"
<el-form-item label="封面图" prop="couponUrl"> oninput="value=value.replace(/[^\d.]/g,'')"
<el-upload >
:limit="1" <template slot="append"></template>
class="el-uploadfeng" </el-input>
:action="baseUrl + '/oss/fileoss'" </el-form-item>
list-type="picture-card" </el-col>
:on-preview="handlePictureCardPreview" </el-row>
:file-list="fileList" <el-row :gutter="10">
:on-success="handlePicSuccess" <el-col :span="24">
accept=".jpeg,.jpg,.gif,.png" <el-form-item label="封面图" prop="couponUrl">
:on-remove="handleRemove" <el-upload
> :disabled="!isEdit"
<i class="el-icon-plus"></i> :limit="1"
</el-upload> class="el-uploadfeng"
<el-dialog :visible.sync="dialogVisible" :append-to-body="true"> :action="baseUrl + '/oss/fileoss'"
<img width="100%" :src="dataForm.couponUrl" alt="" /> list-type="picture-card"
</el-dialog> :on-preview="handlePictureCardPreview"
</el-form-item> :file-list="fileList"
</el-col> :on-success="handlePicSuccess"
<el-col :span="8"> accept=".jpeg,.jpg,.gif,.png"
<el-form-item label="备注" prop="remark"> :on-remove="handleRemove"
<el-input >
v-model="dataForm.remark" <i class="el-icon-plus"></i>
placeholder="备注" </el-upload>
type="textarea" <el-dialog :visible.sync="dialogVisible" :append-to-body="true">
:rows="3" <img width="100%" :src="dataForm.couponUrl" alt="" />
autosize </el-dialog>
> </el-form-item>
</el-input> </el-col>
</el-form-item> <el-col :span="8">
</el-col> <el-form-item label="备注" prop="remark">
</el-row> <el-input
</el-form> v-model="dataForm.remark"
<span slot="footer" class="dialog-footer"> :disabled="!isEdit"
<el-button @click="closeDia">取消</el-button> placeholder="备注"
<el-button type="primary" @click="dataFormSubmit()">确定</el-button> type="textarea"
</span> :rows="3"
</el-dialog> autosize
<selectPro ref="selectPro" v-if="showSelectPro" @close="selectProClose" :requesturl = "requesturl" :oldData="proSelectLinkList"></selectPro> >
</div> </el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="closeDia">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
<selectPro
ref="selectPro"
v-if="showSelectPro"
@close="selectProClose"
:requesturl="requesturl"
:oldData="proSelectLinkList"
></selectPro>
</div>
</template> </template>
<script> <script>
import selectPro from '../../../components/selectPro.vue' import selectPro from "../../../components/selectPro.vue";
import global from "../../common/common.vue"; //引入共用组间 import global from "../../common/common.vue"; //引入共用组间
export default { export default {
baseUrl: global.baseUrl, baseUrl: global.baseUrl,
data() { data() {
return { return {
isEdit: true,
showCateError: false, showCateError: false,
requesturl:'', // 课程的请求地址 requesturl: "", // 课程的请求地址
showSelectPro:false, showSelectPro: false,
baseUrl: global.baseUrl, baseUrl: global.baseUrl,
visible: true, visible: true,
options2: [ options2: [
@@ -380,33 +412,35 @@ export default {
} }
}; };
}, },
async created(){ async created() {
// if (e == 2) { // if (e == 2) {
this.courseCateList = await this.getCourseCateList(); this.courseCateList = await this.getCourseCateList();
console.log("this.courseCateList", await this.getCourseCateList()); console.log("this.courseCateList", await this.getCourseCateList());
// } // }
}, },
methods: { methods: {
selectProClose(data){ selectProClose(data) {
console.log('data', data) console.log("data", data);
this.showSelectPro = false this.showSelectPro = false;
this.requesturl = '' this.requesturl = "";
if(data.length > 0){ if (data.length > 0) {
this.proSelectLinkList = this.proSelectLinkList.concat(data) this.proSelectLinkList = this.proSelectLinkList.concat(data);
var list = [...this.proSelectLinkList] var list = [...this.proSelectLinkList];
this.proSelectLinkList = [...new Map(list.map(item => [item.id, item])).values()]; this.proSelectLinkList = [
...new Map(list.map(item => [item.id, item])).values()
];
// this.dataForm.rangeInfo = this.proSelectLinkList.map( item => item.id).join(',') // this.dataForm.rangeInfo = this.proSelectLinkList.map( item => item.id).join(',')
console.log('去重后', this.proSelectLinkList) console.log("去重后", this.proSelectLinkList);
} }
}, },
addLinkPro(){ addLinkPro() {
this.showSelectPro = true this.showSelectPro = true;
this.requesturl = '/common/coupon/getCourseList' this.requesturl = "/common/coupon/getCourseList";
}, },
changeCate(e) { changeCate(e) {
console.log("e", e); console.log("e", e);
this.cateSelectLinkList = e; this.cateSelectLinkList = e;
this.showCateError = false this.showCateError = false;
// this.dataForm.rangeInfo = e.join(","); // this.dataForm.rangeInfo = e.join(",");
}, },
async changeRange(e) { async changeRange(e) {
@@ -437,13 +471,14 @@ export default {
return list; return list;
}, },
init(id) { init(id) {
if(!id){ if (!id) {
console.log('没有传值') console.log("没有传值");
this.visible = true; this.visible = true;
return this.isEdit = true;
return;
} }
this.dataForm.id = id || 0; this.dataForm.id = id || 0;
this.getCouponInfoLoad = true; this.getCouponInfoLoad = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs["dataForm"].resetFields(); this.$refs["dataForm"].resetFields();
if (this.dataForm.id) { if (this.dataForm.id) {
@@ -451,73 +486,89 @@ export default {
url: this.$http.adornUrl(`/common/coupon/getCouponInfo`), url: this.$http.adornUrl(`/common/coupon/getCouponInfo`),
method: "post", method: "post",
data: this.$http.adornData({ id: this.dataForm.id }) data: this.$http.adornData({ id: this.dataForm.id })
}).then(({ data }) => {
if (data.code !== 0) return this.$message.error(data.msg);
this.visible = true;
this.getCouponInfoLoad = false;
if (data && data.code == 0) {
this.dataForm = data.couponEntity;
if (
this.dataForm.effectTime &&
this.dataForm.effectTime != null
) {
this.dataForm.effectTime = new Date(
data.couponEntity.effectTime
).getTime();
console.log("this.dataForm.effectTime", this.dataForm.effectTime );
} else {
this.dataForm.effectTime = null;
}
if (
this.dataForm.expireTime &&
this.dataForm.expireTime != null
) {
this.dataForm.expireTime = new Date(
data.couponEntity.expireTime
).getTime();
console.log(
"this.dataForm.expireTime",
this.dataForm.expireTime
);
} else {
this.dataForm.expireTime = null;
}
if(data.couponEntity.rangeList && data.couponEntity.rangeList.length > 0){
this.selectLinkList = data.couponEntity.rangeList
}else{
this.selectLinkList = []
}
if(this.dataForm.couponRange == 2 && this.dataForm.rangeInfo.length > 0 ){
// var list1 = [...this.selectLinkList]
// list1.forEach( item => {
// item.label = item.name
// })
// this.cateSelectLinkList = this.selectLinkList
var ss = this.dataForm.rangeInfo.split(',')
this.cateSelectLinkList = ss.map(element => parseInt(element) );
}else if(this.dataForm.couponRange == 1){
this.proSelectLinkList = this.selectLinkList
}else{
this.cateSelectLinkList = []
this.proSelectLinkList = []
}
// this.dataForm.couponUrl = {name:'', url:}
if (this.dataForm.couponUrl && this.dataForm.couponUrl != "") {
var img = { name: "", url: this.dataForm.couponUrl };
var attr = [];
attr.push(img);
this.fileList = attr;
}else{
this.fileList = []
}
}
}).catch(err => {
this.$message.error(err.msg);
this.getCouponInfoLoad = false;
}) })
.then(({ data }) => {
if (data.code !== 0) return this.$message.error(data.msg);
this.visible = true;
this.getCouponInfoLoad = false;
if (data && data.code == 0) {
this.dataForm = data.couponEntity;
if (this.dataForm.grantCount > 0) {
this.isEdit = false;
}
if (
this.dataForm.effectTime &&
this.dataForm.effectTime != null
) {
this.dataForm.effectTime = new Date(
data.couponEntity.effectTime
).getTime();
console.log(
"this.dataForm.effectTime",
this.dataForm.effectTime
);
} else {
this.dataForm.effectTime = null;
}
if (
this.dataForm.expireTime &&
this.dataForm.expireTime != null
) {
this.dataForm.expireTime = new Date(
data.couponEntity.expireTime
).getTime();
console.log(
"this.dataForm.expireTime",
this.dataForm.expireTime
);
} else {
this.dataForm.expireTime = null;
}
if (
data.couponEntity.rangeList &&
data.couponEntity.rangeList.length > 0
) {
this.selectLinkList = data.couponEntity.rangeList;
} else {
this.selectLinkList = [];
}
if (
this.dataForm.couponRange == 2 &&
this.dataForm.rangeInfo.length > 0
) {
// var list1 = [...this.selectLinkList]
// list1.forEach( item => {
// item.label = item.name
// })
// this.cateSelectLinkList = this.selectLinkList
var ss = this.dataForm.rangeInfo.split(",");
this.cateSelectLinkList = ss.map(element =>
parseInt(element)
);
} else if (this.dataForm.couponRange == 1) {
this.proSelectLinkList = this.selectLinkList;
} else {
this.cateSelectLinkList = [];
this.proSelectLinkList = [];
}
// this.dataForm.couponUrl = {name:'', url:}
if (this.dataForm.couponUrl && this.dataForm.couponUrl != "") {
var img = { name: "", url: this.dataForm.couponUrl };
var attr = [];
attr.push(img);
this.fileList = attr;
} else {
this.fileList = [];
}
}
})
.catch(err => {
this.$message.error(err.msg);
this.getCouponInfoLoad = false;
});
} }
}); });
}, },
@@ -540,9 +591,9 @@ export default {
console.log(this.dataForm.startTime); console.log(this.dataForm.startTime);
}, },
delCourse(id) { delCourse(id) {
console.log('id',id) console.log("id", id);
let index = this.proSelectLinkList.findIndex(item => item.id === id); let index = this.proSelectLinkList.findIndex(item => item.id === id);
this.proSelectLinkList.splice(index,1) this.proSelectLinkList.splice(index, 1);
}, },
closeDia() { closeDia() {
this.visible = false; this.visible = false;
@@ -565,18 +616,23 @@ export default {
couponRange: "", //优惠卷范围 0无限制 1课程卷 2课程品类卷 couponRange: "", //优惠卷范围 0无限制 1课程卷 2课程品类卷
rangeInfo: "" //范围详情(课程卷是课程id,分割 课程品类卷是课程分类根id,分割) rangeInfo: "" //范围详情(课程卷是课程id,分割 课程品类卷是课程分类根id,分割)
}; };
this.proSelectLinkList = [] this.proSelectLinkList = [];
this.cateSelectLinkList = [] this.cateSelectLinkList = [];
this.selectLinkList = [] this.selectLinkList = [];
this.fileList = [] this.fileList = [];
}, },
// 表单提交 // 表单提交
dataFormSubmit() { dataFormSubmit() {
this.$refs["dataForm"].validate(valid => { this.$refs["dataForm"].validate(valid => {
if (valid) { if (valid) {
if(!this.dataForm.id && this.dataForm.effectType == 2 && this.dataForm.effectTime < new Date().getTime()) return this.$message.error("生效时间不能小于当前时间") if (
if (this.dataForm.effectType == 2 ) { !this.dataForm.id &&
this.dataForm.effectType == 2 &&
this.dataForm.effectTime < new Date().getTime()
)
return this.$message.error("生效时间不能小于当前时间");
if (this.dataForm.effectType == 2) {
if ( if (
this.dataForm.effectTime == null || this.dataForm.effectTime == null ||
this.dataForm.effectTime == "" this.dataForm.effectTime == ""
@@ -595,7 +651,6 @@ export default {
this.$message.error("生效时间不能大于截止时间"); this.$message.error("生效时间不能大于截止时间");
return false; return false;
} }
} }
if (this.dataForm.effectType == 1) { if (this.dataForm.effectType == 1) {
if ( if (
@@ -609,8 +664,11 @@ export default {
} }
if (this.dataForm.couponRange == 2) { if (this.dataForm.couponRange == 2) {
if(this.cateSelectLinkList.length == 0) {this.showCateError = true; return this.$message.error("请选择课程品类");} if (this.cateSelectLinkList.length == 0) {
this.dataForm.rangeInfo = this.cateSelectLinkList.join(',') this.showCateError = true;
return this.$message.error("请选择课程品类");
}
this.dataForm.rangeInfo = this.cateSelectLinkList.join(",");
// if ( // if (
// this.dataForm.rangeInfo == null || // this.dataForm.rangeInfo == null ||
// this.dataForm.rangeInfo == "" // this.dataForm.rangeInfo == ""
@@ -618,11 +676,13 @@ export default {
// this.$message.error("请选择课程品类"); // this.$message.error("请选择课程品类");
// return false; // return false;
// } // }
} }
if (this.dataForm.couponRange == 1) { if (this.dataForm.couponRange == 1) {
if(this.proSelectLinkList.length == 0) return this.$message.error("请选择课程"); if (this.proSelectLinkList.length == 0)
this.dataForm.rangeInfo = this.proSelectLinkList.map( item => item.id).join(',') return this.$message.error("请选择课程");
this.dataForm.rangeInfo = this.proSelectLinkList
.map(item => item.id)
.join(",");
// if ( // if (
// this.dataForm.rangeInfo == null || // this.dataForm.rangeInfo == null ||
// this.dataForm.rangeInfo == "" // this.dataForm.rangeInfo == ""
@@ -631,8 +691,11 @@ export default {
// return false; // return false;
// } // }
} }
if(this.dataForm.useLevel < this.dataForm.couponAmount) return this.$message.error("优惠券面额不能大于使用门槛"); if (Number(this.dataForm.useLevel) <= Number(this.dataForm.couponAmount)) {
console.log('this.dataForm', this.dataForm) this.$message.error("优惠券面额不能大于使用门槛");
return false;
}
console.log("this.dataForm", this.dataForm);
this.$http({ this.$http({
url: this.$http.adornUrl( url: this.$http.adornUrl(

View File

@@ -1,16 +1,35 @@
<template> <template>
<div class="mod-config"> <div class="mod-config">
<el-radio-group v-model="currentState" style="margin-bottom: 15px;" @tab-click="handleClick"> <el-radio-group
<el-radio-button label="">全部</el-radio-button> v-model="currentState"
<el-radio-button label="0">生效中</el-radio-button> style="margin-bottom: 15px;"
<el-radio-button label="1">已过期</el-radio-button> @tab-click="handleClick"
</el-radio-group> >
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> <el-radio-button label="">全部</el-radio-button>
<el-radio-button label="0">生效中</el-radio-button>
<el-radio-button label="1">已过期</el-radio-button>
</el-radio-group>
<el-form
:inline="true"
:model="dataForm"
@keyup.enter.native="getDataList()"
>
<el-form-item> <el-form-item>
<el-input v-model="dataForm.couponName" placeholder="参数名" clearable></el-input> <el-input
v-model="dataForm.couponName"
placeholder="参数名"
clearable
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="优惠券范围"> <el-form-item label="优惠券范围">
<el-select v-model="dataForm.couponRange" placeholder="请选择" @change="pageIndex = 1; getDataList()"> <el-select
v-model="dataForm.couponRange"
placeholder="请选择"
@change="
pageIndex = 1;
getDataList();
"
>
<el-option <el-option
v-for="item in rangList" v-for="item in rangList"
:key="item.value" :key="item.value"
@@ -21,7 +40,14 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="优惠券类型"> <el-form-item label="优惠券类型">
<el-select v-model="dataForm.TypeList" placeholder="请选择" @change="pageIndex = 1; getDataList()"> <el-select
v-model="dataForm.TypeList"
placeholder="请选择"
@change="
pageIndex = 1;
getDataList();
"
>
<el-option <el-option
v-for="item in TypeList" v-for="item in TypeList"
:key="item.value" :key="item.value"
@@ -33,7 +59,12 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="getDataList()">查询</el-button> <el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('book:coupon:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button> <el-button
v-if="isAuth('book:coupon:save')"
type="primary"
@click="addOrUpdateHandle()"
>新增</el-button
>
<!-- <el-button v-if="isAuth('book:coupon:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button> --> <!-- <el-button v-if="isAuth('book:coupon:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button> -->
</el-form-item> </el-form-item>
</el-form> </el-form>
@@ -42,7 +73,8 @@
border border
v-loading="dataListLoading" v-loading="dataListLoading"
@selection-change="selectionChangeHandle" @selection-change="selectionChangeHandle"
style="width: 100%;"> style="width: 100%;"
>
<!-- <el-table-column <!-- <el-table-column
type="selection" type="selection"
header-align="center" header-align="center"
@@ -53,55 +85,80 @@
prop="id" prop="id"
header-align="center" header-align="center"
align="center" align="center"
label="序号" width="50"> label="序号"
width="50"
>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="couponName" prop="couponName"
header-align="center" header-align="center"
align="center" align="center"
label="优惠券名称"> label="优惠券名称"
>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
header-align="center" header-align="center"
align="center" align="center"
label="优惠券类型" width="100px"> label="优惠券类型"
<template slot-scope="scope"> width="100px"
{{scope.row.effectType | getType}} >
</template> <template slot-scope="scope">
{{ scope.row.effectType | getType }}
</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="couponAmount" prop="couponAmount"
header-align="center" header-align="center"
align="center" align="center"
label="面值" width="90px"> label="面值"
width="90px"
>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="expirationDate" prop="expirationDate"
header-align="center" header-align="center"
align="center" align="center"
label="时间"> label="时间"
>
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.createTime">创建时间{{scope.row.createTime}}</span> <span v-if="scope.row.createTime"
<span v-if="scope.row.effectTime"><br/>生效时间{{scope.row.effectTime}}</span> >创建时间{{ scope.row.createTime }}</span
<span v-if="scope.row.expireTime"><br/>结束时间{{scope.row.expireTime}}</span> >
<span v-if="scope.row.effectTime"
><br />生效时间{{ scope.row.effectTime }}</span
>
<span v-if="scope.row.expireTime"
><br />结束时间{{ scope.row.expireTime }}</span
>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="couponRange" prop="couponRange"
header-align="center" header-align="center"
align="center" align="center"
label="优惠券范围"> label="优惠券范围"
>
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.couponRange | getRange}} {{ scope.row.couponRange | getRange }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="totalCirculation" prop="totalCirculation"
header-align="center" header-align="center"
align="center" align="center"
label="发行数量" width="90px"> label="发行数量"
width="90px"
>
</el-table-column><el-table-column
prop="grantCount"
header-align="center"
align="center"
label="已领取数量"
>
<template slot-scope="scope">
{{ scope.row.grantCount }}
</template>
</el-table-column> </el-table-column>
<!-- <el-table-column <!-- <el-table-column
prop="useCount" prop="useCount"
@@ -119,15 +176,17 @@
prop="receiveCount" prop="receiveCount"
header-align="center" header-align="center"
align="center" align="center"
label="操作"> label="操作"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
v-model="scope.row.currentState" v-model="scope.row.currentState"
:active-value ="0" :active-value="0"
:inactive-value='1' :inactive-value="1"
@change="changeStateHandle(scope.row.id, scope.row.currentState)" @change="changeStateHandle(scope.row.id, scope.row.currentState)"
active-text="发放中" active-text="发放中"
inactive-text="暂停发放"> inactive-text="暂停发放"
>
</el-switch> </el-switch>
</template> </template>
</el-table-column> </el-table-column>
@@ -136,10 +195,23 @@
header-align="center" header-align="center"
align="center" align="center"
width="150" width="150"
label="操作"> label="操作"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="primary" size="small" plain @click="addOrUpdateHandle(scope.row.id)">修改</el-button> <el-button
<el-button type="danger" size="small" plain @click="deleteHandle(scope.row.id)">删除</el-button> type="primary"
size="small"
plain
@click="addOrUpdateHandle(scope.row.id)"
>修改</el-button
>
<el-button
type="danger"
size="small"
plain
@click="deleteHandle(scope.row.id)"
>删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -150,194 +222,202 @@
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:page-size="pageSize" :page-size="pageSize"
:total="totalPage" :total="totalPage"
layout="total, sizes, prev, pager, next, jumper"> layout="total, sizes, prev, pager, next, jumper"
>
</el-pagination> </el-pagination>
<!-- 弹窗, 新增 / 修改 --> <!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> <add-or-update
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getDataList"
></add-or-update>
</div> </div>
</template> </template>
<script> <script>
import global from "@/views/common/common.vue"; //引入共用组间 import global from "@/views/common/common.vue"; //引入共用组间
import AddOrUpdate from './coupon-add-or-update' import AddOrUpdate from "./coupon-add-or-update";
import commentsListVue from '../book/commentsList.vue' import commentsListVue from "../book/commentsList.vue";
export default { export default {
data () { data() {
return { return {
dataForm: { dataForm: {
couponName: '', couponName: "",
couponRange: '', couponRange: "",
couponType:'' couponType: ""
},
currentState:'', // "currentState":""//当前状态 0 发放中 1结束
dataList: [],
rangList: global.rangList,
TypeList: global.TypeList,
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
courseCateList:[]
}
},
filters: {
// 格式化时间
getType (value) {
switch (value) {
case 0:
return '长期有效'
case 1:
return '领取生效'
case 2:
return '自定义'
}
}, },
getRange (value) { currentState: "", // "currentState":""//当前状态 0 发放中 1结束
switch (value) { dataList: [],
case 0: rangList: global.rangList,
TypeList: global.TypeList,
return '无限制' pageIndex: 1,
case 1: pageSize: 10,
return '课程券' totalPage: 0,
case 2: dataListLoading: false,
return '课程品类券' dataListSelections: [],
} addOrUpdateVisible: false,
courseCateList: []
};
},
filters: {
// 格式化时间
getType(value) {
switch (value) {
case 0:
return "长期有效";
case 1:
return "领取生效";
case 2:
return "自定义";
} }
}, },
components: { getRange(value) {
AddOrUpdate switch (value) {
}, case 0:
activated () { return "无限制";
this.getDataList() case 1:
}, return "课程券";
methods: { case 2:
// 修改优惠券状态 return "课程品类券";
changeStateHandle (id, state) { }
console.log('进来了') }
this.$http({ },
url: this.$http.adornUrl('/common/coupon/updateCouponState'), components: {
method: 'post', AddOrUpdate
data: this.$http.adornData({ },
id: id, activated() {
currentState: state this.getDataList();
}) },
}).then(({data}) => { methods: {
// 修改优惠券状态
changeStateHandle(id, state) {
console.log("进来了");
this.$http({
url: this.$http.adornUrl("/common/coupon/updateCouponState"),
method: "post",
data: this.$http.adornData({
id: id,
currentState: state
})
})
.then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.$message({ this.$message({
message: '操作成功', message: "操作成功",
type:'success', type: "success",
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
this.getDataList() this.getDataList();
} }
}) });
} else { } else {
this.$message.error(data.msg) this.$message.error(data.msg);
} }
}).catch((e) => {
this.$message.error(e.msg)
}) })
}, .catch(e => {
handleClick(){ this.$message.error(e.msg);
console.log(this.currentState) });
this.pageIndex = 1 },
this.getDataList() handleClick() {
console.log(this.currentState);
}, this.pageIndex = 1;
// 获取数据列表 this.getDataList();
getDataList () { },
this.dataListLoading = true // 获取数据列表
this.$http({ getDataList() {
url: this.$http.adornUrl('/common/coupon/getCouponList'), this.dataListLoading = true;
method: 'post', this.$http({
data: this.$http.adornData({ url: this.$http.adornUrl("/common/coupon/getCouponList"),
'page': this.pageIndex, method: "post",
'limit': this.pageSize, data: this.$http.adornData({
'couponName': this.dataForm.couponName, page: this.pageIndex,
'currentState': this.currentState, //当前状态 0 发放中 1结束 limit: this.pageSize,
"couponType": this.dataForm.couponType,//优惠券类型 0现金 1折扣 couponName: this.dataForm.couponName,
"couponRange":this.dataForm.couponRange,//优惠卷范围 0无限制 1课程卷 2课程品类卷 currentState: this.currentState, //当前状态 0 发放中 1结束
}) couponType: this.dataForm.couponType, //优惠券类型 0现金 1折扣
}).then(({data}) => { couponRange: this.dataForm.couponRange //优惠卷范围 0无限制 1课程卷 2课程品类卷
if(data.code !==0) return this.$message.error(data.msg) })
})
.then(({ data }) => {
if (data.code !== 0) return this.$message.error(data.msg);
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.couponPage.records this.dataList = data.couponPage.records;
this.totalPage = data.couponPage.total this.totalPage = data.couponPage.total;
} else { } else {
this.dataList = [] this.dataList = [];
this.totalPage = 0 this.totalPage = 0;
} }
this.dataListLoading = false this.dataListLoading = false;
}).catch((e) => {
this.$message.error(e.msg)
this.dataListLoading = false
}) })
}, .catch(e => {
// 每页数 this.$message.error(e.msg);
sizeChangeHandle (val) { this.dataListLoading = false;
this.pageSize = val });
this.pageIndex = 1 },
this.getDataList() // 每页数
}, sizeChangeHandle(val) {
// 当前页 this.pageSize = val;
currentChangeHandle (val) { this.pageIndex = 1;
this.pageIndex = val this.getDataList();
this.getDataList() },
}, // 当前页
// 多选 currentChangeHandle(val) {
selectionChangeHandle (val) { this.pageIndex = val;
this.dataListSelections = val this.getDataList();
}, },
// 新增 / 修改 // 多选
addOrUpdateHandle (id) { selectionChangeHandle(val) {
this.addOrUpdateVisible = true this.dataListSelections = val;
this.$nextTick(() => { },
this.$refs.addOrUpdate.init(id) // 新增 / 修改
// this.addOrUpdateVisible = true addOrUpdateHandle(id) {
}) this.addOrUpdateVisible = true;
}, this.$nextTick(() => {
// 删除 this.$refs.addOrUpdate.init(id);
deleteHandle (id) { // this.addOrUpdateVisible = true
// var ids = id ? [id] : this.dataListSelections.map(item => { });
// return item.id },
// }) // 删除
this.$confirm(`确定对[id=${id}]进行删除操作?`, '提示', { deleteHandle(id) {
confirmButtonText: '确定', // var ids = id ? [id] : this.dataListSelections.map(item => {
cancelButtonText: '取消', // return item.id
type: 'warning' // })
}).then(() => { this.$confirm(`确定对[id=${id}]进行删除操作?`, "提示", {
this.$http({ confirmButtonText: "确定",
url: this.$http.adornUrl('/common/coupon/delCoupon'), cancelButtonText: "取消",
method: 'post', type: "warning"
data: this.$http.adornData({ }).then(() => {
id: id this.$http({
}) url: this.$http.adornUrl("/common/coupon/delCoupon"),
}).then(({data}) => { method: "post",
if (data && data.code === 0) { data: this.$http.adornData({
this.$message({ id: id
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
}) })
}) }).then(({ data }) => {
} if (data && data.code === 0) {
},watch:{ this.$message({
currentState: { message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
}
});
} else {
this.$message.error(data.msg);
}
});
});
}
},
watch: {
currentState: {
handler(val, oldVal) { handler(val, oldVal) {
this.getDataList() this.getDataList();
}, },
deep: true deep: true
},
} }
} }
};
</script> </script>

View File

@@ -0,0 +1,49 @@
<template>
<div class="mod-config">
<div
style="padding:0 20px;box-sizing: border-box;height:calc(100% - 100px);"
>
<common-commont
ref="commonCommont"
></common-commont>
</div>
</div>
</template>
<script>
import commonCommont from "@/views/components/courseList/commont.vue";
export default {
data() {
return {
aaa:111,
};
},
components: {
commonCommont
},
activated() {
this.$nextTick(() => {
this.$refs.commonCommont.init();
});
},
created(){
this.$nextTick(() => {
this.$refs.commonCommont.init();
});
},
methods: {
}
};
</script>
<style lang="less" scoped>
.mod-config{
height: 80vh;
}
</style>

View File

@@ -24,7 +24,13 @@
<el-form-item label="排序" prop="sort"> <el-form-item label="排序" prop="sort">
<el-input v-model="dataForm.sort" placeholder="排序"></el-input> <el-input v-model="dataForm.sort" placeholder="排序"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="自考开关" prop="canzk">
<el-switch
v-model="dataForm.canzk"
active-text="开启"
inactive-text="关闭">
</el-switch>
</el-form-item>
<el-form-item <el-form-item
label="课程图" label="课程图"
prop="image" prop="image"
@@ -243,7 +249,8 @@ export default {
id: 0, id: 0,
title: "", title: "",
etitle:'', etitle:'',
titleAbbr:'' titleAbbr:'',
canzk: false, // 是否开启自考
// publisherName: '', // publisherName: '',
// splits: 0, // splits: 0,
// authorId: [], // authorId: [],
@@ -421,6 +428,7 @@ export default {
attr.push(img); attr.push(img);
this.fileList = attr; this.fileList = attr;
} }
data.canzk = data.canzk == '1' ? true : false
this.dataForm = { ...data }; this.dataForm = { ...data };
} }
}); });
@@ -462,6 +470,7 @@ export default {
data: this.$http.adornData({ data: this.$http.adornData({
id: this.dataForm.id || undefined, id: this.dataForm.id || undefined,
title: this.dataForm.title, title: this.dataForm.title,
canzk: this.dataForm.canzk ? '1' : '0', // 是否可以自考 0/ 1 0 否 1 是
sort: this.dataForm.sort, sort: this.dataForm.sort,
image: this.dataForm.image, image: this.dataForm.image,
content: this.dataForm.content, content: this.dataForm.content,
@@ -479,6 +488,8 @@ export default {
this.visible = false; this.visible = false;
this.relationProductIds = [] this.relationProductIds = []
this.relationProducts = [] this.relationProducts = []
this.dataForm.canzk = false
this.$emit("refreshDataList"); this.$emit("refreshDataList");
} }
}); });

View File

@@ -169,35 +169,44 @@
fixed="right" fixed="right"
header-align="center" header-align="center"
align="center" align="center"
width="300" width="280"
label="操作" label="操作"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<div> <div>
<el-button
type="text"
size="small"
@click="addOrUpdateHandle(scope.row)"
>修改</el-button
>
<router-link <router-link
:to="{ :to="{
path: 'course-courseCatalogue', path: 'course-courseCatalogue',
query: { id: scope.row.id, pageIndex } query: { id: scope.row.id, pageIndex }
}" }"
> >
<el-button type="text" size="small">目录管理</el-button> <el-button type="text" size="small">目录管理</el-button>
</router-link> </router-link>
<el-button
type="text"
size="small"
@click="addOrUpdateHandle(scope.row)"
>修改</el-button
>
<el-button <el-button
type="text" type="text"
size="small" size="small"
@click="handleQuestionBank(scope.row)" @click="handleQuestionBank(scope.row)"
>题库管理</el-button >题库管理</el-button
> >
<!-- <el-button
type="text"
size="small"
@click="showLinkComment(scope.row)"
>评论管理<i class="el-icon-s-comment"></i
></el-button> -->
<el-button type="text" size="small" @click="showLinkTags(scope.row)" <el-button type="text" size="small" @click="showLinkTags(scope.row)"
>查看引用</el-button >查看引用</el-button
> >
<el-button <el-button
style="color: red;"
type="text" type="text"
size="small" size="small"
@click="deleteHandle(scope.row.id)" @click="deleteHandle(scope.row.id)"
@@ -298,6 +307,25 @@
<el-button type="primary" @click="closeLink"> </el-button> <el-button type="primary" @click="closeLink"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-drawer
title="课程评论一览"
:visible.sync="commontListVisible"
size="60%"
@close="closeCommontLink"
>
<div
style="padding:0 20px;box-sizing: border-box;height:calc(100% - 120px);"
>
<common-commont
ref="commonCommont"
:courseId="courseId"
v-if="commontListVisible"
></common-commont>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="closeLink"> </el-button>
</span>
</el-drawer>
<!-- 教务主任设置 --> <!-- 教务主任设置 -->
<el-dialog <el-dialog
title="教务主任管理" title="教务主任管理"
@@ -358,16 +386,17 @@
</span> </span>
</el-dialog> </el-dialog>
<el-drawer title="" size="80%" :visible.sync="showQuestionBank" destroy-on-close> <el-drawer
title=""
size="80%"
:visible.sync="showQuestionBank"
destroy-on-close
>
<div slot="title"> <div slot="title">
<p <p style="margin: 0;font-size: 18px;">
style="margin: 0;font-size: 18px;"
>
<span style="font-weight: bold;">题库管理</span <span style="font-weight: bold;">题库管理</span
><span style="margin-left: 20px;">[ {{ selectCourse.title }} ]</span> ><span style="margin-left: 20px;">[ {{ selectCourse.title }} ]</span>
</p> </p>
</div> </div>
<div style="padding:0 20px;box-sizing: border-box;"> <div style="padding:0 20px;box-sizing: border-box;">
<question-bank <question-bank
@@ -381,6 +410,7 @@
<script> <script>
import commonShopTable from "./shopproductTable.vue"; import commonShopTable from "./shopproductTable.vue";
import commonCommont from "@/views/components/courseList/commont.vue";
import AddOrUpdate from "./course-add-or-update"; import AddOrUpdate from "./course-add-or-update";
import questionBank from "./examination/questionBank"; import questionBank from "./examination/questionBank";
export default { export default {
@@ -388,6 +418,7 @@ export default {
return { return {
selectCourse: {}, selectCourse: {},
showQuestionBank: false, showQuestionBank: false,
commontListVisible: false,
selectType: [], selectType: [],
director: { director: {
director: null, director: null,
@@ -446,7 +477,8 @@ export default {
components: { components: {
AddOrUpdate, AddOrUpdate,
commonShopTable, commonShopTable,
questionBank questionBank,
commonCommont
}, },
activated() { activated() {
if (this.$route.query.upPageInde != null) { if (this.$route.query.upPageInde != null) {
@@ -638,6 +670,9 @@ export default {
this.resListVisible = false; this.resListVisible = false;
this.resList = []; this.resList = [];
}, },
closeCommontLink() {
this.commontListVisible = false;
},
showLinkTags(row) { showLinkTags(row) {
this.$http({ this.$http({
url: this.$http.adornUrl("/master/course/getCourseLableLinkList"), url: this.$http.adornUrl("/master/course/getCourseLableLinkList"),
@@ -653,6 +688,27 @@ export default {
// console.log(row, "row" , res.data.resList,this.resList); // console.log(row, "row" , res.data.resList,this.resList);
}); });
}, },
showLinkComment(row) {
this.courseId = row.id;
this.commontListVisible = true;
this.$nextTick(() => {
this.$refs.commonCommont.init();
});
// this.$http({
// url: this.$http.adornUrl("/master/courseGuestbook/getCourseGuestbookList"),
// method: "post",
// data: this.$http.adornData({
// courseId: row.id
// })
// }).then(res => {
// if (res.data.code == 0 && res.data.resList.length > 0) {
// this.resList = res.data.resList;
// }
// // console.log(row, "row" , res.data.resList,this.resList);
// });
},
handleChange(value) { handleChange(value) {
console.log(value, "989999999"); console.log(value, "989999999");
}, },
@@ -903,6 +959,7 @@ export default {
.flexbox { .flexbox {
display: flex; display: flex;
} }
/deep/.el-drawer__header{ /deep/.el-drawer__header {
background-color: #f0f0f0 !important;} background-color: #f0f0f0 !important;
}
</style> </style>

View File

@@ -533,13 +533,13 @@ export default {
examTime:parseInt(this.ClassModelForm.examTime), // 考试时长 examTime:parseInt(this.ClassModelForm.examTime), // 考试时长
}) })
}).then(({ data }) => { }).then(({ data }) => {
this.flag = false;
if (data && data.code == 0) { if (data && data.code == 0) {
this.$message.success("操作成功"); this.$message.success("操作成功");
this.$nextTick(() => { this.$nextTick(() => {
this.handleClose(); this.handleClose();
}); });
} else { } else {
this.flag = false;
this.$message.error(data.msg); this.$message.error(data.msg);
} }
}).catch(e =>{ }).catch(e =>{
@@ -637,6 +637,7 @@ export default {
this.$refs["ClassModelForm"].resetFields(); this.$refs["ClassModelForm"].resetFields();
this.userList = []; this.userList = [];
this.courseList = []; this.courseList = [];
this.flag = false;
}); });
this.$emit("handleClose"); this.$emit("handleClose");
} }

View File

@@ -129,7 +129,7 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination @size-change="sheetSizeChangeHandle" @current-change="currentSheetChangeHandle" <el-pagination @size-change="sheetSizeChangeHandle" @current-change="currentSheetChangeHandle"
:current-page="sheetPageIndex" :page-sizes="[40, 60, 100, 150]" :page-size="sheetPageSize" :total="MDtotal" :current-page="sheetPageIndex" :page-sizes="[20,40, 60, 100, 150]" :page-size="sheetPageSize" :total="MDtotal"
layout="total, sizes, prev, pager, next, jumper"> layout="total, sizes, prev, pager, next, jumper">
</el-pagination> </el-pagination>
</div> </div>
@@ -269,19 +269,22 @@
</div> </div>
</div> </div>
</div> </div>
<div class="td5 flexbox" style="justify-content: center; align-items: center; width: 150px;"> <div class="td5 flexbox" style="justify-content: center; align-items: center; width: 150px; text-align:center">
<!-- <div class="tabName" style="">备注信息
<br/>
<span :style="fitem.remark != '' ? 'color: red' : 'color: #999'">{{ fitem.remark != '' ? fitem.remark : '无' }}</span></div> -->
<div style="margin-bottom: 15px; text-align: center;"> <div style="margin-bottom: 15px; text-align: center;">
<div class="tabContent"> <div class="tabContent">
<span class="tabName">备注</span> <span class="tabName">备注</span>
<!-- <div >备注信息</div> -->
<el-button v-if="fitem.remark" size="mini" type="text" <!-- <el-button v-if="fitem.remark" size="mini" type="text"
@click="openShutManager(this, 'box' + index)">查看</el-button> @click="openShutManager(this, 'box' + index)">查看</el-button> -->
<span @click="editBeizhu(fitem)"> <span @click="editBeizhu(fitem)">
<icon-svg name="beizhu" <icon-svg name="beizhu"
style="width: 14px; height:14px; margin-left: 10px; cursor: pointer;"></icon-svg> style="width: 14px; height:14px; margin-left: 10px; cursor: pointer;"></icon-svg>
</span> </span>
</div> </div>
<div class="beizhu tabContent" :id="'box' + index" style="display:none">{{ fitem.remark }}</div> <div class="beizhu tabContent" style="color: red">{{ fitem.remark }}</div>
</div> </div>
</div> </div>
</div> </div>
@@ -512,7 +515,7 @@
</span> </span>
</el-dialog> </el-dialog>
<el-pagination v-if="tabChange.isPrint != 1" @size-change="sizeChangeHandle" @current-change="currentChangeHandle" <el-pagination v-if="tabChange.isPrint != 1" @size-change="sizeChangeHandle" @current-change="currentChangeHandle"
:current-page="pageIndex" :page-sizes="[40, 60, 100, 150]" :page-size="pageSize" :total="totalPage" :current-page="pageIndex" :page-sizes="[20, 40, 60, 100, 150]" :page-size="pageSize" :total="totalPage"
layout="total, sizes, prev, pager, next, jumper"> layout="total, sizes, prev, pager, next, jumper">
</el-pagination> </el-pagination>
<!-- 弹窗, 新增 / 修改 --> <!-- 弹窗, 新增 / 修改 -->
@@ -600,8 +603,8 @@
}, },
pageIndex: 1, pageIndex: 1,
sheetPageIndex: 1, sheetPageIndex: 1,
pageSize: 40, pageSize: 20,
sheetPageSize: 40, sheetPageSize: 20,
totalPage: 0, totalPage: 0,
dataListLoading: false, dataListLoading: false,
dataListSelections: [], dataListSelections: [],

View File

@@ -1,20 +1,41 @@
<template> <template>
<div class="mod-config"> <div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> <el-form
<el-form-item > :inline="true"
:model="dataForm"
@keyup.enter.native="getDataList()"
>
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable> <el-input v-model="dataForm.key" placeholder="参数名" clearable>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="pageIndex = 1;getDataList()">查询</el-button> <el-button
<el-button v-if="isAuth('book:user:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button> @click="
<el-button type="primary" @click="addOrUpdateHandle()">合并账号</el-button> pageIndex = 1;
getDataList();
"
>查询</el-button
>
<el-button
v-if="isAuth('book:user:save')"
type="primary"
@click="addOrUpdateHandle()"
>新增</el-button
>
<el-button type="primary" @click="addOrUpdateHandle()"
>合并账号</el-button
>
<!-- <el-button v-if="isAuth('book:user:delete')" type="danger" @click="deleteHandle()" <!-- <el-button v-if="isAuth('book:user:delete')" type="danger" @click="deleteHandle()"
:disabled="dataListSelections.length <= 0">批量删除</el-button> --> :disabled="dataListSelections.length <= 0">批量删除</el-button> -->
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table :data="dataList" border v-loading="dataListLoading" <el-table
style="width: 100%;"> :data="dataList"
border
v-loading="dataListLoading"
style="width: 100%;"
>
<!-- <el-table-column type="selection" header-align="center" align="center" width="50"> <!-- <el-table-column type="selection" header-align="center" align="center" width="50">
</el-table-column> --> </el-table-column> -->
<!-- <el-table-column label="序号" width="70" align="center"> <!-- <el-table-column label="序号" width="70" align="center">
@@ -26,11 +47,20 @@
prop="id" prop="id"
header-align="center" header-align="center"
align="center" align="center"
label="用户ID"> label="用户ID"
>
</el-table-column> </el-table-column>
<el-table-column prop="nickname" header-align="center" align="center" label="姓名"> <el-table-column
prop="nickname"
header-align="center"
align="center"
label="姓名"
>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{scope.row.nickname ? scope.row.nickname : '暂无用户名'}}</span>- <span>{{
scope.row.nickname ? scope.row.nickname : "暂无用户名"
}}</span
>-
<span v-if="scope.row.vip == 0">普通用户</span> <span v-if="scope.row.vip == 0">普通用户</span>
<span v-else-if="scope.row.vip == 2">吴门医述VIP</span> <span v-else-if="scope.row.vip == 2">吴门医述VIP</span>
<span v-else-if="scope.row.vip == 1">超级VIP</span> <span v-else-if="scope.row.vip == 1">超级VIP</span>
@@ -44,18 +74,49 @@
<span v-if="scope.row.sex == 0">女</span><span v-if="scope.row.sex == 1">男</span><span v-if="scope.row.sex == 2">保密</span> <span v-if="scope.row.sex == 0">女</span><span v-if="scope.row.sex == 1">男</span><span v-if="scope.row.sex == 2">保密</span>
</template> </template>
</el-table-column> --> </el-table-column> -->
<el-table-column prop="avatar" header-align="center" align="center" label="头像"> <el-table-column
prop="avatar"
header-align="center"
align="center"
label="头像"
>
<template slot-scope="scope"> <template slot-scope="scope">
<img v-if="scope.row.avatar && scope.row.avatar != ''" :src="scope.row.avatar" width="50" height="50" class="tableImg" /> <img
<img v-else src="../../../../static/img/morenAvavter.png" width="50" height="50" class="tableImg"> v-if="scope.row.avatar && scope.row.avatar != ''"
:src="scope.row.avatar"
width="50"
height="50"
class="tableImg"
/>
<img
v-else
src="../../../../static/img/morenAvavter.png"
width="50"
height="50"
class="tableImg"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="nickname" header-align="center" align="center" label="昵称"> <el-table-column
prop="nickname"
header-align="center"
align="center"
label="昵称"
>
</el-table-column> </el-table-column>
<el-table-column prop="tel" header-align="center" align="center" label="电话"> <el-table-column
prop="tel"
header-align="center"
align="center"
label="电话"
>
</el-table-column> </el-table-column>
<el-table-column prop="email" header-align="center" align="center" label="邮箱"> <el-table-column
prop="email"
header-align="center"
align="center"
label="邮箱"
>
</el-table-column> </el-table-column>
<!-- <el-table-column <!-- <el-table-column
prop="password" prop="password"
@@ -75,7 +136,41 @@
align="center" align="center"
label="vip 有效期"> label="vip 有效期">
</el-table-column> --> </el-table-column> -->
<el-table-column prop="peanutCoin" header-align="center" align="center" label="天医币"> <el-table-column
prop="peanutCoin"
header-align="center"
align="center"
label="天医币"
>
</el-table-column>
<el-table-column
prop="peanutCoin"
header-align="center"
align="center"
label="VIP 办理"
>
<template slot-scope="scope">
<el-popover
placement="right"
width="300"
trigger="click"
@show="getVipMoney(scope.row)"
>
<el-table :data="vipList">
<el-table-column
width="150"
property="title"
label="VIP名称"
></el-table-column>
<el-table-column
width="100"
property="lastFee"
label="开通金额"
></el-table-column>
</el-table>
<el-button slot="reference" size="small">办理金额</el-button>
</el-popover>
</template>
</el-table-column> </el-table-column>
<!-- <el-table-column <!-- <el-table-column
prop="readTime" prop="readTime"
@@ -95,48 +190,128 @@
align="center" align="center"
label="删除标记"> label="删除标记">
</el-table-column> --> </el-table-column> -->
<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作"> <el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button> <el-button
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button> type="text"
size="small"
@click="addOrUpdateHandle(scope.row.id)"
>修改</el-button
>
<el-button
type="text"
size="small"
@click="deleteHandle(scope.row.id)"
>删除</el-button
>
<el-dropdown> <el-dropdown>
<span class="el-dropdown-link" style="font-size:12px; color:#17B3A3; cursor: pointer;"> <span
class="el-dropdown-link"
style="font-size:12px; color:#17B3A3; cursor: pointer;"
>
更多操作<i class="el-icon-arrow-down el-icon--right"></i> 更多操作<i class="el-icon-arrow-down el-icon--right"></i>
</span> </span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item><el-button type="text" size="small" @click="ck(scope.row)">/扣天医币</el-button></el-dropdown-item> <el-dropdown-item
><el-button type="text" size="small" @click="ck(scope.row)"
>/扣天医币</el-button
></el-dropdown-item
>
<el-dropdown-item> <el-dropdown-item>
<router-link :to="{ path: 'user-point-memery', query: {'tel':scope.row.tel, 'id':scope.row.id, 'userName':scope.row.nickname} }"> <router-link
<el-button type="text" size="small">/扣天医币记录</el-button> :to="{
path: 'user-point-memery',
query: {
tel: scope.row.tel,
id: scope.row.id,
userName: scope.row.nickname
}
}"
>
<el-button type="text" size="small"
>/扣天医币记录</el-button
>
</router-link> </router-link>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item><el-button type="text" size="small" @click=" thisUserID = scope.row.id; youVisible = true">优惠券管理</el-button></el-dropdown-item> <el-dropdown-item
<el-dropdown-item><el-button type="text" size="small" @click="resetPassword(scope.row)">修改密码</el-button></el-dropdown-item> ><el-button
type="text"
size="small"
@click="
thisUserID = scope.row.id;
youVisible = true;
"
>优惠券管理</el-button
></el-dropdown-item
>
<el-dropdown-item
><el-button
type="text"
size="small"
@click="resetPassword(scope.row)"
>修改密码</el-button
></el-dropdown-item
>
<el-dropdown-item> <el-dropdown-item>
<router-link :to="{ path: '/userCourse', query: {id:scope.row.id} }"> <router-link
<el-button type="text" size="small"> :to="{ path: '/userCourse', query: { id: scope.row.id } }"
用户课程管理 >
</el-button> <el-button type="text" size="small">
用户课程管理
</el-button>
</router-link> </router-link>
</el-dropdown-item> </el-dropdown-item>
<!-- <el-dropdown-item divided>蚵仔煎</el-dropdown-item> --> <!-- <el-dropdown-item divided>蚵仔煎</el-dropdown-item> -->
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex" <el-pagination
:page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="total" @size-change="sizeChangeHandle"
layout="total, sizes, prev, pager, next, jumper"> @current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
>
</el-pagination> </el-pagination>
<!-- 弹窗, 新增 / 修改 --> <!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> <add-or-update
<el-dialog title="充/扣天医币" :close-on-click-modal="false" :visible.sync="adc" append-to-body width="30%" :before-close="closeDia"> v-if="addOrUpdateVisible"
<el-form :model="pointForm" label-width="100px" :rules="pointFormRules" ref="pointForm"> ref="addOrUpdate"
@refreshDataList="getDataList"
></add-or-update>
<el-dialog
title="充/扣天医币"
:close-on-click-modal="false"
:visible.sync="adc"
append-to-body
width="30%"
:before-close="closeDia"
>
<el-form
:model="pointForm"
label-width="100px"
:rules="pointFormRules"
ref="pointForm"
>
<el-form-item label="用户"> <el-form-item label="用户">
{{pointForm.tel}} <span v-if="pointForm.name!=''">({{pointForm.name}})</span> {{ pointForm.tel }}
<span>账户余额<em style="font-style: normal; font-size: 16px; color: #17B3A3;">{{pointForm.peanutCoin}}</em></span> <span v-if="pointForm.name != ''">({{ pointForm.name }})</span>
<span
>账户余额<em
style="font-style: normal; font-size: 16px; color: #17B3A3;"
>{{ pointForm.peanutCoin }}</em
></span
>
</el-form-item> </el-form-item>
<!-- <el-form-item label="充/扣主题"> <!-- <el-form-item label="充/扣主题">
<el-input v-model="pointForm.title"></el-input> <el-input v-model="pointForm.title"></el-input>
@@ -145,147 +320,205 @@
<!-- <el-input v-model="pointForm.pointType" placeholder="0-普通 1-vip"></el-input> <!-- <el-input v-model="pointForm.pointType" placeholder="0-普通 1-vip"></el-input>
--> -->
<el-select v-model="pointForm.pointType" placeholder="请选择"> <el-select v-model="pointForm.pointType" placeholder="请选择">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> <el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="金额" prop="pointAmount"> <el-form-item label="金额" prop="pointAmount">
<el-input-number v-model="pointForm.pointAmount" :placeholder="pointForm.peanutCoin+'可用'"> <el-input-number
v-model="pointForm.pointAmount"
:placeholder="pointForm.peanutCoin + '可用'"
>
</el-input-number> </el-input-number>
</el-form-item> </el-form-item>
<el-form-item label="充扣明细"> <el-form-item label="充扣明细">
<el-input type="textarea" rows="5" v-model="pointForm.remark" placeholder="操作说明"> <el-input
type="textarea"
rows="5"
v-model="pointForm.remark"
placeholder="操作说明"
>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="closeDia">取消</el-button> <el-button @click="closeDia">取消</el-button>
<el-button type="primary" @click="huaSheng(pointForm.peanutCoin)">确定</el-button> <el-button type="primary" @click="huaSheng(pointForm.peanutCoin)"
>确定</el-button
>
</span> </span>
</el-dialog> </el-dialog>
<userCouponList v-if="youVisible" ref="userCouponList" :userId='thisUserID' @close="closeCoupon"></userCouponList> <userCouponList
v-if="youVisible"
ref="userCouponList"
:userId="thisUserID"
@close="closeCoupon"
></userCouponList>
</div> </div>
</template> </template>
<script> <script>
import userCouponList from '../coupon/userCouponList' import userCouponList from "../coupon/userCouponList";
import AddOrUpdate from './user-add-or-update' import AddOrUpdate from "./user-add-or-update";
export default { export default {
data() { data() {
return { return {
dataForm: { dataForm: {
key: '' key: ""
}, },
pointFormRules:{ pointFormRules: {
pointAmount:[ pointAmount: [
{ required: true, message: '请输入金额', trigger: 'blur' }, { required: true, message: "请输入金额", trigger: "blur" }
], ],
pointType:{ required: true, message: '请选择操作类型', trigger: 'blur' } pointType: {
}, required: true,
options: [{ message: "请选择操作类型",
trigger: "blur"
}
},
vipList: [],
options: [
{
value: 0, value: 0,
label: '充天医币' label: "充天医币"
}, {
value: 1,
label: '扣天医币'
}],
adc: false,
pointForm: {
pointType: 0,
remark:'',
// title:'',
pointAmount:0
}, },
dataList: [], {
pageIndex: 1, value: 1,
pageSize: 10, label: "扣天医币"
totalPage: 0, }
total:0, ],
dataListLoading: false, adc: false,
dataListSelections: [], pointForm: {
addOrUpdateVisible: false, pointType: 0,
youVisible: false, remark: "",
youForm: {}, // title:'',
courperList: [], pointAmount: 0
courperHistList: [],
}
},
components: {
AddOrUpdate,
userCouponList
},
activated() {
this.getDataList()
},
methods: {
closeCoupon(val){
this.youVisible = false
}, },
// 用户课程 dataList: [],
userCourse(val){ pageIndex: 1,
pageSize: 10,
totalPage: 0,
total: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
youVisible: false,
youForm: {},
courperList: [],
courperHistList: []
};
},
components: {
AddOrUpdate,
userCouponList
},
activated() {
this.getDataList();
},
methods: {
getVipMoney(data) {
console.log("data at line 420:", data.id);
}, this.$http({
// 获取数据列表 // url: this.$http.adornUrl('/book/user/list'),
getDataList() { url: this.$http.adornUrl("/master/userVip/getVipProductForUser"),
this.dataListLoading = true method: "post",
this.$http({ data: this.$http.adornData({
// url: this.$http.adornUrl('/book/user/list'), uid: data.id
url: this.$http.adornUrl('/book/user/getUserList'),
method: 'post',
data: this.$http.adornData({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
}),
// params: this.$http.adornParams({
// 'page': 1,
// 'limit': this.pageSize,
// 'key': this.dataForm.key
// })
}).then(({
data
}) => {
if (data && data.code === 0) {
this.dataList = data.user.records
this.totalPage = data.user.pages
this.total = data.user.total
this.dataListLoading = false
}
}) })
}, // params: this.$http.adornParams({
// 重置密码 // 'page': 1,
resetPassword(row){ // 'limit': this.pageSize,
console.log(row,'row') // 'key': this.dataForm.key
this.$prompt('请输入新密码', '提示', { // })
confirmButtonText: '确定', }).then(({ data }) => {
cancelButtonText: '取消', if (data && data.code === 0) {
var list=[]
console.log("data at line 436:", data.list);
for(let i in data.list){
if (data.list[i].length > 0) {
list.push([...data.list[i]]);
}
}
this.vipList=list.flat(Infinity)
console.log("this.vipList at line 440:", this.vipList);
}else{
this.$message.error(data.msg);
this.vipList=[]
}
});
},
closeCoupon(val) {
this.youVisible = false;
},
// 用户课程
userCourse(val) {},
// 获取数据列表
getDataList() {
this.dataListLoading = true;
this.$http({
// url: this.$http.adornUrl('/book/user/list'),
url: this.$http.adornUrl("/book/user/getUserList"),
method: "post",
data: this.$http.adornData({
page: this.pageIndex,
limit: this.pageSize,
key: this.dataForm.key
})
// params: this.$http.adornParams({
// 'page': 1,
// 'limit': this.pageSize,
// 'key': this.dataForm.key
// })
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.user.records;
this.totalPage = data.user.pages;
this.total = data.user.total;
this.dataListLoading = false;
}
});
},
// 重置密码
resetPassword(row) {
console.log(row, "row");
this.$prompt("请输入新密码", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消"
// inputPattern: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/, // inputPattern: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/,
// inputErrorMessage: '邮箱格式不正确' // inputErrorMessage: '邮箱格式不正确'
}).then(({ value }) => { })
.then(({ value }) => {
this.$http({ this.$http({
url: this.$http.adornUrl('/book/user/updateUserPassword'), url: this.$http.adornUrl("/book/user/updateUserPassword"),
method: 'post', method: "post",
data: this.$http.adornData({ data: this.$http.adornData({
'id':row.id, id: row.id,
'password': value password: value
}), })
}).then(({data}) => { })
if (data && data.code === 0) { .then(({ data }) => {
this.$message.success('修改密码成功') if (data && data.code === 0) {
} this.$message.success("修改密码成功");
}).catch(({e}) => { }
console.log(e,'e') })
}) .catch(({ e }) => {
console.log(e, "e");
});
// this.$message({ // this.$message({
// type: 'success', // type: 'success',
// message: '你的邮箱是: ' + value // message: '你的邮箱是: ' + value
// }); // });
}).catch(() => { })
.catch(() => {
// this.$message({ // this.$message({
// type: 'info', // type: 'info',
// message: '取消输入' // message: '取消输入'
@@ -293,120 +526,124 @@ import userCouponList from '../coupon/userCouponList'
}); });
}, },
// 每页数 // 每页数
sizeChangeHandle(val) { sizeChangeHandle(val) {
this.pageSize = val this.pageSize = val;
this.pageIndex = 1 this.pageIndex = 1;
this.getDataList() this.getDataList();
}, },
// 当前页 // 当前页
currentChangeHandle(val) { currentChangeHandle(val) {
this.pageIndex = val this.pageIndex = val;
this.getDataList() this.getDataList();
}, },
// 多选 // 多选
selectionChangeHandle(val) { selectionChangeHandle(val) {
this.dataListSelections = val this.dataListSelections = val;
}, },
// 新增 / 修改 // 新增 / 修改
addOrUpdateHandle(id) { addOrUpdateHandle(id) {
this.addOrUpdateVisible = true this.addOrUpdateVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(id) this.$refs.addOrUpdate.init(id);
}) });
}, },
closeDia(){ closeDia() {
this.adc = false this.adc = false;
this.$refs.pointForm.resetFields(); this.$refs.pointForm.resetFields();
// this.pointForm.pointType == 0 // this.pointForm.pointType == 0
}, },
// 删除 // 删除
deleteHandle(id) { deleteHandle(id) {
var ids = id ? [id] : this.dataListSelections.map(item => { var ids = id
return item.id ? [id]
}) : this.dataListSelections.map(item => {
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', { return item.id;
confirmButtonText: '确定', });
cancelButtonText: '取消', this.$confirm(
type: 'warning' `确定对[id=${ids.join(",")}]进行[${id ? "删除" : "批量删除"}]操作?`,
}).then(() => { "提示",
this.$http({ {
url: this.$http.adornUrl('/book/user/delete'), confirmButtonText: "确定",
method: 'post', cancelButtonText: "取消",
data: this.$http.adornData(ids, false) type: "warning"
}).then(({
data
}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
},
// 充值扣款天医币
ck(e) {
this.pointForm=e
this.adc = true
},
huaSheng(point){
// console.log(this.pointForm.pointAmount, point)
if(this.pointForm.pointAmount > point && this.pointForm.pointType == 1){
return this.$message.error('扣除金额不能大于总金额')
} }
this.$refs['pointForm'].validate((valid) => { ).then(() => {
this.$http({ this.$http({
url: this.$http.adornUrl(`/book/user/pointChange?pointType=${this.pointForm.pointType}&note=${this.pointForm.remark}&pointAmount=${this.pointForm.pointAmount}&id=${this.pointForm.id}`), url: this.$http.adornUrl("/book/user/delete"),
method: 'get', method: "post",
params: this.$http.adornParams() data: this.$http.adornData(ids, false)
}).then(({ }).then(({ data }) => {
data
}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.$message.success('操作成功') this.$message({
this.getDataList() message: "操作成功",
this.adc = false type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
}
});
} else {
this.$message.error(data.msg);
} }
}) });
}) });
}, },
// async getUserCouponList(userId) { // 充值扣款天医币
// var obj = undefined ck(e) {
// await this.$http({ this.pointForm = e;
// url: this.$http.adornUrl('/common/coupon/getCouponHistoryList'), this.adc = true;
// method: 'post', },
// data: this.$http.adornData({ huaSheng(point) {
// // 'userId': this.youForm.id, // console.log(this.pointForm.pointAmount, point)
// "page":1, if (this.pointForm.pointAmount > point && this.pointForm.pointType == 1) {
// "limit":10, return this.$message.error("扣除金额不能大于总金额");
// "getType":"",//获取类型 0 后台赠送 1 主动获取 }
// "status":"",//使用状态 0 未使用 1 已使用 2 已过期 this.$refs["pointForm"].validate(valid => {
// "userInfo":"",//用户信息 this.$http({
// "userId": userId url: this.$http.adornUrl(
// }) `/book/user/pointChange?pointType=${this.pointForm.pointType}&note=${this.pointForm.remark}&pointAmount=${this.pointForm.pointAmount}&id=${this.pointForm.id}`
// }).then(async({ data }) => { ),
// if(data.code != 0 ) return this.$message.error(data.msg) method: "get",
// if (data && data.code == 0) { params: this.$http.adornParams()
// obj = data }).then(({ data }) => {
// console.log('data', data) if (data && data.code === 0) {
// this.youVisible = true this.$message.success("操作成功");
// } this.getDataList();
// }).catch(({e}) => { this.adc = false;
// console.log(e,'e') }
// obj = undefined });
// this.$message.error(e.msg) });
// }) },
// return obj // async getUserCouponList(userId) {
// }, // var obj = undefined
// 个人优惠券 // await this.$http({
// url: this.$http.adornUrl('/common/coupon/getCouponHistoryList'),
// method: 'post',
// data: this.$http.adornData({
// // 'userId': this.youForm.id,
// "page":1,
// "limit":10,
// "getType":"",//获取类型 0 后台赠送 1 主动获取
// "status":"",//使用状态 0 未使用 1 已使用 2 已过期
// "userInfo":"",//用户信息
// "userId": userId
// })
// }).then(async({ data }) => {
// if(data.code != 0 ) return this.$message.error(data.msg)
// if (data && data.code == 0) {
// obj = data
// console.log('data', data)
// this.youVisible = true
// }
// }).catch(({e}) => {
// console.log(e,'e')
// obj = undefined
// this.$message.error(e.msg)
// })
// return obj
// },
// 个人优惠券
// async youhui(e) { // async youhui(e) {
// this.youForm = e // this.youForm = e
// this.youForm.memberId = e.id // this.youForm.memberId = e.id
@@ -420,28 +657,26 @@ import userCouponList from '../coupon/userCouponList'
// }, // },
// 删除优惠券 // 删除优惠券
courDelete(e) { courDelete(e) {
let arrList = [] let arrList = [];
arrList.push(e.id) arrList.push(e.id);
this.$http({ this.$http({
url: this.$http.adornUrl('/book/couponhistory/delete'), url: this.$http.adornUrl("/book/couponhistory/delete"),
method: 'post', method: "post",
data: this.$http.adornData(arrList, false) data: this.$http.adornData(arrList, false)
}).then(({ }).then(({ data }) => {
data if (data && data.code === 0) {
}) => { this.$message({
if (data && data.code === 0) { message: "删除成功",
this.$message({ type: "success",
message: '删除成功', duration: 1500
type: 'success', });
duration: 1500, this.youhui(this.youForm);
}) this.youVisible = true;
this.youhui(this.youForm) }
this.youVisible = true });
}
})
}
} }
} }
};
</script> </script>

View File

@@ -193,8 +193,9 @@
</el-form-item> </el-form-item>
</div> </div>
</div> </div>
<el-form-item label="开通时长:" v-if="youForm.courseId" prop="days"> <el-form-item label="开通时长:" v-if="youForm.courseId" prop="days" style="width:400px">
<el-select v-model="youForm.days" placeholder="请选择开通时长"> <el-input v-model="youForm.days" placeholder="请选择开通时长"><template slot="append"></template></el-input>
<!-- <el-select v-model="youForm.days" placeholder="请选择开通时长">
<el-option <el-option
v-for="item in timeOptions" v-for="item in timeOptions"
:key="item.value" :key="item.value"
@@ -202,7 +203,7 @@
:value="item.value" :value="item.value"
> >
</el-option> </el-option>
</el-select> </el-select> -->
</el-form-item> </el-form-item>
<el-form-item label="开通原因:" prop="come" style="width: 400px"> <el-form-item label="开通原因:" prop="come" style="width: 400px">
<el-input v-model="youForm.come" type="textarea" :rows="2" placeholder="请输入内容"></el-input> <el-input v-model="youForm.come" type="textarea" :rows="2" placeholder="请输入内容"></el-input>
@@ -329,11 +330,14 @@ export default {
// AddOrUpdate // AddOrUpdate
}, },
created() { created() {
this.userId=this.$route.query.id
console.log(this.$route.query); console.log(this.$route.query);
console.log(this.userId, "onsole.log(this.$route.query)"); console.log(this.userId, "onsole.log(this.$route.query)");
this.init(); this.init();
}, },
activated() { activated() {
this.userId=this.$route.query.id
this.init();
// this.getDataList() // this.getDataList()
// this.getcourpeList() // this.getcourpeList()
}, },
@@ -482,11 +486,11 @@ export default {
}, },
init() { init() {
if (!this.userId) { // if (!this.userId) {
setTimeout(() => { // setTimeout(() => {
this.init(); // this.init();
}, 1000); // }, 1000);
} // }
this.$http({ this.$http({
url: this.$http.adornUrl(`/book/user/info/${this.userId}`), url: this.$http.adornUrl(`/book/user/info/${this.userId}`),
method: "get", method: "get",

View File

@@ -0,0 +1,244 @@
<template>
<div class="vip-personnel">
<el-form :inline="true" :model="dataForm">
<el-form-item>
<el-input v-model="dataForm.userName" placeholder="用户名称" clearable></el-input>
</el-form-item>
<el-form-item>
<el-input v-model="dataForm.tel" placeholder="手机号码" clearable></el-input>
</el-form-item>
<el-form-item>
<el-input v-model="dataForm.email" placeholder="邮箱" clearable></el-input>
</el-form-item>
<el-form-item>
<el-select v-model="dataForm.type" placeholder="请选择类型">
<el-option label="超v" value=1></el-option>
<el-option label="吴门医述v原简易超v" value=2></el-option>
<el-option label="众秒之门vip" value=3></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-select v-model="dataForm.state" placeholder="请选择状态">
<el-option label="有效" value=0></el-option>
<el-option label="失效" value=1></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="pageIndex = 1;getDataList()">查询</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="id"
header-align="center"
align="center"
width="70"
label="ID">
<template slot-scope="scope">{{scope.row.user.id}}</template>
</el-table-column>
<el-table-column
prop="name"
header-align="center"
align="center"
width="120"
label="用户名称">
<template slot-scope="scope">{{scope.row.user.name}}</template>
</el-table-column>
<el-table-column
prop="tel"
header-align="center"
align="center"
width="120"
label="手机号码">
<template slot-scope="scope">{{scope.row.user.tel}}</template>
</el-table-column>
<el-table-column
prop="email"
header-align="center"
align="center"
width="120"
label="邮箱">
<template slot-scope="scope">{{scope.row.user.email}}</template>
</el-table-column>
<el-table-column
prop="type"
header-align="center"
align="center"
width="120"
label="类型">
<template slot-scope="scope">
<span v-if="scope.row.type==1">超v</span>
<span v-if="scope.row.type==2">吴门医述v原简易超v</span>
<span v-if="scope.row.type==3">众秒之门vip</span>
</template>
</el-table-column>
<el-table-column
prop="state"
header-align="center"
align="center"
label="状态">
<template slot-scope="scope">
<span v-if="scope.row.state==0">有效</span>
<span v-if="scope.row.state==1" style=" color: red;">失效</span>
</template>
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
width="160"
label="开始时间">
<template slot-scope="scope">{{scope.row.startTime}}</template>
</el-table-column>
<el-table-column
prop="endTime"
header-align="center"
align="center"
width="160"
label="结束时间">
<template slot-scope="scope">{{scope.row.endTime}}</template>
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="130"
label="操作">
<template slot-scope="scope">
<el-popover
placement="right"
width="300"
trigger="click"
@show="getVipMoney(scope.row)"
>
<el-table :data="vipList" class="vip-list-table">
<el-table-column
width="150"
property="title"
label="VIP名称"
></el-table-column>
<el-table-column
width="100"
property="lastFee"
label="开通金额"
></el-table-column>
</el-table>
<el-button slot="reference" size="small">办理金额</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
</div>
</template>
<script>
export default {
data () {
return {
dataForm: {
userName: '',
tel: '',
email: '',
type: '',
state: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
vipList: []
}
},
methods: {
// 获取列表数据
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/master/userVip/listByPage'),
method: 'POST',
data: {
current: this.pageIndex,
limit: this.pageSize,
userName: this.dataForm.userName,
tel: this.dataForm.tel,
email: this.dataForm.email,
type: this.dataForm.type,
state: this.dataForm.state
}
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.result.records
this.totalPage = data.result.total
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// VIP办理
getVipMoney (data) {
this.$http({
url: this.$http.adornUrl('/master/userVip/getVipProductForUser'),
method: 'POST',
data: this.$http.adornData({
uid: data.userId
})
}).then(({data}) => {
let list = []
if (data && data.code === 0) {
for (let i in data.list) {
if (data.list[i].length > 0) {
list.push([...data.list[i]])
}
}
this.vipList = list.flat(Infinity)
} else {
this.$message.error(data.msg)
this.vipList = []
}
})
}
},
activated () {
this.getDataList()
}
}
</script>
<style scoped>
.vip-personnel .el-form-item:last-child{
margin-right:0;
}
</style>

View File

@@ -0,0 +1,214 @@
<template>
<div class="vip-product">
<el-form :inline="true">
<el-form-item class="el-form-item">
<el-button type="primary" @click="addProduct()">新增</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="type"
header-align="center"
align="center"
label="类型">
<template slot-scope="scope">
<span v-if="scope.row.type==1">超级vip</span>
<span v-if="scope.row.type==2">医学vip</span>
<span v-if="scope.row.type==3">国学vip</span>
</template>
</el-table-column>
<el-table-column
prop="title"
header-align="center"
align="center"
width="140"
label="title">
</el-table-column>
<el-table-column
prop="year"
header-align="center"
align="center"
label="有效期">
<template slot-scope="scope">
<span>{{ scope.row.year }} </span>
</template>
</el-table-column>
<el-table-column
prop="dateType"
header-align="center"
align="center"
label="有效时长">
<template slot-scope="scope">
<span v-if="scope.row.dateType==0">长期有效</span>
<span v-if="scope.row.dateType==1">短期有效</span>
</template>
</el-table-column>
<el-table-column
prop="fee"
header-align="center"
align="center"
label="价格">
</el-table-column>
<el-table-column
prop="rebateFee"
header-align="center"
align="center"
label="折扣价格">
</el-table-column>
<el-table-column
prop="startTime"
header-align="center"
align="center"
width="160"
label="开始时间">
</el-table-column>
<el-table-column
prop="endTime"
header-align="center"
align="center"
width="160"
label="结束时间">
</el-table-column>
<!-- <el-table-column-->
<!-- prop="delFlag"-->
<!-- header-align="center"-->
<!-- align="center"-->
<!-- label="状态">-->
<!-- <template slot-scope="scope">-->
<!-- <span v-if="scope.row.delFlag==0">正常</span>-->
<!-- <span v-if="scope.row.delFlag!=0">&#45;&#45;</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="updateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<update-product v-if="updateState" ref="updateProduct" @refreshDataList="getDataList"></update-product>
</div>
</template>
<script>
import UpdateProduct from './update-product'
export default {
data () {
return {
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
updateState: false
}
},
components: {
UpdateProduct
},
methods: {
// 获取列表数据
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/master/BuyConfig/getVipBuyConfigList'),
method: 'POST',
data: {
page: this.pageIndex,
limit: this.pageSize
}
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.result.records
this.totalPage = data.result.total
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 新增
addProduct () {
this.updateState = true
this.$nextTick(() => {
this.$refs.updateProduct.init()
})
},
// 修改
updateHandle (id) {
this.updateState = true
this.$nextTick(() => {
this.$refs.updateProduct.init(id)
})
},
// 删除
deleteHandle (id) {
this.$confirm(`确定对[id=${id}]进行[删除]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/master/BuyConfig/delVipBuyConfig'),
method: 'POST',
data: {id: id}
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success'
})
this.getDataList()
} else {
this.$message.error(data.msg)
}
})
})
}
},
activated () {
this.getDataList()
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,188 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="80px">
<el-form-item label="类型" prop="type">
<el-select v-model="dataForm.type" placeholder="请选择商品类型">
<el-option label="超级vip" value=1></el-option>
<el-option label="医学vip" value=2></el-option>
<el-option label="国学vip" value=3></el-option>
</el-select>
</el-form-item>
<el-form-item label="title" prop="title">
<el-input v-model="dataForm.title" placeholder="请输入title"></el-input>
</el-form-item>
<el-form-item label="有效期" prop="year">
<el-input v-model="dataForm.year" placeholder="请输入有效期"></el-input>
</el-form-item>
<el-form-item label="有效时长" prop="dateType">
<el-radio v-model="dataForm.dateType" :label='0'>长期有效</el-radio>
<el-radio v-model="dataForm.dateType" :label='1'>短期有效</el-radio>
</el-form-item>
<el-form-item label="价格" prop="fee">
<el-input v-model="dataForm.fee" placeholder="请输入价格"></el-input>
</el-form-item>
<el-form-item label="折扣价格" prop="rebateFee">
<el-input v-model="dataForm.rebateFee" placeholder="请输入折扣价格"></el-input>
</el-form-item>
<el-form-item label="开始时间" prop="startTime" v-if="dataForm.dateType==1">
<el-date-picker
value-format="yyyy-MM-dd HH:mm:ss"
v-model="dataForm.startTime"
type="datetime"
placeholder="选择开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="结束时间" prop="endTime" v-if="dataForm.dateType==1">
<el-date-picker
value-format="yyyy-MM-dd HH:mm:ss"
v-model="dataForm.endTime"
type="datetime"
placeholder="选择结束时间">
</el-date-picker>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
type: '',
title: '',
year: '',
dateType: 0,
fee: '',
rebateFee: '',
startTime: '',
endTime: ''
},
type: 1,
year: 0,
dataRule: {
type: [
{ required: true, message: '类型不能为空', trigger: 'blur' }
],
title: [
{ required: true, message: 'title不能为空', trigger: 'blur' }
],
year: [
{ required: true, message: '有效期不能为空', trigger: 'blur' }
],
fee: [
{ required: true, message: '价格不能为空', trigger: 'blur' }
],
rebateFee: [
{ required: true, message: '折扣价格不能为空', trigger: 'blur' }
],
startTime: [
{ required: true, message: '开始时间不能为空', trigger: 'blur' }
],
endTime: [
{ required: true, message: '结束时间不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.visible = true
this.dataForm.id = id
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl('/master/BuyConfig/getVipBuyConfigById'),
method: 'POST',
data: {id: id}
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.type = this.setType(data.data.type)
this.dataForm.title = data.data.title
this.dataForm.year = data.data.year + '年'
this.dataForm.fee = data.data.fee
this.dataForm.rebateFee = data.data.rebateFee
this.dataForm.startTime = data.data.startTime
this.dataForm.endTime = data.data.endTime
this.dataForm.dateType = data.data.dateType
}
})
} else {
this.$refs['dataForm'].resetFields()
}
},
// 设置类型字符串
setType (type) {
if (type === 1) {
return '1'
} else if (type === 2) {
return '2'
} else {
return '3'
}
},
// 数字
extractNumbers (str) {
return str.replace(/\D/g, '')
},
// 提交表单
dataFormSubmit () {
if (this.dataForm.type === '1') {
this.type = 1
} else if (this.dataForm.type === '2') {
this.type = 2
} else {
this.type = 3
}
// 数字
if (this.dataForm.year) {
this.year = this.extractNumbers(this.dataForm.year)
}
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl('/master/BuyConfig/saveOrUpdateVipBuyConfig'),
method: 'POST',
data: {
id: this.dataForm.id,
type: this.type,
title: this.dataForm.title,
year: Number(this.year),
dateType: this.dataForm.dateType,
fee: Number(this.dataForm.fee),
rebateFee: Number(this.dataForm.rebateFee),
startTime: this.dataForm.startTime,
endTime: this.dataForm.endTime
}
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>
<style scoped>
</style>