Merge branch 'master' of https://gitee.com/nny_1/oilSystem
This commit is contained in:
commit
b990ed0b86
39
fuintAdmin/src/api/convenienceStore/goods.js
Normal file
39
fuintAdmin/src/api/convenienceStore/goods.js
Normal file
@ -0,0 +1,39 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 新增商品分类
|
||||
export function insertCvsGoods(data) {
|
||||
return request({
|
||||
url: '/business/cvsGoods/addCvsGoods',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 分页查询分类
|
||||
export function selectTree(data) {
|
||||
return request({
|
||||
url: '/business/cvsGoods/selectTree',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 查询一级分类
|
||||
export function list(data) {
|
||||
return request({
|
||||
url: '/business/cvsGoods/list',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 根据id查询一级分类
|
||||
export function selectParentById(query) {
|
||||
return request({
|
||||
url: '/business/cvsGoods',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,14 @@ export function ljStoreInfo() {
|
||||
})
|
||||
}
|
||||
|
||||
// 查询店铺详细
|
||||
export function ljStoreList() {
|
||||
return request({
|
||||
url: '/business/storeInformation/store/list',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 修改店铺信息
|
||||
export function updateStore(data) {
|
||||
return request({
|
||||
|
@ -10,10 +10,11 @@ export function listUser(query) {
|
||||
}
|
||||
|
||||
// 查询会员列表
|
||||
export function listStatistic() {
|
||||
export function listStatistic(query) {
|
||||
return request({
|
||||
url: '/business/userManager/user/statistic',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
|
344
fuintAdmin/src/views/convenienceStore/index.vue
Normal file
344
fuintAdmin/src/views/convenienceStore/index.vue
Normal file
@ -0,0 +1,344 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card style="margin-top: 20px;">
|
||||
<!-- 查询类别 -->
|
||||
<el-form :inline="true" :model="goodsQueryForm">
|
||||
<el-form-item label="分类名称" prop="categoryName">
|
||||
<el-input v-model="goodsQueryForm.categoryName" placeholder="请输入分类名称" clearable @keyup.enter.native="onQuery"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-select v-model="goodsQueryForm.status" placeholder="请选择商品状态" clearable >
|
||||
<el-option
|
||||
v-for="dict in dict.type.zhzt"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="onQuery">搜索</el-button>
|
||||
<el-button @click="resetForm" icon="el-icon-refresh" >重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card style="margin-top: 15px;">
|
||||
<div class="tTop">分类列表
|
||||
<el-button type="primary" @click="insertGoods" >添加分类</el-button>
|
||||
</div>
|
||||
<!-- default-expand-all二级菜单默认展开 -->
|
||||
<!-- 分类列表 -->
|
||||
<el-table
|
||||
:data="tableData"
|
||||
style="width: 100%;margin-bottom: 20px;"
|
||||
row-key="id"
|
||||
border
|
||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}">
|
||||
<!-- <el-table-column
|
||||
prop="id"
|
||||
label="序号"
|
||||
width="180">
|
||||
</el-table-column> -->
|
||||
<el-table-column prop="categoryName" label="分类名称" width="180" />
|
||||
<el-table-column prop="sorted" label="排序"/>
|
||||
<el-table-column prop="status" label="状态" width="180">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.zhzt" :value="scope.row.status"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" width="180" />
|
||||
<el-table-column prop="createBy" label="创建人" width="180" />
|
||||
<el-table-column label="操作" width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" @click="editeCategory(scope.row)" size="mini">编辑</el-button>
|
||||
<el-button type="danger" @click="delCategory" size="mini">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 添加类别对话框 -->
|
||||
<el-dialog title="添加分类" :visible.sync="dialogFormVisible" width="500px">
|
||||
<el-form :model="form" :inline="true" :rules="rules" ref="form" >
|
||||
<el-form-item label="上级分类" >
|
||||
<el-select v-model="form.pid" placeholder="请选择上级分类">
|
||||
<el-option
|
||||
v-for="item in goodsOptions"
|
||||
:label="item.categoryName"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类名称" prop="categoryName" style="margin-left: -8px;">
|
||||
<el-input v-model="form.categoryName" style="width: 300px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序规则">
|
||||
<el-input-number v-model="form.sorted" @change="handleChange" :min="0" :max="10" style="width: 300px;"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item >
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio v-for="dict in dict.type.zhzt" :label="dict.value">{{ dict.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="cancelSubmit">取 消</el-button>
|
||||
<el-button type="primary" @click="dooSubmit">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 修改类别对话框 -->
|
||||
<el-dialog title="修改分类" :visible.sync="editDialogFormVisible" width="500px">
|
||||
<el-form :model="editForm" :inline="true" :rules="rules" ref="editForm" >
|
||||
<el-form-item label="上级分类" v-if="isShow">
|
||||
<el-select v-model="editForm.pid" placeholder="请选择上级分类">
|
||||
<el-option
|
||||
v-for="item in goodsOptions"
|
||||
:label="item.categoryName"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类名称" prop="categoryName" style="margin-left: -8px;">
|
||||
<el-input v-model="editForm.categoryName" style="width: 300px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序规则">
|
||||
<el-input-number v-model="editForm.sorted" @change="handleChange" :min="0" :max="10" style="width: 300px;"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item >
|
||||
<el-radio-group v-model="editForm.status">
|
||||
<el-radio v-for="dict in dict.type.zhzt" :label="dict.value">{{ dict.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="cancelEdite">取 消</el-button>
|
||||
<el-button type="primary" @click="saveEdite">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<div class="pageSty">
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
</div>
|
||||
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { selectTree, list,insertCvsGoods,selectParentById} from "@/api/convenienceStore/goods.js";
|
||||
import { runInThisContext } from "vm";
|
||||
export default {
|
||||
dicts:['zhzt'],
|
||||
data() {
|
||||
return {
|
||||
//是否修改一二级菜单
|
||||
isShow:false,
|
||||
//编辑表单
|
||||
editForm:{
|
||||
pid:'',
|
||||
categoryName:'',
|
||||
status:'qy',
|
||||
sorted:0,
|
||||
},
|
||||
//父级菜单列表
|
||||
goodsOptions:[],
|
||||
//查询表单
|
||||
goodsQueryForm: {
|
||||
categoryName: '',
|
||||
status: '',
|
||||
pid:"",
|
||||
pageNum:'1',
|
||||
pageSize:'5'
|
||||
},
|
||||
// 添加对话框
|
||||
dialogFormVisible:false,
|
||||
//修改对话框
|
||||
editDialogFormVisible:false,
|
||||
//对话框表单
|
||||
form:{
|
||||
pid:'',
|
||||
categoryName:'',
|
||||
status:'qy',
|
||||
sorted:0,
|
||||
},
|
||||
tableData: [{
|
||||
id: '',
|
||||
pid:'',
|
||||
categoryName: '',
|
||||
sorted: '',
|
||||
status:'',
|
||||
createdTime:'',
|
||||
children: []
|
||||
}],
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 5,
|
||||
categoryName:'',
|
||||
status: undefined,
|
||||
},
|
||||
aa:[],
|
||||
//校验规则
|
||||
rules: {
|
||||
categoryName: [
|
||||
{ required: true, message: '请输入分类名称', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
};
|
||||
},
|
||||
created(){
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
// 编辑类别
|
||||
editeCategory(val){
|
||||
// this.editForm .categoryName = ''
|
||||
// this.editForm.pid = ''
|
||||
// this.editForm.status = 'qy'
|
||||
// this.editForm.sorted = 0
|
||||
if(val.pid !== 0){
|
||||
this.isShow = true
|
||||
}
|
||||
this.editDialogFormVisible = true
|
||||
// selectParentById(val).then(response=>{
|
||||
// this.editForm.categoryName = response.data
|
||||
// })
|
||||
|
||||
},
|
||||
// 取消编辑
|
||||
cancelEdite(){
|
||||
this.editDialogFormVisible = false
|
||||
},
|
||||
// 保存编辑
|
||||
saveEdite(){
|
||||
this.editDialogFormVisible = false
|
||||
},
|
||||
// 删除类别
|
||||
delCategory(){
|
||||
|
||||
},
|
||||
//新增商品类别
|
||||
insertGoods(){
|
||||
this.resetForm('form')
|
||||
this.form.categoryName = ''
|
||||
this.form.pid = ''
|
||||
this.form.status = 'qy'
|
||||
this.form.sorted = 0
|
||||
this.dialogFormVisible = true
|
||||
this.getFirstMenu();
|
||||
},
|
||||
//获取父类
|
||||
getFirstMenu(){
|
||||
list(this.form).then(response=>{
|
||||
this.goodsOptions = response.data
|
||||
})
|
||||
},
|
||||
//查询商品类别
|
||||
onQuery(){
|
||||
selectTree(this.goodsQueryForm).then(response=>{
|
||||
if (response.code === 200) {
|
||||
if(response.data == null){
|
||||
this.tableData = []
|
||||
console.log(response.data);
|
||||
this.total = 0;
|
||||
this.$message('查询成功');
|
||||
}else{
|
||||
this.tableData = response.data.records
|
||||
this.total = response.data.total;
|
||||
this.$message('查询成功');
|
||||
}
|
||||
} else {
|
||||
this.$message('查询失败,请联系管理员');
|
||||
}
|
||||
})
|
||||
},
|
||||
handleChange(){
|
||||
},
|
||||
//提交商品类别
|
||||
dooSubmit(){
|
||||
this.$refs['form'].validate(valid => {
|
||||
if (valid) {
|
||||
//新增一级分类
|
||||
if(this.form.pid == '' || this.form.pid == undefined ){
|
||||
this.form.pid = 0
|
||||
}
|
||||
//新增二级
|
||||
insertCvsGoods(this.form).then(response=>{
|
||||
if (response.code === 200) {
|
||||
this.rest()
|
||||
this.$message('新增成功');
|
||||
}else{
|
||||
this.$message('新增失败 请联系管理员');
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
rest(){
|
||||
this.dialogFormVisible = false
|
||||
this.resetForm();
|
||||
this.goodsOptions = []
|
||||
},
|
||||
// 取消提交
|
||||
cancelSubmit(){
|
||||
this.$refs.form.resetFields();//清空
|
||||
this.form.categoryName = ''
|
||||
this.form.pid = ''
|
||||
this.form.status = ''
|
||||
this.form.sorted = 0
|
||||
this.dialogFormVisible = false
|
||||
},
|
||||
// 分页查询
|
||||
getList(){
|
||||
selectTree(this.queryParams).then(response => {
|
||||
if(response.code == 200){
|
||||
if(response.data == null){
|
||||
this.tableData = [];
|
||||
this.total = 0;
|
||||
}else{
|
||||
this.tableData = response.data.records;
|
||||
this.total = response.data.total;
|
||||
}
|
||||
}else{
|
||||
this.$message('查询失败 请联系管理员')
|
||||
}
|
||||
});
|
||||
},
|
||||
// 取消查询
|
||||
resetForm(){
|
||||
this.goodsQueryForm.categoryName = ''
|
||||
this.goodsQueryForm.status = ''
|
||||
this.getList()
|
||||
},
|
||||
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tTop{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.pageSty{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-left: 250px;
|
||||
}
|
||||
|
||||
</style>
|
@ -2,6 +2,11 @@
|
||||
<div class="app-container">
|
||||
<el-card >
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="来源油站" prop="storeIds">
|
||||
<el-select v-model="storeIds" filterable clearable placeholder="来源油站" style="width: 100%;">
|
||||
<el-option v-for="item in storeList" :key="item.id+''" :label="item.name" :value="item.id+''"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员号" prop="userNo">
|
||||
<el-input
|
||||
v-model="queryParams.userNo"
|
||||
@ -29,69 +34,61 @@
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员等级" prop="gradeId">
|
||||
<el-form-item label="会员等级" prop="name">
|
||||
<el-select
|
||||
v-model="queryParams.gradeId"
|
||||
clearable
|
||||
placeholder="会员等级"
|
||||
placeholder="全部"
|
||||
>
|
||||
<el-option v-for="grade in userGradeList" :key="grade.id+''" :label="grade.name" :value="grade.id+''"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-form-item label="" prop="gradeId">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="状态"
|
||||
v-model="ifBalance"
|
||||
clearable
|
||||
placeholder="全部"
|
||||
>
|
||||
<el-option label="有储值余额" value="haveBalance"/>
|
||||
<el-option label="无储值余额" value="noHaveBalance"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.official"
|
||||
placeholder="全部"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option key="A" label="启用" value="A"/>
|
||||
<el-option key="N" label="禁用" value="N"/>
|
||||
<el-option
|
||||
v-for="dict in dict.type.official"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="注册时间">
|
||||
<el-date-picker
|
||||
v-model="queryParams.startTime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="datetime"
|
||||
style="width:200px"
|
||||
placeholder="开始时间"
|
||||
></el-date-picker>
|
||||
<span class="sp"> ~ </span>
|
||||
<el-date-picker
|
||||
v-model="queryParams.endTime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="datetime"
|
||||
style="width:200px"
|
||||
placeholder="结束时间"
|
||||
v-model="dateRange"
|
||||
style="width: 240px"
|
||||
size="medium"
|
||||
value-format="yyyy-MM-dd"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属店铺" prop="storeIds">
|
||||
<el-select v-model="storeIds" multiple filterable clearable placeholder="请选择店铺" style="width: 100%;">
|
||||
<el-option
|
||||
v-for="item in storeList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></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-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['member:add']"
|
||||
>新增</el-button>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card>
|
||||
<el-card style="margin-top: 20px">
|
||||
<div>统计</div>
|
||||
<template>
|
||||
<div>
|
||||
@ -100,7 +97,6 @@
|
||||
<div class="sta">
|
||||
<el-statistic
|
||||
group-separator=","
|
||||
:precision="2"
|
||||
:value="total"
|
||||
title="会员总数"
|
||||
></el-statistic>
|
||||
@ -108,12 +104,11 @@
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="sta">
|
||||
<el-statistic
|
||||
group-separator=","
|
||||
:precision="2"
|
||||
:value="addNum"
|
||||
title="今日新增/昨日新增"
|
||||
></el-statistic>
|
||||
<el-statistic title="今日新增/昨日新增">
|
||||
<template slot="formatter">
|
||||
{{ addNum }}/{{ yesterdayAddNum }}
|
||||
</template>
|
||||
</el-statistic>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
@ -140,7 +135,6 @@
|
||||
<div class="sta">
|
||||
<el-statistic
|
||||
group-separator=","
|
||||
:precision="2"
|
||||
:value="point"
|
||||
title="积分总余额"
|
||||
></el-statistic>
|
||||
@ -162,6 +156,12 @@
|
||||
</el-card>
|
||||
|
||||
<el-card style="margin-top: 20px">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['member:add']"
|
||||
>新增</el-button>
|
||||
<el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange">
|
||||
<el-table-column label="会员ID" prop="id" align="center" width="60"/>
|
||||
<el-table-column label="头像" align="center" width="70">
|
||||
@ -204,7 +204,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="升数卡" align="center" prop="balance">
|
||||
<template slot-scope="scope">
|
||||
<div>{{ scope.row.literCard ? scope.row.literCard.toFixed(2) : '0.00' }}</div>
|
||||
<div>{{ scope.row.literCard ? scope.row.literCard.toFixed(2) : '0.00' }}L</div>
|
||||
<!-- <el-button-->
|
||||
<!-- class="mini-btn"-->
|
||||
<!-- type="primary"-->
|
||||
@ -242,13 +242,16 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <el-switch-->
|
||||
<!-- v-model="scope.row.status"-->
|
||||
<!-- active-value="A"-->
|
||||
<!-- inactive-value="N"-->
|
||||
<!-- @change="handleStatusChange(scope.row)"-->
|
||||
<!-- ></el-switch>-->
|
||||
<!-- </template>-->
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
v-model="scope.row.status"
|
||||
active-value="A"
|
||||
inactive-value="N"
|
||||
@change="handleStatusChange(scope.row)"
|
||||
></el-switch>
|
||||
<dict-tag :options="dict.type.zhzt" :value="scope.row.status"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="公众号" align="center" prop="official">
|
||||
@ -286,7 +289,7 @@
|
||||
</el-card>
|
||||
|
||||
<!-- 添加或修改对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||
<el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
@ -295,6 +298,13 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="手机号" prop="mobile">
|
||||
<el-input v-model="form.mobile" placeholder="请输入手机号" maxlength="30"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="会员等级" prop="gradeId">
|
||||
@ -308,25 +318,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="有效期限">
|
||||
<el-date-picker
|
||||
v-model="form.startTime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="datetime"
|
||||
placeholder="开始时间"
|
||||
></el-date-picker>
|
||||
<span class="sp"> 至 </span>
|
||||
<el-date-picker
|
||||
v-model="form.endTime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="datetime"
|
||||
placeholder="结束时间"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="会员号" prop="userNo">
|
||||
@ -334,23 +326,6 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="手机号" prop="mobile">
|
||||
<el-input v-model="form.mobile" placeholder="请输入手机号" maxlength="30"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="性别" prop="sex">
|
||||
<el-radio-group v-model="form.sex">
|
||||
<el-radio :key="1" :label="1" :value="1">男</el-radio>
|
||||
<el-radio :key="0" :label="0" :value="0">女</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="身份证号" prop="idcard">
|
||||
@ -360,15 +335,39 @@
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="生日" prop="birthday">
|
||||
<el-input v-model="form.birthday" placeholder="请输入生日,格式如:1990-01-01" maxlength="30"/>
|
||||
<el-form-item label="会员初始积分" prop="point">
|
||||
<el-input v-model="form.point" placeholder="0" maxlength="30"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="通讯地址" prop="address">
|
||||
<el-input v-model="form.address" placeholder="请输入通讯地址" maxlength="100"/>
|
||||
<el-form-item label="初始加油金" prop="refuelMoney">
|
||||
<el-input v-model="form.refuelMoney" placeholder="0" maxlength="30"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="储值通用余额" prop="balance">
|
||||
<el-input v-model="form.balance" placeholder="0" maxlength="30"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="升数卡余额" prop="literCard">
|
||||
<el-input v-model="form.literCard" placeholder="0" maxlength="30"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="是否关注公众号">
|
||||
<el-radio-group v-model="form.official">
|
||||
<el-radio label="ygz" value="ygz">已关注</el-radio>
|
||||
<el-radio label="wgz" value="wgz">未关注</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -376,35 +375,15 @@
|
||||
<el-col :span="24">
|
||||
<el-form-item label="会员状态">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio key="A" label="A" value="A">正常</el-radio>
|
||||
<el-radio key="N" label="N" value="N">禁用</el-radio>
|
||||
<el-radio label="qy" value="qy">启用</el-radio>
|
||||
<el-radio label="jy" value="jy">禁用</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row v-if="form.id">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="注册来源">
|
||||
<el-radio-group v-model="form.source">
|
||||
<el-radio label="" v-if="!form.source">未知</el-radio>
|
||||
<el-radio label="wechat_login" v-if="form.source == 'wechat_login'">微信小程序</el-radio>
|
||||
<el-radio label="wechat_mp" v-if="form.source == 'wechat_mp'">微信公众号</el-radio>
|
||||
<el-radio label="backend_add" v-if="form.source == 'backend_add'">后台添加</el-radio>
|
||||
<el-radio label="register_by_account" v-if="form.source == 'register_by_account'">H5注册</el-radio>
|
||||
<el-radio label="mobile_login" v-if="form.source == 'mobile_login'">手机号登录注册</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注信息">
|
||||
<el-input v-model="form.description" type="textarea" placeholder="请输入内容"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
@ -424,11 +403,13 @@
|
||||
import { getMemberList, updateMemberStatus, getMemberInfo, saveMember, deleteMember } from "@/api/member";
|
||||
import balanceRecharge from "./balanceRecharge";
|
||||
import pointRecharge from "./pointRecharge";
|
||||
import {listStatistic, listUser} from "@/api/staff/user/user";
|
||||
import {addUser, delUser, getUser, listStatistic, listUser, updateUser} from "@/api/staff/user/user";
|
||||
import {listUserGrade} from "@/api/staff/user/usergrade";
|
||||
import {ljStoreList} from "@/api/staff/store";
|
||||
export default {
|
||||
name: "MemberIndex",
|
||||
components: { balanceRecharge, pointRecharge },
|
||||
dicts: ['official'],
|
||||
dicts: ['official','zhzt'],
|
||||
data() {
|
||||
return {
|
||||
// 余额
|
||||
@ -441,6 +422,8 @@ export default {
|
||||
refuelMoney:'',
|
||||
// 今日新增
|
||||
addNum:'',
|
||||
// 昨日新增
|
||||
yesterdayAddNum:'',
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 标题
|
||||
@ -473,7 +456,8 @@ export default {
|
||||
// 默认排序
|
||||
defaultSort: {prop: 'updateTime', order: 'descending'},
|
||||
// 表单参数
|
||||
form: { id: '', name: '', gradeId: '', mobile: '', userNo: '', startTime: '', endTime: '', sex: 1, idcard: '', birthday: '', address: '', status: "A", description: '' },
|
||||
form: { id: '', name: '', gradeId: '', mobile: '', userNo: '',point:'0', startTime: '', endTime: '', refuelMoney:'0',official:'wgz',
|
||||
balance:'0', literCard:'0', sex: 1, idcard: '', birthday: '', address: '', status: "qy", description: '' },
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
page: 1,
|
||||
@ -484,15 +468,19 @@ export default {
|
||||
name: '',
|
||||
gradeId: '',
|
||||
status: '',
|
||||
storeIds: ''
|
||||
storeIds: '',
|
||||
official:'',
|
||||
balance:'',
|
||||
},
|
||||
ifBalance:'',
|
||||
// 表单校验
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: "会员名称不能为空", trigger: "blur" },
|
||||
{ min: 2, max: 200, message: '会员名称长度必须介于2 和 100 之间', trigger: 'blur' }
|
||||
],
|
||||
gradeId: [{ required: true, message: "请选择会员等级", trigger: "blur" }]
|
||||
gradeId: [{ required: true, message: "请选择会员等级", trigger: "blur" }],
|
||||
mobile: [{ required: true, message: "请输入手机号", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
@ -503,18 +491,17 @@ export default {
|
||||
methods: {
|
||||
// 跳转详情页
|
||||
goDedi(id){
|
||||
console.log('id:',id)
|
||||
this.$router.push({
|
||||
path:"/member/userInfo",
|
||||
// query:{
|
||||
// id:id
|
||||
// }
|
||||
query:{
|
||||
id:id
|
||||
}
|
||||
})
|
||||
},
|
||||
// 查询列表
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listUser().then( response => {
|
||||
listUser(this.addDateRange(this.queryParams, this.dateRange)).then( response => {
|
||||
this.list = response.data.records;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
@ -531,18 +518,34 @@ export default {
|
||||
// }
|
||||
// );
|
||||
},
|
||||
// 获得统计信息
|
||||
getStatistic(){
|
||||
listStatistic().then( response => {
|
||||
listStatistic(this.addDateRange(this.queryParams, this.dateRange)).then( response => {
|
||||
this.addNum = response.data.addNum;
|
||||
this.yesterdayAddNum = response.data.yesterdayAddNum;
|
||||
this.balance = response.data.balance;
|
||||
this.point = response.data.point;
|
||||
this.literCard = response.data.literCard;
|
||||
this.refuelMoney = response.data.refuelMoney;
|
||||
});
|
||||
listUserGrade().then( response => {
|
||||
this.userGradeList = response.data.records
|
||||
});
|
||||
ljStoreList().then( response => {
|
||||
this.storeList = response.data
|
||||
});
|
||||
},
|
||||
// 搜索按钮操作
|
||||
handleQuery() {
|
||||
this.queryParams.page = 1;
|
||||
if (this.ifBalance=='haveBalance'){
|
||||
this.queryParams.balance = 1;
|
||||
}else {
|
||||
this.queryParams.balance = 2;
|
||||
}
|
||||
if (this.ifBalance==''){
|
||||
this.queryParams.balance = ''
|
||||
}
|
||||
this.getList();
|
||||
},
|
||||
// 重置按钮操作
|
||||
@ -588,7 +591,6 @@ export default {
|
||||
},
|
||||
// 关闭对话框
|
||||
closeDialog(dialog) {
|
||||
console.log('closeDialog');
|
||||
if (dialog == 'balance') {
|
||||
this.openBalance = false;
|
||||
}
|
||||
@ -607,14 +609,10 @@ export default {
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.resetForm("form");
|
||||
this.form.id = '';
|
||||
this.form.description = '';
|
||||
this.form.name = '';
|
||||
this.form.startTime = '';
|
||||
this.form.endTime = '';
|
||||
this.form.gradeId = '';
|
||||
this.form.userNo = '';
|
||||
this.form.mobile = '';
|
||||
this.form= { id: '', name: '', gradeId: '', mobile: '', userNo: '',point:'0', startTime: '', endTime: '',
|
||||
refuelMoney:'0',official:'wgz',balance:'0', literCard:'0', sex: 1, idcard: '', birthday: '', address: '',
|
||||
status: "qy", description: ''
|
||||
}
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
@ -626,17 +624,17 @@ export default {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id) {
|
||||
saveMember(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改会员成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
updateUser(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改会员成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
saveMember(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增会员成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
addUser(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增会员成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -645,8 +643,8 @@ export default {
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids;
|
||||
getMemberInfo(id).then(response => {
|
||||
this.form = response.data.memberInfo;
|
||||
getUser(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "编辑会员";
|
||||
});
|
||||
@ -655,7 +653,8 @@ export default {
|
||||
handleDelete(row) {
|
||||
const name = row.name
|
||||
this.$modal.confirm('确定删除"' + name + '"的会员信息?').then(function() {
|
||||
return deleteMember(row.id);
|
||||
// return deleteMember(row.id);
|
||||
return delUser(row.id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
@ -668,7 +667,7 @@ export default {
|
||||
<style scoped>
|
||||
.app-container{
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
height: 100%;
|
||||
background: #f6f8f9;
|
||||
}
|
||||
.sta{
|
||||
|
@ -1,15 +1,453 @@
|
||||
<template>
|
||||
<div>
|
||||
会员详情页
|
||||
<div class="app-container">
|
||||
<el-card>
|
||||
<div slot="header" class="clearfix" style="display: flex;justify-content: space-between">
|
||||
<el-page-header @back="goBack" content="详情页面">
|
||||
</el-page-header>
|
||||
<div>
|
||||
<el-button type="primary" plain round>子卡管理<i class="el-icon-bank-card el-icon--right"></i></el-button>
|
||||
<el-button type="primary" plain round>会员码</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div>基础资料</div>
|
||||
<div style="display: flex;margin-top: 20px">
|
||||
<div class="left">
|
||||
<div>
|
||||
<img v-if="form.avatar" :src="form.avatar" style="width: 80px;height: 80px">
|
||||
<img v-else src="@/assets/images/avatar.png" style="width: 80px;height: 80px">
|
||||
</div>
|
||||
<el-button type="warning" plain round size="mini" style="margin: 10px">绑定实体卡</el-button><br>
|
||||
<el-button type="primary" icon="el-icon-bank-card" round style="margin: 10px;width: 50%;height: 40px">会员充值</el-button>
|
||||
</div>
|
||||
<div class="right">
|
||||
<el-descriptions>
|
||||
<el-descriptions-item label="手机号">{{form.mobile}}
|
||||
<el-tag size="mini" @click="replaceMobile">更换</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="会员昵称">{{form.name}}</el-descriptions-item>
|
||||
<el-descriptions-item label="实体卡号">{{form.idcard}}</el-descriptions-item>
|
||||
<el-descriptions-item label="绑定信息"></el-descriptions-item>
|
||||
<el-descriptions-item label="会员状态">
|
||||
<dict-tag :options="dict.type.zhzt" :value="form.status"/>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="加油次数">{{form.consumeNum}}</el-descriptions-item>
|
||||
<el-descriptions-item label="加油总金额">{{form.refuelMoney}}</el-descriptions-item>
|
||||
<el-descriptions-item label="所属油站">{{ store.name }}</el-descriptions-item>
|
||||
<el-descriptions-item label="注册时间">{{form.createTime}}</el-descriptions-item>
|
||||
<el-descriptions-item label="关联副卡">{{form.secondCard}}</el-descriptions-item>
|
||||
<el-descriptions-item label="会员等级">{{ grade.name }}</el-descriptions-item>
|
||||
<el-descriptions-item label="储值优惠"></el-descriptions-item>
|
||||
<el-descriptions-item label="每日笔数"></el-descriptions-item>
|
||||
<el-descriptions-item label="固定等级"></el-descriptions-item>
|
||||
<el-descriptions-item label="备注信息">{{ form.description }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card style="margin: 20px 0">
|
||||
<div>会员资产</div>
|
||||
<div>
|
||||
<template>
|
||||
<div>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="4">
|
||||
<div class="sta">
|
||||
<el-statistic
|
||||
group-separator=","
|
||||
:value="form.point"
|
||||
title="累计积分"
|
||||
></el-statistic>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="sta">
|
||||
<el-statistic
|
||||
group-separator=","
|
||||
:value="form.refuelMoney"
|
||||
title="加油金">
|
||||
</el-statistic>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="sta">
|
||||
<el-statistic
|
||||
group-separator=","
|
||||
:precision="2"
|
||||
:value="form.balance"
|
||||
title="账户余额"
|
||||
></el-statistic>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="sta">
|
||||
<el-statistic
|
||||
group-separator=","
|
||||
:precision="2"
|
||||
:value="form.literCard"
|
||||
title="升数卡余额"
|
||||
></el-statistic>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card>
|
||||
<template>
|
||||
<el-tabs v-model="activeName" @tab-click="handleClick">
|
||||
<el-tab-pane label="加油订单" name="refuelOrder">
|
||||
<el-table ref="tables" v-loading="loading" :data="list">
|
||||
<el-table-column label="所属油站" prop="id" align="center"/>
|
||||
<el-table-column label="订单时间" align="center"/>
|
||||
<el-table-column label="交易终端" align="center" prop="userNo"/>
|
||||
<el-table-column label="油品/油枪" align="center" prop="name" />
|
||||
<el-table-column label="订单金额" align="center" prop="mobile"/>
|
||||
<el-table-column label="优惠金额" align="center" prop="gradeId"/>
|
||||
<el-table-column label="实付金额" align="center" prop="balance"/>
|
||||
<el-table-column label="付款类型" align="center" prop="balance"/>
|
||||
<el-table-column label="订单号" align="center" prop="balance"/>
|
||||
<el-table-column label="订单类型" align="center" prop="point"/>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.page"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="商品订单" name="shopOrder">
|
||||
<el-table ref="tables" v-loading="loading" :data="list">
|
||||
<el-table-column label="所属油站" prop="id" align="center"/>
|
||||
<el-table-column label="订单时间" align="center"/>
|
||||
<el-table-column label="订单金额" align="center" prop="userNo"/>
|
||||
<el-table-column label="商品数量" align="center" prop="name" />
|
||||
<el-table-column label="储值卡" align="center" prop="mobile"/>
|
||||
<el-table-column label="实付金额" align="center" prop="balance"/>
|
||||
<el-table-column label="付款类型" align="center" prop="balance"/>
|
||||
<el-table-column label="订单号" align="center" prop="balance"/>
|
||||
<el-table-column label="订单类型" align="center" prop="point"/>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.page"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="余额记录" name="balanceRecord">
|
||||
<!-- <el-tabs v-model="balanceRecord" type="card" @tab-click="handleClick">-->
|
||||
<!-- <el-tab-pane label="储值卡记录" name="first">储值卡记录</el-tab-pane>-->
|
||||
<!-- <el-tab-pane label="升数卡记录" name="second">升数卡记录</el-tab-pane>-->
|
||||
<!-- </el-tabs>-->
|
||||
<el-radio-group v-model="tabPosition" size="mini" style="margin-bottom: 30px;">
|
||||
<el-radio-button label="giftCard">储值卡记录</el-radio-button>
|
||||
<el-radio-button label="literCard">升数卡记录</el-radio-button>
|
||||
</el-radio-group>
|
||||
<div v-if="tabPosition=='giftCard'">
|
||||
<el-table ref="tables" v-loading="loading" :data="list">
|
||||
<el-table-column prop="date" label="所属油站"/>
|
||||
<el-table-column prop="date" label="变动账户"/>
|
||||
<el-table-column prop="date" label="类型"/>
|
||||
<el-table-column label="详细信息">
|
||||
<el-table-column prop="name" label="变动金额"/>
|
||||
<el-table-column prop="address" label="变动前余额"/>
|
||||
<el-table-column prop="address" label="变动后余额"/>
|
||||
</el-table-column>
|
||||
<el-table-column prop="date" label="订单号"/>
|
||||
<el-table-column prop="date" label="描述"/>
|
||||
<el-table-column prop="date" label="变动时间"/>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.page"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
<div v-else>
|
||||
<el-table ref="tables" v-loading="loading" :data="list">
|
||||
<el-table-column label="所属油站" prop="id" align="center"/>
|
||||
<el-table-column label="变动账户" align="center"/>
|
||||
<el-table-column label="类型" align="center" prop="userNo"/>
|
||||
<el-table-column label="变动升数" align="center" prop="name" />
|
||||
<el-table-column label="订单号" align="center" prop="balance"/>
|
||||
<el-table-column label="描述" align="center" prop="balance"/>
|
||||
<el-table-column label="变动时间" align="center" prop="point"/>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.page"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="积分记录" name="pointRecord">
|
||||
<el-table ref="tables" v-loading="loading" :data="list">
|
||||
<el-table-column label="所属油站" prop="id" align="center"/>
|
||||
<el-table-column label="变动时间" align="center"/>
|
||||
<el-table-column label="类型" align="center" prop="userNo"/>
|
||||
<el-table-column label="变动积分" align="center" prop="name" />
|
||||
<el-table-column label="描述" align="center" prop="balance"/>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.page"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="卡券列表" name="cardList">
|
||||
<el-radio-group v-model="cardList" size="mini" style="margin-bottom: 30px;">
|
||||
<el-radio-button label="notUse">未使用</el-radio-button>
|
||||
<el-radio-button label="used">已使用</el-radio-button>
|
||||
<el-radio-button label="expired">已过期</el-radio-button>
|
||||
<el-radio-button label="whole">全部</el-radio-button>
|
||||
</el-radio-group>
|
||||
<div>
|
||||
<el-table ref="tables" v-loading="loading" :data="list">
|
||||
<el-table-column prop="date" label="所属油站"/>
|
||||
<el-table-column prop="date" label="优惠券名称"/>
|
||||
<el-table-column prop="date" label="卡券类型"/>
|
||||
<el-table-column prop="date" label="满减金额"/>
|
||||
<el-table-column prop="date" label="券面额"/>
|
||||
<el-table-column prop="date" label="适用油品"/>
|
||||
<el-table-column prop="date" label="状态"/>
|
||||
<el-table-column label="卡券可用规则">
|
||||
<el-table-column prop="name" label="有效期"/>
|
||||
<el-table-column prop="address" label="周期与时段"/>
|
||||
</el-table-column>
|
||||
<el-table-column prop="date" label="领取时间"/>
|
||||
<el-table-column prop="date" label="描述"/>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.page"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="成长值记录" name="growthValue">
|
||||
<el-radio-group v-model="growthValue" size="mini" style="margin-bottom: 30px;">
|
||||
<el-radio-button label="whole">全部</el-radio-button>
|
||||
<el-radio-button label="gasoline">汽油成长值</el-radio-button>
|
||||
<el-radio-button label="diesel">柴油成长值</el-radio-button>
|
||||
<el-radio-button label="naturalGas">天然气成长值</el-radio-button>
|
||||
</el-radio-group>
|
||||
<div>
|
||||
<el-table ref="tables" v-loading="loading" :data="list">
|
||||
<el-table-column label="所属油站" prop="id" align="center"/>
|
||||
<el-table-column label="变动时间" align="center"/>
|
||||
<el-table-column label="类型" align="center" prop="userNo"/>
|
||||
<el-table-column label="变动成长值" align="center" prop="name" />
|
||||
<el-table-column label="描述" align="center" prop="balance"/>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.page"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="加油金记录" name="refuelMoney">
|
||||
<el-table ref="tables" v-loading="loading" :data="list">
|
||||
<el-table-column label="所属油站" prop="id" align="center"/>
|
||||
<el-table-column label="变动时间" align="center"/>
|
||||
<el-table-column label="类型" align="center" prop="userNo"/>
|
||||
<el-table-column label="变动数据" align="center" prop="name" />
|
||||
<el-table-column label="记录单号" align="center" prop="name" />
|
||||
<el-table-column label="变动描述" align="center" prop="balance"/>
|
||||
<el-table-column label="场景来源" align="center" prop="balance"/>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.page"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</template>
|
||||
</el-card>
|
||||
|
||||
|
||||
<!-- 更换手机号对话框-->
|
||||
<el-dialog :close-on-click-modal="false" :title="title" :visible.sync="openMobile" style="margin-top: 200px" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="新手机号" prop="mobile" style="width: 420px">
|
||||
<el-input v-model="form.mobile" placeholder="请输入新手机号" maxlength="30" />
|
||||
<span style="font-size: 12px;color: grey">
|
||||
手机号更换后,旧手机号将无法使用,更换后实时生效
|
||||
</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</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>
|
||||
export default {
|
||||
import {getUser, updateUser} from "@/api/staff/user/user";
|
||||
import {ljStoreInfo} from "@/api/staff/store";
|
||||
import {getUserGrade} from "@/api/staff/user/usergrade";
|
||||
|
||||
export default {
|
||||
dicts: ['official','zhzt'],
|
||||
data(){
|
||||
return{
|
||||
title:'',
|
||||
// 是否显示修改对话框
|
||||
openMobile: false,
|
||||
growthValue:'whole',
|
||||
cardList:'notUse',
|
||||
tabPosition: 'giftCard',
|
||||
balanceRecord: 'first',
|
||||
// 遮罩层
|
||||
loading: false,
|
||||
id:'',
|
||||
// 会员信息
|
||||
form:{},
|
||||
// 店铺信息
|
||||
store:'',
|
||||
// 会员等级信息
|
||||
grade:'',
|
||||
activeName: 'refuelOrder',
|
||||
tableData:[],
|
||||
total:'',
|
||||
queryParams: {
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
mobile: '',
|
||||
id: '',
|
||||
name: '',
|
||||
status: '',
|
||||
},
|
||||
list: [],
|
||||
// 表单校验
|
||||
rules: {
|
||||
mobile: [{ required: true, message: "请输入手机号", trigger: "blur" }],
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.id = this.$route.query.id;
|
||||
this.getUserInfo();
|
||||
},
|
||||
methods: {
|
||||
// 更换手机号
|
||||
replaceMobile(){
|
||||
this.openMobile = true;
|
||||
this.title = '更换手机号'
|
||||
},
|
||||
getList(){
|
||||
|
||||
},
|
||||
// 获取详情
|
||||
getUserInfo(){
|
||||
let _this = this;
|
||||
// 获取会员详情
|
||||
getUser(this.id).then(response => {
|
||||
this.form = response.data;
|
||||
this.getGrade(response.data.gradeId);
|
||||
});
|
||||
// 获取店铺详情
|
||||
ljStoreInfo().then(response => {
|
||||
this.store = response.data;
|
||||
});
|
||||
},
|
||||
getGrade(id){
|
||||
getUserGrade(id).then(response => {
|
||||
this.grade = response.data;
|
||||
});
|
||||
},
|
||||
// 提交按钮
|
||||
submitForm: function() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id) {
|
||||
updateUser(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.openMobile = false;
|
||||
this.getUserInfo();
|
||||
});
|
||||
} else {
|
||||
// addUser(this.form).then(response => {
|
||||
// this.$modal.msgSuccess("新增成功");
|
||||
// this.open = false;
|
||||
// this.getList();
|
||||
// });
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.resetForm("form");
|
||||
this.form= {}
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.openMobile = false;
|
||||
},
|
||||
handleClick(tab, event) {
|
||||
console.log(tab, event);
|
||||
},
|
||||
// 返回
|
||||
goBack() {
|
||||
this.$router.back(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.app-container{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #f6f8f9;
|
||||
}
|
||||
.left{
|
||||
width: 20%;
|
||||
display: table-cell;
|
||||
/*垂直居中 */
|
||||
vertical-align: middle;
|
||||
/*水平居中*/
|
||||
text-align: center;
|
||||
}
|
||||
.right{
|
||||
flex: 1;
|
||||
}
|
||||
.sta{
|
||||
height: 100px;
|
||||
margin-top: 10px;
|
||||
padding-top: 30px;
|
||||
}
|
||||
</style>
|
||||
|
@ -836,7 +836,7 @@ export default {
|
||||
<style scoped>
|
||||
.app-container{
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
height: 100%;
|
||||
background: #f6f8f9;
|
||||
}
|
||||
.pagin-box{
|
||||
|
@ -191,6 +191,8 @@ export default {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-container{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #f6f8f9;
|
||||
}
|
||||
.card{
|
||||
|
@ -277,19 +277,37 @@
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="所需成长值">
|
||||
<el-input v-model="form.gasoline" placeholder="1" style="width: 240px">
|
||||
<template slot="prepend">汽油</template>
|
||||
<template slot="append">成长值</template>
|
||||
</el-input>
|
||||
<el-input v-model="form.dieselOil" placeholder="1" style="width: 240px">
|
||||
<template slot="prepend">柴油</template>
|
||||
<template slot="append">成长值</template>
|
||||
</el-input>
|
||||
<el-input v-model="form.naturalGas" placeholder="1" style="width: 240px">
|
||||
<template slot="prepend">天然气</template>
|
||||
<template slot="append">成长值</template>
|
||||
</el-input>
|
||||
<el-form-item label="所需成长值" prop="gasoline">
|
||||
<e-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item prop="gasoline">
|
||||
<el-input v-model="form.gasoline" placeholder="1" style="width: 240px">
|
||||
<template slot="prepend">汽油</template>
|
||||
<template slot="append">成长值</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</e-row>
|
||||
<e-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item prop="dieselOil">
|
||||
<el-input v-model="form.dieselOil" placeholder="1" style="width: 240px">
|
||||
<template slot="prepend">柴油</template>
|
||||
<template slot="append">成长值</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</e-row>
|
||||
<e-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item prop="naturalGas">
|
||||
<el-input v-model="form.naturalGas" placeholder="1" style="width: 240px">
|
||||
<template slot="prepend">天然气</template>
|
||||
<template slot="append">成长值</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</e-row>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -302,7 +320,7 @@
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="优惠类型">
|
||||
<el-form-item label="优惠类型" prop="preferential">
|
||||
<el-radio-group v-model="form.preferential">
|
||||
<el-radio
|
||||
v-for="dict in dict.type.yhlx"
|
||||
@ -325,7 +343,7 @@
|
||||
<div v-if="form.preferential=='自定义优惠'">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="汽油优惠">
|
||||
<el-form-item label="汽油优惠" prop="preferential">
|
||||
<el-radio-group v-model="form.gasolineDiscount">
|
||||
<el-radio label="无优惠">无优惠</el-radio>
|
||||
<el-radio label="满减优惠">满减优惠</el-radio>
|
||||
@ -354,7 +372,7 @@
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="柴油优惠">
|
||||
<el-form-item label="柴油优惠" prop="preferential">
|
||||
<el-radio-group v-model="form.dieselDiscount">
|
||||
<el-radio label="无优惠">无优惠</el-radio>
|
||||
<el-radio label="满减优惠">满减优惠</el-radio>
|
||||
@ -383,7 +401,7 @@
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="天然气优惠">
|
||||
<el-form-item label="天然气优惠" prop="preferential">
|
||||
<el-radio-group v-model="form.naturalGasDiscount">
|
||||
<el-radio label="无优惠">无优惠</el-radio>
|
||||
<el-radio label="满减优惠">满减优惠</el-radio>
|
||||
@ -414,7 +432,7 @@
|
||||
<div v-else>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="关联优惠组">
|
||||
<el-form-item label="关联优惠组" prop="preferential">
|
||||
<el-select v-model="form.promotionGroup">
|
||||
<el-option
|
||||
v-for="dict in dict.type.yhhdz"
|
||||
@ -438,7 +456,7 @@
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="状态">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio label="qy">启用</el-radio>
|
||||
<el-radio label="jy">禁用</el-radio>
|
||||
@ -601,14 +619,20 @@ export default {
|
||||
{ required: true, message: "等级名称不能为空", trigger: "blur" },
|
||||
{ min: 2, max: 100, message: '等级名称长度必须介于2 和 100 之间', trigger: 'blur' }
|
||||
],
|
||||
catchType: [
|
||||
{ required: true, message: "请选择升级方式", trigger: "blur" },
|
||||
gasoline: [
|
||||
{ required: true, message: "请填写汽油成长值", trigger: "blur" },
|
||||
],
|
||||
catchValue: [
|
||||
{ required: true, message: "请输入升级条件值", trigger: "blur" },
|
||||
dieselOil: [
|
||||
{ required: true, message: "请填写柴油成长值", trigger: "blur" },
|
||||
],
|
||||
validDay: [
|
||||
{ required: true, message: "请输入有效期天数,0表述永久有效", trigger: "blur" },
|
||||
naturalGas: [
|
||||
{ required: true, message: "请填写天然气成长值", trigger: "blur" },
|
||||
],
|
||||
preferential: [
|
||||
{ required: true, message: "请选择优惠类型", trigger: "blur" },
|
||||
],
|
||||
status: [
|
||||
{ required: true, message: "请选择会员等级状态", trigger: "blur" },
|
||||
],
|
||||
discount: [
|
||||
{ required: true, message: "请输入支付折扣", trigger: "blur" },
|
||||
@ -863,8 +887,8 @@ export default {
|
||||
|
||||
<style scoped>
|
||||
.app-container{
|
||||
//width: 100%;
|
||||
//height: 100vh;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #f6f8f9;
|
||||
}
|
||||
.card{
|
||||
|
@ -0,0 +1,62 @@
|
||||
package com.fuint.business.convenienceSore.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.convenienceSore.entity.CvsGoods;
|
||||
import com.fuint.business.convenienceSore.service.CvsGoodsService;
|
||||
import com.fuint.business.convenienceSore.vo.CvsGoodsVo;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author :admin
|
||||
* @date : 2023/10/16
|
||||
* 便利店商品管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/business/cvsGoods")
|
||||
public class CvsGoodsController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CvsGoodsService cvsGoodsService;
|
||||
|
||||
/**新增商品类别*/
|
||||
@PostMapping("/addCvsGoods")
|
||||
public ResponseObject insertCvsGoods( @RequestBody CvsGoods goods){
|
||||
int i = cvsGoodsService.insertCvsGoods(goods);
|
||||
if(i == -1){
|
||||
return getFailureResult("新增失败,数据已存在");
|
||||
}else {
|
||||
return getSuccessResult(i);
|
||||
}
|
||||
}
|
||||
|
||||
/**分页查询*/
|
||||
@PostMapping("/selectTree")
|
||||
private ResponseObject selectTree(@RequestBody CvsGoods goods){
|
||||
Page page =new Page<>(goods.getPageNum(),goods.getPageSize());
|
||||
IPage<CvsGoodsVo> list = cvsGoodsService.selectTree(page,goods);
|
||||
return getSuccessResult(list);
|
||||
}
|
||||
|
||||
//查询一级菜单
|
||||
@PostMapping("/list")
|
||||
public ResponseObject list(CvsGoods goods)
|
||||
{
|
||||
List<CvsGoods> list = cvsGoodsService.selectCvsGoodsList(goods);
|
||||
return getSuccessResult(list);
|
||||
}
|
||||
|
||||
//根据id查询一级菜单
|
||||
@GetMapping("/{id}")
|
||||
public ResponseObject selectParentById(@PathVariable Integer id)
|
||||
{
|
||||
CvsGoods cvsGoods = cvsGoodsService.selectParentById(id);
|
||||
return getSuccessResult(cvsGoods);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.fuint.business.convenienceSore.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fuint.framework.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author :admin
|
||||
* @date : 2023/10/16
|
||||
* 便利店商品分类表
|
||||
*/
|
||||
@Data
|
||||
@TableName("cvs_goods")
|
||||
public class CvsGoods extends BaseEntity {
|
||||
|
||||
//主键
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
//父分类id
|
||||
private Integer pid;
|
||||
|
||||
//编码
|
||||
private String code;
|
||||
|
||||
//商品分类
|
||||
private String categoryName;
|
||||
|
||||
//商品排序
|
||||
private Integer sorted;
|
||||
|
||||
//商品状态
|
||||
private String status;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer pageNum;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer pageSize;
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.fuint.business.convenienceSore.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.convenienceSore.entity.CvsGoods;
|
||||
import com.fuint.business.convenienceSore.vo.CvsGoodsVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author :admin
|
||||
* @date : 2023/10/16
|
||||
* 便利店商品管理接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface CvsGoodsMapper extends BaseMapper<CvsGoods> {
|
||||
//查找一级菜单
|
||||
IPage<CvsGoodsVo> selectCvsGoodsList(Page page , @Param("goods") CvsGoods goods);
|
||||
|
||||
//查找二级菜单
|
||||
List<CvsGoodsVo> selectCvsGoodsTreeList(CvsGoods goods);
|
||||
|
||||
//根据id和name查找
|
||||
List<CvsGoods> selectGoodsList(CvsGoods goods);
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fuint.business.convenienceSore.mapper.CvsGoodsMapper">
|
||||
|
||||
<sql id="selectCvsGoods">
|
||||
select id,pid,category_name,code,sorted, status, create_time, create_by, update_time, update_by from cvs_goods
|
||||
</sql>
|
||||
|
||||
<!--判断新增是否重复 -->
|
||||
<select id="selectGoodsList" parameterType="com.fuint.business.convenienceSore.entity.CvsGoods" resultType="com.fuint.business.convenienceSore.entity.CvsGoods" >
|
||||
<include refid="selectCvsGoods"></include>
|
||||
<where>
|
||||
<if test="pid != null">
|
||||
and pid = #{pid}
|
||||
</if>
|
||||
<if test="categoryName != null and categoryName != ''">
|
||||
and category_name = #{categoryName}
|
||||
</if>
|
||||
<if test="sorted != null and sorted != ''">
|
||||
and sorted = #{sorted}
|
||||
</if>
|
||||
</where>
|
||||
order by sorted
|
||||
</select>
|
||||
|
||||
<!--查询一级分类列表 -->
|
||||
<select id="selectCvsGoodsList" parameterType="com.fuint.business.convenienceSore.entity.CvsGoods" resultType="com.fuint.business.convenienceSore.vo.CvsGoodsVo">
|
||||
SELECT
|
||||
DISTINCT
|
||||
pTable.id,
|
||||
pTable.pid,
|
||||
pTable.category_name,
|
||||
pTable.`CODE`,
|
||||
pTable.sorted,
|
||||
pTable.`STATUS`,
|
||||
pTable.create_time,
|
||||
pTable.create_by,
|
||||
pTable.update_time,
|
||||
pTable.update_by
|
||||
FROM
|
||||
(SELECT * from cvs_goods WHERE pid = 0) pTable
|
||||
left join
|
||||
(SELECT * from cvs_goods WHERE pid != 0) cTable on pTable.id = cTable.pid
|
||||
<where>
|
||||
<if test="goods.status != null and goods.status != ''">
|
||||
and pTable.status = #{goods.status}
|
||||
</if>
|
||||
<if test="goods.categoryName != null and goods.categoryName!= ''">
|
||||
and pTable.category_name like concat('%',#{goods.categoryName},'%')
|
||||
or cTable.category_name like concat('%',#{goods.categoryName},'%')
|
||||
</if>
|
||||
</where>
|
||||
group by pTable.id
|
||||
order by sorted
|
||||
</select>
|
||||
|
||||
<!--查找二级分类-->
|
||||
<select id="selectCvsGoodsTreeList" parameterType="com.fuint.business.convenienceSore.entity.CvsGoods" resultType="com.fuint.business.convenienceSore.vo.CvsGoodsVo">
|
||||
SELECT
|
||||
id,
|
||||
pid,
|
||||
category_name,
|
||||
`CODE`,
|
||||
sorted,
|
||||
`STATUS`,
|
||||
create_time,
|
||||
create_by,
|
||||
update_time,
|
||||
update_by
|
||||
FROM
|
||||
cvs_goods
|
||||
<where >
|
||||
<if test="pid != null ">
|
||||
and pid = #{pid}
|
||||
</if>
|
||||
<if test="categoryName != null and categoryName != ''">
|
||||
and category_name like CONCAT('%',#{categoryName},'%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
order by sorted
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,24 @@
|
||||
package com.fuint.business.convenienceSore.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.convenienceSore.entity.CvsGoods;
|
||||
import com.fuint.business.convenienceSore.vo.CvsGoodsVo;
|
||||
import io.swagger.models.auth.In;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author :admin
|
||||
* @date : 2023/10/16
|
||||
*/
|
||||
public interface CvsGoodsService {
|
||||
|
||||
int insertCvsGoods(CvsGoods cvsGoods);
|
||||
|
||||
IPage<CvsGoodsVo> selectTree(Page page, CvsGoods goods);
|
||||
|
||||
List<CvsGoods> selectCvsGoodsList(CvsGoods goods);
|
||||
|
||||
CvsGoods selectParentById(Integer id);
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
package com.fuint.business.convenienceSore.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.convenienceSore.entity.CvsGoods;
|
||||
import com.fuint.business.convenienceSore.mapper.CvsGoodsMapper;
|
||||
import com.fuint.business.convenienceSore.service.CvsGoodsService;
|
||||
import com.fuint.business.convenienceSore.vo.CvsGoodsVo;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author :admin
|
||||
* @date : 2023/10/16
|
||||
*/
|
||||
@Service
|
||||
public class CvsGoodsServiceImpl extends ServiceImpl<CvsGoodsMapper,CvsGoods> implements CvsGoodsService {
|
||||
|
||||
/**添加商品信息*/
|
||||
@Transactional
|
||||
public int insertCvsGoods( CvsGoods cvsGoods){
|
||||
//查找分类名称是否存在
|
||||
List<CvsGoods> cvsGoodsList = baseMapper.selectGoodsList(cvsGoods);
|
||||
if(CollectionUtil.isNotEmpty(cvsGoodsList)){
|
||||
return -1;
|
||||
}else {
|
||||
int insertGoods = baseMapper.insert(cvsGoods);
|
||||
cvsGoods.setCode(cvsGoods.getPid()+","+cvsGoods.getId()+",");
|
||||
baseMapper.updateById(cvsGoods);
|
||||
return insertGoods;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public IPage<CvsGoodsVo> selectTree(Page page, CvsGoods g){
|
||||
// 查询全部数据
|
||||
IPage<CvsGoodsVo> cvsGoodsPage= baseMapper.selectCvsGoodsList(page,g);//一节点
|
||||
List<CvsGoodsVo> cvsGoodsList = cvsGoodsPage.getRecords();
|
||||
if(CollectionUtil.isNotEmpty(cvsGoodsList)){
|
||||
List<CvsGoodsVo> resList = new ArrayList<>();
|
||||
resList.addAll(cvsGoodsList);
|
||||
for (CvsGoodsVo cvsGoods : cvsGoodsList) {
|
||||
g.setPid(cvsGoods.getId());
|
||||
List<CvsGoodsVo> treeList = baseMapper.selectCvsGoodsTreeList(g);//二级节点
|
||||
resList.addAll(treeList);//一级和二级合并
|
||||
}
|
||||
// cvsGoodsList转换为cvsGoodsVoList
|
||||
List<CvsGoodsVo> CvsGoodsVoList = resList.stream().map(goods -> {
|
||||
CvsGoodsVo cvsGoodsVo = new CvsGoodsVo();
|
||||
cvsGoodsVo.setId(goods.getId());
|
||||
cvsGoodsVo.setCategoryName(goods.getCategoryName());
|
||||
cvsGoodsVo.setPid(goods.getPid());
|
||||
cvsGoodsVo.setStatus(goods.getStatus());
|
||||
cvsGoodsVo.setCreateTime(new Date());
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
cvsGoodsVo.setCreateBy(nowAccountInfo.getId().toString());
|
||||
cvsGoodsVo.setSorted(goods.getSorted());
|
||||
return cvsGoodsVo;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
//获取得所有parentId为0的数据,也就是一级目录
|
||||
//用于封装数据,取得他的孩子(也就是下级目录)的数据
|
||||
List<CvsGoodsVo> CvsGoodsVoTree = CvsGoodsVoList.stream()
|
||||
.filter(categoryVo -> categoryVo.getPid().equals(0))
|
||||
.map((cvsVoParent) -> {
|
||||
cvsVoParent.setChildren(getChildrenData(cvsVoParent, CvsGoodsVoList));
|
||||
return cvsVoParent;
|
||||
}).collect(Collectors.toList());
|
||||
cvsGoodsPage.setRecords(CvsGoodsVoTree);
|
||||
return cvsGoodsPage;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取孩子(下级目录)的方法,递归实现
|
||||
* @return
|
||||
*/
|
||||
private List<CvsGoodsVo> getChildrenData(CvsGoodsVo root, List<CvsGoodsVo> all) {
|
||||
List<CvsGoodsVo> children = all.stream().filter(cvsVo ->
|
||||
cvsVo.getPid().equals(root.getId())
|
||||
).map(categoryVo -> {
|
||||
categoryVo.setChildren(getChildrenData(categoryVo, all));
|
||||
return categoryVo;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return children;
|
||||
}
|
||||
|
||||
//查询一级节点
|
||||
public List<CvsGoods> selectCvsGoodsList(CvsGoods goods){
|
||||
LambdaQueryWrapper<CvsGoods> queryWrapper =new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CvsGoods::getPid,"0").orderByAsc(CvsGoods::getSorted);
|
||||
return baseMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
//根据id查找父级
|
||||
public CvsGoods selectParentById(Integer id){
|
||||
return baseMapper.selectById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.fuint.business.convenienceSore.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fuint.business.convenienceSore.entity.CvsGoods;
|
||||
import com.fuint.repository.model.base.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.beans.factory.parsing.BeanEntry;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author :admin
|
||||
* @date : 2023/10/17
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CvsGoodsVo extends BaseEntity {
|
||||
//主键
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
//父分类id
|
||||
private Integer pid;
|
||||
|
||||
//编码
|
||||
private String code;
|
||||
|
||||
//商品分类
|
||||
private String categoryName;
|
||||
|
||||
//商品排序
|
||||
private Integer sorted;
|
||||
|
||||
//商品状态
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 子节点
|
||||
*/
|
||||
private List<CvsGoodsVo> children;
|
||||
|
||||
}
|
@ -289,18 +289,8 @@ public class BackendStoreController extends BaseController {
|
||||
@ApiOperation(value = "获取店铺详情")
|
||||
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
|
||||
@CrossOrigin
|
||||
public ResponseObject getStoreInfo(HttpServletRequest request, @PathVariable("id") Integer id) throws BusinessCheckException {
|
||||
String token = request.getHeader("Access-Token");
|
||||
AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
|
||||
if (accountInfo == null) {
|
||||
return getFailureResult(1001, "请先登录");
|
||||
}
|
||||
|
||||
public ResponseObject getStoreInfo( @PathVariable("id") Integer id) throws BusinessCheckException {
|
||||
StoreDto storeInfo = storeService.queryStoreDtoById(id);
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("storeInfo", storeInfo);
|
||||
|
||||
return getSuccessResult(result);
|
||||
return getSuccessResult(storeInfo);
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/business/storeInformation/store")
|
||||
public class LJStoreController extends BaseController {
|
||||
@ -25,6 +27,16 @@ public class LJStoreController extends BaseController {
|
||||
return getSuccessResult(store);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询门店信息
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public ResponseObject list(){
|
||||
List<LJStore> list = storeService.selectStoreList();
|
||||
return getSuccessResult(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改门店信息
|
||||
* @param store
|
||||
|
@ -3,6 +3,8 @@ package com.fuint.business.storeInformation.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.business.storeInformation.entity.LJStore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺信息 业务层
|
||||
*/
|
||||
@ -13,6 +15,12 @@ public interface ILJStoreService extends IService<LJStore> {
|
||||
*/
|
||||
public LJStore selectStoreById();
|
||||
|
||||
/**
|
||||
* 查询店铺信息
|
||||
* @return
|
||||
*/
|
||||
public List<LJStore> selectStoreList();
|
||||
|
||||
/**
|
||||
* 修改店铺信息
|
||||
* @param store 店铺信息
|
||||
|
@ -8,6 +8,8 @@ import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺信息 业务层
|
||||
*/
|
||||
@ -25,6 +27,15 @@ public class LJStoreServiceImpl extends ServiceImpl<LJStoreMapper, LJStore> impl
|
||||
return store;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询店铺信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<LJStore> selectStoreList() {
|
||||
return baseMapper.selectList(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改店铺信息
|
||||
* @param store 店铺信息
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fuint.business.userManager.entity;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fuint.framework.entity.BaseEntity;
|
||||
@ -11,6 +12,7 @@ import lombok.Setter;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员个人信息
|
||||
@ -114,4 +116,7 @@ public class LJUser extends BaseEntity implements Serializable {
|
||||
|
||||
@ApiModelProperty("加油次数")
|
||||
private BigDecimal consumeNum;
|
||||
|
||||
@ApiModelProperty("副卡信息")
|
||||
private String secondCard;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
<result property="literCard" column="liter_card" />
|
||||
<result property="refuelMoney" column="refuel_money" />
|
||||
<result property="consumeNum" column="consume_num" />
|
||||
<result property="secondCard" column="second_card" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
@ -39,7 +40,7 @@
|
||||
<sql id="selectUser">
|
||||
select id, mobile, user_no, avatar, name, open_id, idcard, grade_id, start_time, end_time, balance, point,
|
||||
sex, birthday, car_no, source, password, salt, address, merchant_id, store_id, create_time, update_time,
|
||||
status, description, operator,official,liter_card,refuel_money,consume_num from mt_user
|
||||
status, description, operator,official,liter_card,refuel_money,consume_num,second_card from mt_user
|
||||
</sql>
|
||||
|
||||
<select id="selectUserList" resultMap="UserResult">
|
||||
@ -58,9 +59,27 @@
|
||||
<if test="user.gradeId != null and user.gradeId != ''">
|
||||
and grade_id = #{user.gradeId}
|
||||
</if>
|
||||
<if test="user.storeId != null and user.storeId != ''">
|
||||
and store_id = #{user.storeId}
|
||||
</if>
|
||||
<if test="user.official != null and user.official != ''">
|
||||
and official = #{user.official}
|
||||
</if>
|
||||
<if test="user.balance != null and user.balance != '' and user.balance == 2">
|
||||
and balance = 0
|
||||
</if>
|
||||
<if test="user.balance != null and user.balance != '' and user.balance == 1">
|
||||
and balance != 0
|
||||
</if>
|
||||
<if test="user.params.beginTime != null and user.params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
and date_format(create_time,'%y%m%d') >= date_format(#{user.params.beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="user.params.endTime != null and user.params.endTime != ''"><!-- 结束时间检索 -->
|
||||
and date_format(create_time,'%y%m%d') <= date_format(#{user.params.endTime},'%y%m%d')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectSumByStore" resultType="java.lang.Double" parameterType="int">
|
||||
select sum(${sumValue}) from mt_user where store_id = #{storeId};
|
||||
select sum(${sumValue}) from mt_user where store_id = #{storeId}
|
||||
</select>
|
||||
</mapper>
|
@ -1,5 +1,6 @@
|
||||
package com.fuint.business.userManager.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -11,8 +12,13 @@ import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.xml.crypto.Data;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 会员信息 业务层
|
||||
@ -30,7 +36,8 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
user.setStoreId(storeId);
|
||||
return baseMapper.selectUserList(page,user);
|
||||
IPage<LJUser> ljUserIPage = baseMapper.selectUserList(page, user);
|
||||
return ljUserIPage;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -48,14 +55,20 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
|
||||
Double refuelMoney = baseMapper.selectSumByStore(storeId, "refuel_money");
|
||||
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("TO_DAYS(create_time)","TO_DAYS(NOW())");
|
||||
queryWrapper.apply(true, "TO_DAYS(NOW())-TO_DAYS(create_time) = 0");
|
||||
Integer addNum = baseMapper.selectCount(queryWrapper);
|
||||
|
||||
QueryWrapper queryWrapper1 = new QueryWrapper<>();
|
||||
queryWrapper1.apply(true, "TO_DAYS(NOW())-TO_DAYS(create_time) = 1");
|
||||
|
||||
Integer yesterdayAddNum = baseMapper.selectCount(queryWrapper1);
|
||||
|
||||
map.put("balance",balance);
|
||||
map.put("point",point);
|
||||
map.put("literCard",literCard);
|
||||
map.put("refuelMoney",refuelMoney);
|
||||
map.put("addNum",addNum);
|
||||
map.put("yesterdayAddNum",yesterdayAddNum);
|
||||
return map;
|
||||
}
|
||||
|
||||
@ -88,6 +101,12 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
user.setStoreId(storeId);
|
||||
if (user.getUserNo()==null || user.getUserNo().equals("")){
|
||||
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
// String timestamp = dateFormat.format(new Date());
|
||||
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
|
||||
user.setUserNo(randomString);
|
||||
}
|
||||
int row = baseMapper.insert(user);
|
||||
return row;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ public enum StatusEnum {
|
||||
ENABLED("A", "启用"),
|
||||
EXPIRED("C", "过期"),
|
||||
DISABLE("D", "删除"),
|
||||
FORBIDDEN("N", "禁用"),
|
||||
FORBIDDEN("jy", "禁用"),
|
||||
UnAudited("U", "待审核");
|
||||
|
||||
private String key;
|
||||
|
@ -9,7 +9,7 @@ import com.fuint.framework.exception.BusinessCheckException;
|
||||
import com.fuint.framework.pagination.PaginationRequest;
|
||||
import com.fuint.framework.pagination.PaginationResponse;
|
||||
import com.fuint.repository.model.TAccount;
|
||||
import com.fuint.repository.model.TDuty;
|
||||
import com.fuint.system.role.entity.TDuty;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -20,6 +20,8 @@ import com.fuint.repository.mapper.*;
|
||||
import com.fuint.repository.model.*;
|
||||
import com.fuint.system.dept.entity.SysDept;
|
||||
import com.fuint.system.dept.service.ISysDeptService;
|
||||
import com.fuint.system.role.entity.TDuty;
|
||||
import com.fuint.system.role.mapper.TDutyMapper;
|
||||
import com.fuint.utils.Digests;
|
||||
import com.fuint.utils.Encodes;
|
||||
import com.github.pagehelper.Page;
|
||||
|
@ -14,8 +14,9 @@ import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import com.fuint.module.backendApi.response.LoginResponse;
|
||||
import com.fuint.repository.model.TAccount;
|
||||
import com.fuint.repository.model.TDuty;
|
||||
import com.fuint.system.role.entity.TDuty;
|
||||
import com.fuint.repository.model.TSource;
|
||||
import com.fuint.system.role.service.DutyService;
|
||||
import com.fuint.utils.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
@ -2,95 +2,8 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fuint.system.dept.mapper.SysDeptMapper">
|
||||
<mapper namespace="com.fuint.system.config.mapper.SysConfigMapper">
|
||||
|
||||
|
||||
<select id="selectDeptList" resultType="com.fuint.system.dept.entity.SysDept">
|
||||
select *
|
||||
from sys_dept d
|
||||
where 1=1
|
||||
<if test="dept.deptId != null and dept.deptId != 0">
|
||||
AND dept_id = #{dept.deptId}
|
||||
</if>
|
||||
<if test="dept.parentId != null and dept.parentId != 0">
|
||||
AND parent_id = #{dept.parentId}
|
||||
</if>
|
||||
<if test="dept.deptName != null and dept.deptName != ''">
|
||||
AND dept_name like concat('%', #{dept.deptName}, '%')
|
||||
</if>
|
||||
<if test="dept.status != null and dept.status != ''">
|
||||
AND status = #{dept.status}
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
<if test="ownDeptStr != null and ownDeptStr!=''">
|
||||
AND ancestors like concat (#{ownDeptStr},'%')
|
||||
</if>
|
||||
|
||||
order by d.parent_id, d.order_num
|
||||
</select>
|
||||
|
||||
<select id="selectDeptListByRoleId" resultType="Long">
|
||||
select d.dept_id
|
||||
from sys_dept d
|
||||
left join sys_role_dept rd on d.dept_id = rd.dept_id
|
||||
where rd.role_id = #{roleId}
|
||||
<if test="deptCheckStrictly">
|
||||
and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
|
||||
</if>
|
||||
order by d.parent_id, d.order_num
|
||||
</select>
|
||||
|
||||
<select id="selectDeptById" parameterType="Long" resultType="com.fuint.system.dept.entity.SysDept">
|
||||
select d.*,
|
||||
(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
|
||||
from sys_dept d
|
||||
where d.dept_id = #{deptId}
|
||||
</select>
|
||||
|
||||
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
|
||||
select count(1) from t_account where dept_id = #{deptId}
|
||||
</select>
|
||||
|
||||
<select id="hasChildByDeptId" parameterType="Long" resultType="int">
|
||||
select count(1) from sys_dept
|
||||
where parent_id = #{deptId} limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectChildrenDeptById" resultType="com.fuint.system.dept.entity.SysDept">
|
||||
select * from sys_dept where find_in_set(#{deptId}, ancestors)
|
||||
</select>
|
||||
|
||||
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
|
||||
select count(*) from sys_dept where status = 0 and find_in_set(#{deptId}, ancestors)
|
||||
</select>
|
||||
|
||||
<select id="checkDeptNameUnique" resultType="com.fuint.system.dept.entity.SysDept">
|
||||
select *
|
||||
from sys_dept
|
||||
where dept_name=#{deptName} and parent_id = #{parentId} limit 1
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<update id="updateDeptChildren" parameterType="java.util.List">
|
||||
update sys_dept set ancestors =
|
||||
<foreach collection="depts" item="item" index="index"
|
||||
separator=" " open="case dept_id" close="end">
|
||||
when #{item.deptId} then #{item.ancestors}
|
||||
</foreach>
|
||||
where dept_id in
|
||||
<foreach collection="depts" item="item" index="index"
|
||||
separator="," open="(" close=")">
|
||||
#{item.deptId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateDeptStatusNormal" parameterType="Long">
|
||||
update sys_dept set status = '0' where dept_id in
|
||||
<foreach collection="array" item="deptId" open="(" separator="," close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
@ -3,6 +3,7 @@ package com.fuint.system.dept.entity;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fuint.framework.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
@ -13,6 +14,7 @@ import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -38,7 +40,7 @@ public class SysDept extends BaseEntity
|
||||
/** 部门名称 */
|
||||
private String deptName;
|
||||
|
||||
//节点类型:1代理商2连锁店3基本门店
|
||||
//节点类型:1代理商2连锁店3基本门店4三方机构
|
||||
private String deptType;
|
||||
|
||||
|
||||
@ -52,6 +54,12 @@ public class SysDept extends BaseEntity
|
||||
private String leaderName;
|
||||
|
||||
private String leaderPhone;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date validStartTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date validEndTime;
|
||||
//有效次数
|
||||
private Integer validNum;
|
||||
/** 子部门 */
|
||||
@TableField(exist = false)
|
||||
private List<SysDept> children = new ArrayList<SysDept>();
|
||||
|
@ -81,11 +81,10 @@ public interface SysDeptMapper extends BaseMapper<SysDept>
|
||||
|
||||
|
||||
/**
|
||||
* 修改所在部门正常状态
|
||||
*
|
||||
* @param deptIds 部门ID组
|
||||
* 修改所在部门状态
|
||||
*
|
||||
*/
|
||||
public void updateDeptStatusNormal(Long[] deptIds);
|
||||
public void updateDeptStatusNormal(String ancestor);
|
||||
|
||||
/**
|
||||
* 修改子元素关系
|
||||
|
@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
|
||||
select count(*) from sys_dept where status = 0 and find_in_set(#{deptId}, ancestors)
|
||||
select count(*) from sys_dept where status = 'jy' and find_in_set(#{deptId}, ancestors)
|
||||
</select>
|
||||
|
||||
<select id="checkDeptNameUnique" resultType="com.fuint.system.dept.entity.SysDept">
|
||||
@ -86,10 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</update>
|
||||
|
||||
<update id="updateDeptStatusNormal" parameterType="Long">
|
||||
update sys_dept set status = '0' where dept_id in
|
||||
<foreach collection="array" item="deptId" open="(" separator="," close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
update sys_dept set status = 'jy' where ancestors like concat(#{ancestor},'%')
|
||||
</update>
|
||||
|
||||
|
||||
|
@ -224,7 +224,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper,SysDept> imple
|
||||
}else if(dept.getDeptType().equals("2")){
|
||||
//连锁店
|
||||
SysDept parentDept = this.getById(dept.getParentId());
|
||||
if (parentDept.getDeptType().equals("1")){
|
||||
if (parentDept.getDeptType().equals("1")||parentDept.getDeptType().equals("4")){
|
||||
ChainStoreInfo chainStoreInfo = new ChainStoreInfo();
|
||||
chainStoreInfo.setStoreName(dept.getDeptName());
|
||||
chainStoreInfo.setContractDeptId(dept.getDeptId());
|
||||
@ -233,7 +233,13 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper,SysDept> imple
|
||||
throw new Exception("请在正确的节点类型下创建连锁店");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
}else if(dept.getDeptType().equals("4")){
|
||||
//第三方机构
|
||||
SysDept parentDept = this.getById(dept.getParentId());
|
||||
if (!parentDept.getDeptType().equals("1")){
|
||||
throw new Exception("请在正确的节点类型下创建第三方机构");
|
||||
}
|
||||
} else {
|
||||
//代理商
|
||||
dept.setDeptType("1");
|
||||
}
|
||||
@ -275,10 +281,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper,SysDept> imple
|
||||
storeService.updateById(store);
|
||||
}
|
||||
int result = baseMapper.updateById(dept);
|
||||
if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors())
|
||||
&& !StringUtils.equals("0", dept.getAncestors()))
|
||||
if (UserConstants.DEPT_DISABLE.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors()))
|
||||
{
|
||||
// 如果该部门是启用状态,则启用该部门的所有上级部门
|
||||
// 如果该部门是停用状态,则停用该部门的所有下级部门
|
||||
updateParentDeptStatusNormal(dept);
|
||||
}
|
||||
return result;
|
||||
@ -291,9 +296,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper,SysDept> imple
|
||||
*/
|
||||
private void updateParentDeptStatusNormal(SysDept dept)
|
||||
{
|
||||
String ancestors = dept.getAncestors();
|
||||
Long[] deptIds = Convert.toLongArray(ancestors);
|
||||
baseMapper.updateDeptStatusNormal(deptIds);
|
||||
baseMapper.updateDeptStatusNormal(dept.getAncestors());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.fuint.module.backendApi.controller;
|
||||
package com.fuint.system.role.controller;
|
||||
|
||||
import com.fuint.common.util.Constants;
|
||||
import com.fuint.common.dto.AccountDto;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.dto.RoleDto;
|
||||
import com.fuint.common.enums.AdminRoleEnum;
|
||||
import com.fuint.common.service.DutyService;
|
||||
import com.fuint.system.role.service.DutyService;
|
||||
import com.fuint.common.service.SourceService;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import com.fuint.framework.exception.BusinessCheckException;
|
||||
@ -15,7 +15,7 @@ import com.fuint.framework.pagination.PaginationResponse;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import com.fuint.module.backendApi.request.DutyStatusRequest;
|
||||
import com.fuint.repository.model.TDuty;
|
||||
import com.fuint.system.role.entity.TDuty;
|
||||
import com.fuint.repository.model.TSource;
|
||||
import com.fuint.utils.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -145,7 +145,7 @@ public class BackendDutyController extends BaseController {
|
||||
}
|
||||
|
||||
TDuty tDuty = new TDuty();
|
||||
tDuty.setMerchantId(accountInfo.getMerchantId());
|
||||
tDuty.setStoreId(accountInfo.getMerchantId());
|
||||
tDuty.setDutyName(name);
|
||||
tDuty.setDutyType(type);
|
||||
tDuty.setStatus(status);
|
||||
@ -181,7 +181,7 @@ public class BackendDutyController extends BaseController {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
RoleDto roleInfo = new RoleDto();
|
||||
roleInfo.setMerchantId(htDuty.getMerchantId());
|
||||
roleInfo.setMerchantId(htDuty.getStoreId());
|
||||
roleInfo.setId(htDuty.getDutyId().longValue());
|
||||
roleInfo.setName(htDuty.getDutyName());
|
||||
roleInfo.setType(htDuty.getDutyType());
|
||||
@ -225,7 +225,7 @@ public class BackendDutyController extends BaseController {
|
||||
}
|
||||
|
||||
TDuty duty = tDutyService.getRoleById(Long.parseLong(id));
|
||||
if (!duty.getMerchantId().equals(accountInfo.getMerchantId()) && accountInfo.getMerchantId() > 0) {
|
||||
if (!duty.getStoreId().equals(accountInfo.getMerchantId()) && accountInfo.getMerchantId() > 0) {
|
||||
return getFailureResult(201, "抱歉,您没有修改权限");
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.fuint.repository.model;
|
||||
package com.fuint.system.role.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@ -31,7 +31,7 @@ public class TDuty extends BaseEntity implements Serializable {
|
||||
private Integer dutyId;
|
||||
|
||||
@ApiModelProperty("商户ID")
|
||||
private Integer merchantId;
|
||||
private Integer storeId;
|
||||
|
||||
@ApiModelProperty("角色名称")
|
||||
private String dutyName;
|
@ -1,7 +1,7 @@
|
||||
package com.fuint.repository.mapper;
|
||||
package com.fuint.system.role.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fuint.repository.model.TDuty;
|
||||
import com.fuint.system.role.entity.TDuty;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fuint.repository.mapper.TDutyMapper">
|
||||
<mapper namespace="com.fuint.system.role.mapper.TDutyMapper">
|
||||
|
||||
<select id="findByStatus" resultType="com.fuint.repository.model.TDuty">
|
||||
<select id="findByStatus" resultType="com.fuint.system.role.entity.TDuty">
|
||||
select * from t_duty u
|
||||
where u.status = #{status}
|
||||
<if test="merchantId != null and merchantId > 0">
|
||||
@ -10,7 +10,7 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="findByName" resultType="com.fuint.repository.model.TDuty">
|
||||
<select id="findByName" resultType="com.fuint.system.role.entity.TDuty">
|
||||
select * from t_duty u
|
||||
where u.DUTY_NAME = #{name}
|
||||
<if test="merchantId != null and merchantId > 0">
|
||||
@ -18,7 +18,7 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="findByIdIn" resultType="com.fuint.repository.model.TDuty">
|
||||
<select id="findByIdIn" resultType="com.fuint.system.role.entity.TDuty">
|
||||
select * from t_duty where duty_id in
|
||||
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
@ -1,11 +1,11 @@
|
||||
package com.fuint.common.service;
|
||||
package com.fuint.system.role.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.framework.exception.BusinessCheckException;
|
||||
import com.fuint.framework.pagination.PaginationRequest;
|
||||
import com.fuint.framework.pagination.PaginationResponse;
|
||||
import com.fuint.module.backendApi.request.DutyStatusRequest;
|
||||
import com.fuint.repository.model.TDuty;
|
||||
import com.fuint.system.role.entity.TDuty;
|
||||
import com.fuint.repository.model.TSource;
|
||||
import com.fuint.common.domain.TreeNode;
|
||||
import java.util.List;
|
@ -1,10 +1,10 @@
|
||||
package com.fuint.common.service.impl;
|
||||
package com.fuint.system.role.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.common.enums.StatusEnum;
|
||||
import com.fuint.common.service.DutyService;
|
||||
import com.fuint.system.role.service.DutyService;
|
||||
import com.fuint.framework.annoation.OperationServiceLog;
|
||||
import com.fuint.framework.exception.BusinessCheckException;
|
||||
import com.fuint.common.domain.TreeNode;
|
||||
@ -12,9 +12,9 @@ import com.fuint.framework.exception.BusinessRuntimeException;
|
||||
import com.fuint.framework.pagination.PaginationRequest;
|
||||
import com.fuint.framework.pagination.PaginationResponse;
|
||||
import com.fuint.module.backendApi.request.DutyStatusRequest;
|
||||
import com.fuint.repository.mapper.TDutyMapper;
|
||||
import com.fuint.system.role.mapper.TDutyMapper;
|
||||
import com.fuint.repository.mapper.TDutySourceMapper;
|
||||
import com.fuint.repository.model.TDuty;
|
||||
import com.fuint.system.role.entity.TDuty;
|
||||
import com.fuint.repository.model.TDutySource;
|
||||
import com.fuint.repository.model.TSource;
|
||||
import com.fuint.utils.ArrayUtil;
|
||||
@ -82,7 +82,7 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
|
||||
@OperationServiceLog(description = "删除后台角色")
|
||||
public void deleteDuty(Integer merchantId, long dutyId) {
|
||||
TDuty tDuty = getRoleById(dutyId);
|
||||
if (!merchantId.equals(tDuty.getMerchantId()) && merchantId > 0) {
|
||||
if (!merchantId.equals(tDuty.getStoreId()) && merchantId > 0) {
|
||||
throw new BusinessRuntimeException("抱歉,您没有删除的权限");
|
||||
}
|
||||
try {
|
||||
@ -106,7 +106,7 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
|
||||
public void updateStatus(Integer merchantId, DutyStatusRequest dutyStatusRequest) throws BusinessCheckException {
|
||||
TDuty tDuty = tDutyMapper.selectById(dutyStatusRequest.getRoleId());
|
||||
|
||||
if (!merchantId.equals(tDuty.getMerchantId()) && merchantId > 0) {
|
||||
if (!merchantId.equals(tDuty.getStoreId()) && merchantId > 0) {
|
||||
throw new BusinessRuntimeException("抱歉,您没有操作的权限");
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
|
||||
throw new BusinessCheckException("角色不存在.");
|
||||
}
|
||||
if (!StringUtil.equals(tduty.getDutyName(), existsDuty.getDutyName())) {
|
||||
TDuty tDuty = findByName(existsDuty.getMerchantId(), tduty.getDutyName());
|
||||
TDuty tDuty = findByName(existsDuty.getStoreId(), tduty.getDutyName());
|
||||
if (tDuty != null) {
|
||||
throw new BusinessCheckException("角色名已存在.");
|
||||
}
|
||||
@ -188,7 +188,7 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@OperationServiceLog(description = "新增后台角色")
|
||||
public void saveDuty(TDuty duty, List<TSource> sources) throws BusinessCheckException {
|
||||
TDuty existsDuty = tDutyMapper.findByName(duty.getMerchantId(), duty.getDutyName());
|
||||
TDuty existsDuty = tDutyMapper.findByName(duty.getStoreId(), duty.getDutyName());
|
||||
if (existsDuty != null) {
|
||||
throw new BusinessCheckException("角色名称已经存在.");
|
||||
}
|
||||
@ -224,9 +224,9 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
|
||||
String merchantId = paginationRequest.getSearchParams().get("merchantId") == null ? "" : paginationRequest.getSearchParams().get("merchantId").toString();
|
||||
if (StringUtils.isNotBlank(merchantId)) {
|
||||
lambdaQueryWrapper.and(wq -> wq
|
||||
.eq(TDuty::getMerchantId, 0)
|
||||
.eq(TDuty::getStoreId, 0)
|
||||
.or()
|
||||
.eq(TDuty::getMerchantId, merchantId));
|
||||
.eq(TDuty::getStoreId, merchantId));
|
||||
}
|
||||
|
||||
lambdaQueryWrapper.orderByDesc(TDuty::getDutyId);
|
@ -7,7 +7,7 @@ import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.dto.RoleDto;
|
||||
import com.fuint.common.enums.StatusEnum;
|
||||
import com.fuint.common.service.AccountService;
|
||||
import com.fuint.common.service.DutyService;
|
||||
import com.fuint.system.role.service.DutyService;
|
||||
import com.fuint.common.service.MerchantService;
|
||||
import com.fuint.business.store.service.StoreService;
|
||||
import com.fuint.common.util.CommonUtil;
|
||||
@ -18,7 +18,7 @@ import com.fuint.framework.web.ResponseObject;
|
||||
import com.fuint.repository.model.MtMerchant;
|
||||
import com.fuint.business.store.entity.MtStore;
|
||||
import com.fuint.repository.model.TAccount;
|
||||
import com.fuint.repository.model.TDuty;
|
||||
import com.fuint.system.role.entity.TDuty;
|
||||
import com.fuint.utils.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
Loading…
Reference in New Issue
Block a user