订单按天计算详情

This commit is contained in:
xiezhijun 2021-03-26 19:04:44 +08:00
parent 275f8c2437
commit 74cfe232a8
13 changed files with 472 additions and 105 deletions

View File

@ -5,8 +5,11 @@ import java.math.RoundingMode;
import java.util.List;
import com.stdiet.custom.domain.SysCommissionDayDetail;
import com.stdiet.custom.domain.SysOrder;
import com.stdiet.custom.domain.SysOrderCommisionDayDetail;
import com.stdiet.custom.dto.request.SysOrderCommision;
import com.stdiet.custom.service.ISysCommissionDayService;
import com.stdiet.custom.service.ISysOrderService;
import com.stdiet.framework.web.domain.server.Sys;
import com.stdiet.system.domain.CusSalesman;
import com.stdiet.system.service.ISysUserService;
@ -199,6 +202,16 @@ public class SysCommisionController extends BaseController {
return getDataTable(sysCommissionDayService.calculateCommissionByDay(sysCommision));
}
/**
* 根据用户ID查询该用户按天计算提成的详情
* */
@PreAuthorize("@ss.hasPermi('commisionDay:detail:list')")
@GetMapping("/orderDetailDay")
public AjaxResult getOrderCommissionDetailDay(SysCommision sysCommision) {
startPage();
return sysCommissionDayService.calculateOrderCommissionDetail(sysCommision);
}
/**
* 导出按天计算提成详细列表
*/

View File

