|
@@ -16,16 +16,16 @@
|
|
|
</div>
|
|
|
<div class="filter-control">
|
|
|
<span>优惠状态:</span>
|
|
|
- <el-select v-model="listQuery.couponStatus" style="width:120px;" clearable @change="getList">
|
|
|
+ <el-select v-model="listQuery.status" style="width:120px;" clearable @change="getList">
|
|
|
<el-option value="" label="请选择" />
|
|
|
- <el-option :value="1" label="未生效" />
|
|
|
- <el-option :value="2" label="已生效" />
|
|
|
- <el-option :value="3" label="已关闭" />
|
|
|
- <el-option :value="4" label="已失效" />
|
|
|
+ <el-option :value="0" label="未生效" />
|
|
|
+ <el-option :value="1" label="已生效" />
|
|
|
+ <el-option :value="2" label="已关闭" />
|
|
|
+ <el-option :value="3" label="已失效" />
|
|
|
</el-select>
|
|
|
</div>
|
|
|
<div class="filter-control">
|
|
|
- <span>购买时间:</span>
|
|
|
+ <span>优惠月份:</span>
|
|
|
<el-date-picker
|
|
|
v-model="time"
|
|
|
type="daterange"
|
|
@@ -44,20 +44,30 @@
|
|
|
</div>
|
|
|
<el-table :data="tableData" height="550" border style="width: 100%">
|
|
|
<el-table-column label="优惠月份" width="180">
|
|
|
- <template>
|
|
|
- <el-table-column label="开始时间" prop="couponStartTime" /> - <el-table-column label="结束时间" prop="couponEndTime" />
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ {{ row.useTime }} -- {{ row.endTime }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="coupon" label="优惠券" width="780">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <p v-for="item in row.couponList" :key="item.index">
|
|
|
+ 优惠券{{ item.index + 1 }} : <b>{{ item.couponType === 0 ? '活动券' : item.couponType === 1 ? '品类券' : '店铺券' }}</b>
|
|
|
+ ¥{{ item.couponAmount }},满{{ item.touchPrice }}可用
|
|
|
+ {{ item.productType ? item.productType === '1' ? ',全商城商品通用' : ',仅可购买指定商品' : '' }}
|
|
|
+ {{ item.categoryType ? item.categoryType === '1' ? ',仅可购买产品类商品' : ',仅可购买仪器类商品' : '' }}
|
|
|
+ <span v-if="item.couponType === 3">,仅可购买店铺“{{ item.shopName }}”的商品</span>
|
|
|
+ </p>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="coupon" label="优惠券" width="280" />
|
|
|
- <el-table-column prop="couponStatus" label="优惠状态">
|
|
|
+ <el-table-column prop="status" label="优惠状态">
|
|
|
<template slot-scope="{ row }">
|
|
|
- <span v-if="row.couponStatus === 0" class="el-span-zero">
|
|
|
+ <span v-if="row.status === '0'" class="el-span-zero">
|
|
|
未生效
|
|
|
</span>
|
|
|
- <span v-else-if="row.couponStatus === 1" class="el-span-one">
|
|
|
+ <span v-else-if="row.status === '1'" class="el-span-one">
|
|
|
已生效
|
|
|
</span>
|
|
|
- <span v-else-if="row.couponStatus === 2" class="el-span-two">
|
|
|
+ <span v-else-if="row.status === '2'" class="el-span-two">
|
|
|
已关闭
|
|
|
</span>
|
|
|
<span v-else class="el-span-three">
|
|
@@ -65,13 +75,21 @@
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column label="操作">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-button type="text">编辑</el-button>
|
|
|
+ <el-button type="text" :hidden="row.status !== 2 ? false : true" @click="closeCoupon(row)">关闭</el-button>
|
|
|
+ <el-button type="text" :hidden="row.status === 2 ? false : true" @click="openCoupon(row)">开启</el-button>
|
|
|
+ <el-button type="text" @click="deleteCoupon(row)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
|
|
|
<!-- 页码 -->
|
|
|
<pagination
|
|
|
:total="total"
|
|
|
- :page-sizes="[100]"
|
|
|
- :page-size="100"
|
|
|
+ :page-sizes="[20, 30, 50, 100]"
|
|
|
+ :page-size="20"
|
|
|
:page.sync="listQuery.pageNum"
|
|
|
:limit.sync="listQuery.pageSize"
|
|
|
/>
|
|
@@ -99,9 +117,18 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-tabs>
|
|
|
+ <el-dialog title="提示" :visible.sync="dialogTableVisible" width="50%">
|
|
|
+ <span>{{ msg }}</span>
|
|
|
+ <div slot="footer">
|
|
|
+ <el-button type="primary" @click="renovate()">确定</el-button>
|
|
|
+ <el-button type="primary" @click="dialogTableVisible = false">取消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+import { fetchCouponList, fetchCloseCoupon, fetchOpenCoupon, fetchDeleteCoupon } from '@/api/member/coupon/coupon'
|
|
|
+
|
|
|
const defaultCoupon = {
|
|
|
type: '',
|
|
|
money: '',
|
|
@@ -165,7 +192,7 @@ export default {
|
|
|
pickerOptions,
|
|
|
listQuery: {
|
|
|
couponType: '',
|
|
|
- couponStatus: '',
|
|
|
+ status: '',
|
|
|
couponStartTime: '',
|
|
|
couponEndTime: '',
|
|
|
pageNum: 0,
|
|
@@ -174,30 +201,10 @@ export default {
|
|
|
// 超级会员优惠券
|
|
|
total: 0,
|
|
|
time: '',
|
|
|
+ tableData: [],
|
|
|
couponList: [],
|
|
|
- tableData: [
|
|
|
- {
|
|
|
- couponStartTime: '2016-05-03',
|
|
|
- couponEndTime: '2016-08-03',
|
|
|
- coupon: '王小虎',
|
|
|
- couponStatus: 0
|
|
|
- }, {
|
|
|
- couponStartTime: '2016-05-03',
|
|
|
- couponEndTime: '2016-08-03',
|
|
|
- coupon: '王小虎',
|
|
|
- couponStatus: 1
|
|
|
- }, {
|
|
|
- couponStartTime: '2016-05-03',
|
|
|
- couponEndTime: '2016-08-03',
|
|
|
- coupon: '王小虎',
|
|
|
- couponStatus: 2
|
|
|
- }, {
|
|
|
- couponStartTime: '2016-05-03',
|
|
|
- couponEndTime: '2016-08-03',
|
|
|
- coupon: '王小虎',
|
|
|
- couponStatus: 3
|
|
|
- }
|
|
|
- ]
|
|
|
+ dialogTableVisible: false,
|
|
|
+ msg: ''
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -205,8 +212,51 @@ export default {
|
|
|
this.getList()
|
|
|
},
|
|
|
methods: {
|
|
|
- getList() {
|
|
|
- console.log(1111)
|
|
|
+ async getList() {
|
|
|
+ if (this.time && this.time.length > 0) {
|
|
|
+ this.listQuery.couponStartTime = this.time[0]
|
|
|
+ this.listQuery.couponEndTime = this.time[1]
|
|
|
+ } else {
|
|
|
+ this.listQuery.couponStartTime = ''
|
|
|
+ this.listQuery.couponEndTime = ''
|
|
|
+ }
|
|
|
+ const res = await fetchCouponList(this.listQuery)
|
|
|
+ this.tableData = res.data.results
|
|
|
+ this.total = res.data.totalRecord
|
|
|
+ },
|
|
|
+ // 关闭超级会员专属优惠券
|
|
|
+ async closeCoupon(row) {
|
|
|
+ const res = await fetchCloseCoupon(row.id)
|
|
|
+ this.dialogTableVisible = true
|
|
|
+ if (res.code === 1) {
|
|
|
+ this.msg = '关闭超级会员专属优惠券完成'
|
|
|
+ } else {
|
|
|
+ this.msg = '关闭超级会员专属优惠券失败'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 开启超级会员专属优惠券
|
|
|
+ async openCoupon(row) {
|
|
|
+ const res = await fetchOpenCoupon(row.id)
|
|
|
+ this.dialogTableVisible = true
|
|
|
+ if (res.code === 1) {
|
|
|
+ this.msg = '开启超级会员专属优惠券完成'
|
|
|
+ } else {
|
|
|
+ this.msg = '开启超级会员专属优惠券失败'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 删除超级会员专属优惠券
|
|
|
+ async deleteCoupon(row) {
|
|
|
+ const res = await fetchDeleteCoupon(row.id)
|
|
|
+ this.dialogTableVisible = true
|
|
|
+ if (res.code === 1) {
|
|
|
+ this.msg = '删除超级会员专属优惠券完成'
|
|
|
+ } else {
|
|
|
+ this.msg = '删除超级会员专属优惠券失败'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ renovate() {
|
|
|
+ this.dialogTableVisible = false
|
|
|
+ this.getlist()
|
|
|
},
|
|
|
handleAdd() {
|
|
|
// 新增优惠券
|