|
@@ -11,8 +11,9 @@
|
|
:model="searchForm"
|
|
:model="searchForm"
|
|
@submit="search"
|
|
@submit="search"
|
|
@reset="onReSet"
|
|
@reset="onReSet"
|
|
|
|
+ ref="searchForm"
|
|
>
|
|
>
|
|
- <el-form-item>
|
|
|
|
|
|
+ <el-form-item prop="search">
|
|
<el-input
|
|
<el-input
|
|
v-model.trim="searchForm.search"
|
|
v-model.trim="searchForm.search"
|
|
clearable
|
|
clearable
|
|
@@ -20,26 +21,30 @@
|
|
placeholder="优惠券名称、编号"
|
|
placeholder="优惠券名称、编号"
|
|
></el-input>
|
|
></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item>
|
|
|
|
|
|
+ <el-form-item prop="type">
|
|
<el-select
|
|
<el-select
|
|
placeholder="优惠券类型"
|
|
placeholder="优惠券类型"
|
|
v-model.trim="searchForm.type"
|
|
v-model.trim="searchForm.type"
|
|
filterable
|
|
filterable
|
|
clearable
|
|
clearable
|
|
>
|
|
>
|
|
- <el-option label="满减券" value="FULL_REDUCTION"></el-option>
|
|
|
|
- <el-option label="折扣券" value="DISCOUNT"></el-option>
|
|
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in couponTypeList"
|
|
|
|
+ :key="item.value"
|
|
|
|
+ :value="item.value"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ ></el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item>
|
|
|
|
|
|
+ <el-form-item prop="status">
|
|
<el-select
|
|
<el-select
|
|
placeholder="优惠券状态"
|
|
placeholder="优惠券状态"
|
|
- v-model.trim="searchForm.type"
|
|
|
|
|
|
+ v-model.trim="searchForm.status"
|
|
filterable
|
|
filterable
|
|
clearable
|
|
clearable
|
|
>
|
|
>
|
|
- <el-option label="正常" value="1"></el-option>
|
|
|
|
- <el-option label="过期" value="0"></el-option>
|
|
|
|
|
|
+ <el-option label="启用" value="1"></el-option>
|
|
|
|
+ <el-option label="停用" value="0"></el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
@@ -47,38 +52,58 @@
|
|
<el-button native-type="reset" type="danger">重置</el-button>
|
|
<el-button native-type="reset" type="danger">重置</el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</save-form>
|
|
</save-form>
|
|
|
|
+ <auth auths="sysCoupon/add">
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ style="margin-bottom: 30px"
|
|
|
|
+ @click="gotoDetail()"
|
|
|
|
+ >新增优惠券</el-button
|
|
|
|
+ >
|
|
|
|
+ </auth>
|
|
|
|
+
|
|
<div class="tableWrap">
|
|
<div class="tableWrap">
|
|
<el-table
|
|
<el-table
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
:header-cell-style="{ background: '#EDEEF0', color: '#444' }"
|
|
:header-cell-style="{ background: '#EDEEF0', color: '#444' }"
|
|
:data="tableList"
|
|
:data="tableList"
|
|
|
|
+
|
|
>
|
|
>
|
|
<el-table-column
|
|
<el-table-column
|
|
align="center"
|
|
align="center"
|
|
- prop="studentId"
|
|
|
|
|
|
+ prop="id"
|
|
label="优惠券编号"
|
|
label="优惠券编号"
|
|
></el-table-column>
|
|
></el-table-column>
|
|
<el-table-column
|
|
<el-table-column
|
|
align="center"
|
|
align="center"
|
|
- prop="studentId"
|
|
|
|
|
|
+ prop="name"
|
|
label="优惠券名称"
|
|
label="优惠券名称"
|
|
></el-table-column>
|
|
></el-table-column>
|
|
- <el-table-column
|
|
|
|
- align="center"
|
|
|
|
- prop="studentId"
|
|
|
|
- label="类型"
|
|
|
|
- ></el-table-column>
|
|
|
|
|
|
+ <el-table-column align="center" prop="description" label="描述">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <div>
|
|
|
|
+ <Tooltip
|
|
|
|
+ :content="scope.row.description ? scope.row.description : ''"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column align="center" prop="studentId" label="类型">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <div>
|
|
|
|
+ {{ scope.row.type | couponTypeFilter }}
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
<el-table-column
|
|
<el-table-column
|
|
align="center"
|
|
align="center"
|
|
prop="cloudStudyUseStudentDuty"
|
|
prop="cloudStudyUseStudentDuty"
|
|
- sortable="custom"
|
|
|
|
width="140px"
|
|
width="140px"
|
|
>
|
|
>
|
|
<template slot="header" slot-scope="slot">
|
|
<template slot="header" slot-scope="slot">
|
|
<div class="titleCell">
|
|
<div class="titleCell">
|
|
<span>面值</span>
|
|
<span>面值</span>
|
|
<el-tooltip placement="top" popper-class="mTooltip">
|
|
<el-tooltip placement="top" popper-class="mTooltip">
|
|
- <div slot="content">可优惠最大金额</div>
|
|
|
|
|
|
+ <div slot="content">可优惠面值</div>
|
|
<i
|
|
<i
|
|
class="el-icon-question micon el-tooltip"
|
|
class="el-icon-question micon el-tooltip"
|
|
style="
|
|
style="
|
|
@@ -92,13 +117,17 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <div>{{ scope.row.cloudStudyUseStudentDuty }}人</div>
|
|
|
|
|
|
+ <div v-if="scope.row.type == 'FULL_REDUCTION'">
|
|
|
|
+ {{ scope.row.faceValue | hasMoneyFormat }}
|
|
|
|
+ </div>
|
|
|
|
+ <div v-if="scope.row.type == 'DISCOUNT'">
|
|
|
|
+ {{ scope.row.faceValue }}%
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column
|
|
<el-table-column
|
|
align="center"
|
|
align="center"
|
|
prop="cloudStudyUseStudentDuty"
|
|
prop="cloudStudyUseStudentDuty"
|
|
- sortable="custom"
|
|
|
|
width="140px"
|
|
width="140px"
|
|
>
|
|
>
|
|
<template slot="header" slot-scope="slot">
|
|
<template slot="header" slot-scope="slot">
|
|
@@ -119,13 +148,12 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <div>{{ scope.row.cloudStudyUseStudentDuty }}人</div>
|
|
|
|
|
|
+ <div>{{ scope.row.fullAmount | hasMoneyFormat }}</div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column
|
|
<el-table-column
|
|
align="center"
|
|
align="center"
|
|
prop="cloudStudyUseStudentDuty"
|
|
prop="cloudStudyUseStudentDuty"
|
|
- sortable="custom"
|
|
|
|
width="140px"
|
|
width="140px"
|
|
>
|
|
>
|
|
<template slot="header" slot-scope="slot">
|
|
<template slot="header" slot-scope="slot">
|
|
@@ -146,18 +174,17 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <div>{{ scope.row.cloudStudyUseStudentDuty }}人</div>
|
|
|
|
|
|
+ <div>{{ scope.row.limitExchangeNum }}</div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column
|
|
<el-table-column
|
|
align="center"
|
|
align="center"
|
|
prop="cloudStudyUseStudentDuty"
|
|
prop="cloudStudyUseStudentDuty"
|
|
- sortable="custom"
|
|
|
|
width="140px"
|
|
width="140px"
|
|
>
|
|
>
|
|
<template slot="header" slot-scope="slot">
|
|
<template slot="header" slot-scope="slot">
|
|
<div class="titleCell">
|
|
<div class="titleCell">
|
|
- <span>使用期限</span>
|
|
|
|
|
|
+ <span>有效期天数</span>
|
|
<el-tooltip placement="top" popper-class="mTooltip">
|
|
<el-tooltip placement="top" popper-class="mTooltip">
|
|
<div slot="content">自领取之日起多少天有效</div>
|
|
<div slot="content">自领取之日起多少天有效</div>
|
|
<i
|
|
<i
|
|
@@ -173,14 +200,14 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <div>{{ scope.row.cloudStudyUseStudentDuty }}人</div>
|
|
|
|
|
|
+ <div v-if="scope.row.deadline">{{ scope.row.deadline }}天</div>
|
|
|
|
+ <div v-else>--</div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column
|
|
<el-table-column
|
|
align="center"
|
|
align="center"
|
|
prop="cloudStudyUseStudentDuty"
|
|
prop="cloudStudyUseStudentDuty"
|
|
- sortable="custom"
|
|
|
|
- width="140px"
|
|
|
|
|
|
+ width="160px"
|
|
>
|
|
>
|
|
<template slot="header" slot-scope="slot">
|
|
<template slot="header" slot-scope="slot">
|
|
<div class="titleCell">
|
|
<div class="titleCell">
|
|
@@ -200,14 +227,16 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <div>{{ scope.row.cloudStudyUseStudentDuty }}人</div>
|
|
|
|
|
|
+ <div>
|
|
|
|
+ <p>{{ scope.row.effectiveStartTime }}</p>
|
|
|
|
+ <p>{{ scope.row.effectiveExpireTime }}</p>
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column
|
|
<el-table-column
|
|
align="center"
|
|
align="center"
|
|
prop="cloudStudyUseStudentDuty"
|
|
prop="cloudStudyUseStudentDuty"
|
|
- sortable="custom"
|
|
|
|
- width="140px"
|
|
|
|
|
|
+ width="160px"
|
|
>
|
|
>
|
|
<template slot="header" slot-scope="slot">
|
|
<template slot="header" slot-scope="slot">
|
|
<div class="titleCell">
|
|
<div class="titleCell">
|
|
@@ -227,32 +256,71 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <div>{{ scope.row.cloudStudyUseStudentDuty }}人</div>
|
|
|
|
|
|
+ <div>
|
|
|
|
+ <p>{{ scope.row.startDate }}</p>
|
|
|
|
+ <p>{{ scope.row.endDate }}</p>
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column
|
|
<el-table-column
|
|
align="center"
|
|
align="center"
|
|
- prop="studentId"
|
|
|
|
|
|
+ prop="stockCount"
|
|
label="总库存"
|
|
label="总库存"
|
|
></el-table-column>
|
|
></el-table-column>
|
|
<el-table-column
|
|
<el-table-column
|
|
align="center"
|
|
align="center"
|
|
- prop="studentId"
|
|
|
|
|
|
+ prop="warningStockNum"
|
|
label="剩余库存"
|
|
label="剩余库存"
|
|
- ></el-table-column>
|
|
|
|
|
|
+ >
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <div>
|
|
|
|
+ {{ scope.row.stockCount - scope.row.consumeNum }}
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column align="center" prop="status" label="状态">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <div>
|
|
|
|
+ {{ scope.row.status ? "启用" : "停用" }}
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
<el-table-column
|
|
<el-table-column
|
|
align="center"
|
|
align="center"
|
|
prop="studentId"
|
|
prop="studentId"
|
|
- label="状态"
|
|
|
|
- ></el-table-column>
|
|
|
|
- <el-table-column align="center" prop="studentId" label="操作">
|
|
|
|
|
|
+ label="操作"
|
|
|
|
+ width="120px"
|
|
|
|
+ >
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<div>
|
|
<div>
|
|
- <el-button type="text" @click="gotoDetail(scope.row)">查看</el-button>
|
|
|
|
- <el-button type="text">停用</el-button>
|
|
|
|
- <el-button type="text">启用</el-button>
|
|
|
|
- <el-button type="text">修改</el-button>
|
|
|
|
- <el-button type="text">删除</el-button>
|
|
|
|
|
|
+ <auth auths="sysCoupon/updateCoupon">
|
|
|
|
+ <!-- <el-button type="text" @click="gotoDetail(scope.row)"
|
|
|
|
+ >查看</el-button
|
|
|
|
+ > -->
|
|
|
|
+ <el-button
|
|
|
|
+ type="text"
|
|
|
|
+ v-if="scope.row.status"
|
|
|
|
+ @click="stop(scope.row)"
|
|
|
|
+ >停用</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button type="text" v-else @click="start(scope.row)"
|
|
|
|
+ >启用</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button
|
|
|
|
+ type="text"
|
|
|
|
+ v-if="!scope.row.status"
|
|
|
|
+ @click="gotoDetail(scope.row)"
|
|
|
|
+ >修改</el-button
|
|
|
|
+ >
|
|
|
|
+ </auth>
|
|
|
|
+ <auth auths="sysCoupon/delete">
|
|
|
|
+ <el-button
|
|
|
|
+ type="text"
|
|
|
|
+ v-if="!scope.row.consumeNum > 0 && !scope.row.status"
|
|
|
|
+ @click="removeCoupon(scope.row)"
|
|
|
|
+ >删除</el-button
|
|
|
|
+ >
|
|
|
|
+ </auth>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -275,15 +343,21 @@ import axios from "axios";
|
|
import { getToken } from "@/utils/auth";
|
|
import { getToken } from "@/utils/auth";
|
|
import pagination from "@/components/Pagination/index";
|
|
import pagination from "@/components/Pagination/index";
|
|
import load from "@/utils/loading";
|
|
import load from "@/utils/loading";
|
|
|
|
+import { getSysCoupon, resetSysCoupon, delSysCoupon } from "./api";
|
|
|
|
+import { couponTypeList } from "@/utils/searchArray";
|
|
|
|
+import Tooltip from "@/components/Tooltip/index";
|
|
export default {
|
|
export default {
|
|
- components: { pagination },
|
|
|
|
|
|
+ components: { pagination, Tooltip },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ couponTypeList,
|
|
searchForm: {
|
|
searchForm: {
|
|
search: null,
|
|
search: null,
|
|
|
|
+ type: null,
|
|
|
|
+ status: null,
|
|
},
|
|
},
|
|
|
|
|
|
- tableList: [{}],
|
|
|
|
|
|
+ tableList: [],
|
|
organList: [],
|
|
organList: [],
|
|
rules: {
|
|
rules: {
|
|
// 分页规则
|
|
// 分页规则
|
|
@@ -303,16 +377,99 @@ export default {
|
|
this.init();
|
|
this.init();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- init() {},
|
|
|
|
- getList() {},
|
|
|
|
|
|
+ init() {
|
|
|
|
+ this.getList();
|
|
|
|
+ },
|
|
|
|
+ async getList() {
|
|
|
|
+ try {
|
|
|
|
+ const res = await getSysCoupon({
|
|
|
|
+ ...this.searchForm,
|
|
|
|
+ page: this.rules.page,
|
|
|
|
+ rows: this.rules.limit,
|
|
|
|
+ });
|
|
|
|
+ this.tableList = res.data.rows;
|
|
|
|
+ this.rules.total = res.data.total;
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.log(e);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
search() {
|
|
search() {
|
|
this.rules.page = 1;
|
|
this.rules.page = 1;
|
|
this.getList();
|
|
this.getList();
|
|
},
|
|
},
|
|
- onReSet() {},
|
|
|
|
- gotoDetail(row){
|
|
|
|
- this.$router.push('/operateManager/couponUpdate')
|
|
|
|
- }
|
|
|
|
|
|
+ onReSet() {
|
|
|
|
+ this.$refs.searchForm.resetFields();
|
|
|
|
+ this.search();
|
|
|
|
+ },
|
|
|
|
+ gotoDetail(row) {
|
|
|
|
+ if (row) {
|
|
|
|
+ this.$router.push({
|
|
|
|
+ path: "/operateManager/couponUpdate",
|
|
|
|
+ query: { row: JSON.stringify(row) },
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ this.$router.push("/operateManager/couponUpdate");
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ stop(row) {
|
|
|
|
+ this.$confirm("您确定停用优惠券?", "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning",
|
|
|
|
+ })
|
|
|
|
+ .then(async () => {
|
|
|
|
+ try {
|
|
|
|
+ let params = {
|
|
|
|
+ ...row,
|
|
|
|
+ };
|
|
|
|
+ params.status = 0;
|
|
|
|
+ const res = await resetSysCoupon(params);
|
|
|
|
+ this.$message.success("停用成功");
|
|
|
|
+ this.getList();
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.log(e);
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {});
|
|
|
|
+ },
|
|
|
|
+ start(row) {
|
|
|
|
+ this.$confirm("您确定启用优惠券?", "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning",
|
|
|
|
+ })
|
|
|
|
+ .then(async () => {
|
|
|
|
+ try {
|
|
|
|
+ let params = {
|
|
|
|
+ ...row,
|
|
|
|
+ };
|
|
|
|
+ params.status = 1;
|
|
|
|
+ const res = await resetSysCoupon(params);
|
|
|
|
+ this.$message.success("启用成功");
|
|
|
|
+ this.getList();
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.log(e);
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {});
|
|
|
|
+ },
|
|
|
|
+ removeCoupon(row) {
|
|
|
|
+ this.$confirm("您确定删除优惠券?", "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning",
|
|
|
|
+ })
|
|
|
|
+ .then(async () => {
|
|
|
|
+ try {
|
|
|
|
+ const res = await delSysCoupon({ id: row.id });
|
|
|
|
+ this.$message.success("删除成功");
|
|
|
|
+ this.getList();
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.log(e);
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {});
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|