修改打印机页面,增加叫号管理页面、霸王餐、店铺优惠券

This commit is contained in:
2025-02-22 18:13:19 +08:00
parent 5238df86e5
commit 5a877b550b
32 changed files with 2972 additions and 394 deletions

View File

@@ -0,0 +1,99 @@
<template>
<div class="app-container">
<div class="container">
<el-form ref="form" :model="form" label-width="140px" label-position="left">
<el-form-item label="功能启用">
<el-switch v-model="form.enable"></el-switch>
</el-form-item>
<el-form-item label="充值设置">
<div class="labelbox">
用户消费结账时成功充值消费
<el-input style="width: 80px; margin: 0 15px" v-model="form.rechargeTimes"></el-input>
倍的金额本单即可享受免单
</div>
</el-form-item>
<el-form-item label="充值门槛">
<div class="labelbox">
订单支付金额需满
<el-input
style="width: 80px; margin: 0 15px"
v-model="form.rechargeThreshold"
></el-input>
元才能使用
</div>
</el-form-item>
<el-form-item label="充值说明">
<el-input type="textarea" v-model="form.rechargeDesc"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="editlist">保存</el-button>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
import bwcApi from "@/api/account/bwc";
import { ElMessage } from "element-plus";
export default {
name: "bwc",
data() {
return {
form: {
id: "",
enable: "",
rechargeTimes: "",
rechargeThreshold: "",
withCoupon: "",
withPoints: "",
rechargeDesc: "",
useTypeList: [],
childShopIdList: "",
},
};
},
created() {
this.getlist();
},
methods: {
async getlist() {
let res = await bwcApi.getList();
this.form = res;
},
async editlist() {
let res = await bwcApi.edit(this.form);
ElMessage({
message: "保存成功",
type: "success",
});
this.getlist();
},
},
};
</script>
<style scoped lang="scss">
.app-container {
padding: 12px 20px;
height: auto;
background-color: #f4f9ff;
.container {
padding: 30px;
width: 100%;
height: 100%;
background: #ffffff;
.labelbox {
display: flex;
justify-content: flex-start;
align-items: center;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 16px;
color: #666666;
}
}
}
</style>

View File

