订单按天计算详情

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

@ -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;