|
@@ -5,6 +5,16 @@
|
|
|
<span class="admin-page-title">优惠券管理</span>
|
|
<span class="admin-page-title">优惠券管理</span>
|
|
|
<div class="admin-page-actions">
|
|
<div class="admin-page-actions">
|
|
|
<el-input v-model="keyword" placeholder="搜索优惠券..." prefix-icon="el-icon-search" clearable @keyup.enter.native="handleSearch" @clear="handleSearch" />
|
|
<el-input v-model="keyword" placeholder="搜索优惠券..." prefix-icon="el-icon-search" clearable @keyup.enter.native="handleSearch" @clear="handleSearch" />
|
|
|
|
|
+ <el-tag
|
|
|
|
|
+ v-if="sortState.length > 0"
|
|
|
|
|
+ closable
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ class="sort-tag"
|
|
|
|
|
+ @close="clearSort"
|
|
|
|
|
+ @click="clearSort"
|
|
|
|
|
+ >
|
|
|
|
|
+ {{ sortLabel }}
|
|
|
|
|
+ </el-tag>
|
|
|
<el-button type="primary" size="small" @click="handleCreate">新建优惠券</el-button>
|
|
<el-button type="primary" size="small" @click="handleCreate">新建优惠券</el-button>
|
|
|
<el-button type="success" size="small" @click="handleBatchIssue">批量发放</el-button>
|
|
<el-button type="success" size="small" @click="handleBatchIssue">批量发放</el-button>
|
|
|
</div>
|
|
</div>
|
|
@@ -18,7 +28,9 @@
|
|
|
<template slot-scope="{ row }">
|
|
<template slot-scope="{ row }">
|
|
|
<el-tag size="mini">{{ typeLabel(row.type) }}</el-tag>
|
|
<el-tag size="mini">{{ typeLabel(row.type) }}</el-tag>
|
|
|
</template>
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
|
|
|
|
+ <template slot="header">
|
|
|
|
|
+ <span class="sort-header" @click.stop="onSortClick( + col_key + ',$event)" @dblclick.stop="onSortToggle( + col_key + )">名称{{ sortIcon( + col_key + ) }}</span>
|
|
|
|
|
+ </template></el-table-column>
|
|
|
<el-table-column label="面值/折扣" width="100">
|
|
<el-table-column label="面值/折扣" width="100">
|
|
|
<template slot-scope="{ row }">
|
|
<template slot-scope="{ row }">
|
|
|
<span v-if="row.type === 'DISCOUNT'">{{ (row.discountRate / 100).toFixed(1) }}折</span>
|
|
<span v-if="row.type === 'DISCOUNT'">{{ (row.discountRate / 100).toFixed(1) }}折</span>
|
|
@@ -188,10 +200,12 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+import SortMixin from '@/mixins/SortMixin'
|
|
|
import { getCouponList, createCoupon, updateCoupon, deleteCoupon, batchIssueCoupons } from '@/api/coupon'
|
|
import { getCouponList, createCoupon, updateCoupon, deleteCoupon, batchIssueCoupons } from '@/api/coupon'
|
|
|
import ProductPicker from '@/components/ProductPicker'
|
|
import ProductPicker from '@/components/ProductPicker'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
|
|
+ mixins: [SortMixin],
|
|
|
name: 'CouponManagement',
|
|
name: 'CouponManagement',
|
|
|
components: { ProductPicker },
|
|
components: { ProductPicker },
|
|
|
computed: {
|
|
computed: {
|
|
@@ -258,7 +272,7 @@ export default {
|
|
|
async loadData() {
|
|
async loadData() {
|
|
|
this.loading = true
|
|
this.loading = true
|
|
|
try {
|
|
try {
|
|
|
- const res = await getCouponList({ page: this.page, size: this.size, keyword: this.keyword || undefined })
|
|
|
|
|
|
|
+ const res = await getCouponList({ page: this.page, size: this.size, keyword: this.keyword || undefined }, sort: this.sortState.length > 0 ? this.sortState : undefined)
|
|
|
if (res.data) {
|
|
if (res.data) {
|
|
|
this.list = res.data.records || res.data.list || res.data
|
|
this.list = res.data.records || res.data.list || res.data
|
|
|
this.total = res.data.total || this.list.length
|
|
this.total = res.data.total || this.list.length
|
|
@@ -372,7 +386,7 @@ export default {
|
|
|
this.batchUserIds = ''
|
|
this.batchUserIds = ''
|
|
|
this.batchDialogVisible = true
|
|
this.batchDialogVisible = true
|
|
|
try {
|
|
try {
|
|
|
- const res = await getCouponList({ page: 1, size: 999 })
|
|
|
|
|
|
|
+ const res = await getCouponList({ page: 1, size: 999 }, sort: this.sortState.length > 0 ? this.sortState : undefined)
|
|
|
this.couponOptions = res.data.records || res.data.list || res.data || []
|
|
this.couponOptions = res.data.records || res.data.list || res.data || []
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
console.error(e)
|
|
console.error(e)
|
|
@@ -424,4 +438,19 @@ export default {
|
|
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|
|
|
.coupon-management { padding: 20px; }
|
|
.coupon-management { padding: 20px; }
|
|
|
|
|
+
|
|
|
|
|
+.sort-header {
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ user-select: none;
|
|
|
|
|
+ font-weight: 500;
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+}
|
|
|
|
|
+.sort-header:hover {
|
|
|
|
|
+ color: #409eff;
|
|
|
|
|
+}
|
|
|
|
|
+.sort-tag {
|
|
|
|
|
+ margin-left: 8px;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ white-space: nowrap;
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|