emis-frontend/src/views/emis/emisSettleBill/BillPaybackSumQuery.vue
2025-01-05 12:50:57 +08:00

620 lines
21 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<XdPageContainer id="BillPaybackSumQuery1" >
<SearchForm slot="pageHeader" :model="queryParams" ref="queryForm" size="mini" :maxShow="20" label-width="68px" v-show="showSearch" @search="handleQuery" @reset="resetQuery">
<!-- 账单月份 开票状态 收款状态 账期内回款率 超期回款率 超期未回款率 销售联系人 -->
<el-form-item label="账单月份" prop="billMonth">
<el-date-picker size="mini" style="width:100%" v-model="queryParams.billMonth" type="month" placeholder="账单月份" value-format="yyyy-MM"></el-date-picker>
</el-form-item>
<el-form-item :label="$t('开票状态')" prop="openBillStatus">
<el-select clearable v-model="queryParams.openBillStatus" placeholder="开票状态" style="width:100%">
<el-option key="1" label="已开票" value="1"></el-option>
<el-option key="0" label="未开票" value="0"></el-option>
<el-option key="3" label="不开票" value="3"></el-option>
<el-option key="2" label="部分开票" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('收款状态')" prop="paymentStatus">
<el-select clearable v-model="queryParams.paymentStatus" placeholder="收款状态" style="width:100%">
<el-option key="0" label="未收款" value="0"></el-option>
<el-option key="1" label="已收款" value="1"></el-option>
<el-option key="2" label="部分收款" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('支付方式')" prop="settleType" label-width="100px">
<el-select clearable v-model="queryParams.settleType" placeholder="支付方式" style="width:100%">
<el-option key="1" label="现金" value="1"></el-option>
<el-option key="2" label="月结" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('账期内回款')" prop="zqnhkl" label-width="100px">
<el-select clearable v-model="queryParams.zqnhkl" placeholder="账期内回款" style="width:100%">
<el-option key="0" label="否" value="0"></el-option>
<el-option key="1" label="是" value="1"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('超期回款')" prop="cqhkl" label-width="100px">
<el-select clearable v-model="queryParams.cqhkl" placeholder="超期回款" style="width:100%">
<el-option key="0" label="否" value="0"></el-option>
<el-option key="1" label="是" value="1"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('销售联系人')" prop="salesmen" label-width="100px">
<SalemanPicker :placeholder="$t('销售联系人')" v-model="queryParams.salesmen" ></SalemanPicker>
</el-form-item>
</SearchForm>
<!-- slot-scope="slotProps"
:height="(slotProps.contentHeight-100)+'px'" -->
<div slot="pageContent">
<xd-table
height="calc(100vh - 20rem)"
ref="refTable"
v-loading="loading"
border
size="mini"
storageName="BillPaybackStatList_main_240702"
:data="emisStatList"
:showSearch.sync="showSearch"
:queryParams="queryParams"
:total="total"
@selection-change="handleSelectionChange"
@sort-change="handleSortChange"
@row-dblclick="onDblClick"
show-summary
:summary-method="getSummaries"
highlight-current-row
>
<div slot="toolbar">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
</el-col>
</el-row>
</div>
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="$t('销售联系人')" align="center" prop="salesmen" min-width="100" />
<el-table-column :label="$t('账期')" align="center" prop="billMonth" min-width="80" />
<el-table-column :label="$t('总应收(¥)')" align="center" prop="recPayMoney" min-width="120" :sortable="true"/>
<el-table-column :label="$t('总已收(¥)')" align="center" prop="totalRecdPayMoney" min-width="120" :sortable="true"/>
<el-table-column :label="$t('总未收(¥)')" align="center" prop="totalNoRecdPayMoney" min-width="120" :sortable="true"/>
<el-table-column :label="$t('总理赔(¥)')" align="center" prop="totalSatisfyMoney" min-width="120" :sortable="true"/>
<el-table-column :label="$t('总折让(¥)')" align="center" prop="totalAllowanceMoney" min-width="120" :sortable="true"/>
<el-table-column :label="$t('总抵扣(¥)')" align="center" prop="totalDeductionMoney" min-width="120" :sortable="true"/>
<el-table-column :label="$t('总其它(¥)')" align="center" prop="totalOtherMoney" min-width="120" :sortable="true"/>
<el-table-column :label="$t('账单数')" align="center" prop="totalBillCount" min-width="120" :sortable="true"/>
<el-table-column :label="$t('已收账单数')" align="center" prop="hasPayBillCount" min-width="120" :sortable="true"/>
<el-table-column :label="$t('部分收账单数')" align="center" prop="somePayBillCount" min-width="130" :sortable="true"/>
<el-table-column :label="$t('未收账单数')" align="center" prop="noPayBillCount" min-width="130" :sortable="true"/>
<el-table-column :label="$t('账期内已收(¥)')" align="center" prop="recdPayMoney" min-width="140" :sortable="true"/>
<el-table-column :label="$t('账期内未收(¥)')" align="center" prop="noRecdPayMoney" min-width="140" :sortable="true"/>
<el-table-column :label="$t('超期已收(¥)')" align="center" prop="expiredRecdPayMoney" min-width="130" :sortable="true"/>
<el-table-column :label="$t('超期未收(¥)')" align="center" prop="expiredNoRecdPayMoney" min-width="130" :sortable="true"/>
<el-table-column :label="$t('账期内回款率')" align="center" prop="billPayRate" min-width="130" >
<template slot-scope="scope">
<span>{{ ((scope.row.recdPayMoney / scope.row.recPayMoney) * 100).toFixed(2) + '%' }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('超期回款率')" align="center" prop="expireBillPayRate" min-width="120" >
<template slot-scope="scope">
<span>{{ ((scope.row.expiredRecdPayMoney / scope.row.recPayMoney) * 100).toFixed(2) + '%' }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('超期未回款率')" align="center" prop="expireBillNoPayRate" min-width="150" >
<template slot-scope="scope">
<span>{{ ((scope.row.expiredNoRecdPayMoney / scope.row.recPayMoney) * 100).toFixed(2) + '%' }}</span>
</template>
</el-table-column>
</xd-table>
</div>
</XdPageContainer>
</template>
<script>
import { queryBillPayStatInfoList } from "@/api/emis/emisSettleBill";
import SalemanPicker from '@/views/emis/EmisBaseTools/SalemanPicker.vue';
export default {
name: "BillPaybackSumQuery",
components: { SalemanPicker},
dicts: ['emis_scan_type'],
data() {
return {
// 调整表格的高度,不允许滚动
tableHeight: 200,
// 遮罩层
loading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 创建时间搜索
dateTimeRange:[],
// 总条数
total: 0,
recordTotal:0,
// 网点电子面单申请表格数据
emisStatList: [],
emisStatRecordList:[],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
activeName: 'first',
openForm: false,
titleForm: "",
titleEmisElectronicPagApply: "",
openEmisElectronicPagApply: false,
// 显示编辑框更多
moreInputVisible: false,
dataMap:new Map(),
// 弹出展示层
currentId:null,
id:null,
titleView:"",
openView: false,
// 备注时间范围
daterangeApplyDate: [],
// 备注时间范围
daterangeCreateTime: [],
// 备注时间范围
daterangeUpdateTime: [],
tempQueryParams:null,
// 查询参数
queryParams: {
pageNum:1,
pageSize:500,
settleBillNo: null,
settleType: null,
billMonth: null,
custNo: null,
openBillStatus: null,
paymentStatus: null,
chargeStatus: null,
payee: null,
salesmen: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
id: [
{ required: true, message: "id不能为空", trigger: "blur" }
],
}
};
},
created() {
},
methods: {
/** 查询统计信息 */
getList() {
this.loading = true;
this.tempQueryParams = {...this.queryParams};
queryBillPayStatInfoList(this.tempQueryParams).then(response => {
this.emisStatList = response.rows;
this.total = response.total;
this.loading = false;
});
},
handleQuery(){
this.getList();
},
/** 查询明细列表 */
onDblClick(row, column, event) {
// this.loading = true;
console.log("===>onDblClick====>",row);
this.$emit("onSelect", row);
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.selectionList=selection;
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
// 排序 查询字段是表格中字段名字 动态取值排序顺序
getProperty(obj, str) {
str = str.replace(/\[(\w+)\]/g, ".$1"); // 处理数组下标
let arr = str.split(".");
for (let i in arr) {
obj = obj[arr[i]] || "";
}
return obj;
},
sortFun: function (attr, rev) {
//第一个参数传入info里的prop表示排的是哪一列,第二个参数是升还是降排序
if (rev == undefined||rev==null) {
rev = 1;
} else {
rev = (rev) ? 1 : -1;
}
let that=this;
return function (a, b) {
a = that.getProperty(a,attr);
b = that.getProperty(b,attr);
if (a < b) {
return rev * -1;
}
if (a > b) {
return rev * 1;
}
return 0;
}
},
// 排序 查询字段是表格中字段名字 动态取值排序顺序
handleSortChange(column) {
this.emisStatList = this.emisStatList.sort(
this.sortFun(column.prop, column.order === 'ascending')
);
},
//指定列求和
getSummaries(param) {
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计';
return;
}
if (
column.property === 'recPayMoney'
) {
const values = data.map(item => Number(item.recPayMoney));
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] = sums[index].toFixed(2);
}
else if (
column.property === 'hasRecdPayMoney'
) {
const values = data.map(item => Number(item.hasRecdPayMoney));
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] = sums[index].toFixed(2);
}
else if (
column.property === 'hasPayBillCount'
) {
const values = data.map(item => Number(item.hasPayBillCount));
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] = sums[index].toFixed(0);
}
else if (
column.property === 'totalBillCount'
) {
const values = data.map(item => Number(item.totalBillCount));
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] = sums[index].toFixed(0);
}
else if(
column.property === 'somePayBillCount'
){
const values = data.map(item => Number(item.somePayBillCount));
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] = sums[index].toFixed(0);
}
else if(
column.property === 'noPayBillCount'
){
const values = data.map(item => Number(item.noPayBillCount));
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] = sums[index].toFixed(0);
}
else if(
column.property === 'recdPayMoney'
){
const values = data.map(item => Number(item.recdPayMoney));
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] = sums[index].toFixed(2);
}
else if(
column.property === 'noRecdPayMoney'
){
const values = data.map(item => Number(item.noRecdPayMoney));
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] = sums[index].toFixed(2);
}
else if(
column.property === 'expiredRecdPayMoney'
){
const values = data.map(item => Number(item.expiredRecdPayMoney));
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] = sums[index].toFixed(2);
}
else if(
column.property === 'expiredNoRecdPayMoney'
){
const values = data.map(item => Number(item.expiredNoRecdPayMoney));
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] = sums[index].toFixed(2);
}
else if(
column.property === 'totalRecdPayMoney'
){
const values = data.map(item => Number(item.totalRecdPayMoney));
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] = sums[index].toFixed(2);
}
else if(
column.property === 'totalNoRecdPayMoney'
){
const values = data.map(item => Number(item.totalNoRecdPayMoney));
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] = sums[index].toFixed(2);
}
});
console.log(sums);
return sums
},
/** 导出按钮操作 */
handleExport() {
const loadingInstance = this.$loading({
text: '正在导出...'
})
if(this.selectionList&&this.selectionList.length>0){
this.exportData(this.selectionList,loadingInstance);
}
else{
let qExportParam= {...this.queryParams};
qExportParam.pageNum=1;
qExportParam.pageSize=5000;
queryBillPayStatInfoList(qExportParam).then(response => {
if (response.code === 200) {
this.exportData(response.rows,loadingInstance);
}
});
}
},
exportData(selData,loadingInstance){
const curList =selData
import('@/vendor/Export2Excel').then(excel => {
const exportParam=this.$refs.refTable.getExportParam();
const tHeader = exportParam.header;
const filterVal = exportParam.filter;
const data = this.formatJson(filterVal, curList, selData)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '统计',
autoWidth: true
})
loadingInstance.close()
})
},
formatJson(filterVal, jsonData, resData) {
let index = 0
return jsonData.map(v => filterVal.map(j => {
if (j === 'index') {
return ++index
}
if (j === 'kjlx') {
return v['sendSiteName']+'--'+v['dispatchUnderlingSiteName'];
}
if (j === 'fjr') {
return v['sendName']+'--'+v['receiveName'];
}
if (j === 'sendMobile') {
return "";
}
if (j === 'paymentStatus') {
return this.selectDictLabel(this.dict.type.emis_payment_status,v[j]);
}
if (j === 'pickupMethod') {
return this.selectDictLabel(this.dict.type.emis_qujian_fangshi,v[j]);
}
if (j === 'customsEclaration') {
return this.selectDictLabel(this.dict.type.emis_declare_mode,v[j]);
}
if (j === 'customsClear') {
return this.selectDictLabel(this.dict.type.emis_customs_clear,v[j]);
}
if (j === 'packType') {
return this.selectDictLabels(this.dict.type.emis_tab_packing_type,v[j]);
}
if (j === 'dispatchMethod') {
if(v[j] == 1){
return '派送';
}else{
return '自提';
}
}
if (j === 'blMessage') {
if(v[j] == 1){
return '发送';
}else{
return '不发送';
}
}
if (j === 'blAcceptMessage') {
if(v[j] == 1){
return '发送';
}else{
return '不发送';
}
}
if (j === 'blSign') {
if(v[j] == 1){
return '已签收';
}else{
return '未签收';
}
}
if (j === 'paymentType') {
return this.selectDictLabel(this.dict.type.emis_payment_type,v[j]);
}
return v[j]
}))
},
}
};
</script>
<style scoped>
.el-divider{
margin-top: 0px;
background: 0 0;
border-top: 1px solid #E6EBF5;
}
.el-divider__text {
color: #0955ee;
cursor: pointer;
}
.ellipsis {
overflow: hidden;
text-overflow: ellipsis;
vertical-align: top;
white-space: nowrap;
}
</style>