oil-station/fuintAdmin/src/views/member/userLabel.vue

294 lines
8.5 KiB
Vue
Raw Normal View History

2024-08-16 18:26:19 +08:00
<!-- 收银台订单-->
<template>
2024-10-16 20:42:28 +08:00
<div style="box-sizing: border-box;padding: 10px; background: #f6f8f9;">
<div class="wit_box" shadow="never">
2024-08-16 18:26:19 +08:00
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="120px">
<el-form-item label="" prop="labelName" style="width: 180px">
<el-input
v-model="queryParams.labelName"
placeholder="请输入标签名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="">
<el-date-picker
v-model="beginTime"
style="width: 160px"
type="date"
placeholder="开始日期">
</el-date-picker>
<el-date-picker
v-model="endTime"
style="width: 160px"
type="date"
placeholder="结束日期">
</el-date-picker>
</el-form-item>
2024-10-29 18:05:39 +08:00
<el-form-item style="float: right;margin-right: 0px">
2024-08-16 18:26:19 +08:00
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
<el-button type="primary" @click="handleAdd">新增标签</el-button>
</el-form-item>
</el-form>
<div class="table-box">
<el-table
:data="orderList"
2024-10-23 08:52:43 +08:00
border
2024-08-16 18:26:19 +08:00
style="width: 100%">
<el-table-column type="index" width="50" align="center" label="序号"/>
<el-table-column prop="labelName" align="center" label="标签名称"></el-table-column>
2024-10-23 08:52:43 +08:00
<el-table-column prop="remark" width="550" align="center" label="备注">
2024-08-16 18:26:19 +08:00
<template slot-scope="scope">
<span>{{ scope.row.remark || "--" }}</span>
</template>
</el-table-column>
2024-08-27 10:18:27 +08:00
<el-table-column prop="userNum" align="center" label="会员数量">
<template slot-scope="scope">
<span>{{ scope.row.userNum || 0 }}</span>
</template>
</el-table-column>
<el-table-column prop="userProportion" align="center" label="会员占比">
<template slot-scope="scope">
<span>{{ scope.row.userProportion || 0 }}%</span>
</template>
</el-table-column>
2024-08-16 18:26:19 +08:00
<el-table-column prop="status" align="center" label="标签状态">
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
active-value="qy"
inactive-value="jy"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</template>
</el-table-column>
<el-table-column prop="accountName" align="center" label="创建人"></el-table-column>
<el-table-column prop="createTime" align="center" label="创建时间"></el-table-column>
<el-table-column align="center" label="操作">
<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>
</div>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
2024-10-16 20:42:28 +08:00
</div>
2024-08-16 18:26:19 +08:00
<!-- 添加或修改对话框 -->
2024-10-31 09:22:25 +08:00
<el-dialog center :close-on-click-modal="false" :title="title" :visible.sync="open" width="30%" append-to-body>
2024-10-23 08:52:43 +08:00
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
2024-08-16 18:26:19 +08:00
<el-form-item label="标签名称" prop="labelName">
<el-input v-model="form.labelName" placeholder="请输入标签名称" maxlength="30"/>
</el-form-item>
<el-form-item label="标签状态" prop="status">
<el-switch
v-model="form.status"
active-value="qy"
inactive-value="jy"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</el-form-item>
<el-form-item label="备注" >
<el-input v-model="form.desc" placeholder="请输入备注" type="textarea"/>
</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 {delStaff} from "@/api/staff/staff";
import {addUserLabel, deleteUserLabel, editUserLabel, getUserLabel, listUserLabel} from "@/api/staff/user/userlabel";
export default {
dicts: ['zhzt'],
data() {
return {
loading: false,
open:false,
title:'',
// 日期范围
dateRange: [],
beginTime: "",
endTime: "",
// 收银台订单列表
orderList: [],
deptList: [],
form:{},
// 查询参数
queryParams: {
page: 1,
pageSize: 10,
},
total: 0,
// 表单校验
rules: {
labelName: [
{required: true, message: "标签名称不能为空", trigger: "blur"},
],
status: [
{required: true, message: "状态不能为空", trigger: "blur"}
]
}
}
},
created() {
this.getList();
},
methods: {
getDeptList() {
// getRunningWaterByTissueApi(this.addDateRange(this.queryParams)).then(response => {
// this.deptList = response.data.records;
// })
},
// 获取列表信息
getList() {
let dateRange = []
if (this.beginTime && this.endTime) {
dateRange.push(this.beginTime.toLocaleDateString())
dateRange.push(this.endTime.toLocaleDateString())
}
listUserLabel(this.addDateRange(this.queryParams, dateRange)).then(res => {
this.orderList = res.data.records
this.total = res.data.total
})
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 提交按钮
submitForm: function () {
this.$refs["form"].validate(valid => {
if (valid) {
if (!this.form.id) {
addUserLabel(this.form).then(res => {
this.$message.success("添加成功")
this.open = false
this.queryParams.page = 1;
this.getList()
})
} else {
editUserLabel(this.form).then(res => {
this.$message.success("修改成功")
this.open = false
this.queryParams.page = 1;
this.getList()
})
}
}
});
},
// 新增按钮操作
handleAdd() {
this.reset();
this.form = {
status:"qy"
}
this.open = true;
this.title = "新增会员标签";
},
// 搜索按钮操作
handleQuery() {
this.queryParams.page = 1;
this.getList();
},
// 重置按钮操作
resetQuery() {
this.dateRange = [];
this.queryParams = {
page: 1,
pageSize: 10,
}
this.beginTime = ''
this.endTime = ''
this.handleQuery();
},
// 修改按钮操作
handleUpdate(row) {
this.reset();
getUserLabel(row.id).then(res => {
this.open = true;
this.form = res.data;
this.title = "修改会员标签"
})
},
// 表单重置
reset() {
this.resetForm("form");
},
// 删除按钮操作
handleDelete(row) {
const name = row.labelName || this.id;
this.$modal.confirm('是否确认删除"' + name + '"的会员标签信息?').then(function() {
return deleteUserLabel(row.id);
}).then(() => {
this.queryParams.page = 1
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
}
</script>
<style scoped>
.box-card {
width: 100%;
margin: 0px 20px 20px 20px;
border: none;
box-shadow: none;
}
.el-form--inline .el-form-item {
margin-right: 20px;
}
.table-box {
width: 100%;
2024-10-16 20:42:28 +08:00
height: 77vh;
2024-08-16 18:26:19 +08:00
overflow: auto;
}
2024-10-16 20:42:28 +08:00
.wit_box{
background: #fff;
box-sizing: border-box;
padding: 15px;
border-radius: 10px;
}
2024-08-16 18:26:19 +08:00
</style>