@ -3,6 +3,7 @@ package com.stdiet.custom.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.stdiet.common.annotation.Excel;
import com.stdiet.common.core.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDate;
@ -12,22 +13,24 @@ import java.util.Map;
/**
* 每个订单的提成详情
* */
@Data
public class SysOrderCommisionDayDetail extends BaseEntity {
private static final long serialVersionUID = 1L;
/**订单成交时间*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime orderTime;
/**客户姓名*/
private String name;
/**服务结束时间*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "成交时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate serverStartDate;
/**服务结束时间*/
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate serverEndDate;
/**服务月数*/
@ -39,12 +42,18 @@ public class SysOrderCommisionDayDetail extends BaseEntity {
/**订单金额*/
private BigDecimal orderAmount;
/**订单总提成**/
private BigDecimal orderCommission;
/**服务天数*/
private Integer serverDay;
/**每天金额*/
private BigDecimal dayMoney;
/** 暂停总天数 **/
private int pauseTotalDay;
/**每年每月暂停天数*/
private Map<String, Integer> everyYearMonthPauseDay;
@ -54,99 +63,12 @@ public class SysOrderCommisionDayDetail extends BaseEntity {
/**每年每月对应金额*/
private Map<String, BigDecimal> everyYearMonthServerMoney;
public LocalDateTime getOrderTime() {
return orderTime;
}
/**每年每月对应提成*/
private Map<String, BigDecimal> everyYearMonthServerCommission;
public void setOrderTime(LocalDateTime orderTime) {
this.orderTime = orderTime;
}
//该笔订单成交的当月的总成交额用于确定提成比例
private BigDecimal monthOrderTotalAmount;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public LocalDate getServerStartDate() {
return serverStartDate;
}
public void setServerStartDate(LocalDate serverStartDate) {
this.serverStartDate = serverStartDate;
}
public LocalDate getServerEndDate() {
return serverEndDate;
}
public void setServerEndDate(LocalDate serverEndDate) {
this.serverEndDate = serverEndDate;
}
public Integer getServerMonth() {
return serverMonth;
}
public void setServerMonth(Integer serverMonth) {
this.serverMonth = serverMonth;
}
public Integer getGiveDay() {
return giveDay;
}
public void setGiveDay(Integer giveDay) {
this.giveDay = giveDay;
}
public BigDecimal getOrderAmount() {
return orderAmount;
}
public void setOrderAmount(BigDecimal orderAmount) {
this.orderAmount = orderAmount;
}
public Integer getServerDay() {
return serverDay;
}
public void setServerDay(Integer serverDay) {
this.serverDay = serverDay;
}
public BigDecimal getDayMoney() {
return dayMoney;
}
public void setDayMoney(BigDecimal dayMoney) {
this.dayMoney = dayMoney;
}
public Map<String, Integer> getEveryYearMonthPauseDay() {
return everyYearMonthPauseDay;
}
public void setEveryYearMonthPauseDay(Map<String, Integer> everyYearMonthPauseDay) {
this.everyYearMonthPauseDay = everyYearMonthPauseDay;
}
public Map<String, Integer> getEveryYearMonthServerDay() {
return everyYearMonthServerDay;
}
public void setEveryYearMonthServerDay(Map<String, Integer> everyYearMonthServerDay) {
this.everyYearMonthServerDay = everyYearMonthServerDay;
}
public Map<String, BigDecimal> getEveryYearMonthServerMoney() {
return everyYearMonthServerMoney;
}
public void setEveryYearMonthServerMoney(Map<String, BigDecimal> everyYearMonthServerMoney) {
this.everyYearMonthServerMoney = everyYearMonthServerMoney;
}
//该笔订单对应提成比例
private Float commissionRate;
}

View File

@ -0,0 +1,13 @@
package com.stdiet.custom.dto.response;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class EveryMonthTotalAmount {
private String yearMonth;
private BigDecimal totalAmount;
}

View File

@ -2,12 +2,14 @@ package com.stdiet.custom.mapper;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import com.stdiet.custom.domain.SysCommision;
import com.stdiet.custom.domain.SysCommissionDayDetail;
import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.domain.SysOrder;
import com.stdiet.custom.dto.request.SysOrderCommision;
import com.stdiet.custom.dto.response.EveryMonthTotalAmount;
import org.apache.ibatis.annotations.Param;
/**
@ -85,4 +87,17 @@ public interface SysOrderMapper
* @return
*/
int getOrderCountByCustomer(SysCustomer sysCustomer);
/**
* 查询每年每月的总金额
* @return
*/
List<EveryMonthTotalAmount> getTotalAmountByUserId(SysCommision sysCommision);
/**
* 获取订单数量按天提成计算
* @param sysCommision
* @return
*/
int selectSimpleOrderMessageCount(SysCommision sysCommision);
}

View File

@ -1,5 +1,6 @@
package com.stdiet.custom.service;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.custom.domain.SysCommision;
import com.stdiet.custom.domain.SysCommissionDayDetail;
import com.stdiet.custom.domain.SysOrder;
@ -33,4 +34,9 @@ public interface ISysCommissionDayService {
*/
LocalDate getServerEndDate(SysOrder sysOrder);
/**
* 计算订单提成详情
*/
AjaxResult calculateOrderCommissionDetail(SysCommision sysCommision);
}

View File

@ -3,9 +3,12 @@ package com.stdiet.custom.service;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.stdiet.custom.domain.SysCommision;
import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.domain.SysOrder;
import com.stdiet.custom.dto.response.EveryMonthTotalAmount;
/**
* 销售订单Service接口
@ -84,4 +87,17 @@ public interface ISysOrderService
* @return
*/
int getOrderCountByCustomer(SysCustomer sysCustomer);
/**
* 查询每年每月的总金额
* @return
*/
List<EveryMonthTotalAmount> getTotalAmountByUserId(SysCommision sysCommision);
/**
* 获取订单数量按天提成计算
* @param sysCommision
* @return
*/
int selectSimpleOrderMessageCount(SysCommision sysCommision);
}

View File

