优惠券修改
This commit is contained in:
79
src/api/coupon.js
Normal file
79
src/api/coupon.js
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取优惠券列表
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getTbShopCoupon(params) {
|
||||||
|
return request({
|
||||||
|
url: '/api/tbShopCoupon',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
...params
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取优惠券详情
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getTbShopCouponInfo(id) {
|
||||||
|
return request({
|
||||||
|
url: '/api/tbShopCoupon/' + id,
|
||||||
|
method: 'get',
|
||||||
|
params: {}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增加优惠券
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function addTbShopCoupon(params) {
|
||||||
|
return request({
|
||||||
|
url: '/api/tbShopCoupon',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
...params
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除优惠券
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function delTbShopCoupon(params) {
|
||||||
|
return request({
|
||||||
|
url: '/api/tbShopCoupon',
|
||||||
|
method: 'delete',
|
||||||
|
data: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取领取列表
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function queryReceive(params) {
|
||||||
|
return request({
|
||||||
|
url: '/api/tbShopCoupon/queryReceive',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
...params
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取领取列表
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function delReceive(params) {
|
||||||
|
return request({
|
||||||
|
url: '/api/tbShopCoupon/receive',
|
||||||
|
method: 'delete',
|
||||||
|
data: params
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -1,388 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<el-dialog :title="form.id ? '编辑酒品' : '添加酒品'" :visible.sync="dialogVisible" @close="reset">
|
|
||||||
<div class="head-container" v-if="!form.id">
|
|
||||||
<div class="tab_wrap">
|
|
||||||
<div class="tab" :style="{ '--index': form.source }">
|
|
||||||
<div class="item" v-for="(item, index) in tabs" :key="item.value"
|
|
||||||
:class="{ active: index == form.source }" @click="tabChange(item)">
|
|
||||||
{{ item.label }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
|
|
||||||
<template v-if="form.source == 0">
|
|
||||||
<el-form-item label="酒品名" prop="name">
|
|
||||||
<el-input v-model="form.name" placeholder="请输入酒品名" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="酒品图片">
|
|
||||||
<uploadImg ref="uploadImg" :limit="1" @success="e => form.imgUrl = e[0]"
|
|
||||||
@remove="form.imgUrl = ''" />
|
|
||||||
</el-form-item>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
<template v-if="!form.id">
|
|
||||||
<el-form-item label="选择商品" prop="name">
|
|
||||||
<div>
|
|
||||||
<el-button type="primary" icon="el-icon-plus"
|
|
||||||
@click="$refs.shopListRef.show([...productIds])">
|
|
||||||
添加商品
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
<div class="shop_list">
|
|
||||||
<div class="item_wrap" v-for="(item, index) in productIds" :key="item.id"
|
|
||||||
@click="productIds.splice(index, 1)">
|
|
||||||
<div class="item" :data-index="index + 1">
|
|
||||||
<el-image :src="item.coverImg" style="width: 100%;height: 100%;"></el-image>
|
|
||||||
</div>
|
|
||||||
<div class="name">{{ item.name }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</el-form-item>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
<el-form-item label="商品">
|
|
||||||
<div class="goods_info">
|
|
||||||
<el-image :src="form.imgUrl" style="width: 50px;height: 50px;"></el-image>
|
|
||||||
<div class="info">{{ form.name }}</div>
|
|
||||||
</div>
|
|
||||||
</el-form-item>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
<el-form-item label="单位">
|
|
||||||
<el-input v-model="form.unit" placeholder="请输入单位" style="width: 200px;" />
|
|
||||||
<!-- <el-select v-model="form.unitId" placeholder="请选择单位" style="width: 200px;" @change="selectUnitt">
|
|
||||||
<el-option :label="item.name" :value="item.id" v-for="item in units" :key="item.id"></el-option>
|
|
||||||
</el-select>
|
|
||||||
<el-button type="primary" plain icon="el-icon-plus"
|
|
||||||
@click="$refs.addUnitRef.show()">添加单位</el-button> -->
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="有效期(天)">
|
|
||||||
<el-input-number v-model="form.period" controls-position="right" step-strictly :min="1"
|
|
||||||
placeholder="请输入有效期(天)"></el-input-number>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<span slot="footer" class="dialog-footer">
|
|
||||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
||||||
<el-button type="primary" @click="onSubmitHandle">确 定</el-button>
|
|
||||||
</span>
|
|
||||||
</el-dialog>
|
|
||||||
<addUnit ref="addUnitRef" @success="tbShopUnit" />
|
|
||||||
<shopList ref="shopListRef" @success="slectShop" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { tbShopStorageGood } from '@/api/application'
|
|
||||||
import { queryAllShopUser, tbShopUnit } from '@/api/shop'
|
|
||||||
import uploadImg from '@/components/uploadImg'
|
|
||||||
import addUnit from '@/views/product/components/addUnit'
|
|
||||||
import shopList from '@/components/shopList'
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
uploadImg,
|
|
||||||
addUnit,
|
|
||||||
shopList
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
const nameValidator = (rule, value, callback) => {
|
|
||||||
if (this.form.source == 0) {
|
|
||||||
if (!this.form.name) {
|
|
||||||
callback(new Error('请输入酒名名'))
|
|
||||||
} else {
|
|
||||||
callback()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!this.productIds.length) {
|
|
||||||
callback(new Error('请选择商品'))
|
|
||||||
} else {
|
|
||||||
callback()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
dialogVisible: false,
|
|
||||||
tabs: [
|
|
||||||
{
|
|
||||||
value: 0,
|
|
||||||
label: '手动添加'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 1,
|
|
||||||
label: '从商品添加'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
units: [],
|
|
||||||
loading: false,
|
|
||||||
options: [],
|
|
||||||
productIds: [],
|
|
||||||
form: {
|
|
||||||
name: '',
|
|
||||||
imgUrl: '',
|
|
||||||
source: 0,
|
|
||||||
id: '',
|
|
||||||
goods: [
|
|
||||||
{
|
|
||||||
imgUrl: '',
|
|
||||||
name: '',
|
|
||||||
}
|
|
||||||
],
|
|
||||||
period: '',
|
|
||||||
unit: ''
|
|
||||||
},
|
|
||||||
resetForm: '',
|
|
||||||
rules: {
|
|
||||||
name: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
validator: nameValidator,
|
|
||||||
trigger: 'change'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.resetForm = { ...this.form }
|
|
||||||
// this.getTableData()
|
|
||||||
this.tbShopUnit()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
slectShop(res) {
|
|
||||||
if (this.productIds.length) {
|
|
||||||
res.map(async item => {
|
|
||||||
if (!await this.checkShop(item.id)) {
|
|
||||||
this.productIds.push({ ...item })
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.productIds = res
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selectUnitt(e) {
|
|
||||||
this.form.unit = this.units.find(item => item.id == e).name
|
|
||||||
},
|
|
||||||
// 获取单位
|
|
||||||
async tbShopUnit() {
|
|
||||||
try {
|
|
||||||
const res = await tbShopUnit({
|
|
||||||
shopId: localStorage.getItem('shopId'),
|
|
||||||
sort: 'id',
|
|
||||||
page: 0,
|
|
||||||
size: 100
|
|
||||||
})
|
|
||||||
this.units = res.content
|
|
||||||
} catch (error) { }
|
|
||||||
},
|
|
||||||
// 切换类型
|
|
||||||
tabChange(item) {
|
|
||||||
this.form.source = this.tabs.findIndex(i => i.value == item.value)
|
|
||||||
},
|
|
||||||
// 获取用户列表
|
|
||||||
async getTableData(query = '') {
|
|
||||||
this.loading = true
|
|
||||||
try {
|
|
||||||
const res = await queryAllShopUser({
|
|
||||||
telephone: query,
|
|
||||||
})
|
|
||||||
this.loading = false
|
|
||||||
this.options = res.content
|
|
||||||
} catch (error) {
|
|
||||||
this.loading = false
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 提交
|
|
||||||
onSubmitHandle() {
|
|
||||||
this.$refs.form.validate(async valid => {
|
|
||||||
if (valid) {
|
|
||||||
try {
|
|
||||||
if (this.form.source == 0) {
|
|
||||||
// 手动大导入
|
|
||||||
this.form.goods = [{
|
|
||||||
name: this.form.name,
|
|
||||||
imgUrl: this.form.imgUrl
|
|
||||||
}]
|
|
||||||
} else {
|
|
||||||
this.form.goods = this.productIds.map(item => {
|
|
||||||
return {
|
|
||||||
name: item.name,
|
|
||||||
imgUrl: item.coverImg
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
let res = await tbShopStorageGood(this.form, this.form.id ? 'put' : 'post')
|
|
||||||
this.$emit('success', res)
|
|
||||||
this.close()
|
|
||||||
this.$notify({
|
|
||||||
title: '成功',
|
|
||||||
message: `${this.form.id ? '编辑' : '添加'}成功`,
|
|
||||||
type: 'success'
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
show(obj) {
|
|
||||||
this.dialogVisible = true
|
|
||||||
if (obj && obj.id) {
|
|
||||||
this.form = obj
|
|
||||||
if (obj.imgUrl && obj.source == 0) {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.$refs.uploadImg.fileList = [
|
|
||||||
{
|
|
||||||
url: obj.imgUrl
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}, 100)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
close() {
|
|
||||||
this.dialogVisible = false
|
|
||||||
},
|
|
||||||
reset() {
|
|
||||||
if (this.form.source == 0) {
|
|
||||||
this.$refs.uploadImg.clearFiles()
|
|
||||||
}
|
|
||||||
this.form = { ...this.resetForm }
|
|
||||||
this.$refs.form.resetFields()
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.goods_info {
|
|
||||||
background-color: #f9f9f9;
|
|
||||||
padding: 10px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.info {
|
|
||||||
flex: 1;
|
|
||||||
padding-left: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.head-container {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tab_wrap {
|
|
||||||
background-color: #DCF0E8;
|
|
||||||
padding: 4px;
|
|
||||||
|
|
||||||
.tab {
|
|
||||||
--w: 120px;
|
|
||||||
height: 35px;
|
|
||||||
display: flex;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
|
|
||||||
&::after {
|
|
||||||
content: "";
|
|
||||||
width: var(--w);
|
|
||||||
height: inherit;
|
|
||||||
background-color: #39D47A;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: calc(var(--index) * var(--w));
|
|
||||||
z-index: 1;
|
|
||||||
transition: left .3s ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
.item {
|
|
||||||
width: var(--w);
|
|
||||||
height: inherit;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
color: #39D47A;
|
|
||||||
transition: all .1s ease-in-out .15s;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.active {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.shop_list {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
|
|
||||||
.item_wrap {
|
|
||||||
$size: 80px;
|
|
||||||
|
|
||||||
.item {
|
|
||||||
$radius: 4px;
|
|
||||||
width: $size;
|
|
||||||
height: $size;
|
|
||||||
border-radius: $radius;
|
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
margin-right: 10px;
|
|
||||||
margin-top: 10px;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::after {
|
|
||||||
content: attr(data-index);
|
|
||||||
font-size: 12px;
|
|
||||||
height: 20px;
|
|
||||||
display: flex;
|
|
||||||
padding: 0 10px;
|
|
||||||
border-radius: 0 0 $radius 0;
|
|
||||||
align-items: center;
|
|
||||||
background-color: rgba(0, 0, 0, 0.3);
|
|
||||||
backdrop-filter: blur(10px);
|
|
||||||
color: #fff;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
z-index: 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
content: '删除';
|
|
||||||
font-size: 12px;
|
|
||||||
width: 100%;
|
|
||||||
height: 20px;
|
|
||||||
display: flex;
|
|
||||||
padding: 0 10px;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background-color: rgba(0, 0, 0, 0.3);
|
|
||||||
backdrop-filter: blur(10px);
|
|
||||||
color: #fff;
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
z-index: 10;
|
|
||||||
transition: all .1s ease-in-out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.name {
|
|
||||||
width: $size;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,145 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="head-container">
|
|
||||||
<div class="head-container">
|
|
||||||
<el-form :model="query" inline>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button type="primary" @click="$refs.addModal.show()">添加酒品</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="搜索">
|
|
||||||
<el-input v-model="query.name" placeholder="酒名"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
|
||||||
<el-button @click="resetHandle">重置</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
</div>
|
|
||||||
<div class="head-container">
|
|
||||||
<el-table :data="tableData.data" v-loading="tableData.loading">
|
|
||||||
<el-table-column label="酒名" prop="name">
|
|
||||||
<template v-slot="scope">
|
|
||||||
<div style="display: flex;align-items: center;">
|
|
||||||
<el-image :src="scope.row.imgUrl"
|
|
||||||
style="width:40px;height: 40px;border-radius: 4px;background-color: #efefef;">
|
|
||||||
<div class="img_error" slot="error">
|
|
||||||
<i class="icon el-icon-document-delete"></i>
|
|
||||||
</div>
|
|
||||||
</el-image>
|
|
||||||
<span style="margin-left: 10px;">{{ scope.row.name }}</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="单位" prop="unit">
|
|
||||||
<template v-slot="scope">
|
|
||||||
<el-tag type="primary">{{ scope.row.unit }}</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="有效期(天)" prop="period"></el-table-column>
|
|
||||||
<el-table-column label="来源" prop="source">
|
|
||||||
<template v-slot="scope">
|
|
||||||
<span v-if="scope.row.source == 0">手动导入</span>
|
|
||||||
<span v-if="scope.row.source == 1">商品导入</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" width="120">
|
|
||||||
<template v-slot="scope">
|
|
||||||
<div style="display: flex;gap: 10px;">
|
|
||||||
<el-button type="text"
|
|
||||||
@click="$refs.winAddModal.show({ name: scope.row.name, imgUrl: scope.row.imgUrl, expDay: scope.row.period, unit: scope.row.unit }, true)">存酒</el-button>
|
|
||||||
<el-button type="text" @click="$refs.addModal.show(scope.row)">编辑</el-button>
|
|
||||||
<el-popconfirm title="确定删除吗?" @confirm="delHandle(scope.row)">
|
|
||||||
<el-button type="text" slot="reference">删除</el-button>
|
|
||||||
</el-popconfirm>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</div>
|
|
||||||
<div class="head-container">
|
|
||||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
|
||||||
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
|
||||||
</div>
|
|
||||||
<addModal ref="addModal" @success="getTableData" />
|
|
||||||
<winAddModal ref="winAddModal" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { tbShopStorageGoodlist, tbShopStorageGood } from '@/api/application'
|
|
||||||
import addModal from './addModal'
|
|
||||||
import winAddModal from '../winestorage/addModal'
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
addModal,
|
|
||||||
winAddModal
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
statusList: [
|
|
||||||
{
|
|
||||||
value: 0,
|
|
||||||
label: '已取完'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 1,
|
|
||||||
label: '未取完'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
query: {
|
|
||||||
name: ""
|
|
||||||
},
|
|
||||||
tableData: {
|
|
||||||
data: [],
|
|
||||||
page: 0,
|
|
||||||
size: 10,
|
|
||||||
loading: false,
|
|
||||||
total: 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.getTableData()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
// 删除
|
|
||||||
async delHandle(row) {
|
|
||||||
try {
|
|
||||||
let obj = { ...row }
|
|
||||||
obj.isDel = 1
|
|
||||||
await tbShopStorageGood(obj, 'put')
|
|
||||||
this.$notify.success('删除成功')
|
|
||||||
this.getTableData()
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 重置查询
|
|
||||||
resetHandle() {
|
|
||||||
this.tableData.page = 0;
|
|
||||||
this.query.name = ''
|
|
||||||
this.getTableData()
|
|
||||||
},
|
|
||||||
// 分页回调
|
|
||||||
paginationChange(e) {
|
|
||||||
this.tableData.page = e - 1;
|
|
||||||
this.getTableData()
|
|
||||||
},
|
|
||||||
// 获取商品列表
|
|
||||||
async getTableData() {
|
|
||||||
this.tableData.loading = true
|
|
||||||
try {
|
|
||||||
const res = await tbShopStorageGoodlist({
|
|
||||||
name: this.query.name,
|
|
||||||
page: this.tableData.page,
|
|
||||||
size: this.tableData.size
|
|
||||||
})
|
|
||||||
this.tableData.loading = false
|
|
||||||
this.tableData.data = res.content
|
|
||||||
this.tableData.total = res.totalElements
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,188 +0,0 @@
|
|||||||
<template>
|
|
||||||
<el-dialog :title="form.id ? '编辑存酒' : '添加存酒'" width="500px" :visible.sync="dialogVisible" @close="reset">
|
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
|
|
||||||
<template v-if="!form.id">
|
|
||||||
<el-form-item label="选择用户" prop="userid">
|
|
||||||
<el-select v-model="form.userid" placeholder="请输入用户昵称" filterable remote
|
|
||||||
:remote-method="queryAllShopUser" :loading="loading" @change="userChange">
|
|
||||||
<el-option v-for="item in options" :key="item.id" :label="`${item.nickName}-${item.telephone}`"
|
|
||||||
:value="item.id">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="选择酒品">
|
|
||||||
<el-select v-model="form.name" @change="wineChange" v-if="!wine">
|
|
||||||
<el-option :label="item.name" :value="item.name" v-for="(item, index) in wineList"
|
|
||||||
:key="index"></el-option>
|
|
||||||
</el-select>
|
|
||||||
<div class="goods_info" v-else>
|
|
||||||
<el-image :src="form.imgUrl" style="width: 50px;height: 50px;"></el-image>
|
|
||||||
<div class="info">{{ form.name }}</div>
|
|
||||||
</div>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="数量">
|
|
||||||
<el-input-number v-model="form.num" :step="1" step-strictly :min="1"></el-input-number>
|
|
||||||
</el-form-item>
|
|
||||||
</template>
|
|
||||||
<el-form-item label="数量" v-else>
|
|
||||||
<el-input-number v-model="num" :step="1" step-strictly :min="1" :max="form.num"></el-input-number>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<span slot="footer" class="dialog-footer">
|
|
||||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
||||||
<el-button type="primary" @click="onSubmitHandle">确 定</el-button>
|
|
||||||
</span>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { queryAllShopUser } from '@/api/shop'
|
|
||||||
import { tbShopStorageGoodlist, storageWin, storagePut } from '@/api/application'
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
dialogVisible: false,
|
|
||||||
loading: false,
|
|
||||||
options: [],
|
|
||||||
num: '',
|
|
||||||
wine: false,
|
|
||||||
form: {
|
|
||||||
id: '',
|
|
||||||
imgUrl: '',
|
|
||||||
name: '',
|
|
||||||
nickname: '',
|
|
||||||
num: 1,
|
|
||||||
status: '',
|
|
||||||
telphone: '',
|
|
||||||
unit: '',
|
|
||||||
userid: '',
|
|
||||||
expDay: ''
|
|
||||||
},
|
|
||||||
resetForm: '',
|
|
||||||
rules: {
|
|
||||||
userid: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: ' ',
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
wineList: []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.resetForm = { ...this.form }
|
|
||||||
this.queryAllShopUser()
|
|
||||||
this.tbShopStorageGoodlist()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
// 选择用户
|
|
||||||
userChange(e) {
|
|
||||||
let user = this.options.find(item => item.id == e)
|
|
||||||
this.form.nickname = user.nickName
|
|
||||||
this.form.telphone = user.telephone
|
|
||||||
},
|
|
||||||
// 选择酒品
|
|
||||||
wineChange(e) {
|
|
||||||
let wine = this.wineList.find(item => item.name == e)
|
|
||||||
this.form.imgUrl = wine.imgUrl
|
|
||||||
this.form.expDay = wine.period
|
|
||||||
this.form.unit = wine.unit
|
|
||||||
},
|
|
||||||
// 获取酒品列表
|
|
||||||
async tbShopStorageGoodlist() {
|
|
||||||
try {
|
|
||||||
const res = await tbShopStorageGoodlist({
|
|
||||||
page: 0,
|
|
||||||
size: 100
|
|
||||||
})
|
|
||||||
this.wineList = res.content
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 获取用户列表
|
|
||||||
async queryAllShopUser(query = '') {
|
|
||||||
this.loading = true
|
|
||||||
try {
|
|
||||||
const res = await queryAllShopUser({
|
|
||||||
name: query,
|
|
||||||
})
|
|
||||||
this.loading = false
|
|
||||||
this.options = res.content
|
|
||||||
} catch (error) {
|
|
||||||
this.loading = false
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 提交
|
|
||||||
onSubmitHandle() {
|
|
||||||
console.log(this.form)
|
|
||||||
this.$refs.form.validate(async valid => {
|
|
||||||
if (valid) {
|
|
||||||
try {
|
|
||||||
let res = ''
|
|
||||||
if (this.form.id) {
|
|
||||||
res = await storagePut({
|
|
||||||
id: this.form.id,
|
|
||||||
num: this.num,
|
|
||||||
type: 0
|
|
||||||
})
|
|
||||||
this.$notify({
|
|
||||||
title: '成功',
|
|
||||||
message: `取酒成功`,
|
|
||||||
type: 'success'
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
res = await storageWin(this.form)
|
|
||||||
this.$notify({
|
|
||||||
title: '成功',
|
|
||||||
message: `存酒成功`,
|
|
||||||
type: 'success'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.$emit('success', res)
|
|
||||||
this.close()
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
async show(obj = {}, wine = false) {
|
|
||||||
this.dialogVisible = true
|
|
||||||
if (obj && obj.id) {
|
|
||||||
this.form = { ...obj }
|
|
||||||
}
|
|
||||||
if (obj && obj.name) {
|
|
||||||
this.form.name = obj.name
|
|
||||||
this.form.imgUrl = obj.imgUrl
|
|
||||||
this.form.expDay = obj.expDay
|
|
||||||
this.form.unit = obj.unit
|
|
||||||
}
|
|
||||||
this.wine = wine
|
|
||||||
},
|
|
||||||
close() {
|
|
||||||
this.dialogVisible = false
|
|
||||||
},
|
|
||||||
reset() {
|
|
||||||
this.form = { ...this.resetForm }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.goods_info {
|
|
||||||
background-color: #f9f9f9;
|
|
||||||
padding: 10px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.info {
|
|
||||||
flex: 1;
|
|
||||||
padding-left: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
<template>
|
|
||||||
<el-dialog title="记录" width="500px" :visible.sync="dialogVisible">
|
|
||||||
<el-steps :active="list.length" direction="vertical" :space="100">
|
|
||||||
<el-step :title="item.content" :description="item.time" v-for="item in list" :key="item.id"></el-step>
|
|
||||||
</el-steps>
|
|
||||||
<el-empty description="暂无记录" v-if="!list.length"></el-empty>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { recordList } from '@/api/application'
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
dialogVisible: false,
|
|
||||||
loading: false,
|
|
||||||
list: []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
// 查询存取酒记录
|
|
||||||
async recordList(storageId) {
|
|
||||||
try {
|
|
||||||
this.loading = true
|
|
||||||
const res = await recordList({ storageId: storageId })
|
|
||||||
this.list = res.content
|
|
||||||
this.loading = false
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
show(id) {
|
|
||||||
this.dialogVisible = true
|
|
||||||
this.recordList(id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,166 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="head-container">
|
|
||||||
<div class="head-container">
|
|
||||||
<el-form :model="query" inline>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button type="primary" @click="$refs.addModal.show()">添加存酒</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="搜索">
|
|
||||||
<el-input v-model="query.name" placeholder="酒名/用户昵称"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="手机号">
|
|
||||||
<el-input v-model="query.telphone" placeholder="手机号"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="状态">
|
|
||||||
<el-select v-model="query.status">
|
|
||||||
<el-option v-for="item in statusList" :key="item.value" :value="item.value"
|
|
||||||
:label="item.label"></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
|
||||||
<el-button @click="resetHandle">重置</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
</div>
|
|
||||||
<div class="head-container">
|
|
||||||
<el-table :data="tableData.data" v-loading="tableData.loading" row-key="id">
|
|
||||||
<el-table-column label="用户名" prop="nickname">
|
|
||||||
<template v-slot="scope">
|
|
||||||
<div style="display: flex;align-items: center;">
|
|
||||||
<el-image src=""
|
|
||||||
style="width:40px;height: 40px;background-color: #efefef;display: flex;align-items: center;justify-content: center;">
|
|
||||||
<i class="el-icon-folder-delete" slot="error" style="font-size: 20px;color: #999;"></i>
|
|
||||||
</el-image>
|
|
||||||
<span style="margin-left: 10px;">{{ scope.row.telphone }}</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="酒品名" prop="name">
|
|
||||||
<template v-slot="scope">
|
|
||||||
<div style="display: flex;align-items: center;">
|
|
||||||
<el-image :src="scope.row.imgUrl" style="width:40px;height: 40px;">
|
|
||||||
<i class="el-icon-folder-delete" slot="error"></i>
|
|
||||||
</el-image>
|
|
||||||
<span style="margin-left: 10px;">{{ scope.row.name }}</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="数量" prop="name">
|
|
||||||
<template v-slot="scope">
|
|
||||||
<span>{{ scope.row.num }}({{ scope.row.unit }})</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="存酒时间" prop="savTime"></el-table-column>
|
|
||||||
<el-table-column label="到期时间" prop="expTime"></el-table-column>
|
|
||||||
<el-table-column label="状态" prop="status">
|
|
||||||
<template v-slot="scope">
|
|
||||||
<el-tag :type="statusList.find(item => item.value === scope.row.status).type">{{
|
|
||||||
statusList.find(item => item.value === scope.row.status).label }}</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" width="120">
|
|
||||||
<template v-slot="scope">
|
|
||||||
<div style="display: flex;gap: 10px;">
|
|
||||||
<el-button type="text" @click="$refs.HistoryModal.show(scope.row.id)">查看记录</el-button>
|
|
||||||
<el-button type="text" v-if="scope.row.status == 0" disabled>已取完</el-button>
|
|
||||||
<el-button type="text" @click="$refs.addModal.show(scope.row)"
|
|
||||||
v-if="scope.row.status == 1">取酒</el-button>
|
|
||||||
<el-button type="text" v-if="scope.row.status == 2" disabled>已过期</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</div>
|
|
||||||
<div class="head-container">
|
|
||||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
|
||||||
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
|
||||||
</div>
|
|
||||||
<addModal ref="addModal" @success="getTableData" />
|
|
||||||
<HistoryModal ref="HistoryModal" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import addModal from './addModal'
|
|
||||||
import HistoryModal from './historyModal'
|
|
||||||
import { storageList } from '@/api/application'
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
addModal,
|
|
||||||
HistoryModal
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
statusList: [
|
|
||||||
{
|
|
||||||
value: '',
|
|
||||||
label: '全部',
|
|
||||||
type: 'warning'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 0,
|
|
||||||
label: '已取完',
|
|
||||||
type: 'warning'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 1,
|
|
||||||
label: '存储中',
|
|
||||||
type: 'primary'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 2,
|
|
||||||
label: '已过期',
|
|
||||||
type: 'info'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
query: {
|
|
||||||
name: "",
|
|
||||||
telphone: "",
|
|
||||||
status: ''
|
|
||||||
},
|
|
||||||
tableData: {
|
|
||||||
data: [],
|
|
||||||
page: 0,
|
|
||||||
size: 10,
|
|
||||||
loading: false,
|
|
||||||
total: 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.getTableData()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
// 重置查询
|
|
||||||
resetHandle() {
|
|
||||||
this.tableData.page = 0
|
|
||||||
this.query.name = ''
|
|
||||||
this.query.telphone = ''
|
|
||||||
this.query.status = ''
|
|
||||||
this.getTableData()
|
|
||||||
},
|
|
||||||
// 分页回调
|
|
||||||
paginationChange(e) {
|
|
||||||
this.tableData.page = e - 1;
|
|
||||||
this.getTableData()
|
|
||||||
},
|
|
||||||
// 获取商品列表
|
|
||||||
async getTableData() {
|
|
||||||
try {
|
|
||||||
this.tableData.loading = true
|
|
||||||
const res = await storageList({
|
|
||||||
...this.query,
|
|
||||||
page: this.tableData.page,
|
|
||||||
size: this.tableData.size
|
|
||||||
})
|
|
||||||
this.tableData.loading = false
|
|
||||||
this.tableData.data = res.content
|
|
||||||
this.tableData.total = res.totalElements
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="head-container">
|
|
||||||
<el-table :data="tableData.data" v-loading="tableData.loading">
|
|
||||||
<el-table-column label="商品信息">
|
|
||||||
<template v-slot="scope">
|
|
||||||
<div class="shop_info">
|
|
||||||
<el-image :src="scope.row.imgUrl"
|
|
||||||
style="width: 50px;height: 50px;border-radius: 4px;background-color: #efefef;">
|
|
||||||
<div class="img_error" slot="error">
|
|
||||||
<i class="icon el-icon-document-delete"></i>
|
|
||||||
</div>
|
|
||||||
</el-image>
|
|
||||||
<div class="info">
|
|
||||||
<span>{{ scope.row.name }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="有效存酒" prop="savNum"></el-table-column>
|
|
||||||
<el-table-column label="已过期存酒" prop="expNum"></el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { countRecord } from '@/api/application'
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
tableData: {
|
|
||||||
data: [],
|
|
||||||
page: 0,
|
|
||||||
size: 10,
|
|
||||||
loading: false,
|
|
||||||
total: 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.getTableData()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
// 分页回调
|
|
||||||
paginationChange(e) {
|
|
||||||
this.tableData.page = e - 1
|
|
||||||
this.getTableData()
|
|
||||||
},
|
|
||||||
// 获取商品列表
|
|
||||||
async getTableData() {
|
|
||||||
try {
|
|
||||||
this.tableData.loading = true
|
|
||||||
const res = await countRecord({
|
|
||||||
page: this.tableData.page,
|
|
||||||
size: this.tableData.size
|
|
||||||
})
|
|
||||||
this.tableData.loading = false
|
|
||||||
this.tableData.data = res.content
|
|
||||||
this.tableData.total = res.totalElements
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.shop_info {
|
|
||||||
display: flex;
|
|
||||||
|
|
||||||
.info {
|
|
||||||
flex: 1;
|
|
||||||
padding-left: 8px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
|
|
||||||
.tag_wrap {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,271 +1,350 @@
|
|||||||
|
<!-- eslint-disable vue/no-use-v-if-with-v-for -->
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<div class="tab">
|
<div class="tab">
|
||||||
<div class="tab_item" @click="tabClick(item)" :class="{active: tabActive == item.type}" v-for="(item,index) in tabList" :key="index"> {{ item.name }} <span class="bor"></span></div>
|
<div v-for="(item,index) in tabList" v-if="(form.id&&form.type == item.type)||!form.id" :key="index" class="tab_item" :class="{active: form.type == item.type}" @click="tabClick(item)"> {{ item.name }} <span class="bor" /></div>
|
||||||
</div>
|
|
||||||
<!-- 优惠券 -->
|
|
||||||
<div class="content" v-if="tabActive == 1">
|
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
|
|
||||||
<el-form-item label="优惠卷卷名" prop="title">
|
|
||||||
<el-input v-model="form.title" placeholder="" style="width: 289px;"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="使用门槛" prop="title">
|
|
||||||
<el-input v-model="form.title" placeholder="" style="width: 180px;margin-right: 66px;">
|
|
||||||
<template slot="prepend">满</template>
|
|
||||||
<template slot="append">元</template>
|
|
||||||
</el-input>
|
|
||||||
<el-input v-model="form.title" placeholder="" style="width: 180px;">
|
|
||||||
<template slot="prepend">减</template>
|
|
||||||
<template slot="append">元</template>
|
|
||||||
</el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="有效期类型">
|
|
||||||
<el-radio-group v-model="form.validityType">
|
|
||||||
<el-radio :label="item.value" v-for="item in couponEnum.validityType" :key="item.value">
|
|
||||||
{{ item.label }}
|
|
||||||
</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="有效时间" v-if="form.validityType == 1">
|
|
||||||
<el-date-picker v-model="selectTime" type="daterange" range-separator="至" start-placeholder="开始日期"
|
|
||||||
end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']"
|
|
||||||
value-format="yyyy-MM-dd HH:mm:ss">
|
|
||||||
</el-date-picker>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="使用门槛" prop="title">
|
|
||||||
<el-input v-model="form.title" placeholder="" style="width: 200px;">
|
|
||||||
<template slot="prepend">隔</template>
|
|
||||||
<template slot="append">天生效</template>
|
|
||||||
</el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="可用周期" prop="title">
|
|
||||||
<el-checkbox-group v-model="form.checkedCycle" >
|
|
||||||
<el-checkbox v-for="(city,index) in couponEnum.cycle" :label="city.label" :key="index">{{city.label}}</el-checkbox>
|
|
||||||
</el-checkbox-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="指定时间段">
|
|
||||||
<el-radio-group v-model="form.effectType">
|
|
||||||
<el-radio :label="item.value" v-for="item in couponEnum.effectType" :key="item.value">
|
|
||||||
{{ item.label }}
|
|
||||||
</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="指定时间段" v-if="form.effectType == 1">
|
|
||||||
<el-date-picker v-model="selectTime" type="daterange" range-separator="至" start-placeholder="开始日期"
|
|
||||||
end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']"
|
|
||||||
value-format="yyyy-MM-dd HH:mm:ss">
|
|
||||||
</el-date-picker>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="发放数量" prop="title">
|
|
||||||
<el-input v-model="form.title" placeholder="" style="width: 200px;"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<span slot="footer" class="dialog-footer">
|
|
||||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
||||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<!-- 商品券 -->
|
|
||||||
<div class="content" v-if="tabActive == 2">
|
|
||||||
<el-form ref="form" :model="formTwo" :rules="rulesTwo" label-width="120px" label-position="left">
|
|
||||||
<el-form-item label="商品卷卷名" prop="title">
|
|
||||||
<el-input v-model="form.title" placeholder="" style="width: 289px;"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="发放数量" >
|
|
||||||
<el-input v-model="form.title" placeholder="" style="width: 289px;"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="使用门槛" >
|
|
||||||
全额满<el-input v-model="form.title" placeholder="" style="width: 100px;margin: 0 23px;"><template slot="suffix">元</template></el-input>可用
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="赠送商品" v-if="form.classType == 'product'" prop="classType">
|
|
||||||
<div>
|
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="$refs.shopListRef.show([...productIds])">
|
|
||||||
添加 </el-button>
|
|
||||||
</div>
|
|
||||||
<div class="shop_list">
|
|
||||||
<div class="item_wrap" v-for="(item, index) in productIds" :key="item.id"
|
|
||||||
@click="productIds.splice(index, 1)">
|
|
||||||
<div class="name">{{ item.name }}</div>
|
|
||||||
<el-input v-model="form.title" placeholder="请填写数量" style="width: 100px;"></el-input>
|
|
||||||
<div class="del">删除</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
|
|
||||||
</el-form>
|
|
||||||
<span slot="footer" class="dialog-footer">
|
|
||||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
||||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<shopList ref="shopListRef" @success="slectShop" />
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 优惠券 -->
|
||||||
|
<div v-if="form.type == 1" class="content">
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
|
||||||
|
<el-form-item label="优惠卷卷名" prop="title">
|
||||||
|
<el-input v-model="form.title" placeholder="" style="width: 289px;" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="使用门槛">
|
||||||
|
<el-input v-model="form.fullAmount" type="number" placeholder="" style="width: 180px;margin-right: 66px;">
|
||||||
|
<template slot="prepend">满</template>
|
||||||
|
<template slot="append">元</template>
|
||||||
|
</el-input>
|
||||||
|
<el-input v-model="form.discountAmount" type="number" placeholder="" style="width: 180px;">
|
||||||
|
<template slot="prepend">减</template>
|
||||||
|
<template slot="append">元</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="有效期类型">
|
||||||
|
<el-radio-group v-model="form.validityType">
|
||||||
|
<el-radio v-for="item in couponEnum.validityType" :key="item.value" :label="item.value">
|
||||||
|
{{ item.label }}
|
||||||
|
</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="form.validityType == 'custom'" label="有效时间" prop="validEndTime">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="validityTime"
|
||||||
|
type="daterange"
|
||||||
|
range-separator="至"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
:default-time="['06:00:00', '23:59:59']"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
@change="validityChange"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="使用门槛" prop="daysToTakeEffect">
|
||||||
|
<el-input v-model="form.daysToTakeEffect" placeholder="" style="width: 200px;">
|
||||||
|
<template slot="prepend">隔</template>
|
||||||
|
<template slot="append">天生效</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item label="可用周期" prop="userDays">
|
||||||
|
<el-checkbox-group v-model="form.userDays">
|
||||||
|
<el-checkbox v-for="(city,index) in couponEnum.cycle" :key="index" :label="city.label" @change="userDayChagne">{{ city.label }}</el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="指定时间段">
|
||||||
|
<el-radio-group v-model="form.useTimeType">
|
||||||
|
<el-radio v-for="item in couponEnum.useTimeType" :key="item.value" :label="item.value">
|
||||||
|
{{ item.label }}
|
||||||
|
</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="form.useTimeType == 'custom'" label="指定时间段" prop="useEndTime">
|
||||||
|
<el-time-picker
|
||||||
|
v-model="useTime"
|
||||||
|
is-range
|
||||||
|
range-separator="至"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
:default-time="['00:00:00', '23:59:59']"
|
||||||
|
value-format="HH:mm"
|
||||||
|
@change="useTimeChange"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="发放数量" prop="number">
|
||||||
|
<el-input v-model="form.number" type="number" placeholder="" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<!-- 商品券 -->
|
||||||
|
<div v-if="form.type == 2" class="content">
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
|
||||||
|
<el-form-item label="商品卷卷名" prop="title">
|
||||||
|
<el-input v-model="form.title" placeholder="" style="width: 289px;" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="发放数量" prop="number">
|
||||||
|
<el-input v-model="form.number" type="number" placeholder="" style="width: 289px;" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="使用门槛">
|
||||||
|
全额满<el-input v-model="form.fullAmount" placeholder="" style="width: 100px;margin: 0 23px;"><template slot="suffix">元</template></el-input>可用
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="赠送商品" prop="products">
|
||||||
|
<div>
|
||||||
|
<el-button type="primary" icon="el-icon-plus" @click="$refs.shopListRef.show([...form.products])">
|
||||||
|
添加 </el-button>
|
||||||
|
</div>
|
||||||
|
<div class="shop_list">
|
||||||
|
<div
|
||||||
|
v-for="(item, index) in form.products"
|
||||||
|
:key="item.id"
|
||||||
|
class="item_wrap"
|
||||||
|
>
|
||||||
|
<div class="name">{{ item.name }}</div>
|
||||||
|
<el-input v-model="item.num" placeholder="请填写数量" style="width: 100px;" />
|
||||||
|
<div class="del" @click="form.products.splice(index, 1)">删除</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<shopList ref="shopListRef" @success="slectShop" />
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import couponEnum from './couponEnum'
|
import couponEnum from './couponEnum'
|
||||||
import shopList from '@/components/shopList'
|
import shopList from '@/components/shopList'
|
||||||
import { tbMerchantCoupon } from '@/api/shop'
|
import { addTbShopCoupon, getTbShopCouponInfo } from '@/api/coupon'
|
||||||
export default {
|
export default {
|
||||||
components: { shopList },
|
components: { shopList },
|
||||||
data() {
|
data() {
|
||||||
const validateProduct = (rule, value, callback) => {
|
const validateProduct = (rule, value, callback) => {
|
||||||
if (!this.productIds.length) {
|
if (!this.form.products.length) {
|
||||||
callback(new Error('请选择商品'))
|
callback(new Error('请选择商品'))
|
||||||
} else {
|
} else {
|
||||||
callback()
|
callback()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return {
|
|
||||||
tabList: [
|
|
||||||
{ name: "新增优惠券", type: 1},
|
|
||||||
{ name: "新增商品券", type: 2},
|
|
||||||
],
|
|
||||||
tabActive: 1,
|
|
||||||
couponEnum,
|
|
||||||
dialogVisible: false,
|
|
||||||
loading: false,
|
|
||||||
selectTime: [],
|
|
||||||
form: {
|
|
||||||
id: '',
|
|
||||||
validityType: '0',
|
|
||||||
checkedCycle: [],
|
|
||||||
type: '0',
|
|
||||||
title: '',
|
|
||||||
classType: 'product',
|
|
||||||
|
|
||||||
limitAmount: '',
|
|
||||||
ratio: '1',
|
|
||||||
amount: '',
|
|
||||||
number: '1',
|
|
||||||
limitNumber: '1',
|
|
||||||
effectType: '0',
|
|
||||||
fromTime: '',
|
|
||||||
toTime: '',
|
|
||||||
relationIds: '',
|
|
||||||
status: 1
|
|
||||||
},
|
|
||||||
formTwo: {
|
|
||||||
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
title: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: ' ',
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
classType: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
validator: validateProduct,
|
|
||||||
trigger: 'change'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
rulesTwo: {
|
|
||||||
title: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: ' ',
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
classType: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
validator: validateProduct,
|
|
||||||
trigger: 'change'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
resetForm: '',
|
|
||||||
productIds: []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.resetForm = { ...this.form }
|
|
||||||
console.log(this.$route.query.type)
|
|
||||||
this.tabActive = this.$route.query.type;
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
tabClick (item) {
|
|
||||||
console.log(item)
|
|
||||||
this.tabActive = item.type;
|
|
||||||
|
|
||||||
},
|
|
||||||
// 选择商品
|
|
||||||
slectShop(res) {
|
|
||||||
if (this.productIds.length) {
|
|
||||||
res.map(async item => {
|
|
||||||
if (!await this.checkShop(item.id)) {
|
|
||||||
this.productIds.push({ ...item })
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.productIds = res
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 判断是否存在重复商品
|
|
||||||
checkShop(id) {
|
|
||||||
let falg = false
|
|
||||||
this.productIds.map(item => {
|
|
||||||
if (item.id == id) {
|
|
||||||
falg = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return falg
|
|
||||||
},
|
|
||||||
// 提交
|
|
||||||
onSubmitHandle() {
|
|
||||||
console.log(this.form)
|
|
||||||
this.$refs.form.validate(async valid => {
|
|
||||||
if (valid) {
|
|
||||||
try {
|
|
||||||
this.loading = true
|
|
||||||
this.form.shopId = localStorage.getItem('shopId')
|
|
||||||
this.form.fromTime = this.selectTime[0] || ''
|
|
||||||
this.form.toTime = this.selectTime[1] || ''
|
|
||||||
|
|
||||||
let arr = []
|
|
||||||
if (this.form.classType == 'product') {
|
|
||||||
arr = this.productIds.map(item => item.id)
|
|
||||||
}
|
|
||||||
|
|
||||||
this.form.relationIds = arr.join(',')
|
|
||||||
|
|
||||||
let res = await tbMerchantCoupon(this.form, this.form.id ? 'put' : 'post')
|
|
||||||
this.$emit('success', res)
|
|
||||||
this.close()
|
|
||||||
this.$notify({
|
|
||||||
title: '成功',
|
|
||||||
message: `${this.form.id ? '编辑' : '添加'}成功`,
|
|
||||||
type: 'success'
|
|
||||||
});
|
|
||||||
this.loading = false
|
|
||||||
} catch (error) {
|
|
||||||
this.loading = false
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
show(obj) {
|
|
||||||
this.dialogVisible = true
|
|
||||||
if (obj && obj.id) {
|
|
||||||
this.form = { ...obj }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
close() {
|
|
||||||
this.dialogVisible = false
|
|
||||||
},
|
|
||||||
reset() {
|
|
||||||
this.form = { ...this.resetForm }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return {
|
||||||
|
tabList: [
|
||||||
|
{ name: '新增优惠券', type: 1 },
|
||||||
|
{ name: '新增商品券', type: 2 }
|
||||||
|
],
|
||||||
|
tabActive: 1,
|
||||||
|
couponEnum,
|
||||||
|
dialogVisible: false,
|
||||||
|
loading: false,
|
||||||
|
validityTime: [],
|
||||||
|
useTime: ['06:00:00', '23:59:59'],
|
||||||
|
form: {
|
||||||
|
id: '',
|
||||||
|
shopId: '',
|
||||||
|
type: '1',
|
||||||
|
title: '',
|
||||||
|
fullAmount: null,
|
||||||
|
discountAmount: null,
|
||||||
|
validityType: 'fixed',
|
||||||
|
validStartTime: '',
|
||||||
|
validEndTime: '',
|
||||||
|
userDays: [],
|
||||||
|
useTimeType: 'all',
|
||||||
|
useStartTime: '',
|
||||||
|
useEndTime: '',
|
||||||
|
products: [],
|
||||||
|
number: ''
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
title: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '填写券名',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
daysToTakeEffect: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '填写生效天数',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
userDays: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '选择可用周期',
|
||||||
|
trigger: 'change'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
validEndTime: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '选择有效时间段',
|
||||||
|
trigger: 'change'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
useEndTime: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '选择指定时间段',
|
||||||
|
trigger: 'change'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
products: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
validator: validateProduct,
|
||||||
|
trigger: 'change'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
number: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '填写发放数量',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
resetForm: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.resetForm = { ...this.form }
|
||||||
|
this.form.type = this.$route.query.type
|
||||||
|
this.form.useStartTime = this.useTime[0]
|
||||||
|
this.form.useEndTime = this.useTime[1]
|
||||||
|
if (this.$route.query.id) { this.form.id = this.$route.query.id; this.getCouponInfo(this.$route.query.id) }
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/**
|
||||||
|
* 切换类型
|
||||||
|
* @param item
|
||||||
|
*/
|
||||||
|
tabClick(item) {
|
||||||
|
console.log(item)
|
||||||
|
this.form.type = item.type
|
||||||
|
this.$refs.form.resetFields()
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取优惠券详情
|
||||||
|
*/
|
||||||
|
async getCouponInfo(id) {
|
||||||
|
const resInfo = await getTbShopCouponInfo(id)
|
||||||
|
this.form = resInfo
|
||||||
|
if (resInfo.validityType === 'custom') {
|
||||||
|
this.validityTime = [resInfo.validStartTime, resInfo.validEndTime]
|
||||||
|
}
|
||||||
|
if (resInfo.useTimeType === 'custom') {
|
||||||
|
this.useTime = [resInfo.useStartTime, resInfo.useEndTime]
|
||||||
|
}
|
||||||
|
this.form.userDays = this.form.userDays.split(',')
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择可用周期
|
||||||
|
*/
|
||||||
|
userDayChagne(e) {
|
||||||
|
console.log(this.form.userDays)
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 有效期选择
|
||||||
|
* @param e
|
||||||
|
*/
|
||||||
|
validityChange(e) {
|
||||||
|
this.form.validStartTime = e[0]
|
||||||
|
this.form.validEndTime = e[1]
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定时间段选择
|
||||||
|
* @param e
|
||||||
|
*/
|
||||||
|
useTimeChange(e) {
|
||||||
|
this.form.useStartTime = e[0]
|
||||||
|
this.form.useEndTime = e[1]
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择商品
|
||||||
|
* @param res
|
||||||
|
*/
|
||||||
|
slectShop(res) {
|
||||||
|
if (res.length <= 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.form.products = []
|
||||||
|
if (this.form.products.length) {
|
||||||
|
res.map(async item => {
|
||||||
|
if (!await this.checkShop(item.id)) {
|
||||||
|
this.form.products.push({
|
||||||
|
id: item.id,
|
||||||
|
name: item.name,
|
||||||
|
num: null
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.form.products.push({
|
||||||
|
id: res[0].id,
|
||||||
|
name: res[0].name,
|
||||||
|
num: null
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否存在重复商品
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
checkShop(id) {
|
||||||
|
let falg = false
|
||||||
|
this.form.products.map(item => {
|
||||||
|
// eslint-disable-next-line eqeqeq
|
||||||
|
if (item.id == id) {
|
||||||
|
falg = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return falg
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交
|
||||||
|
*/
|
||||||
|
onSubmitHandle() {
|
||||||
|
console.log(this.form)
|
||||||
|
this.$refs.form.validate(async valid => {
|
||||||
|
if (valid) {
|
||||||
|
try {
|
||||||
|
this.loading = true
|
||||||
|
if (!this.form.shopId) { this.form.shopId = localStorage.getItem('shopId') }
|
||||||
|
this.form.userDays = this.form.userDays.toString()
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
const res = await addTbShopCoupon(this.form)
|
||||||
|
this.$store.dispatch('tagsView/delView', this.$route) // 关闭当前页
|
||||||
|
this.$router.replace({ name: 'coupon_list' }) // 要打开的页面
|
||||||
|
this.$notify({
|
||||||
|
title: '成功',
|
||||||
|
message: `${this.form.id ? '编辑' : '添加'}成功`,
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
this.loading = false
|
||||||
|
} catch (error) {
|
||||||
|
this.loading = false
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -296,7 +375,7 @@ export default {
|
|||||||
background-color: #3F9EFF;
|
background-color: #3F9EFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
.content{
|
.content{
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
@@ -325,4 +404,4 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
<div class="search">
|
<div class="search">
|
||||||
<el-form :model="query" inline label-position="left">
|
<el-form :model="query" inline label-position="left">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-input v-model="query.name" placeholder="用户ID/用户昵称/用户手机" style="width: 180px;" />
|
<el-input v-model="query.value" placeholder="用户ID/用户昵称/用户手机" style="width: 180px;" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-select v-model="query.state" placeholder="选择状态" style="width: 154px;">
|
<el-select v-model="query.status" placeholder="选择状态" style="width: 154px;">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in stateList"
|
v-for="item in stateList"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
@@ -19,21 +19,22 @@
|
|||||||
<el-form-item />
|
<el-form-item />
|
||||||
<el-form-item label="领取时间">
|
<el-form-item label="领取时间">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="query.createdAt"
|
v-model="queryTime"
|
||||||
type="daterange"
|
type="daterange"
|
||||||
range-separator="至"
|
range-separator="至"
|
||||||
start-placeholder="开始日期"
|
start-placeholder="开始日期"
|
||||||
end-placeholder="结束日期"
|
end-placeholder="结束日期"
|
||||||
:default-time="['00:00:00', '23:59:59']"
|
:default-time="['00:00:00', '23:59:59']"
|
||||||
value-format="yyyy-MM-dd HH:mm:ss"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
@change="queryTimeChange"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||||
<el-button v-loading="downloadLoading" icon="el-icon-download" @click="downloadHandle">
|
<!-- <el-button v-loading="downloadLoading" icon="el-icon-download" @click="downloadHandle">
|
||||||
<span v-if="!downloadLoading">导出</span>
|
<span v-if="!downloadLoading">导出</span>
|
||||||
<span v-else>下载中...</span>
|
<span v-else>下载中...</span>
|
||||||
</el-button>
|
</el-button> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
@@ -41,19 +42,32 @@
|
|||||||
<el-table v-loading="loading" :data="tableData">
|
<el-table v-loading="loading" :data="tableData">
|
||||||
|
|
||||||
<el-table-column label="用户ID" prop="id" />
|
<el-table-column label="用户ID" prop="id" />
|
||||||
<el-table-column label="用户名" prop="areaName" />
|
<el-table-column label="用户名" prop="name" />
|
||||||
<el-table-column label="领取时间" prop="tableName" />
|
<el-table-column label="领取时间" prop="receiveTime" />
|
||||||
<el-table-column label="使用时间" prop="tableName" />
|
<el-table-column label="使用时间" prop="useTime" />
|
||||||
<el-table-column label="获得来源" prop="tableName" />
|
<el-table-column label="获得来源" prop="source" />
|
||||||
<el-table-column label="状态" prop="tableName" />
|
<el-table-column label="状态" align="status">
|
||||||
<el-table-column label="使用门店" prop="tableName" />
|
|
||||||
<el-table-column label="订单数量" prop="orderCount">
|
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<div class="cursor-pointer" @click="toTableOrderList(scope.row)">
|
<div style="display: flex;align-items: center;">
|
||||||
{{ scope.row.orderCount }}
|
<div v-if="scope.row.overNum == scope.row.num" style="width: 30px;color: #FAAD14;">未使用</div>
|
||||||
|
<div v-if="scope.row.num!=0&&scope.row.overNum != scope.row.num">{{ scope.row.overNum }}/{{ scope.row.num }}</div>
|
||||||
|
<div v-if="scope.row.overNum == 0" style="color: #52C41A;">已使用</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="使用门店" prop="tableName" />
|
||||||
|
<el-table-column label="操作" width="150">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
|
||||||
|
<el-button
|
||||||
|
slot="reference"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
style="color: #FF4D4F;"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-popconfirm>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
@@ -62,35 +76,98 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { queryReceive, delReceive } from '@/api/coupon'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
// eslint-disable-next-line vue/require-prop-types
|
||||||
|
props: ['couponId'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
dialogVisible: true,
|
dialogVisible: false,
|
||||||
downloadLoading: false,
|
downloadLoading: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
stateList: [
|
stateList: [
|
||||||
{ label: '未使用', value: 1 },
|
{ label: '未使用', value: 0 },
|
||||||
{ label: '已使用', value: 2 }
|
{ label: '已使用', value: 1 }
|
||||||
],
|
],
|
||||||
|
queryTime: [],
|
||||||
query: {
|
query: {
|
||||||
name: '',
|
couponId: '',
|
||||||
createdAt: [],
|
value: '',
|
||||||
state: ''
|
status: 0,
|
||||||
|
startTime: '',
|
||||||
|
endTime: '',
|
||||||
|
page: 1,
|
||||||
|
size: 10
|
||||||
},
|
},
|
||||||
|
resetQuery: null,
|
||||||
tableData: null
|
tableData: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.resetQuery = { ...this.query }
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/**
|
/**
|
||||||
* 查询
|
* 查询
|
||||||
*/
|
*/
|
||||||
getTableData() {
|
async getTableData() {
|
||||||
|
// eslint-disable-next-line no-unused-vars, prefer-const
|
||||||
|
console.log(this.couponId)
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars, prefer-const
|
||||||
|
let res = await queryReceive({
|
||||||
|
shopId: localStorage.getItem('shopId'),
|
||||||
|
couponId: this.query.couponId,
|
||||||
|
value: this.query.value,
|
||||||
|
status: this.query.status,
|
||||||
|
startTime: this.query.startTime,
|
||||||
|
endTime: this.query.endTime,
|
||||||
|
page: this.query.page,
|
||||||
|
size: this.query.size
|
||||||
|
})
|
||||||
},
|
},
|
||||||
// 导出Excel
|
|
||||||
|
/**
|
||||||
|
* 时间选择监听
|
||||||
|
*/
|
||||||
|
queryTimeChange(e) {
|
||||||
|
this.query.startTime = e[0]
|
||||||
|
this.query.endTime = e[1]
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除优惠券
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
async delTableHandle(id) {
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
const delRes = await delReceive(id)
|
||||||
|
console.log(delRes)
|
||||||
|
this.getTableData()
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打开详情
|
||||||
|
* @param obj
|
||||||
|
*/
|
||||||
|
show(obj) {
|
||||||
|
console.log(obj)
|
||||||
|
this.dialogVisible = true
|
||||||
|
this.query.couponId = obj.id
|
||||||
|
this.getTableData()
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭详情
|
||||||
|
*/
|
||||||
|
close() {
|
||||||
|
this.dialogVisible = false
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出Excel
|
||||||
|
*/
|
||||||
async downloadHandle() {
|
async downloadHandle() {
|
||||||
try {
|
try {
|
||||||
this.downloadLoading = true
|
this.downloadLoading = true
|
||||||
@@ -107,28 +184,8 @@ export default {
|
|||||||
console.log(error)
|
console.log(error)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 提交
|
|
||||||
onSubmitHandle() {
|
|
||||||
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 打开详情
|
|
||||||
* @param obj
|
|
||||||
*/
|
|
||||||
show(obj) {
|
|
||||||
this.dialogVisible = true
|
|
||||||
// if (obj && obj.id) {
|
|
||||||
// this.form = { ...obj }
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 关闭详情
|
|
||||||
*/
|
|
||||||
close() {
|
|
||||||
this.dialogVisible = false
|
|
||||||
},
|
|
||||||
reset() {
|
reset() {
|
||||||
this.form = { ...this.resetForm }
|
this.query = { ...this.resetQuery }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,51 +1,51 @@
|
|||||||
export default {
|
export default {
|
||||||
classType: [
|
classType: [
|
||||||
{
|
{
|
||||||
value: 'product',
|
value: 'product',
|
||||||
label: '商品券'
|
label: '商品券'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'common',
|
value: 'common',
|
||||||
label: '通用券'
|
label: '通用券'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
type: [
|
type: [
|
||||||
{
|
{
|
||||||
value: '0',
|
value: '0',
|
||||||
label: '满减'
|
label: '满减'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: '1',
|
value: '1',
|
||||||
label: '折扣'
|
label: '折扣'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
cycle: [
|
cycle: [
|
||||||
{ label: '周一'},
|
{ label: '周一' },
|
||||||
{ label: '周二'},
|
{ label: '周二' },
|
||||||
{ label: '周三'},
|
{ label: '周三' },
|
||||||
{ label: '周四'},
|
{ label: '周四' },
|
||||||
{ label: '周五'},
|
{ label: '周五' },
|
||||||
{ label: '周六'},
|
{ label: '周六' },
|
||||||
{ label: '周七'},
|
{ label: '周七' }
|
||||||
],
|
],
|
||||||
validityType: [
|
validityType: [
|
||||||
{
|
{
|
||||||
value: '0',
|
value: 'fixed',
|
||||||
label: '领券后有效期内可用'
|
label: '领券后有效期内可用'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: '1',
|
value: 'custom',
|
||||||
label: '固定有效期范围内可用'
|
label: '固定有效期范围内可用'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
effectType: [
|
useTimeType: [
|
||||||
{
|
{
|
||||||
value: '0',
|
value: 'all',
|
||||||
label: '全时段可用'
|
label: '全时段可用'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: '1',
|
value: 'custom',
|
||||||
label: '指定时间段'
|
label: '指定时间段'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,121 +1,161 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<div class="head-container">
|
<div class="head-container">
|
||||||
<!-- <el-button type="primary" icon="el-icon-plus" @click="$refs.addCoupon.show()">
|
<!-- <el-button type="primary" icon="el-icon-plus" @click="$refs.addCoupon.show()">
|
||||||
添加优惠券
|
添加优惠券
|
||||||
</el-button> -->
|
</el-button> -->
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="$router.push({name: 'add_coupon', query: {type:1}})">
|
<el-button type="primary" icon="el-icon-plus" @click="$router.push({name: 'add_coupon', query: {type:1}})">
|
||||||
添加优惠券
|
添加优惠券
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="$router.push({name: 'add_coupon', query: {type:2}})">
|
|
||||||
添加商品券
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
<div class="head-container">
|
|
||||||
<el-table :data="tableData.data" v-loading="tableData.loading">
|
|
||||||
<el-table-column label="ID" prop="title"></el-table-column>
|
|
||||||
<el-table-column label="名称" prop="title"></el-table-column>
|
|
||||||
<el-table-column label="优惠类型" prop="type">
|
|
||||||
<template v-slot="scope">
|
|
||||||
{{ scope.row.type | typeFilter }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="使用门槛" prop="ratio"></el-table-column>
|
|
||||||
<el-table-column label="有效期" prop="effectType">
|
|
||||||
<template v-slot="scope">
|
|
||||||
{{ scope.row.effectType | effectTypeFilter }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="用户领取方式" prop="ratio"></el-table-column>
|
|
||||||
<el-table-column label="总发放数量" prop="ratio"></el-table-column>
|
|
||||||
<el-table-column label="已领取" prop="ratio"></el-table-column>
|
|
||||||
<el-table-column label="已使用" prop="ratio"></el-table-column>
|
|
||||||
<el-table-column label="剩余" prop="ratio"></el-table-column>
|
|
||||||
<el-table-column label="操作" width="150">
|
|
||||||
<template v-slot="scope">
|
|
||||||
<el-button type="text" icon="el-icon-edit" @click="toPath( '/product/add_shop' ,scope.row )">编辑</el-button>
|
|
||||||
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
|
|
||||||
<el-button type="text" icon="el-icon-delete" style="margin-left: 20px !important;"
|
|
||||||
slot="reference">删除</el-button>
|
|
||||||
</el-popconfirm>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</div>
|
|
||||||
<div class="head-container">
|
|
||||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
|
|
||||||
@current-change="paginationChange" @size-change="sizeChange"
|
|
||||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
|
||||||
</div>
|
|
||||||
<addCoupon ref="addCoupon" @success="resetHandle" />
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="head-container">
|
||||||
|
<el-table v-loading="tableData.loading" :data="tableData.data">
|
||||||
|
<el-table-column label="ID" prop="id" />
|
||||||
|
<el-table-column label="名称" prop="title" />
|
||||||
|
<el-table-column label="使用门槛">
|
||||||
|
<template v-slot="scope">
|
||||||
|
{{ `满${scope.row.fullAmount}${scope.row.discountAmount?'减'+scope.row.discountAmount+'元':''}` }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<!-- <el-table-column label="有效期">
|
||||||
|
<template v-slot="scope">
|
||||||
|
{{ `领券后${scope.row.validDays}天过期` }}
|
||||||
|
</template>
|
||||||
|
</el-table-column> -->
|
||||||
|
<el-table-column label="用户领取方式">
|
||||||
|
<template v-slot="scope">
|
||||||
|
{{ `无` }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="总发放数量" prop="number" />
|
||||||
|
<el-table-column label="已领取" align="center">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<div style="display: flex;align-items: center;">
|
||||||
|
<div style="width: 30px;">{{ scope.row.number-scope.row.leftNumber }}</div>
|
||||||
|
<div style="margin: 0 10px;">|</div>
|
||||||
|
<div style="color: #3F9EFF;cursor: pointer;flex-shrink: 0;" @click="couponDetailsOpen(scope.row)">详情</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="已使用" prop="useNumber" />
|
||||||
|
<el-table-column label="剩余" prop="leftNumber" />
|
||||||
|
<el-table-column label="操作" width="150">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<el-button type="text" icon="el-icon-edit" @click="$router.push({name: 'add_coupon', query: {type:scope.row.type ,id: scope.row.id}} )">编辑</el-button>
|
||||||
|
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
|
||||||
|
<el-button
|
||||||
|
slot="reference"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
style="margin-left: 20px !important;"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-popconfirm>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
<div class="head-container">
|
||||||
|
<el-pagination
|
||||||
|
:total="tableData.total"
|
||||||
|
:current-page="tableData.page + 1"
|
||||||
|
:page-size="tableData.size"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
@current-change="paginationChange"
|
||||||
|
@size-change="sizeChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<couponDetails ref="couponDetails" @success="resetHandle" />
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import couponEnum from './couponEnum'
|
import couponEnum from './couponEnum'
|
||||||
import addCoupon from './components/coupon_details.vue'
|
import couponDetails from './components/coupon_details.vue'
|
||||||
import { tbMerchantCouponGet } from '@/api/shop'
|
import { getTbShopCoupon, delTbShopCoupon } from '@/api/coupon'
|
||||||
export default {
|
export default {
|
||||||
components: { addCoupon },
|
// eslint-disable-next-line vue/no-unused-components
|
||||||
data() {
|
components: { couponDetails },
|
||||||
return {
|
filters: {
|
||||||
tableData: {
|
|
||||||
data: [],
|
typeFilter(value) {
|
||||||
page: 0,
|
// eslint-disable-next-line eqeqeq
|
||||||
size: 10,
|
return couponEnum.type.find(item => item.value == value).label
|
||||||
loading: false,
|
|
||||||
total: 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
filters: {
|
effectTypeFilter(value) {
|
||||||
|
// eslint-disable-next-line eqeqeq
|
||||||
typeFilter(value) {
|
return couponEnum.effectType.find(item => item.value == value).label
|
||||||
return couponEnum.type.find(item => item.value == value).label
|
|
||||||
},
|
|
||||||
effectTypeFilter(value) {
|
|
||||||
return couponEnum.effectType.find(item => item.value == value).label
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.getTableData()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
// 是否允许修改商品
|
|
||||||
toPath ( path , row) {
|
|
||||||
this.$router.push({path: path, query: row})
|
|
||||||
},
|
|
||||||
// 重置查询
|
|
||||||
resetHandle() {
|
|
||||||
this.page = 0
|
|
||||||
this.getTableData()
|
|
||||||
},
|
|
||||||
// 分页大小改变
|
|
||||||
sizeChange(e) {
|
|
||||||
this.tableData.size = e
|
|
||||||
this.getTableData()
|
|
||||||
},
|
|
||||||
// 分页回调
|
|
||||||
paginationChange(e) {
|
|
||||||
this.tableData.page = e - 1
|
|
||||||
this.getTableData()
|
|
||||||
},
|
|
||||||
// 获取商品列表
|
|
||||||
async getTableData() {
|
|
||||||
this.tableData.loading = true
|
|
||||||
try {
|
|
||||||
const res = await tbMerchantCouponGet({
|
|
||||||
page: this.tableData.page,
|
|
||||||
size: this.tableData.size,
|
|
||||||
shopId: localStorage.getItem('shopId')
|
|
||||||
})
|
|
||||||
this.tableData.loading = false
|
|
||||||
this.tableData.data = res.content
|
|
||||||
this.tableData.total = res.totalElements
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
tableData: {
|
||||||
|
data: [],
|
||||||
|
page: 0,
|
||||||
|
size: 10,
|
||||||
|
loading: false,
|
||||||
|
total: 0
|
||||||
|
},
|
||||||
|
couponId: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getTableData()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 是否允许修改商品
|
||||||
|
toPath(path, row) {
|
||||||
|
this.$router.push({ path: path, query: row })
|
||||||
|
},
|
||||||
|
// 重置查询
|
||||||
|
resetHandle() {
|
||||||
|
this.page = 0
|
||||||
|
this.getTableData()
|
||||||
|
},
|
||||||
|
// 分页大小改变
|
||||||
|
sizeChange(e) {
|
||||||
|
this.tableData.size = e
|
||||||
|
this.getTableData()
|
||||||
|
},
|
||||||
|
// 分页回调
|
||||||
|
paginationChange(e) {
|
||||||
|
this.tableData.page = e - 1
|
||||||
|
this.getTableData()
|
||||||
|
},
|
||||||
|
// 获取优惠券列表
|
||||||
|
async getTableData() {
|
||||||
|
this.tableData.loading = true
|
||||||
|
try {
|
||||||
|
const res = await getTbShopCoupon({
|
||||||
|
page: this.tableData.page,
|
||||||
|
size: this.tableData.size,
|
||||||
|
shopId: localStorage.getItem('shopId')
|
||||||
|
})
|
||||||
|
this.tableData.loading = false
|
||||||
|
this.tableData.data = res.content
|
||||||
|
this.tableData.total = res.totalElements
|
||||||
|
console.log(this.tableData)
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看领取详情
|
||||||
|
*/
|
||||||
|
couponDetailsOpen(row) {
|
||||||
|
this.$refs.couponDetails.show(row)
|
||||||
|
this.couponId = row.id
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除优惠券
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
async delTableHandle(id) {
|
||||||
|
const delRes = await delTbShopCoupon(id)
|
||||||
|
console.log(delRes)
|
||||||
|
this.getTableData()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user