会员管理

This commit is contained in:
cun-nan 2023-10-17 19:01:29 +08:00
parent ee68993784
commit 26cd3cdf7c
16 changed files with 711 additions and 165 deletions

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'
// 查询会员详细
export function getChainStoreConfig(id) {
export function getChainStoreConfig() {
return request({
url: '/business/userManager/chainStoreConfig',
method: 'get'

View File

@ -0,0 +1,9 @@
import request from '@/utils/request'
// 查询会员详细
export function getSysConfig(key) {
return request({
url: '/sysConfig/getByKey/' + key,
method: 'get'
})
}

View File

@ -9,6 +9,14 @@ export function listUser(query) {
})
}
// 查询会员列表
export function listStatistic() {
return request({
url: '/business/userManager/user/statistic',
method: 'get',
})
}
// 查询会员详细
export function getUser(id) {
return request({

View File

@ -91,6 +91,76 @@
</el-form>
</el-card>
<el-card>
<div>统计</div>
<template>
<div>
<el-row :gutter="20">
<el-col :span="4">
<div class="sta">
<el-statistic
group-separator=","
:precision="2"
:value="total"
title="会员总数"
></el-statistic>
</div>
</el-col>
<el-col :span="4">
<div class="sta">
<el-statistic
group-separator=","
:precision="2"
:value="addNum"
title="今日新增/昨日新增"
></el-statistic>
</div>
</el-col>
<el-col :span="4">
<div class="sta">
<el-statistic
group-separator=","
:precision="2"
:value="balance"
title="储值总余额"
></el-statistic>
</div>
</el-col>
<el-col :span="4">
<div class="sta">
<el-statistic
group-separator=","
:precision="2"
:value="literCard"
title="升数卡总余额"
></el-statistic>
</div>
</el-col>
<el-col :span="4">
<div class="sta">
<el-statistic
group-separator=","
:precision="2"
:value="point"
title="积分总余额"
></el-statistic>
</div>
</el-col>
<el-col :span="4">
<div class="sta">
<el-statistic
group-separator=","
:precision="2"
:value="refuelMoney"
title="加油金余额"
></el-statistic>
</div>
</el-col>
</el-row>
</div>
</template>
</el-card>
<el-card style="margin-top: 20px">
<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"/>
@ -101,7 +171,15 @@
</template>
</el-table-column>
<el-table-column label="会员号" align="center" prop="userNo" width="150"/>
<el-table-column label="名称" align="center" prop="name" />
<el-table-column label="名称" align="center" prop="name" >
<template slot-scope="scope">
<!-- <router-link :to="'/system/dict/data/' + scope.row.dictId" class="link-type">-->
<!-- <span>{{ scope.row.dictType }}</span>-->
<!-- </router-link>-->
<span style="color: #409EFF;cursor: pointer " @click="goDedi(scope.row.id)">{{ scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column label="手机号" align="center" prop="mobile" width="110">
<template slot-scope="scope">
<span>{{ scope.row.mobile ? scope.row.mobile : '-' }}</span>
@ -346,13 +424,23 @@
import { getMemberList, updateMemberStatus, getMemberInfo, saveMember, deleteMember } from "@/api/member";
import balanceRecharge from "./balanceRecharge";
import pointRecharge from "./pointRecharge";
import {listUser} from "@/api/staff/user/user";
import {listStatistic, listUser} from "@/api/staff/user/user";
export default {
name: "MemberIndex",
components: { balanceRecharge, pointRecharge },
dicts: ['official'],
data() {
return {
//
balance:'',
//
point:'',
//
literCard:'',
//
refuelMoney:'',
//
addNum:'',
//
loading: true,
//
@ -410,8 +498,19 @@ export default {
},
created() {
this.getList();
this.getStatistic();
},
methods: {
//
goDedi(id){
console.log('id:',id)
this.$router.push({
path:"/member/userInfo",
// query:{
// id:id
// }
})
},
//
getList() {
this.loading = true;
@ -432,6 +531,15 @@ export default {
// }
// );
},
getStatistic(){
listStatistic().then( response => {
this.addNum = response.data.addNum;
this.balance = response.data.balance;
this.point = response.data.point;
this.literCard = response.data.literCard;
this.refuelMoney = response.data.refuelMoney;
});
},
//
handleQuery() {
this.queryParams.page = 1;
@ -563,4 +671,10 @@ export default {
height: 100vh;
background: #f6f8f9;
}
.sta{
height: 100px;
margin-top: 10px;
background: #f6f8f9;
padding-top: 30px;
}
</style>

View File

@ -0,0 +1,15 @@
<template>
<div>
会员详情页
</div>
</template>
<script>
export default {
}
</script>
<style lang="scss" scoped>
</style>

View File

@ -690,6 +690,7 @@ export default {
listStaff(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.list = response.data.records;
this.total = response.data.total;
console.log(response)
// response.data.records.forEach(item=>{
// this.categoryOptions.push(item.category)
// })

View File

@ -7,23 +7,15 @@
<div>
<div style="display: flex;justify-content: space-between">
<span style="color: grey;">会员等级规则说明</span>
<el-button type="success" round>开启等级功能</el-button>
<el-button v-show="level1" @click="editLevel1" type="primary" round>开启等级功能</el-button>
<el-button v-show="level2" @click="editLevel2" type="danger" round>关闭等级功能</el-button>
</div>
<el-alert
type="warning"
style="margin-top: 15px"
:closable="false">
<p>
1用户每次消费后根据成长值计算方式中的规则获得相应的成长值并根据会员等级配置的规则自动更新用户的会员等级
</p>
<p>
2会员等级区分汽油柴油天然气会员加油或加气将按照对应的等级进行优惠
</p>
<p>
3当成长值累计达到下一个等级时实时升级升级后的等级规则将生效
</p>
<p>
4开启会员等级功能系统将按照规则及成长值进行处理如关闭等级功能用户等级将失效,将无法享受对应优惠规则成长值将暂停增加或减少但不影响会员已有成长值
<p v-for="(item,index) in memberLevelRule" :id="index">
{{item}}
</p>
</el-alert>
</div>
@ -40,78 +32,33 @@
type="warning"
style="margin-top: 15px"
:closable="false">
<p>
清算说明
</p>
<p>
1油站可根据自身运营情况选择并设置会员等级的清算规则保存后实时生效不影响会员已有成长值规则不影响会员的成长值增减
</p>
<p>
2按月清算: 以月为周期动态调整会员成长值等级清算,如本月所属会员等级则按照上月成长值计算本月所得成长值下月有效
</p>
<p>
3不清算: 按照成长值累计只升不降且用户等级按照用户获得的成长值实时计算所属会员等级
<p v-for="(item,index) in levelClearRule" :key="index">
{{item}}
</p>
</el-alert>
</div>
<div style="margin-top: 15px">
<span style="color: grey;">成长值计算方式</span>
<div style="display: flex;justify-content: space-between">
<div style="margin-top: 10px;display: flex;width: 30%">
<el-input
placeholder="汽油成长值比例,每消费1元积"
:disabled="true" style="width: 800px">
</el-input>
<el-input
placeholder="1"
:disabled="true">
</el-input>
<el-input
placeholder="成长值"
:disabled="true">
</el-input>
</div>
<div style="margin-top: 10px;display: flex;width: 30%">
<el-input
placeholder="柴油成长值比例,每消费1元积"
:disabled="true" style="width: 800px">
</el-input>
<el-input
placeholder="1"
:disabled="true">
</el-input>
<el-input
placeholder="成长值"
:disabled="true">
</el-input>
</div>
<div style="margin-top: 10px;display: flex;width: 30%">
<el-input
placeholder="天然气成长值比例,每消费1元积"
:disabled="true" style="width: 800px">
</el-input>
<el-input
placeholder="1"
:disabled="true">
</el-input>
<el-input
placeholder="成长值"
:disabled="true">
</el-input>
</div>
<el-input v-model="gasGrowthValue" disabled placeholder="1" style="margin: 10px 10px">
<template slot="prepend">汽油成长值比例,每消费1元积</template>
<template slot="append">成长值</template>
</el-input>
<el-input v-model="dieselGrowthValue" disabled placeholder="1" style="margin: 10px 10px">
<template slot="prepend">柴油成长值比例,每消费1元积</template>
<template slot="append">成长值</template>
</el-input>
<el-input v-model="naturalGrowthValue" disabled placeholder="1" style="margin: 10px 10px">
<template slot="prepend">天然气成长值比例,每消费1元积</template>
<template slot="append">成长值</template>
</el-input>
</div>
<el-alert
type="warning"
style="margin-top: 15px"
:closable="false">
<p>
1支付成功订单增加成长值退款成功订单扣减成长值
</p>
<p>
2成长值按照加油或加气订单消费金额计算(非实付金额)商品订单不包含在内
</p>
<p>
3汽油柴油天然气成长值默认为1:1进行计算,如加油金额消费99.6,将累计99个成长值不足1元的部分直接舍掉),成长值比例暂不支持更改
<p v-for="(item,index) in growthValueRule" :id="index">
{{item}}
</p>
</el-alert>
</div>
@ -163,6 +110,16 @@
<!-- </el-card>-->
<el-card class="card">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
@click="handleAdd"
>新增会员等级</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange">
<el-table-column label="等级" prop="grade" width="55"/>
<el-table-column label="等级名称" align="center" prop="name" />
@ -200,20 +157,65 @@
<dict-tag :options="dict.type.yhlx" :value="scope.row.preferential"/>
</template>
</el-table-column>
<el-table-column label="特权信息" align="center">
<el-table-column label="特权信息" >
<template slot-scope="scope">
<div v-show="scope.row.preferential=='自定义优惠'">
<p>
汽油
<span style="margin-left: 10px">{{ scope.row.gasolineDiscount }}</span>
<span v-if="scope.row.gasolineRule!=null && scope.row.gasolineRule!=''"
style="color: grey;font-size: 12px">
<div style="margin-left: 10px"
v-if="scope.row.gasolineDiscount=='满减优惠'"
v-for="(item,index) in scope.row.gasolineRuleList"
:key="index">
消费满{{item.gasolineRule1}},立减{{item.gasolineRule2}}
</div>
<div style="margin-left: 10px"
v-if="scope.row.gasolineDiscount=='每升优惠'"
v-for="(item,index) in scope.row.gasolineRuleList"
:key="index">
消费满{{item.gasolineRule1}},每升优惠{{item.gasolineRule3}}
</div>
</span>
</p>
<p>
柴油
<span style="margin-left: 10px">{{ scope.row.dieselDiscount }}</span>
<span v-if="scope.row.dieselRule!=null && scope.row.dieselRule!=''"
style="margin-left: 10px;color: grey;font-size: 12px">
<div style="margin-left: 10px"
v-if="scope.row.dieselDiscount=='满减优惠'"
v-for="(item,index) in scope.row.dieselRuleList"
:key="index">
消费满{{item.dieselRule1}},立减{{item.dieselRule2}}
</div>
<div style="margin-left: 10px"
v-if="scope.row.dieselDiscount=='每升优惠'"
v-for="(item,index) in scope.row.dieselRuleList"
:key="index">
消费满{{item.dieselRule1}},每升优惠{{item.dieselRule3}}
</div>
</span>
</p>
<p>
天然气
<span style="margin-left: 10px">{{ scope.row.naturalGasDiscount }}</span>
<span v-if="scope.row.naturalGasRule!=null && scope.row.naturalGasRule!=''"
style="margin-left: 10px;color: grey;font-size: 12px">
<div style="margin-left: 10px"
v-if="scope.row.naturalGasDiscount=='满减优惠'"
v-for="(item,index) in scope.row.naturalGasRuleList"
:key="index">
消费满{{item.naturalGas1}},立减{{item.naturalGas2}}
</div>
<div style="margin-left: 10px"
v-if="scope.row.naturalGasDiscount=='每单位优惠'"
v-for="(item,index) in scope.row.naturalGasRuleList"
:key="index">
消费满{{item.naturalGas1}},每单位优惠{{item.naturalGas3}}
</div>
</span>
</p>
</div>
<div v-show="scope.row.preferential=='优惠活动组'">
@ -224,12 +226,7 @@
</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>
<dict-tag :options="dict.type.zhzt" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@ -262,7 +259,7 @@
</el-card>
<!-- 添加或修改对话框 -->
<el-dialog :title="title" :visible.sync="open" class="common-dialog" width="700px" append-to-body>
<el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="50%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="24">
@ -280,69 +277,231 @@
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="升级条件描述" prop="catchCondition">
<el-input v-model="form.catchCondition" placeholder="请输入升级条件描述" maxlength="200" />
<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>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="升级权益描述" prop="userPrivilege">
<el-input v-model="form.userPrivilege" type="textarea" placeholder="请输入升级权益描述"></el-input>
</el-form-item>
<div style="font-size: 16px">
等级特权
</div>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="升级方式" prop="catchType">
<el-select
v-model="form.catchType"
clearable
placeholder="升级方式"
>
<el-option v-for="catchType in catchTypeList" :key="catchType.key" :label="catchType.name" :value="catchType.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="升级条件值" prop="catchValue">
<el-input v-model="form.catchValue" placeholder="请输入升级条件值,单位可能是元、次"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="有效天数" prop="validDay">
<el-input v-model="form.validDay" placeholder="请输入有效天数如300表示永久有效"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="支付折扣" prop="discount">
<el-input v-model="form.discount" placeholder="请输入支付折扣数字8.8"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="积分加速" prop="speedPoint">
<el-input v-model="form.speedPoint" placeholder="请输入积分加速,积分加速倍数,数字"></el-input>
<el-form-item label="优惠类型">
<el-radio-group v-model="form.preferential">
<el-radio
v-for="dict in dict.type.yhlx"
:key="dict.value"
:label="dict.label"
:value="dict.value"></el-radio>
</el-radio-group>
<div>
<div style="color: grey;font-size: 12px;height: 18px">
自定义优惠:当前页面自定义简单的油品优惠
</div>
<div style="color: grey;font-size: 12px;height: 18px">
优惠活动组:使用优惠组设置来配置当前等级用户的优惠信息,支持周期性
</div>
</div>
</el-form-item>
</el-col>
</el-row>
<div v-if="form.preferential=='自定义优惠'">
<el-row>
<el-col :span="24">
<el-form-item label="汽油优惠">
<el-radio-group v-model="form.gasolineDiscount">
<el-radio label="无优惠">无优惠</el-radio>
<el-radio label="满减优惠">满减优惠</el-radio>
<el-radio label="每升优惠">每升优惠</el-radio>
</el-radio-group>
<div v-if="form.gasolineDiscount != '无优惠'">
<div v-for="(item,idx) in gasolinePreferential" style="display: flex">
<el-input v-model="item.gasolineRule1" placeholder="1" style="width: 260px;">
<template slot="prepend">消费满</template>
<template slot="append"></template>
</el-input>
<el-input v-model="item.gasolineRule2" placeholder="1" style="width: 260px;" v-if="form.gasolineDiscount == '满减优惠'">
<template slot="prepend">立减</template>
<template slot="append"></template>
</el-input>
<el-input v-model="item.gasolineRule3" placeholder="1" style="width: 260px;" v-if="form.gasolineDiscount == '每升优惠'">
<template slot="prepend">每升优惠</template>
<template slot="append"></template>
</el-input>
<el-button v-if="idx==0" type="primary" @click="addGasOline()" icon="el-icon-plus" style="margin-left: 20px"></el-button>
<el-button v-else type="danger" @click="subGasOline(idx)" icon="el-icon-close" style="margin-left: 20px"></el-button>
</div>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="柴油优惠">
<el-radio-group v-model="form.dieselDiscount">
<el-radio label="无优惠">无优惠</el-radio>
<el-radio label="满减优惠">满减优惠</el-radio>
<el-radio label="每升优惠">每升优惠</el-radio>
</el-radio-group>
<div v-if="form.dieselDiscount != '无优惠'">
<div v-for="(item,idx) in dieselPreferential" style="display: flex">
<el-input v-model="item.dieselRule1" placeholder="1" style="width: 260px;">
<template slot="prepend">消费满</template>
<template slot="append"></template>
</el-input>
<el-input v-model="item.dieselRule2" placeholder="1" style="width: 260px;" v-if="form.dieselDiscount == '满减优惠'">
<template slot="prepend">立减</template>
<template slot="append"></template>
</el-input>
<el-input v-model="item.dieselRule3" placeholder="1" style="width: 260px;" v-if="form.dieselDiscount == '每升优惠'">
<template slot="prepend">每升优惠</template>
<template slot="append"></template>
</el-input>
<el-button v-if="idx==0" type="primary" @click="addDiesel()" icon="el-icon-plus" style="margin-left: 20px"></el-button>
<el-button v-else type="danger" @click="subDiesel(idx)" icon="el-icon-close" style="margin-left: 20px"></el-button>
</div>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="天然气优惠">
<el-radio-group v-model="form.naturalGasDiscount">
<el-radio label="无优惠">无优惠</el-radio>
<el-radio label="满减优惠">满减优惠</el-radio>
<el-radio label="每单位优惠">每单位优惠</el-radio>
</el-radio-group>
<div v-if="form.naturalGasDiscount != '无优惠'">
<div v-for="(item,idx) in naturalGasPreferential" style="display: flex">
<el-input v-model="item.naturalGas1" placeholder="1" style="width: 260px;">
<template slot="prepend">消费满</template>
<template slot="append"></template>
</el-input>
<el-input v-model="item.naturalGas2" placeholder="1" style="width: 260px;" v-if="form.naturalGasDiscount == '满减优惠'">
<template slot="prepend">立减</template>
<template slot="append"></template>
</el-input>
<el-input v-model="item.naturalGas3" placeholder="1" style="width: 260px;" v-if="form.naturalGasDiscount == '每单位优惠'">
<template slot="prepend">每单位优惠</template>
<template slot="append"></template>
</el-input>
<el-button v-if="idx==0" type="primary" @click="addNaturalGas()" icon="el-icon-plus" style="margin-left: 20px"></el-button>
<el-button v-else type="danger" @click="subNaturalGas(idx)" icon="el-icon-close" style="margin-left: 20px"></el-button>
</div>
</div>
</el-form-item>
</el-col>
</el-row>
</div>
<div v-else>
<el-row>
<el-col :span="24">
<el-form-item label="关联优惠组">
<el-select v-model="form.promotionGroup">
<el-option
v-for="dict in dict.type.yhhdz"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<div>
<div style="color: grey;font-size: 12px;height: 18px">
关联组后当前等级的用户优惠将按照优惠组的规则享受满减优惠
</div>
<div style="color: grey;font-size: 12px;height: 18px">
优惠活动组请前往活动营销-特惠活动-优惠活动组进行配置
</div>
</div>
</el-form-item>
</el-col>
</el-row>
</div>
<el-row>
<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">启用</el-radio>
<el-radio label="jy">禁用</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<!-- <el-row>-->
<!-- <el-col :span="24">-->
<!-- <el-form-item label="升级条件描述" prop="catchCondition">-->
<!-- <el-input v-model="form.catchCondition" placeholder="请输入升级条件描述" maxlength="200" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- <el-row>-->
<!-- <el-col :span="24">-->
<!-- <el-form-item label="升级权益描述" prop="userPrivilege">-->
<!-- <el-input v-model="form.userPrivilege" type="textarea" placeholder="请输入升级权益描述"></el-input>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- <el-row>-->
<!-- <el-col :span="24">-->
<!-- <el-form-item label="升级方式" prop="catchType">-->
<!-- <el-select-->
<!-- v-model="form.catchType"-->
<!-- clearable-->
<!-- placeholder="升级方式"-->
<!-- >-->
<!-- <el-option v-for="catchType in catchTypeList" :key="catchType.key" :label="catchType.name" :value="catchType.value"/>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- <el-row>-->
<!-- <el-col :span="24">-->
<!-- <el-form-item label="升级条件值" prop="catchValue">-->
<!-- <el-input v-model="form.catchValue" placeholder="请输入升级条件值,单位可能是元、次"></el-input>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- <el-row>-->
<!-- <el-col :span="24">-->
<!-- <el-form-item label="有效天数" prop="validDay">-->
<!-- <el-input v-model="form.validDay" placeholder="请输入有效天数如300表示永久有效"></el-input>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- <el-row>-->
<!-- <el-col :span="24">-->
<!-- <el-form-item label="支付折扣" prop="discount">-->
<!-- <el-input v-model="form.discount" placeholder="请输入支付折扣数字8.8"></el-input>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- <el-row>-->
<!-- <el-col :span="24">-->
<!-- <el-form-item label="积分加速" prop="speedPoint">-->
<!-- <el-input v-model="form.speedPoint" placeholder="请输入积分加速,积分加速倍数,数字"></el-input>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@ -354,13 +513,50 @@
<script>
import { getUserGradeList, updateUserGradeStatus, getUserGradeInfo, saveUserGrade, deleteUserGrade } from "@/api/userGrade";
import {listUserGrade} from "@/api/staff/user/usergrade";
import {addUserGrade, delUserGrade, getUserGrade, listUserGrade, updateUserGrade} from "@/api/staff/user/usergrade";
import {getChainStoreConfig, updateChainStoreConfig} from "@/api/staff/user/chainstoreconfig";
import {getSysConfig} from "@/api/staff/user/sysconfig";
export default {
name: "UserGradeIndex",
dicts: ['yhlx'],
dicts: ['yhlx','zhzt','yhhdz'],
data() {
return {
level1:true,
level2:false,
//
gasolinePreferential:[
{
gasolineRule1:1,
gasolineRule2:1,
gasolineRule3:1,
}
],
dieselPreferential:[
{
dieselRule1:1,
dieselRule2:1,
dieselRule3:1,
}
],
naturalGasPreferential:[
{
naturalGas1:1,
naturalGas2:1,
naturalGas3:1,
}
],
//
memberLevelRule:[],
//
levelClearRule:[],
//
growthValueRule:[],
//
gasGrowthValue:'',
//
dieselGrowthValue:'',
//
naturalGrowthValue:'',
clear:'',
//
loading: true,
@ -383,7 +579,10 @@ export default {
//
defaultSort: {prop: 'createTime', order: 'descending'},
//
form: { id: '', grade: 0, name: '', catchCondition: '', userPrivilege: '', catchType: '', catchValue: '', validDay: '', discount: '', speedPoint: '', status: "A" },
form: { id: '', grade: 0, name: '',gasoline:'',dieselOil:'',naturalGas:'',preferential:'自定义优惠',
gasolineDiscount:'无优惠',dieselDiscount:'无优惠',naturalGasDiscount:'无优惠',promotionGroup:'',
// catchCondition: '', userPrivilege: '', catchType: '', catchValue: '', validDay: '',discount: '', speedPoint: '',
status: 'qy' },
//
queryParams: {
page: 1,
@ -423,18 +622,83 @@ export default {
created() {
this.getList();
this.getClearConfig();
this.getRule();
},
methods: {
editLevel1(){
this.level1 = false;
this.level2 = true;
this.$modal.msgSuccess("等级状态更新成功");
},
editLevel2(){
this.level1 = true;
this.level2 = false;
this.$modal.msgSuccess("等级状态更新成功");
},
addGasOline(){
let temp= {
gasolineRule1:1,
gasolineRule2:1,
gasolineRule3:1,
}
this.gasolinePreferential.push(temp);
},
subGasOline(idx){
this.gasolinePreferential.splice(idx-1,1);
},
addDiesel(){
let temp= {
dieselRule1:1,
dieselRule2:1,
dieselRule3:1,
}
this.dieselPreferential.push(temp);
},
subDiesel(idx){
this.dieselPreferential.splice(idx-1,1);
},
addNaturalGas(){
let temp= {
naturalGas1:1,
naturalGas2:1,
naturalGas3:1,
}
this.naturalGasPreferential.push(temp);
},
subNaturalGas(idx){
this.naturalGasPreferential.splice(idx-1,1);
},
//
getRule(){
getSysConfig('member_level_rule').then(response => {
this.memberLevelRule = response.data.split(";")
});
getSysConfig('level_clear_rule').then(response => {
this.levelClearRule = response.data.split(";")
});
getSysConfig('growth_value_rule').then(response => {
this.growthValueRule = response.data.split(";")
});
getSysConfig('gas_growth_value').then(response => {
this.gasGrowthValue = response.data
});
getSysConfig('diesel_growth_value').then(response => {
this.dieselGrowthValue = response.data
});
getSysConfig('natural_growth_value').then(response => {
this.naturalGrowthValue = response.data
});
},
//
getClearConfig(){
getChainStoreConfig().then(response => {
this.clear = response.data.levelClearRule;
})
},
//
updateClearConfig(){
updateChainStoreConfig({'levelClearRule':this.clear}).then(response => {
this.$modal.msgSuccess("修改成功");
console.log(response)
});
this.getClearConfig();
},
@ -496,18 +760,32 @@ export default {
//
reset() {
this.form = {
id: "",
grade: "",
name: "",
status: "A",
catchType: "",
catchValue: "",
validDay: "",
discount: "",
speedPoint: "",
catchCondition: "",
userPrivilege: ""
id: '', grade: 0, name: '',gasoline:'',dieselOil:'',naturalGas:'',preferential:'自定义优惠',
gasolineDiscount:'无优惠',dieselDiscount:'无优惠',naturalGasDiscount:'无优惠',promotionGroup:'',
// catchCondition: '', userPrivilege: '', catchType: '', catchValue: '', validDay: '',discount: '', speedPoint: '',
status: 'qy'
};
this.gasolinePreferential=[
{
gasolineRule1:1,
gasolineRule2:1,
gasolineRule3:1,
}
],
this.dieselPreferential=[
{
dieselRule1:1,
dieselRule2:1,
dieselRule3:1,
}
],
this.naturalGasPreferential=[
{
naturalGas1:1,
naturalGas2:1,
naturalGas3:1,
}
],
this.resetForm("form");
},
//
@ -519,40 +797,64 @@ export default {
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
this.form.gasolineRule = JSON.stringify(this.gasolinePreferential)
this.form.dieselRule = JSON.stringify(this.dieselPreferential)
this.form.naturalGasRule = JSON.stringify(this.naturalGasPreferential)
if (this.form.id) {
saveUserGrade(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
updateUserGrade(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
// saveUserGrade(this.form).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
} else {
saveUserGrade(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
addUserGrade(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
// saveUserGrade(this.form).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
}
}
});
},
//
handleUpdate(row) {
let _this = this;
this.reset();
const id = row.id || this.ids;
getUserGradeInfo(id).then(response => {
this.form = response.data.userGradeInfo;
getUserGrade(id).then(response => {
_this.form = response.data;
this.gasolinePreferential = JSON.parse(this.form.gasolineRule)
this.dieselPreferential = JSON.parse(this.form.dieselRule)
this.naturalGasPreferential = JSON.parse(this.form.naturalGasRule)
this.open = true;
this.title = "编辑会员等级";
});
// getUserGradeInfo(id).then(response => {
// this.form = response.data.userGradeInfo;
// this.open = true;
// this.title = "";
// });
},
//
handleDelete(row) {
const name = row.name
this.$modal.confirm('是否确认删除"' + name + '"的数据项?').then(function() {
return deleteUserGrade(row.id);
// return deleteUserGrade(row.id);
return delUserGrade(row.id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
this.getList();
}).catch(() => {});
}
}

View File

@ -10,6 +10,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 会员信息 controller层
*/
@ -35,6 +37,16 @@ public class LJUserController extends BaseController {
return getSuccessResult(list);
}
/**
* 查询会员统计信息
* @return
*/
@GetMapping("/statistic")
public ResponseObject getStatistic(){
Map<String, Object> map = userService.selectStatistic();
return getSuccessResult(map);
}
/**
* 根据id查询会员信息
* @param id

View File

@ -1,6 +1,8 @@
package com.fuint.business.userManager.entity;
import com.alibaba.fastjson2.JSONObject;
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;
@ -11,6 +13,7 @@ import lombok.Setter;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* 会员等级表
@ -78,12 +81,30 @@ public class LJUserGrade extends BaseEntity implements Serializable {
@ApiModelProperty("汽油优惠,无优惠,满减优惠,每升优惠")
private String gasolineDiscount;
@ApiModelProperty("汽油优惠规则")
private String gasolineRule;
@ApiModelProperty("柴油优惠,无优惠,满减优惠,每升优惠")
private String dieselDiscount;
@ApiModelProperty("柴油优惠规则")
private String dieselRule;
@ApiModelProperty("天然气优惠,无优惠,满减优惠,每单位优惠")
private String naturalGasDiscount;
@ApiModelProperty("天然气优惠规则")
private String naturalGasRule;
@ApiModelProperty("优惠活动组")
private String promotionGroup;
@TableField(exist = false)
private List<JSONObject> gasolineRuleList;
@TableField(exist = false)
private List<JSONObject> dieselRuleList;
@TableField(exist = false)
private List<JSONObject> naturalGasRuleList;
}

View File

@ -17,4 +17,6 @@ public interface LJUserMapper extends BaseMapper<LJUser> {
* @return
*/
public IPage<LJUser> selectUserList(Page page, @Param("user") LJUser user);
public Double selectSumByStore(@Param("storeId") int storeId,@Param("sumValue") String sumValue);
}

View File

@ -26,12 +26,16 @@
<result property="dieselDiscount" column="diesel_discount" />
<result property="naturalGasDiscount" column="natural_gas_discount" />
<result property="promotionGroup" column="promotion_group" />
<result property="gasolineRule" column="gasoline_rule" />
<result property="dieselRule" column="diesel_rule" />
<result property="naturalGasRule" column="natural_gas_rule" />
</resultMap>
<sql id="selectUserGrade">
select id, merchant_id, grade, name, catch_condition, catch_type, catch_value, user_privilege, valid_day, discount,
speed_point, status, create_time, update_time, create_by, update_by, gasoline, diesel_oil, natural_gas,
preferential, gasoline_discount, diesel_discount, natural_gas_discount,promotion_group from mt_user_grade
preferential, gasoline_discount, diesel_discount, natural_gas_discount,promotion_group,gasoline_rule,
diesel_rule, natural_gas_rule from mt_user_grade
</sql>
<select id="selectUserGradeList" resultMap="UserGradeResult">

View File

@ -60,4 +60,7 @@
</if>
</where>
</select>
<select id="selectSumByStore" resultType="java.lang.Double" parameterType="int">
select sum(${sumValue}) from mt_user where store_id = #{storeId};
</select>
</mapper>

View File

@ -4,39 +4,47 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.userManager.entity.LJUser;
import java.util.Map;
/**
* 会员信息 业务层
*/
public interface LJUserService {
/**
* 根据条件分页查询信息
* 根据条件分页查询员信息
* @param page
* @return
*/
public IPage<LJUser> selectUserList(Page page, LJUser user);
/**
* 根据id查询员工信息
* 查询会员统计信息
* @return
*/
public Map<String ,Object> selectStatistic();
/**
* 根据id查询会员信息
* @param id
* @return
*/
public LJUser selectUserById(int id);
/**
* 根据id删除信息
* 根据id删除员信息
* @param id
*/
public void deleteUserById(Integer id);
/**
* 增加信息
* 增加员信息
* @param user
* @return
*/
public int insertUser(LJUser user);
/**
* 修改信息
* 修改员信息
* @param user
* @return
*/

View File

@ -1,5 +1,6 @@
package com.fuint.business.userManager.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.member.entity.LJStaff;
import com.fuint.business.storeInformation.entity.LJStore;
@ -37,8 +38,9 @@ public class ChainStoreConfigServiceImpl extends ServiceImpl<ChainStoreConfigMap
LJStore store = storeService.selectStoreById();
Integer id = store.getChainStoreId();
chainStoreConfig.setChainStoreId(id);
System.out.println(chainStoreConfig.getLevelClearRule());
int row = baseMapper.updateById(chainStoreConfig);
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("chain_store_id",id);
int row = baseMapper.update(chainStoreConfig,queryWrapper);
return row;
}
}

View File

@ -1,18 +1,33 @@
package com.fuint.business.userManager.service.impl;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
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.userManager.entity.LJUserGrade;
import com.fuint.business.userManager.mapper.LJUserGradeMapper;
import com.fuint.business.userManager.service.LJUserGradeService;
import com.fuint.common.util.StringUtils;
import org.springframework.stereotype.Service;
@Service
public class LJUserGradeServiceImpl extends ServiceImpl<LJUserGradeMapper, LJUserGrade> implements LJUserGradeService {
@Override
public IPage<LJUserGrade> selectUserGradeList(Page page, LJUserGrade userGrade) {
return baseMapper.selectUserGradeList(page,userGrade);
IPage<LJUserGrade> ljUserGradeIPage = baseMapper.selectUserGradeList(page, userGrade);
for (LJUserGrade record : ljUserGradeIPage.getRecords()) {
if (StringUtils.isNotEmpty(record.getGasolineRule())){
record.setGasolineRuleList(JSONArray.parseArray(record.getGasolineRule(), JSONObject.class));
}
if (StringUtils.isNotEmpty(record.getDieselRule())){
record.setDieselRuleList(JSONArray.parseArray(record.getDieselRule(), JSONObject.class));
}
if (StringUtils.isNotEmpty(record.getNaturalGasRule())){
record.setNaturalGasRuleList(JSONArray.parseArray(record.getNaturalGasRule(), JSONObject.class));
}
}
return ljUserGradeIPage;
}
@Override

View File

@ -1,5 +1,6 @@
package com.fuint.business.userManager.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -10,6 +11,9 @@ import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
* 会员信息 业务层
*/
@ -29,6 +33,32 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
return baseMapper.selectUserList(page,user);
}
/**
* 查询会员统计信息
* @return
*/
@Override
public Map<String, Object> selectStatistic() {
Map<String ,Object> map = new HashMap<>();
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
Double balance = baseMapper.selectSumByStore(storeId, "balance");
Double point = baseMapper.selectSumByStore(storeId, "point");
Double literCard = baseMapper.selectSumByStore(storeId, "liter_card");
Double refuelMoney = baseMapper.selectSumByStore(storeId, "refuel_money");
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("TO_DAYS(create_time)","TO_DAYS(NOW())");
Integer addNum = baseMapper.selectCount(queryWrapper);
map.put("balance",balance);
map.put("point",point);
map.put("literCard",literCard);
map.put("refuelMoney",refuelMoney);
map.put("addNum",addNum);
return map;
}
/**
* 根据id查询会员信息
* @param id