This commit is contained in:
cun-nan 2024-01-17 16:26:08 +08:00
parent e9dd0600c2
commit 45677555fc
13 changed files with 336 additions and 77 deletions

View File

@ -44,10 +44,29 @@ export function updateCommission(data) {
})
}
// 删除
// 删除工提成方案
export function delCommission(id) {
return request({
url: '/business/commission/staffCommission/' + id,
method: 'delete'
})
}
// 查询员工提成记录
export function listCommissionRecord(query) {
return request({
url: '/commissionRecord/list',
method: 'get',
params: query
})
}
// 查询员工提成总额
export function allAmountCommissionRecord(query) {
return request({
url: '/commissionRecord/allAmount',
method: 'get',
params: query
})
}

View File

@ -4,15 +4,97 @@
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="油品提成方案" name="oil"></el-tab-pane>
<el-tab-pane label="非油品提成方案" name="nonOil"></el-tab-pane>
<el-tab-pane label="员工提成记录" name="staffCommission">
<div>
<el-form :model="queryParams1" ref="queryForm" size="small" :inline="true" label-width="68px">
<el-form-item label="交易员工" prop="staffId">
<el-select
v-model="queryParams1.staffId"
clearable
placeholder="全部"
>
<el-option v-for="item in staffList" :key="item.id" :label="item.realName" :value="item.id">
<span style="float: left">{{ item.realName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.mobile }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="订单类型">
<el-input v-model="queryParams1.type" placeholder="请输入订单类型"></el-input>
</el-form-item>
<el-form-item label="订单号">
<el-input v-model="queryParams1.orderNo" placeholder="请输入订单号"></el-input>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
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>
<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>
</div>
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>会员充值统计</span>
</div>
<div class="box-gang">
<div class="box">
<div class="size-hui">提成笔数</div>
<div class="size-bole">{{ total1 }}</div>
</div>
<div class="box">
<div class="size-hui">提成金额</div>
<div class="size-bole">{{ allAmount }}</div>
</div>
</div>
</el-card>
<div style="margin-top: 20px" v-if="activeName=='staffCommission'">
<el-table ref="tables" v-loading="loading" :data="commissionList">
<el-table-column label="ID" prop="id" align="center" width="60"/>
<el-table-column label="员工信息" align="center">
<el-table-column label="姓名" prop="realName" align="center"/>
<el-table-column label="手机号" prop="mobile" align="center"/>
</el-table-column>
<el-table-column label="类型" prop="type" align="center" />
<el-table-column label="提成金额(元)" prop="amount" align="center" width="260"/>
<el-table-column label="关联订单号" prop="orderNo" align="center"/>
<el-table-column label="描述" prop="description" align="center"/>
<el-table-column label="创建时间" prop="createTime" align="center" width="160">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total1>0"
:total="total1"
:page.sync="queryParams1.page"
:limit.sync="queryParams1.pageSize"
@pagination="getCommissionList"
/>
</div>
</el-tab-pane>
</el-tabs>
<el-alert
title="方案说明"
type="info"
description="同一角色组、同一参与油品只能设置一种启用的提成方案">
v-if="activeName=='oil' || activeName=='nonOil'"
description="同一角色组、同一参与油品只能设置一种启用的提成方案,挂账订单不参与提成">
</el-alert>
<div style="margin-top: 20px">
<div style="margin-top: 20px" v-if="activeName=='oil' || activeName=='nonOil'">
<el-button
type="primary"
icon="el-icon-plus"
@ -88,9 +170,10 @@
@pagination="getList"
/>
</div>
</el-card>
<!-- 添加或修改对话框 -->
<!-- 添加或修改提成方案对话框 -->
<el-dialog :close-on-click-modal="false" :title="title" width="40%" :visible.sync="open" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
<el-row>
@ -106,14 +189,6 @@
<el-radio-group v-model="form.commissionSource">
<el-radio v-for="dict in dict.type.source" @change="isChange" :label="dict.value">{{ dict.label }}</el-radio>
</el-radio-group>
<!-- <el-radio-group v-model="commissionSource" ref="" @change="getCheckbox">-->
<!-- <el-checkbox-->
<!-- v-for="dict in dict.type.source"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- ></el-checkbox>-->
<!-- </el-radio-group>-->
</el-form-item>
</el-col>
</el-row>
@ -121,12 +196,6 @@
<el-col :span="24">
<el-form-item label="角色组" prop="staffRoleGroup">
<el-select v-model="form.staffRoleGroup" placeholder="请选择所属角色">
<!-- <el-option-->
<!-- v-for="dict in dict.type.staff_role"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- />-->
<el-option
v-for="item in roleList"
:key="item.dutyId+''"
@ -179,21 +248,6 @@
</el-form-item>
</el-col>
</el-row>
<!-- <el-row>-->
<!-- <el-col :span="24">-->
<!-- <el-form-item label="生效时间" prop="takeEffect">-->
<!-- <el-date-picker-->
<!-- v-model="form.takeEffect"-->
<!-- type="daterange"-->
<!-- value-format="yyyy-MM-dd HH:mm:ss"-->
<!-- range-separator="至"-->
<!-- start-placeholder="开始日期"-->
<!-- end-placeholder="结束日期">-->
<!-- </el-date-picker>-->
<!-- <div style="font-size: 12px;color: grey">时间范围内的油品交易有效</div>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<el-row>
<el-col :span="24">
<el-form-item label="方案状态" prop="status">
@ -219,18 +273,21 @@
import {
addCommission, delCommission,
addCommission, allAmountCommissionRecord, delCommission,
getCommission,
listCommission,
listCommission, listCommissionRecord,
queryCommission,
updateCommission
} from "@/api/staffCommission/staffcommission";
import {listDuty} from "@/api/staff/duty";
import {queryStaffs} from "@/api/order/staff";
export default {
dicts: ['source','role','zhzt','comissionType','staff_role'],
data(){
return {
//
allAmount:0,
changeCom:false,
activeName: 'oil',
select:"元",
@ -241,8 +298,10 @@ export default {
title: "",
//
total: 0,
total1: 0,
//
list: [],
commissionList: [],
//
open: false,
//
@ -255,6 +314,13 @@ export default {
name: '',
commissionSource:'油品'
},
queryParams1: {
page: 1,
pageSize: 10,
},
staffList:[],
//
dateRange: [],
//
form: {
type:'orderAmount',
@ -295,8 +361,14 @@ export default {
created() {
this.getList();
this.getDuty();
this.getStaffList();
},
methods:{
getStaffList(){
queryStaffs().then( response => {
this.staffList = response.data;
})
},
//
getDuty(){
listDuty().then(response => {
@ -314,7 +386,8 @@ export default {
commissionSource:'油品'
};
this.getList();
}else {
}
if (this.activeName == 'nonOil') {
this.queryParams = {
page: 1,
pageSize: 10,
@ -324,6 +397,13 @@ export default {
};
this.getList();
}
if (this.activeName == 'staffCommission') {
this.queryParams1 = {
page: 1,
pageSize: 10,
};
this.getCommissionList();
}
},
getCheckbox(){
@ -338,6 +418,20 @@ export default {
this.loading = false;
});
},
//
getCommissionList(){
this.loading = true;
listCommissionRecord(this.addDateRange(this.queryParams1, this.dateRange)).then(res => {
this.commissionList = res.data.records;
this.total1 = res.data.total;
this.loading = false;
})
allAmountCommissionRecord(this.addDateRange(this.queryParams1, this.dateRange)).then(res => {
if (res.data){
this.allAmount = res.data
}
})
},
//
reset() {
this.resetForm("form");
@ -374,6 +468,22 @@ export default {
this.title = "编辑提成方案";
});
},
//
handleQuery() {
this.queryParams1.page = 1;
this.getCommissionList();
},
//
resetQuery() {
this.dateRange = [];
this.queryParams1 = {
page: 1,
pageSize: 10,
}
// this.resetForm("queryForm");
this.handleQuery();
},
//
handleDelete(row) {
const name = row.name
@ -397,25 +507,6 @@ export default {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id) {
// if (this.changeCom){
// queryCommission(this.form).then(response => {
// if (response.data != null) {
// if (this.changeCom) {
// this.$modal.msgError("" + this.form.commissionSource + "")
// }else {
// this.$modal.msgError("")
// }
// } else {
// this.form.royaltyRate = this.form.royaltyRate + this.select
// updateCommission(this.form).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.changeCom = false;
// this.getList();
// });
// }
// })
// }else {
this.form.royaltyRate = this.form.royaltyRate + this.select
updateCommission(this.form).then(response => {
if (response.data==1){
@ -426,21 +517,7 @@ export default {
this.$modal.msgError("同一个角色组只能对应一个" + this.form.commissionSource + "提成方案")
}
});
// }
} else {
// queryCommission(this.form).then(response => {
// if (response.data != null){
// if (response.data.status == 'qy'){
// this.$modal.msgError(""+this.form.commissionSource+"")
// }else {
// this.form.royaltyRate = this.form.royaltyRate + this.select
// addCommission(this.form).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
// }
// }else {
this.form.royaltyRate = this.form.royaltyRate + this.select
addCommission(this.form).then(response => {
if (response.data==1) {
@ -451,8 +528,6 @@ export default {
this.$modal.msgError("同一个角色组只能对应一个"+this.form.commissionSource+"提成方案")
}
});
// }
// })
}
}
});
@ -483,4 +558,33 @@ export default {
height: 100vh;
background: #f6f8f9;
}
.clearfix{
width: 100%;
}
.box-card{
width: 100%;
margin-bottom: 15px;
}
.box-gang{
width: 100%;
display: flex;
align-items: center;
}
.box{
width: 200px;
box-sizing: border-box;
padding: 10px;
background: #f9f9f9;
height: 86px;
margin-right: 10px;
}
.size-hui{
font-size: 14px;
margin-bottom: 10px;
margin-top: 10px;
}
.size-bole{
font-weight: bold;
}
</style>

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.commission.entity.CommissionRecord;
import com.fuint.business.commission.service.CommissionRecordService;
import com.fuint.business.commission.vo.CommissionRecordVo;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.web.bind.annotation.*;
@ -89,7 +90,31 @@ public class CommissionRecordController extends BaseController {
return getSuccessResult(this.commissionRecordService.deleteById(id));
}
/**
* 根据条件分页查询提成记录信息
* @param commissionRecord
* @param pageNo
* @param pageSize
* @return
*/
@GetMapping("list")
public ResponseObject list(CommissionRecordVo commissionRecord,
@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize) {
Page page = new Page(pageNo, pageSize);
IPage< CommissionRecordVo> iPageList = this.commissionRecordService.selectCommissionList(page, commissionRecord);
return getSuccessResult(iPageList);
}
/**
* 消费总金额
* @param commissionRecord
* @return
*/
@GetMapping("allAmount")
public ResponseObject allAmount(CommissionRecordVo commissionRecord) {
return getSuccessResult(commissionRecordService.selectAllAmount(commissionRecord));
}
}

View File

@ -3,6 +3,7 @@ package com.fuint.business.commission.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.commission.entity.CommissionRecord;
import com.fuint.business.commission.vo.CommissionRecordVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
@ -81,5 +82,19 @@ public interface CommissionRecordMapper {
*/
int deleteById(Integer id);
/**
* 根据条件分页查询员工提成记录信息
* @param page
* @param commissionRecord
* @return
*/
IPage<CommissionRecordVo> selectCommissionList(@Param("page") Page page,@Param("commissionRecord") CommissionRecordVo commissionRecord);
/**
* 根据条件查询提成总额
* @return
*/
Double selectAllAmount(@Param("commissionRecord") CommissionRecordVo commissionRecord);
}

View File

@ -183,5 +183,55 @@
delete from commission_record where id = #{id}
</delete>
<select id="selectCommissionList" resultType="com.fuint.business.commission.vo.CommissionRecordVo">
select cr.*,ms.real_name,ms.mobile from commission_record cr
left join mt_staff ms on cr.staff_id = ms.id
<where>
<if test="commissionRecord.storeId != null and commissionRecord.storeId != ''">
and cr.store_id = #{commissionRecord.storeId}
</if>
<if test="commissionRecord.staffId != null and commissionRecord.staffId != ''">
and cr.staff_id = #{commissionRecord.staffId}
</if>
<if test="commissionRecord.type != null and commissionRecord.type != ''">
and cr.type like concat('%', #{commissionRecord.type}, '%')
</if>
<if test="commissionRecord.orderNo != null and commissionRecord.orderNo != ''">
and cr.order_no like concat('%', #{commissionRecord.orderNo}, '%')
</if>
<if test="commissionRecord.params.beginTime != null and commissionRecord.params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(cr.create_time,'%y%m%d') &gt;= date_format(#{commissionRecord.params.beginTime},'%y%m%d')
</if>
<if test="commissionRecord.params.endTime != null and commissionRecord.params.endTime != ''"><!-- 结束时间检索 -->
and date_format(cr.create_time,'%y%m%d') &lt;= date_format(#{commissionRecord.params.endTime},'%y%m%d')
</if>
</where>
order by cr.create_time desc
</select>
<select id="selectAllAmount" resultType="java.lang.Double"
parameterType="com.fuint.business.commission.vo.CommissionRecordVo">
select sum(amount) from commission_record
<where>
<if test="commissionRecord.storeId != null and commissionRecord.storeId != ''">
and store_id = #{commissionRecord.storeId}
</if>
<if test="commissionRecord.staffId != null and commissionRecord.staffId != ''">
and staff_id = #{commissionRecord.staffId}
</if>
<if test="commissionRecord.type != null and commissionRecord.type != ''">
and type like concat('%', #{commissionRecord.type}, '%')
</if>
<if test="commissionRecord.orderNo != null and commissionRecord.orderNo != ''">
and order_no like concat('%', #{commissionRecord.orderNo}, '%')
</if>
<if test="commissionRecord.params.beginTime != null and commissionRecord.params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%y%m%d') &gt;= date_format(#{commissionRecord.params.beginTime},'%y%m%d')
</if>
<if test="commissionRecord.params.endTime != null and commissionRecord.params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%y%m%d') &lt;= date_format(#{commissionRecord.params.endTime},'%y%m%d')
</if>
</where>
</select>
</mapper>

View File

@ -3,6 +3,7 @@ package com.fuint.business.commission.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.commission.entity.CommissionRecord;
import com.fuint.business.commission.vo.CommissionRecordVo;
import io.lettuce.core.dynamic.annotation.Param;
@ -62,4 +63,18 @@ public interface CommissionRecordService {
* @return
*/
int insertRecord(CommissionRecord commissionRecord);
/**
* 根据条件分页查询员工提成记录信息
* @param page
* @param commissionRecord
* @return
*/
IPage<CommissionRecordVo> selectCommissionList(Page page, CommissionRecordVo commissionRecord);
/**
* 根据条件查询提成总额
* @return
*/
Double selectAllAmount(CommissionRecordVo commissionRecord);
}

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.commission.entity.CommissionRecord;
import com.fuint.business.commission.mapper.CommissionRecordMapper;
import com.fuint.business.commission.service.CommissionRecordService;
import com.fuint.business.commission.vo.CommissionRecordVo;
import org.springframework.stereotype.Service;
import com.fuint.common.util.TokenUtil;
import io.lettuce.core.dynamic.annotation.Param;
@ -97,4 +98,18 @@ public class CommissionRecordServiceImpl implements CommissionRecordService {
public int insertRecord(CommissionRecord commissionRecord) {
return commissionRecordMapper.insert(commissionRecord);
}
@Override
public IPage<CommissionRecordVo> selectCommissionList(Page page, CommissionRecordVo commissionRecord) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
commissionRecord.setStoreId(nowAccountInfo.getStoreId());
return commissionRecordMapper.selectCommissionList(page, commissionRecord);
}
@Override
public Double selectAllAmount(CommissionRecordVo commissionRecord) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
commissionRecord.setStoreId(nowAccountInfo.getStoreId());
return commissionRecordMapper.selectAllAmount(commissionRecord);
}
}

View File

@ -1,4 +1,16 @@
package com.fuint.business.commission.vo;
public class CommissionRecordVo {
import com.fuint.business.commission.entity.CommissionRecord;
import lombok.Data;
@Data
public class CommissionRecordVo extends CommissionRecord {
/**
* 员工姓名
*/
private String realName;
/**
* 员工手机号
*/
private String mobile;
}

View File

@ -97,8 +97,8 @@ public class LJUserController extends BaseController {
* @return
*/
@GetMapping("/statistic")
public ResponseObject getStatistic(){
Map<String, Object> map = userService.selectStatistic();
public ResponseObject getStatistic(LJUserVo user){
Map<String, Object> map = userService.selectStatistic(user);
return getSuccessResult(map);
}

View File

@ -55,7 +55,10 @@
</select>
<!-- 查询会员统计信息-->
<select id="selectSumByStore" resultType="java.lang.Double" parameterType="int">
select sum(${sumValue}) from mt_user_balance where chain_store_id = #{chainStoreId}
select sum(${sumValue}) from mt_user_balance
<where>
chain_store_id = #{chainStoreId}
</where>
</select>
<!-- 根据手机号查询会员信息-->
<select id="selectUserByMobile" resultType="com.fuint.business.userManager.vo.LJUserVo"

View File

@ -44,7 +44,7 @@ public interface LJUserService extends IService<LJUser> {
* 查询会员统计信息
* @return
*/
public Map<String ,Object> selectStatistic();
public Map<String ,Object> selectStatistic(LJUserVo user);
/**
* 根据id查询会员信息

View File

@ -92,7 +92,7 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
* @return
*/
@Override
public Map<String, Object> selectStatistic() {
public Map<String, Object> selectStatistic(LJUserVo user) {
Map<String ,Object> map = new HashMap<>();
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();

View File

@ -126,6 +126,7 @@
</view>
<view class="desc" v-if="!isFullPreferential && !isGradePreferential && !isOilStorageCard && !isStoreValueCard">无优惠</view>
<view style="margin: 10px 20px 0;color: red;font-size: 12px;">已为您计算出最大优惠</view>
<view style="margin: 10px 20px 0;color: red;font-size: 12px;">囤油卡不参与任何优惠活动</view>
</view>