<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.addControl"
|
@click="editDialog(1)">新增支付订单</el-button>
|
|
<el-button size="small"
|
type="primary"
|
v-if="powerControl.moveControl"
|
@click="editDialog(2)">流水调整</el-button>
|
|
<el-button size="small"
|
v-if="powerControl.exportControl"
|
@click="exportFile">导出</el-button>
|
</p>
|
|
<div class="list-content">
|
<TableList :isAutoIndex="true"
|
:isPaddingRight="false"
|
:loading="loading"
|
:list="records"
|
:header="tableList"
|
:total="total"
|
:pageInfo="pageInfo"
|
@doAction="doAction"
|
@handleCurrentChange="handleCurrentChange"
|
@handleSizeChange="handleSizeChange"></TableList>
|
</div>
|
|
<!-- 查看 -->
|
<HouseholdBagApplyPayRecords :serialno="rowSerialno"
|
:dialogVisible="dialogVisible"
|
:powerControl="powerControl"
|
@doAction="dialogDoAction" />
|
|
<!-- 新增流水 -->
|
<div v-if="addVisible">
|
<AddHouseholdBagPayRec :serialno="rowSerialno"
|
:dialogVisible="addVisible"
|
@doAction="value => editDialogDoAction(value, 1)" />
|
</div>
|
|
<!-- 调整流水 -->
|
<div v-if="moveVisible">
|
<MoveHouseholdBagPayRec :serialno="rowSerialno"
|
:dialogVisible="moveVisible"
|
@doAction="value => editDialogDoAction(value, 2)" />
|
</div>
|
|
|
</div>
|
</template>
|
<script>
|
/**
|
* 返现佣金-客户签约管理页面
|
*/
|
|
import EditForm from './components/EditForm';
|
import TableList from '@comprehensive/components/TableList';
|
import HouseholdBagApplyPayRecords from '@comprehensive/components/HouseholdBagApplyPayRecords';
|
import AddHouseholdBagPayRec from '@comprehensive/components/AddHouseholdBagPayRec';
|
import MoveHouseholdBagPayRec from '@comprehensive/components/MoveHouseholdBagPayRec';
|
import { refundHouseholdBagApply, qryHouseholdBagApplyImages, cancelHouseholdBagApply, queryFileHouseholdBag, refundHouseholdBagCal } from '@/api/comprehensiveTransaction';
|
import qryHouseholdBagApplyList from '@comprehensive/model/qryHouseholdBagApplyList';
|
import getApplyListAll from '@comprehensive/model/getApplyListAll';
|
import {
|
getProvinceCodeList,
|
getCityCodeList,
|
getAreaCodeList,
|
exportHouseholdBagApplyList
|
} from '@comprehensive/serve/public';
|
import { alert } from '@comprehensive/utils/comm';
|
|
export default {
|
name: 'LoanApply',
|
components: {
|
TableList,
|
EditForm,
|
HouseholdBagApplyPayRecords,
|
AddHouseholdBagPayRec,
|
MoveHouseholdBagPayRec
|
},
|
data() {
|
return {
|
title: '新增',
|
form: {},
|
dialogVisible: false,
|
addVisible: false,
|
moveVisible: false,
|
// 是否显示详情页
|
isShowList: true,
|
formList: [],
|
tableList: [],
|
formRules: {},
|
listModel: null,
|
query: {},
|
records: [],
|
pageInfo: {
|
currentPage: 1,
|
pageSize: 10,
|
},
|
total: 0,
|
serialNo: '',
|
objectType: '',
|
customerID: '',
|
loading: false,
|
uploading: false,
|
// 是否显示所有表单项
|
isShowAll: false,
|
buttons: [
|
{ text: '重置', type: '' },
|
{ text: '搜索' },
|
{ type: 'fold', text: '展开' },
|
],
|
uploadHeader: {
|
'Content-Type': 'multipart/form-data; boundary=ReaquestHeader',
|
},
|
rowSerialno: null,
|
newWindow: null,
|
// 按钮权限控制
|
powerControl:{
|
addControl: false, // 新增
|
payRecordsViewControl: false, // 查看流水
|
cancelApplyFlowControl: false, // 查看流水-取消
|
refundApplyControl: false, // 退款
|
cancelApplyControl: false, // 取消申请
|
exportControl: false, // 导出
|
moveControl: false // 调整
|
}
|
};
|
},
|
created() {
|
this.setPowerControl();
|
this.init();
|
this.getOptions()
|
},
|
methods: {
|
setPowerControl() {
|
let {powerControl} = this
|
if (process.env.NODE_ENV !== 'development') {
|
powerControl.addControl = this.window.top._server_addHouseholdBagPayRe
|
powerControl.payRecordsViewControl = this.window.top._server_qryHouseholdBagApplyPayRecords
|
powerControl.cancelApplyFlowControl = this.window.top._server_cancelHouseholdBagApplyPos
|
powerControl.refundApplyControl = this.window.top._server_refundHouseholdBagApply
|
powerControl.cancelApplyControl = this.window.top._server_cancelHouseholdBagApply
|
powerControl.exportControl = this.window.top._server_exportHouseholdBagApplyList
|
powerControl.moveControl = this.window.top._server_moveHouseholdBagPayRec
|
} else {
|
powerControl.addControl = true
|
powerControl.payRecordsViewControl = true
|
powerControl.cancelApplyFlowControl = true
|
powerControl.refundApplyControl = true
|
powerControl.cancelApplyControl = true
|
powerControl.exportControl = true
|
powerControl.moveControl = true
|
}
|
this.powerControl = powerControl
|
},
|
// 页面初始化处理
|
init() {
|
const { query } = this.$route;
|
this.query = query;
|
const listModel = qryHouseholdBagApplyList();
|
const formList = listModel.getFormList(query);
|
this.tableList = listModel.getTableList();
|
this.formRules = listModel.getFormRules();
|
this.formList = formList;
|
this.listModel = listModel;
|
|
this.fetch();
|
this.getApplyListAll();
|
},
|
editDialog(key) {
|
switch (key) {
|
case 1:
|
this.addVisible = true;
|
break;
|
case 2:
|
this.moveVisible = true;
|
break;
|
default:
|
break;
|
}
|
},
|
async exportFile() {
|
const { pageInfo, formValues } = this
|
const res = await exportHouseholdBagApplyList({ ...pageInfo, ...formValues })
|
if(res.code == '00'){
|
alert('提交成功',res.msg,() => {})
|
}
|
},
|
// 表单事件回调
|
doAction(name, item, { id, label }) {
|
if (name === 'action') {
|
// 取消申请
|
if(id == 0) {
|
this.cancelApply(item)
|
}
|
if (id == 1) {
|
// 查看流水
|
this.rowSerialno = item.serialno;
|
this.dialogVisible = true;
|
}
|
if (id == 2) {
|
// 退款
|
this.refundApply(item);
|
}
|
if (id == 3) {
|
// 查看合同
|
this.qryHBImages(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 });
|
if (info.name === 'projectProvince') {
|
this.getArea('projectCity', info.value);
|
}
|
}
|
},
|
// 表单按钮操作
|
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;
|
}
|
},
|
dialogDoAction(type) {
|
if (type == 'close') {
|
this.rowSerialno = '';
|
this.dialogVisible = false;
|
}
|
},
|
editDialogDoAction(status, key) {
|
this.addVisible = false;
|
this.moveVisible = false;
|
if(status == 'succ') {
|
this.fetch();
|
}
|
},
|
// 查询项目管理列表
|
async getApplyListAll() {
|
const res = await getApplyListAll().request({});
|
const { list } = res;
|
this.updateValue('projectSerialno', { options: list });
|
},
|
// 退款
|
async refundApply(item) {
|
const res = await refundHouseholdBagCal({serialno: item.serialno})
|
if(res.code === '00') {
|
this.$confirm(`退款信息:客户${item.customername},退款${res.result.refundAmt}元,请确认是否退款`, '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning',
|
})
|
.then(() => {
|
refundHouseholdBagApply({serialno: item.serialno}).then((res) => {
|
if (res.code == '00') {
|
this.$message({
|
type: 'success',
|
message: '退款成功!',
|
});
|
}
|
this.fetch()
|
});
|
})
|
.catch(() => {
|
});
|
}
|
},
|
// 取消申请
|
cancelApply(item) {
|
this.$confirm(`将取消客户${item.customername}申请请求,请确认`, '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning',
|
})
|
.then(() => {
|
cancelHouseholdBagApply({serialno: item.serialno}).then((res) => {
|
if (res.code == '00') {
|
this.$message({
|
type: 'success',
|
message: '取消成功!',
|
});
|
}
|
this.fetch()
|
});
|
})
|
.catch(() => {
|
});
|
},
|
// 查看合同
|
qryHBImages(serialno) {
|
qryHouseholdBagApplyImages({serialno: serialno}).then((res) => {
|
if (res.code == '00') {
|
const data = res.result.find(item => {
|
return item.typeno === 'A001T004'
|
})
|
if(!data) {
|
this.$message({
|
message: '暂无可查看合同!',
|
});
|
} else {
|
this.newWindow = window.open(
|
`${process.env.VUE_APP_API_HOST}server/queryFile/${data.serialno}`,
|
'newwindow',
|
'height=700px, width=800px, top=100px,left=400px, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no'
|
)
|
}
|
}
|
});
|
},
|
// 获取当前列表数据
|
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) => {
|
let arr = [];
|
powerControl.cancelApplyControl && arr.push({ id: 0, label: '取消申请', disabled: curr.status != 0 && curr.status != 4 });
|
powerControl.payRecordsViewControl && arr.push({ id: 1, label: '查看流水', disabled: false });
|
arr.push({ id: 3, label: '查看合同', disabled: false });
|
powerControl.refundApplyControl && arr.push({ id: 2, label: '退款', disabled: curr.status < 1 || curr.status > 3 });
|
pre.push({
|
...curr,
|
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();
|
},
|
// 更新表单数据
|
updateValue1(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 });
|
}
|
},
|
getOptions() {
|
const { projectProvince = '', projectCity = '', regions = '' } = this.formValues;
|
console.log('formValues:', this.formValues);
|
|
this.getArea('projectProvince', '', projectProvince === '');
|
if (projectProvince !== '') {
|
this.getArea('projectCity', projectProvince, projectCity === '');
|
}
|
if (projectProvince !== '' && projectCity !== '') {
|
this.getArea('regions', projectCity, regions === '');
|
}
|
},
|
|
updateOptions(name, list, labelKey, valueKey, isResetValue = true) {
|
const valueObj = isResetValue ? { value: '' } : {};
|
this.updateValue(name, {
|
options: list.map((item) => ({
|
label: item[labelKey],
|
value: item[valueKey],
|
})),
|
...valueObj,
|
});
|
},
|
|
async getArea(name, itmeNo, isResetValue = true) {
|
if (name === 'projectProvince') {
|
const { result } = await getProvinceCodeList();
|
this.updateOptions(name, result, 'itemname', 'itemno', isResetValue);
|
}
|
|
if (name === 'projectCity') {
|
const { result } = await getCityCodeList({
|
codeNo: 'AreaCode',
|
itmeNo,
|
});
|
this.updateOptions(name, result, 'itemname', 'itemno', isResetValue);
|
}
|
|
if (name === 'regions') {
|
const { result } = await getAreaCodeList({
|
codeNo: 'AreaCode',
|
itmeNo,
|
});
|
this.updateOptions(name, result, 'itemname', 'itemno', isResetValue);
|
}
|
},
|
},
|
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>
|