@@ -0,0 +1,325 @@
<template>
<div>
<el-dialog title="领取详情" :visible.sync="dialogVisible" width="70%" @close="reset">
<div class="search">
<el-form :model="query" inline label-position="left">
<el-form-item>
<el-input
v-model="query.value"
placeholder="用户ID/用户昵称/用户手机"
style="width: 180px"
/>
</el-form-item>
<el-form-item>
<el-select v-model="query.status" placeholder="选择状态" style="width: 154px">
<el-option
v-for="item in stateList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item />
<el-form-item label="领取时间">
<el-date-picker
v-model="queryTime"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
value-format="yyyy-MM-dd HH:mm:ss"
@change="queryTimeChange"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getTableData">查询</el-button>
<!-- <el-button v-loading="downloadLoading" icon="el-icon-download" @click="downloadHandle">
<span v-if="!downloadLoading">导出</span>
<span v-else>下载中...</span>
</el-button> -->
</el-form-item>
</el-form>
</div>
<div class="head-container">
<el-table v-loading="loading" :data="tableData.data">
<el-table-column label="用户ID" prop="id" />
<el-table-column label="用户名" prpo="name">
<template v-slot="scope">
<div>{{ scope.row.name ? scope.row.name : "-" }}</div>
</template>
</el-table-column>
<el-table-column label="领取时间" prop="receiveTime" />
<el-table-column label="使用时间" prpo="useTime">
<template v-slot="scope">
<div>{{ scope.row.useTime ? scope.row.useTime : "-" }}</div>
</template>
</el-table-column>
<el-table-column label="获得来源" prpo="source">
<template v-slot="scope">
<div>
{{
scope.row.source == "activate"
? "充值活动"
: scope.row.source == "invited"
? "好友分享"
: ""
}}
</div>
</template>
</el-table-column>
<el-table-column label="状态" align="status">
<template v-slot="scope">
<div style="display: flex; align-items: center">
<div v-if="scope.row.overNum == scope.row.num" style="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>
</template>
</el-table-column>
<el-table-column label="使用门店" prpo="useTime">
<template v-slot="scope">
<div>{{ scope.row.tableName ? scope.row.tableName : "-" }}</div>
</template>
</el-table-column>
<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>
</div>
<div class="head-container">
<el-pagination
:total="tableData.total"
:current-page="tableData.page"
:page-size="tableData.size"
layout="total, sizes, prev, pager, next, jumper"
@current-change="paginationChange"
@size-change="sizeChange"
/>
</div>
</el-dialog>
</div>
</template>
<script>
import couponApi from "@/api/account/coupon";
export default {
// eslint-disable-next-line vue/require-prop-types
props: ["couponId"],
data() {
return {
dialogVisible: false,
downloadLoading: false,
loading: false,
stateList: [
{ label: "未使用", value: 0 },
{ label: "已使用", value: 1 },
],
queryTime: [],
query: {
couponId: "",
value: "",
status: 0,
startTime: "",
endTime: "",
page: 1,
size: 10,
},
resetQuery: null,
tableData: {
data: [],
page: 1,
size: 10,
loading: false,
total: 0,
},
};
},
mounted() {
this.resetQuery = { ...this.query };
},
methods: {
/**
* 查询
*/
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,
});
this.tableData.loading = false;
this.tableData.data = res.content;
this.tableData.total = res.totalElements;
},
/**
* 时间选择监听
*/
queryTimeChange(e) {
if (e) {
this.query.startTime = e[0];
this.query.endTime = e[1];
} else {
this.query.startTime = "";
this.query.endTime = "";
}
},
/**
* 删除优惠券
* @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();
},
// 分页大小改变
sizeChange(e) {
this.tableData.size = e;
this.getTableData();
},
// 分页回调
paginationChange(e) {
this.tableData.page = e;
this.query.page = e;
this.getTableData();
},
/**
* 关闭详情
*/
close() {
this.dialogVisible = false;
},
/**
* 导出Excel
*/
async downloadHandle() {
try {
this.downloadLoading = true;
// eslint-disable-next-line no-undef
const file = await summaryTableDownload({
startTime: this.query.createdAt[0],
endTime: this.query.createdAt[1],
});
// eslint-disable-next-line no-undef
downloadFile(file, "数据", "xlsx");
this.downloadLoading = false;
} catch (error) {
this.downloadLoading = false;
console.log(error);
}
},
reset() {
this.query = { ...this.resetQuery };
},
},
};
</script>
<style scoped lang="scss">
.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 0.1s ease-in-out;
}
}
.name {
width: $size;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
</style>

View File

@@ -0,0 +1,51 @@
export default {
classType: [
{
value: "product",
label: "商品券"
},
{
value: "common",
label: "通用券"
}
],
type: [
{
value: "0",
label: "满减"
},
{
value: "1",
label: "折扣"
}
],
cycle: [
{ label: "周一", value: "Monday" },
{ label: "周二", value: "Tuesday" },
{ label: "周三", value: "Wednesday" },
{ label: "周四", value: "Thursday" },
{ label: "周五", value: "Friday" },
{ label: "周六", value: "Saturday" },
{ label: "周七", value: "Sunday" }
],
validityType: [
{
value: "fixed",
label: "领券后有效期内可用"
},
{
value: "custom",
label: "固定有效期范围内可用"
}
],
useTimeType: [
{
value: "all",
label: "全时段可用"
},
{
value: "custom",
label: "指定时间段"
}
]
};

View File

@@ -0,0 +1,183 @@
<template>
<div class="app-container">
<div class="head-container">
<!-- <el-button type="primary" icon="el-icon-plus" @click="$refs.addCoupon.show()">
添加优惠券
</el-button> -->
<el-button
type="primary"
icon="plus"
@click="$router.push({ name: 'add_coupon', query: { type: 1 } })"
>
添加优惠券
</el-button>
</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="用户领取方式" prpo="source">
<template v-slot="scope">
<div>{{ scope.row.source == 'activate' ? '充值活动' :
scope.row.source == 'invited' ? '好友分享' : '' }}</div>
</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; justify-content: 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])">
<template #reference>
<el-button type="text" icon="el-icon-delete" style="margin-left: 20px !important">
删除
</el-button>
</template>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
</div>
<div class="head-container">
<el-pagination
:total="tableData.total"
:current-page="tableData.page"
: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>
<script>
import couponEnum from "./couponEnum";
import couponDetails from "./components/coupon_details.vue";
import couponApi from "@/api/account/coupon";
export default {
// eslint-disable-next-line vue/no-unused-components
components: { couponDetails },
data() {
return {
tableData: {
data: [],
page: 1,
size: 10,
loading: false,
total: 0,
},
couponId: null,
};
},
mounted() {
this.getTableData();
},
methods: {
typeFilter(value) {
// eslint-disable-next-line eqeqeq
return couponEnum.type.find((item) => item.value == value).label;
},
effectTypeFilter(value) {
// eslint-disable-next-line eqeqeq
return couponEnum.effectType.find((item) => item.value == value).label;
},
// 是否允许修改商品
toPath(path, row) {
this.$router.push({ path: path, query: row });
},
// 重置查询
resetHandle() {
this.page = 1;
this.getTableData();
},
// 分页大小改变
sizeChange(e) {
this.tableData.size = e;
this.getTableData();
},
// 分页回调
paginationChange(e) {
console.log(e);
this.tableData.page = e;
this.getTableData();
},
// 获取优惠券列表
async getTableData() {
this.tableData.loading = true;
try {
const res = await couponApi.getList({
page: this.tableData.page,
size: this.tableData.size,
});
this.tableData.loading = false;
this.tableData.data = res;
this.tableData.total = res.length;
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) {
console.log(delRes);
this.getTableData();
},
},
};
</script>

View File

@@ -0,0 +1,90 @@
<template>
<div class="app-container">
<div class="title">营销中心</div>
<div class="list">
<div class="item" v-for="item in list" :key="item.id" @click="to(item)">
<img :src="item.icon" class="icon" />
<div class="info">
<div class="name">{{ item.name }}</div>
<div class="intro">
{{ item.value }}
</div>
</div>
</div>
</div>
</div>
</template>
<script setup>
import card from "@/assets/images/marketing/card.png";
import charge from "@/assets/images/marketing/charge.png";
import invite from "@/assets/images/marketing/invite.png";
import score from "@/assets/images/marketing/score.png";
const router = useRouter();
const to = (item) => {
router.push("/application/" + item.path);
};
const list = ref([
{ name: "优惠券", icon: card, path: "coupon" },
{ name: "霸王餐", icon: charge, path: "bwc" },
{ name: "邀请裂变", icon: invite, path: "" },
{ name: "积分锁客", icon: score, path: "" },
]);
</script>
<style scoped lang="scss">
.title {
font-size: 24px;
font-weight: bold;
padding-top: 10px;
}
.list {
padding: 20px 0;
display: flex;
flex-wrap: wrap;
gap: 14px;
.item {
width: 400px;
background-color: #fff;
display: flex;
align-items: center;
padding: 14px;
&:hover {
cursor: pointer;
.info {
.name {
color: #39d47a;
}
.intro {
color: #39d47a;
}
}
}
.icon {
width: 40px;
height: 40px;
object-fit: cover;
}
.info {
flex: 1;
padding-left: 10px;
.name {
font-weight: bold;
}
.intro {
color: #999;
margin-top: 4px;
}
}
}
}
</style>