This commit is contained in:
user 2023-11-07 13:31:31 +08:00
parent 8e3d5b15ac
commit 673b6ad10a
5 changed files with 361 additions and 15 deletions

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询兑换券列表
export function listExchange(query) {
return request({
url: '/system/exchange/list',
url: 'business/marketingActivity/cardExchange',
method: 'get',
params: query
})
@ -20,7 +20,7 @@ export function getExchange(id) {
// 新增兑换券
export function addExchange(data) {
return request({
url: '/system/exchange',
url: 'business/marketingActivity/cardExchange',
method: 'post',
data: data
})

View File

@ -228,7 +228,7 @@
</template>
<script>
import { listExchange, getExchange, delExchange, addExchange, updateExchange } from "@/api/system/exchange";
// import { listExchange, getExchange, delExchange, addExchange, updateExchange } from "@/api/system/exchange";
export default {
name: "Exchange",

View File

@ -314,8 +314,8 @@
</template>
<script>
import { listRecord, getRecord, delRecord, addRecord, updateRecord } from "@/api/system/record";
import { listRecord, getRecord, delRecord, addRecord, updateRecord } from "@/api/EventMarketing/cardExchange";
export default {
name: "Record",
data() {

View File

@ -53,26 +53,29 @@
<!-- <template slot-scope="scope">-->
<!-- -->
<!-- </template>-->
</el-table-column>
<el-table-column
prop="date"
label="优惠类型"
width="100">
<el-tag>优惠券</el-tag>
</el-table-column>
<el-table-column label="券详情">
<el-table-column
prop="name"
label="满减金额"
width="120">
<el-tag effect="plain">290</el-tag>
</el-table-column>
<el-table-column
prop="name"
label="优惠券金额"
width="120">
<el-tag type="success" effect="plain">50</el-tag>
</el-table-column>
<el-table-column
prop="name"
prop="date"
label="有效期(天)"
width="120">
</el-table-column>
@ -99,6 +102,7 @@
prop="date"
label="二维码"
width="100">
<i class="el-icon-picture"></i>
</el-table-column>
<el-table-column
prop="date"

View File

@ -1,15 +1,357 @@
<template>
<div class="app-container">
orange
</div>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="" prop="name">
<el-input
v-model="queryParams.name"
placeholder="兑换券名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="" prop="isonline">
<el-select v-model="queryParams.isonline" placeholder="是否在线">
<el-option label="在线" value="0"></el-option>
<el-option label="下线" value="1"></el-option>
</el-select>
</el-form-item>
<el-form-item label="" prop="status">
<el-select v-model="queryParams.status" placeholder="兑换券状态">
<el-option label="启用" value="0"></el-option>
<el-option label="禁用" value="1"></el-option>
</el-select>
</el-form-item>
<el-form-item label="" prop="type">
<el-select v-model="queryParams.type" placeholder="兑换券类型">
<el-option label="兑换券" value="0"></el-option>
<el-option label="洗车券" value="1"></el-option>
<el-option label="洗车卡" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:exchange:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:exchange:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:exchange:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="exchangeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键id" align="center" prop="id" />
<el-table-column label="所属连锁店id" align="center" prop="chainStorId" />
<el-table-column label="所属店铺id" align="center" prop="storeId" />
<el-table-column label="是否在线 0在线 1 下线" align="center" prop="isonline" />
<el-table-column label="兑换券状态 0启用 1 禁用" align="center" prop="status" />
<el-table-column label="兑换券名称" align="center" prop="name" />
<el-table-column label="兑换券类型 0兑换券 1洗车券 2洗车卡" align="center" prop="type" />
<el-table-column label="兑换礼品名" align="center" prop="giftName" />
<el-table-column label="卡券有效期" align="center" prop="validity" />
<el-table-column label="使用说明" align="center" prop="useInstructions" />
<el-table-column label="二维码链接" align="center" prop="qrCodeLink" />
<el-table-column label="参与次数" align="center" prop="count" />
<el-table-column label="到期时间" align="center" prop="outTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.outTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改兑换券对话框 -->
<el-dialog :title="title" :visible.sync="open" width="40%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<!-- <el-form-item label="所属连锁店id" prop="chainStorId">-->
<!-- <el-input v-model="form.chainStorId" placeholder="请输入所属连锁店id" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="所属店铺id" prop="storeId">-->
<!-- <el-input v-model="form.storeId" placeholder="请输入所属店铺id" />-->
<!-- </el-form-item>-->
<el-form-item label="兑换券名称" prop="name">
<el-input v-model="form.name" placeholder="请输入兑换券名称" />
</el-form-item>
<el-form-item label="兑换券类型" prop="type">
<el-radio-group v-model="form.type">
<el-radio label="0">兑换券</el-radio>
<el-radio label="1">洗车券</el-radio>
<el-radio label="2">洗车卡</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="兑换礼品名" prop="giftName">
<el-input type="textarea" v-model="form.giftName" placeholder="请输入兑换礼品名"></el-input>
</el-form-item>
<el-form-item label="卡券有效期" prop="validity">
<el-input placeholder="请输入卡券有效期" v-model="form.validity">
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="使用说明" prop="useInstructions">
<el-input type="textarea" v-model="form.useInstructions" placeholder="请输入使用说明"></el-input>
</el-form-item>
<el-form-item label="参与次数" prop="count">
<el-input-number v-model="form.count" controls-position="right" :min="1" :max="999"></el-input-number>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio label="0">启用</el-radio>
<el-radio label="1">禁用</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listExchange, getExchange, delExchange, addExchange, updateExchange } from "@/api/EventMarketing/cardExchange";
export default {
name: 'index'
}
name: "Exchange",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
exchangeList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
chainStorId: null,
storeId: null,
isonline: null,
status: null,
name: null,
type: null,
giftName: null,
validity: null,
useInstructions: null,
qrCodeLink: null,
count: null,
outTime: null,
},
//
form: {},
//
rules: {
name: [
{ required: true, message: '请输入兑换券名称', trigger: 'change' }
],
type: [
{ required: true, message: '请输入兑换券类型', trigger: 'change' }
],
giftName: [
{ required: true, message: '请输入兑换礼品名', trigger: 'change' }
],
validity: [
{ required: true, message: '请输入卡券有效期', trigger: 'change' }
],
useInstructions: [
{ required: true, message: '请输入使用说明', trigger: 'change' }
],
count: [
{ required: true, message: '请输入参与次数', trigger: 'change' }
],
status: [
{ required: true, message: '请选择状态', trigger: 'change' }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询兑换券列表 */
getList() {
this.loading = true;
listExchange(this.queryParams).then(response => {
this.exchangeList = response.data.records;
this.total = response.data.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
chainStorId: null,
storeId: null,
isonline: null,
status: null,
name: null,
type: null,
giftName: null,
validity: null,
useInstructions: null,
qrCodeLink: null,
count: null,
outTime: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加兑换券";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.form = row;
this.open = true;
this.title = "修改兑换券";
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateExchange(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addExchange(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除兑换券编号为"' + ids + '"的数据项?').then(function() {
return delExchange(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/exchange/export', {
...this.queryParams
}, `exchange_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<style scoped>
</style>