<template>
|
<div>
|
<TableList
|
:list="records"
|
:pageInfo="pageInfo"
|
:isAutoIndex="true"
|
:header="tableHeader"
|
title="短信发送记录"
|
:loading="loading"
|
@handleCurrentChange="handleCurrentChange"
|
@handleSizeChange="handleSizeChange"
|
></TableList>
|
|
<TableList
|
:list="records2"
|
:pageInfo="pageInfo2"
|
:header="tableHeader2"
|
title="外呼记录"
|
:isAutoIndex="true"
|
:loading="loading2"
|
@handleCurrentChange="handleCurrentChange2"
|
@handleSizeChange="handleSizeChange2"
|
></TableList>
|
</div>
|
</template>
|
<script>
|
// 贷后变更记录
|
import {
|
querySmsChannel,
|
querySmsInfoList,
|
selectCallSendLog,
|
} from "@comprehensive/serve/public";
|
import TableList from "../TableList";
|
import { smsHeader,SendLog } from "@comprehensive/utils/tableHeaders";
|
import * as dayjs from "dayjs";
|
|
export default {
|
props: {
|
// 申请编号
|
serialNo: {
|
type: String,
|
required: true,
|
},
|
objectType: {
|
type: String,
|
default: "",
|
},
|
customerID: {
|
type: String,
|
default: "",
|
},
|
|
},
|
components: {
|
TableList,
|
},
|
data() {
|
return {
|
records: [],
|
records2:[],
|
loading: false,
|
loading2: false,
|
smsChannel: [],
|
pageInfo: {
|
currentPage: 1,
|
pageSize: 10,
|
total: 0,
|
},
|
pageInfo2: {
|
currentPage: 1,
|
pageSize: 10,
|
total: 0,
|
},
|
tableHeader2:[...SendLog],
|
tableHeader: [...smsHeader],
|
tempRecord: {},
|
};
|
},
|
created() {
|
this.qrySmsChannel();
|
setTimeout(() => {
|
this.init();
|
}, 3000);
|
},
|
methods: {
|
init() {
|
this.pageInfo = {
|
currentPage: 1,
|
pageSize: 10,
|
total: 0,
|
};
|
|
this.queryLoanChangeList();
|
this.queryLoanChangeList2();
|
},
|
async qrySmsChannel() {
|
const res = await querySmsChannel({
|
menuId: 1450,
|
});
|
let { rows } = res;
|
let arr = {};
|
rows.map((item) => {
|
arr[item.channelCode] = item.channelName;
|
});
|
this.smsChannel = arr;
|
},
|
computedItem(item) {
|
// 表格部分字段特殊处理
|
let { createdAt, dealTime, status } = item;
|
const createdAtN = dayjs(createdAt).format("YYYY-MM-DD HH:mm:ss");
|
const dealTimeN = dayjs(dealTime).format("YYYY-MM-DD HH:mm:ss");
|
|
let seconds = dayjs(dealTime).diff(dayjs(createdAt), "seconds") || 0;
|
|
let returnTime = "";
|
if (60 <= seconds && seconds < 3600) {
|
//转为分钟
|
returnTime = Math.round(seconds / 60) + "分" + (seconds % 60) + "秒";
|
} else if (3600 <= seconds && seconds < 86400) {
|
//转为小时
|
returnTime =
|
Math.floor(seconds / 3600) +
|
"小时" +
|
Math.floor((seconds % 3600) / 60) +
|
"分" +
|
Math.floor(seconds % 60) +
|
"秒";
|
} else if (86400 <= seconds) {
|
//转为天
|
returnTime =
|
Math.floor(seconds / 86400) +
|
"天" +
|
Math.floor((seconds % 86400) / 3600) +
|
"小时" +
|
Math.floor((seconds % 3600) / 60) +
|
"分" +
|
Math.floor(seconds % 60) +
|
"秒";
|
} else {
|
returnTime = seconds + "秒";
|
}
|
|
const statusArr = { 1: "落地", 2: "处理中", 3: "成功", 4: "失败" };
|
const statusName = statusArr[status];
|
return {
|
...item,
|
createdAt: createdAtN,
|
dealTime: dealTimeN,
|
elapsedTime: returnTime,
|
statusName,
|
};
|
},
|
async queryLoanChangeList() {
|
const { serialNo, pageInfo } = this;
|
const phoneNo = this.$route.query.phone || sessionStorage.getItem('borrowerPhone')
|
if(!phoneNo){
|
return
|
}
|
this.loading = true;
|
const res = await querySmsInfoList({
|
currentPage: pageInfo.currentPage,
|
pageSize: pageInfo.pageSize || 10,
|
phoneNo: phoneNo,
|
pageNo: pageInfo.currentPage || 1,
|
menuId: 1450,
|
});
|
this.loading = false;
|
let { rows, total } = res;
|
rows = rows.map((item) => {
|
let arr = [];
|
const channerName = this.smsChannel[item.channelCode];
|
console.log("channerName", this.smsChannel);
|
item = { ...item, channerName, buttons: [...arr] };
|
return this.computedItem(item);
|
});
|
this.records = rows;
|
|
this.pageInfo.total = parseInt(total);
|
},
|
async queryLoanChangeList2() {
|
const phoneNo = this.$route.query.phone || sessionStorage.getItem('borrowerPhone')
|
if(!phoneNo){
|
return
|
}
|
this.loading2 = true;
|
const res = await selectCallSendLog({
|
...this.pageInfo2,
|
mobile:phoneNo
|
});
|
this.loading2 = false;
|
let { records, total } = res.result;
|
this.records2 = records;
|
this.pageInfo2.total = parseInt(total);
|
},
|
|
// 修改翻页条数
|
handleSizeChange(val) {
|
this.pageInfo.pageSize = val;
|
this.queryLoanChangeList();
|
},
|
|
// 修改翻页数
|
handleCurrentChange(val) {
|
this.pageInfo.currentPage = val;
|
this.queryLoanChangeList();
|
},
|
|
// 修改翻页条数
|
handleSizeChange2(val) {
|
this.pageInfo2.pageSize = val;
|
this.queryLoanChangeList2();
|
},
|
|
// 修改翻页数
|
handleCurrentChange2(val) {
|
this.pageInfo2.currentPage = val;
|
this.queryLoanChangeList2();
|
},
|
},
|
watch: {
|
serialNo() {
|
this.init();
|
},
|
},
|
};
|
</script>
|
|
<style lang="postcss" scoped>
|
.form-section {
|
display: flex;
|
align-items: baseline;
|
& .search {
|
margin: 10px 0 0 50px;
|
padding: 0;
|
}
|
}
|
</style>
|