<template>
|
<div>
|
<div class="search-form">
|
<EditForm ref="form"
|
formType="search"
|
:inline="true"
|
:list="formList"
|
:buttons="buttons"
|
:isShowAll="isShowAll"
|
:formValues="formValues"
|
:formRules="formRules"
|
@updateValue="updateValue"
|
@buttonAction="buttonAction"></EditForm>
|
</div>
|
|
<p class="export-excle">
|
<el-button size="small"
|
type="primary"
|
v-if="powerControl.paymentControl"
|
@click="otherAction(1)">批量付款</el-button>
|
<el-button size="small"
|
type="primary"
|
icon="el-icon-download"
|
@click="otherAction(2)">数据导出</el-button>
|
</p>
|
|
<div class="list-content">
|
<TableList :isAutoIndex="!powerControl.paymentControl"
|
:isMultipleSelect="powerControl.paymentControl"
|
:isPaddingRight="false"
|
:loading="loading"
|
:list="records"
|
:header="tableList"
|
:total="total"
|
:pageInfo="pageInfo"
|
@doAction="doAction"
|
@handleCurrentChange="handleCurrentChange"
|
@handleSizeChange="handleSizeChange"
|
@handleSelectionChange="handleSelectionChange"></TableList>
|
</div>
|
|
</div>
|
</template>
|
<script>
|
/**
|
* 查询返现园区应付费用列表
|
*/
|
|
import EditForm from './components/EditForm';
|
import TableList from './components/TableList';
|
|
import qryCommissionApplyAllList from '@comprehensive/model/qryCommissionApplyAllList';
|
import queryCommissionDeveloperAll from '@comprehensive/model/queryCommissionDeveloperAll';
|
import queryCommissionPorjectAll from '@comprehensive/model/queryCommissionPorjectAll';
|
|
import {
|
payCommissionFeeOrProfile,
|
exportCommissionSourceExcel,
|
} from '@comprehensive/serve/public';
|
export default {
|
name: 'LoanApply',
|
components: {
|
TableList,
|
EditForm,
|
},
|
data() {
|
return {
|
formList: [],
|
tableList: [],
|
formRules: {},
|
listModel: null,
|
query: {},
|
records: [],
|
selectionRow: [],
|
pageInfo: {
|
currentPage: 1,
|
pageSize: 10,
|
},
|
total: 0,
|
serialNo: '',
|
objectType: '',
|
customerID: '',
|
loading: false,
|
// 是否显示所有表单项
|
isShowAll: false,
|
buttons: [
|
{ text: '重置', type: '' },
|
{ text: '搜索' },
|
{ type: 'fold', text: '展开' },
|
],
|
uploadHeader: {
|
'Content-Type': 'multipart/form-data; boundary=ReaquestHeader',
|
},
|
// 按钮权限控制
|
powerControl:{
|
paymentControl: false, // 付款
|
}
|
};
|
},
|
created() {
|
this.setPowerControl();
|
this.init();
|
},
|
methods: {
|
setPowerControl() {
|
let {powerControl} = this
|
if (process.env.NODE_ENV !== 'development') {
|
powerControl.paymentControl = this.window.top._server_payCommissionFeeOrProfile
|
} else {
|
powerControl.paymentControl = true
|
}
|
this.powerControl = powerControl
|
},
|
// 页面初始化处理
|
init() {
|
const { query } = this.$route;
|
this.query = query;
|
const listModel = qryCommissionApplyAllList();
|
const formList = listModel.getFormList(query);
|
this.tableList = listModel.getTableList();
|
this.formRules = listModel.getFormRules();
|
this.formList = formList;
|
this.listModel = listModel;
|
|
this.fetch();
|
this.queryCommissionPorjectAll();
|
this.queryCommissionDeveloperAll();
|
},
|
// 表单事件回调
|
doAction(name, item, { id, label }) {
|
if (name === 'lastAction') {
|
if (id == 1) {
|
// 付款
|
this.payCommissionFeeOrProfile({
|
count: 1,
|
amount: item.amount,
|
serviceAmt: item.serviceAmt,
|
serialnos: [item.serialno]
|
})
|
}
|
}
|
},
|
// 更新表单数据
|
updateValue(index, info) {
|
const { formList } = this;
|
if (isNaN(index)) {
|
// index is name
|
index = formList.findIndex(({ name }) => name === index);
|
}
|
if (!isNaN(index) && index > -1) {
|
const preInfo = formList[index];
|
this.$set(formList, index, { ...preInfo, ...info });
|
}
|
},
|
// 表单按钮操作
|
buttonAction(index, button) {
|
let { listModel, isShowAll } = this;
|
if (index === 0) {
|
// 重置
|
// this.formList = listModel.getFormList()
|
this.init();
|
}
|
if (index === 1) {
|
// 搜索
|
this.pageInfo.currentPage = 1;
|
this.fetch();
|
}
|
if (index === 2) {
|
// 展开/收起
|
this.isShowAll = !isShowAll;
|
}
|
},
|
otherAction(type) {
|
let {selectionRow} = this;
|
if (type === 1) {
|
// 批量付款
|
if (selectionRow.length) {
|
let amount = 0;
|
let serviceAmt = 0;
|
let serialnos = [];
|
selectionRow.map(item => {
|
amount+=parseFloat((item.amount || 0));
|
serviceAmt+=parseFloat((item.serviceAmt || 0));
|
serialnos.push(item.serialno)
|
})
|
this.payCommissionFeeOrProfile({
|
count: selectionRow.length,
|
amount,
|
serviceAmt,
|
serialnos
|
});
|
} else {
|
this.$confirm(`请先勾选未付款的订单!`, '提示', {
|
showCancelButton: false,
|
showClose: false,
|
});
|
}
|
} else {
|
// 数据导出
|
this.exportCommissionSourceExcel();
|
}
|
},
|
// 获取当前列表数据
|
async fetch() {
|
try {
|
this.loading = true;
|
let { pageInfo, listModel, formValues, query, powerControl } = this;
|
const { customerPhone, from } = query;
|
const res = await listModel.request({ ...pageInfo, ...formValues });
|
this.loading = false;
|
const { list, total } = res;
|
this.records = list.reduce((pre, curr, index) => {
|
let arr = [];
|
if(powerControl.paymentControl) {
|
arr.push({ id: 1, label: '付款', disabled: curr.sourcePayStatus != 0});
|
} else {
|
arr.push({ id: 1, label: '', disabled: true});
|
}
|
|
pre.push({
|
...curr,
|
selectable: curr.sourcePayStatus == 0,
|
buttons: [...arr],
|
});
|
|
return pre;
|
}, []);
|
this.total = total;
|
} catch (error) {
|
this.loading = false;
|
}
|
},
|
// 修改翻页条数
|
handleSizeChange(val) {
|
this.pageInfo.pageSize = val;
|
this.fetch();
|
},
|
// 修改翻页数
|
handleCurrentChange(val) {
|
this.pageInfo.currentPage = val;
|
this.fetch();
|
},
|
handleSelectionChange(array = []) {
|
this.selectionRow = array;
|
console.log(this.selectionRow);
|
},
|
// 批量付款
|
async payCommissionFeeOrProfile(params = {}) {
|
this.$confirm(
|
`已勾选${params.count}单,交易总金额${params.amount}元,服务费${params.serviceAmt || 0}元,请确认!`,
|
'提示',
|
{
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
}
|
)
|
.then(async () => {
|
const res = await payCommissionFeeOrProfile({
|
serialnos: params.serialnos,
|
payType: '1', // 支付类别,1园区费用
|
});
|
if (res.code == '00') {
|
this.fetch();
|
}
|
})
|
.catch(() => {});
|
},
|
// 数据导出
|
async exportCommissionSourceExcel(params = []) {
|
const res = await exportCommissionSourceExcel({ ...this.formValues });
|
if (res.code == '00') {
|
this.$confirm(res.msg, '提示', {
|
showCancelButton: false,
|
showClose: false,
|
});
|
}
|
},
|
// 开发商下拉列表
|
async queryCommissionDeveloperAll() {
|
const res = await queryCommissionDeveloperAll().request({});
|
const { list } = res;
|
this.commissionDeveloperAll = list;
|
this.updateValue('developerId', { options: list });
|
},
|
// 项目下拉列表
|
async queryCommissionPorjectAll() {
|
const res = await queryCommissionPorjectAll().request({});
|
const { list } = res;
|
this.commissionPorjectAll = list;
|
this.updateValue('projectId', { options: list });
|
},
|
},
|
computed: {
|
// 表单值信息
|
formValues() {
|
const { listModel, formList } = this;
|
return listModel.getFormValues(formList);
|
},
|
},
|
// watch: {
|
// $route() {
|
// this.init()
|
// }
|
// }
|
};
|
</script>
|
<style lang="postcss" scoped>
|
.search-form {
|
padding-top: 16px;
|
}
|
.list-content {
|
font-size: 14px;
|
}
|
.export-excle {
|
margin: 0 0 20px 0;
|
}
|
.message {
|
font-size: 12px;
|
color: #666666;
|
padding: 10px 20px;
|
background-color: #fafafa;
|
}
|
.upload-demo {
|
display: inline-block;
|
margin-left: 10px;
|
}
|
</style>
|