|
|
@@ -1,3 +1,7 @@
|
|
|
+<!--
|
|
|
+ PC 收支分类:与小程序 classProfit 同源 /stat/class-profit(StatSaleClass::classProfile)。
|
|
|
+ 采购成本、销售收入已含隔天售后通过日扣减;仅退款含隔天通过日金额。
|
|
|
+-->
|
|
|
<template>
|
|
|
<div class="shop-list">
|
|
|
<x-crud @load="onLoad">
|
|
|
@@ -8,6 +12,26 @@
|
|
|
<template #slot-export-due>
|
|
|
<el-button type="primary" size="mini" style="margin-left:60px;" @click="exportData()">导出数据</el-button>
|
|
|
</template>
|
|
|
+ <template #slot-class-tip>
|
|
|
+ <div class="class-tip">
|
|
|
+ 采购成本、销售收入已按售后扣减(隔天售后记在通过日,分类成本/收入可为负)。采购仅退款、销售仅退款含隔天通过日金额。
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #table-column-income="{scope}">
|
|
|
+ <div :style="negStyle(scope.row.income)">{{ formatNum(scope.row.income) }}</div>
|
|
|
+ </template>
|
|
|
+ <template #table-column-expend="{scope}">
|
|
|
+ <div :style="negStyle(scope.row.expend)">{{ formatNum(scope.row.expend) }}</div>
|
|
|
+ </template>
|
|
|
+ <template #table-column-profit="{scope}">
|
|
|
+ <div :style="negStyle(scope.row.profit)">{{ formatNum(scope.row.profit) }}</div>
|
|
|
+ </template>
|
|
|
+ <template #table-column-saleNum="{scope}">
|
|
|
+ <div :style="negStyle(scope.row.saleNum)">{{ formatNum(scope.row.saleNum) }}</div>
|
|
|
+ </template>
|
|
|
+ <template #table-column-cgNum="{scope}">
|
|
|
+ <div :style="negStyle(scope.row.cgNum)">{{ formatNum(scope.row.cgNum) }}</div>
|
|
|
+ </template>
|
|
|
</x-crud>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -55,8 +79,27 @@ export default {
|
|
|
...mapGetters(['shopInfo']),
|
|
|
},
|
|
|
methods: {
|
|
|
+ /** 数字展示:避免 undefined / NaN */
|
|
|
+ formatNum(val) {
|
|
|
+ const n = parseFloat(val);
|
|
|
+ return isNaN(n) ? 0 : n;
|
|
|
+ },
|
|
|
+ /** 负数量/金额标红,突出隔天通过日扣减 */
|
|
|
+ negStyle(val) {
|
|
|
+ const n = Number(val);
|
|
|
+ return (!isNaN(n) && n < 0) ? 'color:#e74c3c;font-weight:bold;' : '';
|
|
|
+ },
|
|
|
+ /** 与小程序 classProfit 相同查询参数 */
|
|
|
+ queryParams(extra) {
|
|
|
+ return {
|
|
|
+ searchTime: this.searchTime,
|
|
|
+ startTime: this.startTime,
|
|
|
+ endTime: this.endTime,
|
|
|
+ ...(extra || {})
|
|
|
+ };
|
|
|
+ },
|
|
|
exportData(){
|
|
|
- this.$service.stat.getClassProfit({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,export:1}).then(res => {
|
|
|
+ this.$service.stat.getClassProfit(this.queryParams({export:1})).then(res => {
|
|
|
if(res.file){
|
|
|
window.location.href = res.file
|
|
|
}
|
|
|
@@ -66,15 +109,20 @@ export default {
|
|
|
this.app = app;
|
|
|
ctx.service({
|
|
|
page: () => {
|
|
|
- return this.$service.stat.getClassProfit({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime}).then((res) => {
|
|
|
+ return this.$service.stat.getClassProfit(this.queryParams()).then((res) => {
|
|
|
+ const packFreight = this.formatNum(res.packFreight)
|
|
|
+ const onlyRefundCg = this.formatNum(res.onlyRefundCg)
|
|
|
+ const onlyRefund = this.formatNum(res.onlyRefund)
|
|
|
+ const totalLabourCost = this.formatNum(res.totalLabourCost)
|
|
|
+ const totalDiscountAmount = this.formatNum(res.totalDiscountAmount)
|
|
|
let list = [
|
|
|
- ...res.list,
|
|
|
- {className:'物流打包费',income:0,expend:res.packFreight,profit:-res.packFreight,saleNum:0,cgNum:0},
|
|
|
- {className:'采购仅退款',income:res.onlyRefundCg,expend:0,profit:res.onlyRefundCg,saleNum:0,cgNum:0},
|
|
|
- {className:'销售仅退款',income:0,expend:res.onlyRefund,profit:-res.onlyRefund,saleNum:0,cgNum:0},
|
|
|
- {className:'附加人工费',income:res.totalLabourCost,expend:0,profit:res.totalLabourCost,saleNum:0,cgNum:0},
|
|
|
- {className:'优惠金额',income:-res.totalDiscountAmount,expend:0,profit:-res.totalDiscountAmount,saleNum:0,cgNum:0},
|
|
|
- {className:'【汇总金额】',income:res.totalIncome,expend:res.totalExpend,profit:res.totalProfit,saleNum:0,cgNum:0}
|
|
|
+ ...(res.list || []),
|
|
|
+ {className:'物流打包费',income:0,expend:packFreight,profit:-packFreight,saleNum:0,cgNum:0},
|
|
|
+ {className:'采购仅退款',income:onlyRefundCg,expend:0,profit:onlyRefundCg,saleNum:0,cgNum:0},
|
|
|
+ {className:'销售仅退款',income:0,expend:onlyRefund,profit:-onlyRefund,saleNum:0,cgNum:0},
|
|
|
+ {className:'附加人工费',income:totalLabourCost,expend:0,profit:totalLabourCost,saleNum:0,cgNum:0},
|
|
|
+ {className:'优惠金额',income:-totalDiscountAmount,expend:0,profit:-totalDiscountAmount,saleNum:0,cgNum:0},
|
|
|
+ {className:'【汇总金额】',income:this.formatNum(res.totalIncome),expend:this.formatNum(res.totalExpend),profit:this.formatNum(res.totalProfit),saleNum:0,cgNum:0}
|
|
|
]
|
|
|
return {
|
|
|
list: list
|
|
|
@@ -116,7 +164,7 @@ export default {
|
|
|
},
|
|
|
],
|
|
|
op: {
|
|
|
- visible: true,
|
|
|
+ visible: false,
|
|
|
props: {
|
|
|
width: 250,
|
|
|
align: 'center',
|
|
|
@@ -128,12 +176,11 @@ export default {
|
|
|
})
|
|
|
.set('layout', [
|
|
|
[ 'slot-date-select',
|
|
|
- 'slot-order-debt',
|
|
|
'slot-export-due',
|
|
|
'flex1'
|
|
|
],
|
|
|
[ 'data-table' ],
|
|
|
- ['flex1']
|
|
|
+ ['slot-class-tip','flex1']
|
|
|
])
|
|
|
.done();
|
|
|
app.refresh();
|
|
|
@@ -142,7 +189,7 @@ export default {
|
|
|
this.searchTime = 'custom'
|
|
|
this.startTime = this.currentDateList[0]
|
|
|
this.endTime = this.currentDateList[1]
|
|
|
- this.app.refresh({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime});
|
|
|
+ this.app.refresh(this.queryParams());
|
|
|
}
|
|
|
},
|
|
|
};
|
|
|
@@ -152,4 +199,13 @@ export default {
|
|
|
.shop-list {
|
|
|
height: 100%;
|
|
|
}
|
|
|
-</style>
|
|
|
+.class-tip {
|
|
|
+ display: block;
|
|
|
+ width: 100%;
|
|
|
+ margin-top: 10px;
|
|
|
+ padding: 0 4px;
|
|
|
+ font-size: 13px;
|
|
|
+ color: #1c89e0;
|
|
|
+ line-height: 1.6;
|
|
|
+}
|
|
|
+</style>
|