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.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
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
autoOpenBrowser: 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">
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 = "https://testapi.nuttyreading.com";
// const baseUrl = 'https://api.nuttyreading.com'
const baseUrl = 'https://api.nuttyreading.com'
// function commonFun() {
// 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'"
:collapse="sidebarFold"
:collapseTransition="false"
class="site-sidebar__menu">
class="site-sidebar__menu"
>
<el-menu-item index="home" @click="$router.push({ name: 'home' })">
<icon-svg name="shouye" class="site-sidebar__menu-icon"></icon-svg>
<span slot="title">首页</span>
@@ -28,7 +29,8 @@
v-for="menu in menuList"
:key="menu.menuId"
:menu="menu"
:dynamicMenuRoutes="dynamicMenuRoutes">
:dynamicMenuRoutes="dynamicMenuRoutes"
>
</sub-menu>
</el-menu>
</div>
@@ -36,77 +38,114 @@
</template>
<script>
import SubMenu from './main-sidebar-sub-menu'
import { isURL } from '@/utils/validate'
export default {
data () {
return {
dynamicMenuRoutes: []
import SubMenu from "./main-sidebar-sub-menu";
import { isURL } from "@/utils/validate";
export default {
data() {
return {
dynamicMenuRoutes: []
};
},
components: {
SubMenu
},
computed: {
sidebarLayoutSkin: {
get() {
return this.$store.state.common.sidebarLayoutSkin;
}
},
components: {
SubMenu
},
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) }
sidebarFold: {
get() {
return this.$store.state.common.sidebarFold;
}
},
watch: {
$route: 'routeHandle'
menuList: {
get() {
return this.$store.state.common.menuList;
},
set(val) {
this.$store.commit("common/updateMenuList", val);
}
},
created () {
this.menuList = JSON.parse(sessionStorage.getItem('menuList') || '[]')
this.dynamicMenuRoutes = JSON.parse(sessionStorage.getItem('dynamicMenuRoutes') || '[]')
this.routeHandle(this.$route)
menuActiveName: {
get() {
return this.$store.state.common.menuActiveName;
},
set(val) {
this.$store.commit("common/updateMenuActiveName", val);
}
},
methods: {
// 路由操作
routeHandle (route) {
if (route.meta.isTab) {
// tab选中, 不存在先添加
var tab = this.mainTabs.filter(item => item.name === route.name)[0]
if (!tab) {
if (route.meta.isDynamic) {
route = this.dynamicMenuRoutes.filter(item => item.name === route.name)[0]
if (!route) {
return console.error('未能找到可用标签页!')
}
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: {
$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 + ''
this.mainTabsActiveName = tab.name
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);
} 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>

View File

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

View File

@@ -1,16 +1,35 @@
<template>
<div class="mod-config">
<el-radio-group v-model="currentState" style="margin-bottom: 15px;" @tab-click="handleClick">
<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-radio-group
v-model="currentState"
style="margin-bottom: 15px;"
@tab-click="handleClick"
>
<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-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 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
v-for="item in rangList"
:key="item.value"
@@ -21,7 +40,14 @@
</el-select>
</el-form-item>
<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
v-for="item in TypeList"
:key="item.value"
@@ -33,7 +59,12 @@
</el-form-item>
<el-form-item>
<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-form-item>
</el-form>
@@ -42,7 +73,8 @@
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
style="width: 100%;"
>
<!-- <el-table-column
type="selection"
header-align="center"
@@ -53,55 +85,80 @@
prop="id"
header-align="center"
align="center"
label="序号" width="50">
label="序号"
width="50"
>
</el-table-column>
<el-table-column
prop="couponName"
header-align="center"
align="center"
label="优惠券名称">
label="优惠券名称"
>
</el-table-column>
<el-table-column
<el-table-column
header-align="center"
align="center"
label="优惠券类型" width="100px">
<template slot-scope="scope">
{{scope.row.effectType | getType}}
</template>
</el-table-column>
label="优惠券类型"
width="100px"
>
<template slot-scope="scope">
{{ scope.row.effectType | getType }}
</template>
</el-table-column>
<el-table-column
prop="couponAmount"
header-align="center"
align="center"
label="面值" width="90px">
</el-table-column>
label="面值"
width="90px"
>
</el-table-column>
<el-table-column
prop="expirationDate"
header-align="center"
align="center"
label="时间">
label="时间"
>
<template slot-scope="scope">
<span v-if="scope.row.createTime">创建时间{{scope.row.createTime}}</span>
<span v-if="scope.row.effectTime"><br/>生效时间{{scope.row.effectTime}}</span>
<span v-if="scope.row.expireTime"><br/>结束时间{{scope.row.expireTime}}</span>
<span v-if="scope.row.createTime"
>创建时间{{ scope.row.createTime }}</span
>
<span v-if="scope.row.effectTime"
><br />生效时间{{ scope.row.effectTime }}</span
>
<span v-if="scope.row.expireTime"
><br />结束时间{{ scope.row.expireTime }}</span
>
</template>
</el-table-column>
</el-table-column>
<el-table-column
prop="couponRange"
header-align="center"
align="center"
label="优惠券范围">
label="优惠券范围"
>
<template slot-scope="scope">
{{scope.row.couponRange | getRange}}
{{ scope.row.couponRange | getRange }}
</template>
</el-table-column>
</el-table-column>
<el-table-column
prop="totalCirculation"
header-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
prop="useCount"
@@ -119,27 +176,42 @@
prop="receiveCount"
header-align="center"
align="center"
label="操作">
label="操作"
>
<template slot-scope="scope">
<el-switch
v-model="scope.row.currentState"
:active-value ="0"
:inactive-value='1'
:active-value="0"
:inactive-value="1"
@change="changeStateHandle(scope.row.id, scope.row.currentState)"
active-text="发放中"
inactive-text="暂停发放">
inactive-text="暂停发放"
>
</el-switch>
</template>
</el-table-column>
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
label="操作"
>
<template slot-scope="scope">
<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>
<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>
</el-table-column>
</el-table>
@@ -150,194 +222,202 @@
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
layout="total, sizes, prev, pager, next, jumper"
>
</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>
</template>
<script>
import global from "@/views/common/common.vue"; //引入共用组间
import AddOrUpdate from './coupon-add-or-update'
import commentsListVue from '../book/commentsList.vue'
export default {
data () {
return {
dataForm: {
couponName: '',
couponRange: '',
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 '自定义'
}
import AddOrUpdate from "./coupon-add-or-update";
import commentsListVue from "../book/commentsList.vue";
export default {
data() {
return {
dataForm: {
couponName: "",
couponRange: "",
couponType: ""
},
getRange (value) {
switch (value) {
case 0:
return '无限制'
case 1:
return '课程券'
case 2:
return '课程品类券'
}
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 "自定义";
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
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}) => {
getRange(value) {
switch (value) {
case 0:
return "无限制";
case 1:
return "课程券";
case 2:
return "课程品类券";
}
}
},
components: {
AddOrUpdate
},
activated() {
this.getDataList();
},
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) {
this.$message({
message: '操作成功',
type:'success',
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList()
this.getDataList();
}
})
});
} else {
this.$message.error(data.msg)
this.$message.error(data.msg);
}
}).catch((e) => {
this.$message.error(e.msg)
})
},
handleClick(){
console.log(this.currentState)
this.pageIndex = 1
this.getDataList()
},
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/common/coupon/getCouponList'),
method: 'post',
data: this.$http.adornData({
'page': this.pageIndex,
'limit': this.pageSize,
'couponName': this.dataForm.couponName,
'currentState': this.currentState, //当前状态 0 发放中 1结束
"couponType": this.dataForm.couponType,//优惠券类型 0现金 1折扣
"couponRange":this.dataForm.couponRange,//优惠卷范围 0无限制 1课程卷 2课程品类卷
})
}).then(({data}) => {
if(data.code !==0) return this.$message.error(data.msg)
.catch(e => {
this.$message.error(e.msg);
});
},
handleClick() {
console.log(this.currentState);
this.pageIndex = 1;
this.getDataList();
},
// 获取数据列表
getDataList() {
this.dataListLoading = true;
this.$http({
url: this.$http.adornUrl("/common/coupon/getCouponList"),
method: "post",
data: this.$http.adornData({
page: this.pageIndex,
limit: this.pageSize,
couponName: this.dataForm.couponName,
currentState: this.currentState, //当前状态 0 发放中 1结束
couponType: this.dataForm.couponType, //优惠券类型 0现金 1折扣
couponRange: this.dataForm.couponRange //优惠卷范围 0无限制 1课程卷 2课程品类卷
})
})
.then(({ data }) => {
if (data.code !== 0) return this.$message.error(data.msg);
if (data && data.code === 0) {
this.dataList = data.couponPage.records
this.totalPage = data.couponPage.total
this.dataList = data.couponPage.records;
this.totalPage = data.couponPage.total;
} else {
this.dataList = []
this.totalPage = 0
this.dataList = [];
this.totalPage = 0;
}
this.dataListLoading = false
}).catch((e) => {
this.$message.error(e.msg)
this.dataListLoading = false
this.dataListLoading = false;
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
// this.addOrUpdateVisible = true
})
},
// 删除
deleteHandle (id) {
// var ids = id ? [id] : this.dataListSelections.map(item => {
// return item.id
// })
this.$confirm(`确定对[id=${id}]进行删除操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/common/coupon/delCoupon'),
method: 'post',
data: this.$http.adornData({
id: id
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
.catch(e => {
this.$message.error(e.msg);
this.dataListLoading = false;
});
},
// 每页数
sizeChangeHandle(val) {
this.pageSize = val;
this.pageIndex = 1;
this.getDataList();
},
// 当前页
currentChangeHandle(val) {
this.pageIndex = val;
this.getDataList();
},
// 多选
selectionChangeHandle(val) {
this.dataListSelections = val;
},
// 新增 / 修改
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
// this.addOrUpdateVisible = true
});
},
// 删除
deleteHandle(id) {
// var ids = id ? [id] : this.dataListSelections.map(item => {
// return item.id
// })
this.$confirm(`确定对[id=${id}]进行删除操作?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.$http({
url: this.$http.adornUrl("/common/coupon/delCoupon"),
method: "post",
data: this.$http.adornData({
id: id
})
})
}
},watch:{
currentState: {
handler(val, oldVal) {
this.getDataList()
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
}
});
} else {
this.$message.error(data.msg);
}
});
});
}
},
watch: {
currentState: {
handler(val, oldVal) {
this.getDataList();
},
deep: true
},
}
}
};
</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-input v-model="dataForm.sort" placeholder="排序"></el-input>
</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
label="课程图"
prop="image"
@@ -243,7 +249,8 @@ export default {
id: 0,
title: "",
etitle:'',
titleAbbr:''
titleAbbr:'',
canzk: false, // 是否开启自考
// publisherName: '',
// splits: 0,
// authorId: [],
@@ -421,6 +428,7 @@ export default {
attr.push(img);
this.fileList = attr;
}
data.canzk = data.canzk == '1' ? true : false
this.dataForm = { ...data };
}
});
@@ -462,6 +470,7 @@ export default {
data: this.$http.adornData({
id: this.dataForm.id || undefined,
title: this.dataForm.title,
canzk: this.dataForm.canzk ? '1' : '0', // 是否可以自考 0/ 1 0 否 1 是
sort: this.dataForm.sort,
image: this.dataForm.image,
content: this.dataForm.content,
@@ -479,6 +488,8 @@ export default {
this.visible = false;
this.relationProductIds = []
this.relationProducts = []
this.dataForm.canzk = false
this.$emit("refreshDataList");
}
});

View File

@@ -169,35 +169,44 @@
fixed="right"
header-align="center"
align="center"
width="300"
width="280"
label="操作"
>
<template slot-scope="scope">
<div>
<el-button
type="text"
size="small"
@click="addOrUpdateHandle(scope.row)"
>修改</el-button
>
<router-link
:to="{
path: 'course-courseCatalogue',
query: { id: scope.row.id, pageIndex }
}"
>
>
<el-button type="text" size="small">目录管理</el-button>
</router-link>
<el-button
type="text"
size="small"
@click="addOrUpdateHandle(scope.row)"
>修改</el-button
>
<el-button
type="text"
size="small"
@click="handleQuestionBank(scope.row)"
>题库管理</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
>
<el-button
style="color: red;"
type="text"
size="small"
@click="deleteHandle(scope.row.id)"
@@ -298,6 +307,25 @@
<el-button type="primary" @click="closeLink"> </el-button>
</span>
</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
title="教务主任管理"
@@ -358,16 +386,17 @@
</span>
</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">
<p
style="margin: 0;font-size: 18px;"
>
<p style="margin: 0;font-size: 18px;">
<span style="font-weight: bold;">题库管理</span
><span style="margin-left: 20px;">[ {{ selectCourse.title }} ]</span>
</p>
</div>
<div style="padding:0 20px;box-sizing: border-box;">
<question-bank
@@ -381,6 +410,7 @@
<script>
import commonShopTable from "./shopproductTable.vue";
import commonCommont from "@/views/components/courseList/commont.vue";
import AddOrUpdate from "./course-add-or-update";
import questionBank from "./examination/questionBank";
export default {
@@ -388,6 +418,7 @@ export default {
return {
selectCourse: {},
showQuestionBank: false,
commontListVisible: false,
selectType: [],
director: {
director: null,
@@ -446,7 +477,8 @@ export default {
components: {
AddOrUpdate,
commonShopTable,
questionBank
questionBank,
commonCommont
},
activated() {
if (this.$route.query.upPageInde != null) {
@@ -638,6 +670,9 @@ export default {
this.resListVisible = false;
this.resList = [];
},
closeCommontLink() {
this.commontListVisible = false;
},
showLinkTags(row) {
this.$http({
url: this.$http.adornUrl("/master/course/getCourseLableLinkList"),
@@ -653,6 +688,27 @@ export default {
// 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) {
console.log(value, "989999999");
},
@@ -903,6 +959,7 @@ export default {
.flexbox {
display: flex;
}
/deep/.el-drawer__header{
background-color: #f0f0f0 !important;}
/deep/.el-drawer__header {
background-color: #f0f0f0 !important;
}
</style>

View File

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

View File

@@ -129,7 +129,7 @@
</el-table-column>
</el-table>
<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">
</el-pagination>
</div>
@@ -269,19 +269,22 @@
</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 class="tabContent">
<span class="tabName">备注</span>
<!-- <div >备注信息</div> -->
<el-button v-if="fitem.remark" size="mini" type="text"
@click="openShutManager(this, 'box' + index)">查看</el-button>
<!-- <el-button v-if="fitem.remark" size="mini" type="text"
@click="openShutManager(this, 'box' + index)">查看</el-button> -->
<span @click="editBeizhu(fitem)">
<icon-svg name="beizhu"
style="width: 14px; height:14px; margin-left: 10px; cursor: pointer;"></icon-svg>
</span>
</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>
@@ -512,7 +515,7 @@
</span>
</el-dialog>
<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">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
@@ -600,8 +603,8 @@
},
pageIndex: 1,
sheetPageIndex: 1,
pageSize: 40,
sheetPageSize: 40,
pageSize: 20,
sheetPageSize: 20,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],

View File

@@ -1,20 +1,41 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item >
<el-form
:inline="true"
:model="dataForm"
@keyup.enter.native="getDataList()"
>
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable>
</el-input>
</el-form-item>
<el-form-item>
<el-button @click="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
@click="
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()"
:disabled="dataListSelections.length <= 0">批量删除</el-button> -->
</el-form-item>
</el-form>
<el-table :data="dataList" border v-loading="dataListLoading"
style="width: 100%;">
<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 label="序号" width="70" align="center">
@@ -22,15 +43,24 @@
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
</template>
</el-table-column> -->
<el-table-column
<el-table-column
prop="id"
header-align="center"
align="center"
label="用户ID">
label="用户ID"
>
</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">
<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-else-if="scope.row.vip == 2">吴门医述VIP</span>
<span v-else-if="scope.row.vip == 1">超级VIP</span>
@@ -41,21 +71,52 @@
</el-table-column> -->
<!-- <el-table-column prop="sex" header-align="center" align="center" label="性别">
<template slot-scope="scope">
<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>
</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">
<img 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">
<img
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>
</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 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 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
prop="password"
@@ -75,7 +136,41 @@
align="center"
label="vip 有效期">
</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
prop="readTime"
@@ -95,48 +190,128 @@
align="center"
label="删除标记">
</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="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作"
>
<template slot-scope="scope">
<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>
<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>
</span>
<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>
<router-link :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
: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>
</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-button type="text" size="small" @click="resetPassword(scope.row)">修改密码</el-button></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-button
type="text"
size="small"
@click="resetPassword(scope.row)"
>修改密码</el-button
></el-dropdown-item
>
<el-dropdown-item>
<router-link :to="{ path: '/userCourse', query: {id:scope.row.id} }">
<el-button type="text" size="small">
用户课程管理
</el-button>
<router-link
:to="{ path: '/userCourse', query: { id: scope.row.id } }"
>
<el-button type="text" size="small">
用户课程管理
</el-button>
</router-link>
</el-dropdown-item>
<!-- <el-dropdown-item divided>蚵仔煎</el-dropdown-item> -->
</el-dropdown-item>
<!-- <el-dropdown-item divided>蚵仔煎</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</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="total"
layout="total, sizes, prev, pager, next, jumper">
<el-pagination
@size-change="sizeChangeHandle"
@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>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" 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">
<add-or-update
v-if="addOrUpdateVisible"
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="用户">
{{pointForm.tel}} <span v-if="pointForm.name!=''">({{pointForm.name}})</span>
<span>账户余额<em style="font-style: normal; font-size: 16px; color: #17B3A3;">{{pointForm.peanutCoin}}</em></span>
{{ pointForm.tel }}
<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 label="充/扣主题">
<el-input v-model="pointForm.title"></el-input>
@@ -145,268 +320,330 @@
<!-- <el-input v-model="pointForm.pointType" placeholder="0-普通 1-vip"></el-input>
-->
<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-select>
</el-form-item>
<el-form-item label="金额" prop="pointAmount">
<el-input-number v-model="pointForm.pointAmount" :placeholder="pointForm.peanutCoin+'可用'">
</el-input-number>
<el-input-number
v-model="pointForm.pointAmount"
:placeholder="pointForm.peanutCoin + '可用'"
>
</el-input-number>
</el-form-item>
<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-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<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>
</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>
</template>
<script>
import userCouponList from '../coupon/userCouponList'
import AddOrUpdate from './user-add-or-update'
export default {
data() {
return {
dataForm: {
key: ''
},
pointFormRules:{
pointAmount:[
{ required: true, message: '请输入金额', trigger: 'blur' },
],
pointType:{ required: true, message: '请选择操作类型', trigger: 'blur' }
},
options: [{
import userCouponList from "../coupon/userCouponList";
import AddOrUpdate from "./user-add-or-update";
export default {
data() {
return {
dataForm: {
key: ""
},
pointFormRules: {
pointAmount: [
{ required: true, message: "请输入金额", trigger: "blur" }
],
pointType: {
required: true,
message: "请选择操作类型",
trigger: "blur"
}
},
vipList: [],
options: [
{
value: 0,
label: '充天医币'
}, {
value: 1,
label: '扣天医币'
}],
adc: false,
pointForm: {
pointType: 0,
remark:'',
// title:'',
pointAmount:0
label: "充天医币"
},
dataList: [],
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: {
closeCoupon(val){
this.youVisible = false
{
value: 1,
label: "扣天医币"
}
],
adc: false,
pointForm: {
pointType: 0,
remark: "",
// title:'',
pointAmount: 0
},
// 用户课程
userCourse(val){
dataList: [],
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);
},
// 获取数据列表
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
}
this.$http({
// url: this.$http.adornUrl('/book/user/list'),
url: this.$http.adornUrl("/master/userVip/getVipProductForUser"),
method: "post",
data: this.$http.adornData({
uid: data.id
})
},
// 重置密码
resetPassword(row){
console.log(row,'row')
this.$prompt('请输入新密码', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
// params: this.$http.adornParams({
// 'page': 1,
// 'limit': this.pageSize,
// 'key': this.dataForm.key
// })
}).then(({ data }) => {
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])?/,
// inputErrorMessage: '邮箱格式不正确'
}).then(({ value }) => {
// inputErrorMessage: '邮箱格式不正确'
})
.then(({ value }) => {
this.$http({
url: this.$http.adornUrl('/book/user/updateUserPassword'),
method: 'post',
data: this.$http.adornData({
'id':row.id,
'password': value
}),
}).then(({data}) => {
if (data && data.code === 0) {
this.$message.success('修改密码成功')
}
}).catch(({e}) => {
console.log(e,'e')
})
url: this.$http.adornUrl("/book/user/updateUserPassword"),
method: "post",
data: this.$http.adornData({
id: row.id,
password: value
})
})
.then(({ data }) => {
if (data && data.code === 0) {
this.$message.success("修改密码成功");
}
})
.catch(({ e }) => {
console.log(e, "e");
});
// this.$message({
// type: 'success',
// message: '你的邮箱是: ' + value
// });
}).catch(() => {
})
.catch(() => {
// this.$message({
// type: 'info',
// message: '取消输入'
// });
});
// });
});
},
// 每页数
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle(val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
closeDia(){
this.adc = false
this.$refs.pointForm.resetFields();
// this.pointForm.pointType == 0
},
// 删除
deleteHandle(id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/book/user/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).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('扣除金额不能大于总金额')
// 每页数
sizeChangeHandle(val) {
this.pageSize = val;
this.pageIndex = 1;
this.getDataList();
},
// 当前页
currentChangeHandle(val) {
this.pageIndex = val;
this.getDataList();
},
// 多选
selectionChangeHandle(val) {
this.dataListSelections = val;
},
// 新增 / 修改
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
},
closeDia() {
this.adc = false;
this.$refs.pointForm.resetFields();
// this.pointForm.pointType == 0
},
// 删除
deleteHandle(id) {
var ids = id
? [id]
: this.dataListSelections.map(item => {
return item.id;
});
this.$confirm(
`确定对[id=${ids.join(",")}]进行[${id ? "删除" : "批量删除"}]操作?`,
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
this.$refs['pointForm'].validate((valid) => {
).then(() => {
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}`),
method: 'get',
params: this.$http.adornParams()
}).then(({
data
}) => {
url: this.$http.adornUrl("/book/user/delete"),
method: "post",
data: this.$http.adornData(ids, false)
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message.success('操作成功')
this.getDataList()
this.adc = false
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
}
});
} else {
this.$message.error(data.msg);
}
})
})
},
// 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
// },
// 个人优惠券
});
});
},
// 充值扣款天医币
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 => {
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}`
),
method: "get",
params: this.$http.adornParams()
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message.success("操作成功");
this.getDataList();
this.adc = false;
}
});
});
},
// 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) {
// this.youForm = e
// this.youForm.memberId = e.id
@@ -416,32 +653,30 @@ import userCouponList from '../coupon/userCouponList'
// console.log('1', obj)
// // }
// // this.courperHistList = await this.getcourpeList(e.id)
// // this.courperHistList = await this.getcourpeList(e.id)
// },
// 删除优惠券
courDelete(e) {
let arrList = []
arrList.push(e.id)
this.$http({
url: this.$http.adornUrl('/book/couponhistory/delete'),
method: 'post',
data: this.$http.adornData(arrList, false)
}).then(({
data
}) => {
if (data && data.code === 0) {
this.$message({
message: '删除成功',
type: 'success',
duration: 1500,
})
this.youhui(this.youForm)
this.youVisible = true
}
})
}
// 删除优惠券
courDelete(e) {
let arrList = [];
arrList.push(e.id);
this.$http({
url: this.$http.adornUrl("/book/couponhistory/delete"),
method: "post",
data: this.$http.adornData(arrList, false)
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "删除成功",
type: "success",
duration: 1500
});
this.youhui(this.youForm);
this.youVisible = true;
}
});
}
}
};
</script>

View File

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