@ -1,9 +1,11 @@
package com.stdiet.custom.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.utils.DateUtils;
import com.stdiet.custom.domain.*;
import com.stdiet.custom.dto.request.SysOrderCommision;
import com.stdiet.custom.dto.response.EveryMonthTotalAmount;
import com.stdiet.custom.mapper.SysCommisionMapper;
import com.stdiet.custom.mapper.SysOrderMapper;
import com.stdiet.custom.mapper.SysOrderPauseMapper;
@ -103,6 +105,63 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
return serverEndDate;
}
/**
* 计算订单提成详情
* @param sysCommision
*/
@Override
public AjaxResult calculateOrderCommissionDetail(SysCommision sysCommision){
AjaxResult result = AjaxResult.error("参数错误");
if(sysCommision.getUserId() == null){
return result;
}
//分页查询2021年1月份之后所有订单
Map<Long, List<SysOrderCommisionDayDetail>> orderUserMap = getOrderByList(sysCommision);
if(orderUserMap == null || !orderUserMap.containsKey(sysCommision.getUserId())){
return result;
}
//查询用户
List<SysCommision> list = sysCommisionMapper.getAfterSaleAndNutri(sysCommision);
if(list == null || list.size() == 0){
return result;
}
Long userId = list.get(0).getUserId();
Long postId = list.get(0).getPostId();
//获取每个月的成交总额度
List<EveryMonthTotalAmount> everyMonthTotalAmountList = sysOrderMapper.getTotalAmountByUserId(sysCommision);
if(everyMonthTotalAmountList == null || everyMonthTotalAmountList.size() == 0){
return result;
}
Map<String, BigDecimal> everyMonthTotalAmountMap = new TreeMap<>(new MyComparator());
for (EveryMonthTotalAmount everyMonthTotalAmount : everyMonthTotalAmountList) {
everyMonthTotalAmountMap.put(everyMonthTotalAmount.getYearMonth(), everyMonthTotalAmount.getTotalAmount());
}
//获取每个月的提成比例以及计算提成
Map<String, Float> rateMap = getRateByAmount(userId, postId, everyMonthTotalAmountMap);
BigDecimal totalCommission = BigDecimal.valueOf(0);
//根据用户ID获取对应订单列表
List<SysOrderCommisionDayDetail> orderDetailList = orderUserMap.get(userId);
for(SysOrderCommisionDayDetail sysOrderCommisionDayDetail : orderDetailList){
String yearMonth = sysOrderCommisionDayDetail.getOrderTime().getYear() + "" + sysOrderCommisionDayDetail.getOrderTime().getMonth().getValue();
sysOrderCommisionDayDetail.setMonthOrderTotalAmount(everyMonthTotalAmountMap.get(yearMonth));
sysOrderCommisionDayDetail.setCommissionRate(rateMap.get(yearMonth));
//计算该笔订单总提成
sysOrderCommisionDayDetail.setOrderCommission(getMoney(sysOrderCommisionDayDetail.getOrderAmount().doubleValue() * sysOrderCommisionDayDetail.getCommissionRate() / 100D));
Map<String, BigDecimal> everyYearMonthServerCommission = new TreeMap<>(new MyComparator());
for (String everyMonth : sysOrderCommisionDayDetail.getEveryYearMonthServerMoney().keySet()) {
everyYearMonthServerCommission.put(everyMonth, getMoney(sysOrderCommisionDayDetail.getEveryYearMonthServerMoney().get(everyMonth).doubleValue() * sysOrderCommisionDayDetail.getCommissionRate() / 100D));
}
sysOrderCommisionDayDetail.setEveryYearMonthServerCommission(everyYearMonthServerCommission);
totalCommission = totalCommission.add(sysOrderCommisionDayDetail.getOrderCommission());
}
result = AjaxResult.success();
int total = sysOrderMapper.selectSimpleOrderMessageCount(sysCommision);
result.put("total", total);
result.put("list", orderDetailList);
result.put("totalCommission", totalCommission);
return result;
}
/**
* 根据用户ID统计出该用户在该月所有订单的服务数量服务总天数服务订单总额暂停总天数
@ -135,14 +194,14 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
for (String ym : commissionMonthSet) {
BigDecimal ym_mession = new BigDecimal(0);
if(orderAmount.containsKey(ym)){
totalCommissionAmount = totalCommissionAmount.add(getMoney(orderAmount.get(ym).doubleValue() * rateMap.get(ym) / 100D, 1));
totalCommissionAmount = totalCommissionAmount.add(getMoney(orderAmount.get(ym).doubleValue() * rateMap.get(ym) / 100D));
}
for (SysOrderCommisionDayDetail sysOrderCommisionDayDetail : orderDetailList) {
Map<String, BigDecimal> everyYearMonthServerMoney = sysOrderCommisionDayDetail.getEveryYearMonthServerMoney();
if(everyYearMonthServerMoney.containsKey(ym)){
String orderYearMonth = sysOrderCommisionDayDetail.getOrderTime().getYear()+""+sysOrderCommisionDayDetail.getOrderTime().getMonth().getValue();
BigDecimal m = (everyYearMonthServerMoney.get(ym) == null) ? new BigDecimal(0) : everyYearMonthServerMoney.get(ym);
ym_mession = ym_mession.add(getMoney(m.doubleValue() * rateMap.get(orderYearMonth) / 100D, 1));
ym_mession = ym_mession.add(getMoney(m.doubleValue() * rateMap.get(orderYearMonth) / 100D));
}
}
if(isSendCommissionByYearMonth(ym)){
@ -288,7 +347,7 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
//服务总天数
int serverDay = getTotalByMap(everyYearMonthServerDay);
//每天对应金额
BigDecimal dayMoney = getMoney(orderAmount.doubleValue()/serverDay, 1);
BigDecimal dayMoney = getMoney(orderAmount.doubleValue()/serverDay);
//每年每月对于金额
Map<String, BigDecimal> everyYearMonthServerMoney = getEveryMonthServerMoney(everyYearMonthServerDay, orderAmount, dayMoney);
@ -299,12 +358,14 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
sysOrderCommisionDayDetail.setServerEndDate(serverEndDate);
sysOrderCommisionDayDetail.setServerMonth(serverMonth);
sysOrderCommisionDayDetail.setGiveDay(giveDay);
sysOrderCommisionDayDetail.setPauseTotalDay(pauseTotalDay);
sysOrderCommisionDayDetail.setOrderAmount(orderAmount);
sysOrderCommisionDayDetail.setServerDay(serverDay);
sysOrderCommisionDayDetail.setDayMoney(dayMoney);
sysOrderCommisionDayDetail.setEveryYearMonthPauseDay(everyYearMonthPauseDay);
sysOrderCommisionDayDetail.setEveryYearMonthServerDay(everyYearMonthServerDay);
sysOrderCommisionDayDetail.setEveryYearMonthServerMoney(everyYearMonthServerMoney);
return sysOrderCommisionDayDetail;
}
@ -385,11 +446,11 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
double totalMoney = 0.0;
for(String key : keySet){
if(i++ != keySet.size()){
everyMonthServerMoney.put(key, getMoney(everyMonthServerDay.get(key) * dayMoney.doubleValue(), 1));
everyMonthServerMoney.put(key, getMoney(everyMonthServerDay.get(key) * dayMoney.doubleValue()));
totalMoney += everyMonthServerMoney.get(key).doubleValue();
}else{
//由于小数点只保留一位最后一个月的金额等于总额减去前几个月金额避免总数不一致
everyMonthServerMoney.put(key, getMoney(orderMoney.doubleValue() - totalMoney, 1));
everyMonthServerMoney.put(key, getMoney(orderMoney.doubleValue() - totalMoney));
}
}
return everyMonthServerMoney;
@ -436,9 +497,9 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
}
/**
* double转为BigDecimal保留一位小数向下舍去
* double转为BigDecimal保留2位小数四舍五入
* */
public BigDecimal getMoney(Double money, int n){
public BigDecimal getMoney(Double money){
return new BigDecimal(money.toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
}

View File

@ -4,8 +4,10 @@ import com.stdiet.common.annotation.Excel;
import com.stdiet.common.utils.DateUtils;
import com.stdiet.common.utils.SecurityUtils;
import com.stdiet.common.utils.StringUtils;
import com.stdiet.custom.domain.SysCommision;
import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.domain.SysOrder;
import com.stdiet.custom.dto.response.EveryMonthTotalAmount;
import com.stdiet.custom.mapper.SysOrderMapper;
import com.stdiet.custom.service.ISysCommissionDayService;
import com.stdiet.custom.service.ISysOrderPauseService;
@ -22,6 +24,7 @@ import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 销售订单Service业务层处理
@ -349,7 +352,26 @@ public class SysOrderServiceImpl implements ISysOrderService {
* @param sysCustomer
* @return
*/
@Override
public int getOrderCountByCustomer(SysCustomer sysCustomer){
return sysOrderMapper.getOrderCountByCustomer(sysCustomer);
}
/**
* 查询每年每月的总金额
* @return
*/
@Override
public List<EveryMonthTotalAmount> getTotalAmountByUserId(SysCommision sysCommision){
return sysOrderMapper.getTotalAmountByUserId(sysCommision);
}
/**
* 获取订单数量按天提成计算
* @param sysCommision
* @return
*/
public int selectSimpleOrderMessageCount(SysCommision sysCommision){
return sysOrderMapper.selectSimpleOrderMessageCount(sysCommision);
}
}

View File

@ -404,7 +404,7 @@
<if test="reviewStatus != null and reviewStatus != ''">
and review_status = #{reviewStatus}
</if>
<if test="userId != null">
<if test="userId != null"><!-- 限于营养师、售后不可能同一个的情况下 -->
and (su_sale.user_id = #{userId} or su_nutritionist.user_id = #{userId})
</if>
<if test="endTime != null and endTime != ''">
@ -413,6 +413,48 @@
order by o.order_time desc
</select>
<!-- 查询2021年开始的已审核的订单信息的总条数用于计算提成,请勿随意改动) -->
<select id="selectSimpleOrderMessageCount" resultType="int" parameterType="SysCommision">
select count(o.order_id) as orderCount
from sys_order o
left join sys_user su_sale on su_sale.user_id = o.after_sale_id and su_sale.del_flag = 0
left join sys_user su_nutritionist on su_nutritionist.user_id = o.nutritionist_id and su_nutritionist.del_flag = 0
where o.order_time >= '2021-01-01' and o.del_flag = 0
<if test="reviewStatus != null and reviewStatus != ''">
and review_status = #{reviewStatus}
</if>
<if test="userId != null"><!-- 限于营养师、售后不可能同一个的情况下 -->
and (su_sale.user_id = #{userId} or su_nutritionist.user_id = #{userId})
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(o.order_time,'%Y-%m-%d') &lt;= #{endTime}
</if>
order by o.order_time desc
</select>
<!-- 查询售后、营养师的每个月服务总金额 -->
<select id="getTotalAmountByUserId" parameterType="SysCommision" resultType="com.stdiet.custom.dto.response.EveryMonthTotalAmount">
SELECT s.yearMonth,SUM(s.amount) AS totalAmount FROM
(
SELECT CONCAT(YEAR(o.order_time),'',MONTH(o.order_time)) AS yearMonth,o.amount
FROM sys_order o
LEFT JOIN sys_user su_sale ON su_sale.user_id = o.after_sale_id AND su_sale.del_flag = 0
LEFT JOIN sys_user su_nutritionist ON su_nutritionist.user_id = o.nutritionist_id AND su_nutritionist.del_flag = 0
where o.order_time >= '2021-01-01' and o.del_flag = 0
<if test="reviewStatus != null and reviewStatus != ''">
and o.review_status = #{reviewStatus}
</if>
<if test="userId != null"><!-- 限于营养师、售后不可能同一个的情况下 -->
and (su_sale.user_id = #{userId} or su_nutritionist.user_id = #{userId})
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(o.order_time,'%Y-%m-%d') &lt;= #{endTime}
</if>
ORDER BY o.order_time ASC
) s
GROUP BY s.yearMonth
</select>
<!-- 根据客户信息查询客户的订单列表数量 -->
<select id="getOrderCountByCustomer" parameterType="SysCustomer" resultType="int">
SELECT count(so.order_id) FROM sys_order so LEFT JOIN sys_customer sc ON sc.id = so.cus_id AND sc.del_flag = 0

View File

@ -87,3 +87,12 @@ export function exportDayCommision(query) {
})
}
// 用户对应订单的按天计算提成明细
export function orderDetailDay(query) {
return request({
url: '/custom/commision/orderDetailDay',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,226 @@
<template>
<div>
<el-drawer
:title="title"
:close-on-press-escape="false"
:visible.sync="visible"
@closed="handleOnClosed"
size="63%"
>
<div class="order_drawer_wrapper" height="84%">
<div
class="header"
style="float: right; margin-bottom: 20px; margin-right: 60px"
>
<span style="font-size14px;margin-top:-200px"
>当前页总提成{{ totalCommission }}</span
>
</div>
<el-table :data="orderList" v-loading="loading">
<el-table-column
label="订单成交时间"
prop="orderTime"
align="center"
width="160"
></el-table-column>
<el-table-column
label="客户姓名"
prop="name"
align="center"
width="100"
></el-table-column>
<el-table-column
label="订单金额"
prop="orderAmount"
align="center"
width="100"
></el-table-column>
<el-table-column
label="开始时间"
prop="serverStartDate"
align="center"
width="100"
></el-table-column>
<el-table-column
label="结束时间"
prop="serverEndDate"
align="center"
width="100"
></el-table-column>
<el-table-column
label="服务天数"
prop="serverDay"
align="center"
width="100"
>
<template slot-scope="scope">
{{ scope.row.serverDay }}
<el-popover
placement="top-start"
width="200"
popper-class="autohideinfo_detial"
trigger="hover"
>
<div
v-for="(item, index) in scope.row.everyYearMonthServerDay"
:key="index"
>
{{ item }}
</div>
<el-button type="text" slot="reference">详情</el-button>
</el-popover>
</template>
</el-table-column>
<el-table-column
label="暂停天数"
prop="pauseTotalDay"
align="center"
width="100"
></el-table-column>
<el-table-column
label="每天金额"
prop="dayMoney"
align="center"
width="100"
></el-table-column>
<el-table-column
label="当月总额"
prop="monthOrderTotalAmount"
align="center"
width="100"
></el-table-column>
<el-table-column
label="提成比例"
prop="commissionRate"
align="center"
width="100"
>
<template slot-scope="scope">
{{ scope.row.commissionRate + "%" }}
</template>
</el-table-column>
<el-table-column
label="订单提成"
prop="orderCommission"
align="center"
width="100"
>
<template slot-scope="scope">
{{ scope.row.orderCommission }}
<el-popover
placement="top-start"
width="200"
popper-class="autohideinfo_detial"
trigger="hover"
>
<div
v-for="(item, index) in scope.row.everyYearMonthServerCommission"
:key="index"
>
{{ item }}
</div>
<el-button type="text" slot="reference">详情</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParam.pageNum"
:limit.sync="queryParam.pageSize"
@pagination="fetchOrderList"
:pageSizes="[10, 15, 30, 50, 100]"
>
</pagination>
</div>
</el-drawer>
</div>
</template>
<script>
import { orderDetailDay } from "@/api/custom/commision";
export default {
name: "OrdercommissDetail",
components: {},
data() {
return {
visible: false,
loading: false,
title: "",
data: undefined,
orderList: [],
queryParam: {},
total: 0,
totalCommission: 0,
serverDayList: ["1月30", "2月20"],
};
},
computed: {},
methods: {
showDrawer(data) {
this.data = data;
if (!this.data) {
return;
}
(this.queryParam = {
pageNum: 1,
pageSize: 10,
}),
(this.queryParam.userId = this.data.userId);
this.queryParam.reviewStatus = this.data.reviewStatus;
this.queryParam.endTime = this.data.endTime;
this.title = `${this.data.name}」订单提成列表`;
this.visible = true;
this.fetchOrderList();
},
fetchOrderList() {
this.loading = true;
orderDetailDay(this.queryParam).then((res) => {
//console.log(res);
if (res.code == 200) {
this.orderList = this.dealOrderList(res.list);
this.total = res.total;
this.totalCommission = res.totalCommission;
}
this.loading = false;
});
},
handleOnClosed() {
this.data = undefined;
},
dealOrderList(orderList) {
//
orderList.forEach((item, index) => {
let everyYearMonthServerDayArray = [];
for (let yearMonth in item.everyYearMonthServerDay) {
everyYearMonthServerDayArray.push(yearMonth.slice(0, 4) +"-" + yearMonth.slice(4) + "" + item.everyYearMonthServerDay[yearMonth] + "天");
}
item.everyYearMonthServerDay = everyYearMonthServerDayArray;
let everyYearMonthServerCommissionArray = [];
for (let commissYearMonth in item.everyYearMonthServerCommission) {
everyYearMonthServerCommissionArray.push(commissYearMonth.slice(0, 4) +"-" +commissYearMonth.slice(4) +"" + item.everyYearMonthServerCommission[commissYearMonth]);
}
item.everyYearMonthServerCommission = everyYearMonthServerCommissionArray;
});
return orderList;
},
},
};
</script>
<style lang="scss" scoped>
/deep/ :focus {
outline: 0;
}
.order_drawer_wrapper {
height: calc(100vh - 77px);
}
</style>

View File

@ -180,7 +180,7 @@ export default {
pageSize: 10,
userId: null,
postId: null,
reviewStatus: null
reviewStatus: "yes"
},
};
},

View File

@ -157,6 +157,11 @@
@click="openFormDialog('查看发放计划', scope.row)"
>查看发放计划</el-button
>
<el-button
type="text"
@click="handleDetailClick(scope.row)"
>查看订单详情</el-button
>
</template>
</el-table-column>
@ -205,7 +210,11 @@
</el-table-column>
</el-table>
</el-dialog>
<OrdercommissDetail ref="ordercommissDetailRef"></OrdercommissDetail>
</div>
</template>
<style>
@ -226,6 +235,8 @@ import { getOptions } from "@/api/custom/global";
import dayjs from "dayjs";
import OrdercommissDetail from "@/components/OrdercommissDetail";
export default {
name: "CommisionDayDetail",
data() {
@ -266,13 +277,16 @@ export default {
pageSize: 20,
userId: null,
postId: null,
reviewStatus: null,
reviewStatus: "yes",
},
sendCommissionPlanTable: false,
sendCommissionPlan: {},
fixLength: 2,
};
},
components: {
OrdercommissDetail
},
created() {
this.getList();
getOptions().then((response) => {
@ -399,6 +413,14 @@ export default {
this.sendCommissionPlan.total = row.totalNotSentCommissionAmount;
this.sendCommissionPlanTable = true;
},
handleDetailClick(row) {
// console.log(row);
const dateRange = [
dayjs(this.month).startOf("month").format("YYYY-MM-DD"),
dayjs(this.month).endOf("month").format("YYYY-MM-DD"),
];
this.$refs["ordercommissDetailRef"].showDrawer(this.addDateRange({'name': row.nickName, 'userId': row.userId, 'reviewStatus': this.queryParams.reviewStatus}, dateRange));
},
getSummaries(param) {
//param columns data {columns: Array[4], data: Array[5]},
const { columns, data } = param;