|
@@ -1,17 +1,132 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
- <el-button @click="$router.push({ name: 'CouponPkgAdd' })">添加券包</el-button>
|
|
|
- <el-button @click="$router.push({ name: 'CouponPkgQuery' })">查看券包</el-button>
|
|
|
- <el-button @click="$router.push({ name: 'CouponPkgEdit' })">修改券包</el-button>
|
|
|
+ <div class="app-container coupon-list">
|
|
|
+ <el-form v-show="showSearch" :model="queryParams" ref="queryForm" :inline="true" size="small">
|
|
|
+ <el-form-item label="券名称">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.title"
|
|
|
+ placeholder="请输入券名称"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="queryParams.pageNum = 1;getList()"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="el-icon-search" @click="queryParams.pageNum = 1;getList()">搜索</el-button>
|
|
|
+ <el-button icon="el-icon-refresh" @click="getList(true)">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="10">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ size="mini"
|
|
|
+ @click="$router.push({ name: 'CouponPkgAdd' })"
|
|
|
+ v-hasPermi="['business:couponPkg:add']"
|
|
|
+ >生成券包</el-button>
|
|
|
+ </el-col>
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+ <el-table v-loading="loading" :data="tableData">
|
|
|
+ <el-table-column label="券包编号" prop="id" width="80" />
|
|
|
+ <el-table-column label="券包名称" prop="title" />
|
|
|
+ <el-table-column label="券数量" prop="couponNum" />
|
|
|
+ <el-table-column label="总面值" prop="facePrice">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ ¥{{$numberFormat(row.discount)}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="状态" prop="status">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-tag v-if="row.status == 0">待上架</el-tag>
|
|
|
+ <el-tag v-else-if="row.status == 1">上架</el-tag>
|
|
|
+ <el-tag v-else-if="row.status == 2">下架</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column fixed="right" align="right" label="操作" width="150">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-button v-hasPermi="['business:couponPkg:query']" type="text" @click="$router.push({ name: 'CouponPkgQuery', query: { id: row.couponId } })">查看</el-button>
|
|
|
+ <el-button v-if="row.status === 0" v-hasPermi="['business:couponPkg:edit']" type="text" @click="$router.push({ name: 'CouponPkgEdit', query: { id: row.couponId } })">编辑</el-button>
|
|
|
+ <el-button v-if="JSON.parse(row.status).value === 'off' || JSON.parse(row.status).value === 'init'" v-hasPermi="['business:couponPkg:on']" type="text" @click="setStatus(row, 'on')">上架</el-button>
|
|
|
+ <el-button v-if="JSON.parse(row.status).value === 'on'" v-hasPermi="['business:couponPkg:off']" type="text" @click="setStatus(row, 'off')">下架</el-button>
|
|
|
+ <el-button v-if="JSON.parse(row.status).value === 'init'" v-hasPermi="['business:couponPkg:remove']" class="del" type="text" @click="del(row)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList()" />
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+import { getCouponList, delCoupon, setCouponStatus } from '@/api/business/couponPkg'
|
|
|
+import { accDiv } from '@/utils/util'
|
|
|
export default {
|
|
|
data() {
|
|
|
- return {};
|
|
|
+ return {
|
|
|
+ loading: false,
|
|
|
+ showSearch: true,
|
|
|
+ queryParams: {},
|
|
|
+ tableData: [],
|
|
|
+ total: 0
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList(true)
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getList(reset) {
|
|
|
+ if (this.loading) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.loading = true
|
|
|
+ if (reset) {
|
|
|
+ this.queryParams = { pageNum: 1, pageSize: 20 }
|
|
|
+ }
|
|
|
+ getCouponList('pageNum='+this.queryParams.pageNum + '&pageSize='+this.queryParams.pageSize+'&', this.queryParams).then(res => {
|
|
|
+ this.loading = false
|
|
|
+ if (res.code === 0) {
|
|
|
+ console.log(res)
|
|
|
+ this.tableData = res.rows
|
|
|
+ this.total = res.total
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ setStatus(item, status) {
|
|
|
+ this.$confirm(`确认${status === 'on' ? '上架' : '下架'}券 “${item.title}” 吗?`, `${status === 'on' ? '上架' : '下架'}券`, {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ setCouponStatus({
|
|
|
+ couponId: item.couponId,
|
|
|
+ status
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$message.success('操作已完成!')
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ del(item) {
|
|
|
+ this.$confirm(`确认删除券 “${item.title}” 吗?`, '删除券', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ delCoupon(item.couponId).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$message.success('操作已完成!')
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
},
|
|
|
- methods: {},
|
|
|
};
|
|
|
</script>
|
|
|
<style>
|
|
|
-</style>
|
|
|
+</style>
|