0484c2359d
# Conflicts: # pnpm-lock.yaml # src/axios.js # src/views/settlement/formal-settlement.vue # src/views/vehicle/customer-archive.vue
538 lines
19 KiB
Vue
538 lines
19 KiB
Vue
<template>
|
|
<basic-container class="receipt-flow-page">
|
|
<section class="receipt-flow-page__search">
|
|
<el-form :model="query" label-position="right" label-width="88px" @submit.prevent>
|
|
<div class="receipt-flow-page__search-grid">
|
|
<el-form-item label="认领通知单">
|
|
<el-input v-model="query.receiptNoticeNo" clearable placeholder="请输入" />
|
|
</el-form-item>
|
|
<el-form-item label="对方户名">
|
|
<el-input v-model="query.counterpartyName" clearable placeholder="请输入" />
|
|
</el-form-item>
|
|
<el-form-item label="对方账号">
|
|
<el-input v-model="query.counterpartyAccount" clearable placeholder="请输入" />
|
|
</el-form-item>
|
|
<el-form-item label="推送状态">
|
|
<el-select v-model="query.pushStatus" clearable placeholder="请选择">
|
|
<el-option
|
|
v-for="item in pushStatusOptions"
|
|
:key="item.value"
|
|
:label="item.label"
|
|
:value="item.value"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="认领状态">
|
|
<el-select v-model="query.claimStatus" clearable placeholder="请选择">
|
|
<el-option
|
|
v-for="item in claimStatusOptions"
|
|
:key="item.value"
|
|
:label="item.label"
|
|
:value="item.value"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="交易时间">
|
|
<el-date-picker
|
|
v-model="query.transactionTimeRange"
|
|
type="datetimerange"
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
|
range-separator="~"
|
|
start-placeholder="开始时间"
|
|
end-placeholder="结束时间"
|
|
clearable
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item v-show="searchExpanded" label="对方开户行">
|
|
<el-input v-model="query.counterpartyBank" clearable placeholder="请输入" />
|
|
</el-form-item>
|
|
<el-form-item v-show="searchExpanded" label="摘要">
|
|
<el-input v-model="query.summary" clearable placeholder="请输入" />
|
|
</el-form-item>
|
|
<el-form-item v-show="searchExpanded" label="明细流水号">
|
|
<el-input v-model="query.detailSerialNo" clearable placeholder="请输入" />
|
|
</el-form-item>
|
|
<el-form-item v-show="searchExpanded" label="金蝶状态">
|
|
<el-select v-model="query.kingdeeBillStatus" clearable placeholder="请选择">
|
|
<el-option
|
|
v-for="item in kingdeeBillStatusOptions"
|
|
:key="item.value"
|
|
:label="item.label"
|
|
:value="item.value"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item v-show="searchExpanded" label="收款金额">
|
|
<div class="amount-range">
|
|
<el-input-number
|
|
v-model="query.receiptAmountStart"
|
|
:controls="false"
|
|
:min="0"
|
|
placeholder="最低金额"
|
|
/>
|
|
<span>~</span>
|
|
<el-input-number
|
|
v-model="query.receiptAmountEnd"
|
|
:controls="false"
|
|
:min="0"
|
|
placeholder="最高金额"
|
|
/>
|
|
</div>
|
|
</el-form-item>
|
|
<el-form-item v-show="searchExpanded" label="认领人">
|
|
<el-input v-model="query.claimerName" clearable placeholder="请输入" />
|
|
</el-form-item>
|
|
</div>
|
|
<div class="receipt-flow-page__search-actions">
|
|
<el-button type="primary" @click="handleSearch">查询</el-button>
|
|
<el-button @click="resetSearch">重置</el-button>
|
|
<el-tooltip :content="searchExpanded ? '折叠' : '展开'" placement="top">
|
|
<el-button text @click="searchExpanded = !searchExpanded">
|
|
<el-icon><component :is="searchExpanded ? ArrowUp : ArrowDown" /></el-icon>
|
|
</el-button>
|
|
</el-tooltip>
|
|
</div>
|
|
</el-form>
|
|
</section>
|
|
|
|
<section class="receipt-flow-page__table-panel">
|
|
<div class="receipt-flow-page__toolbar">
|
|
<el-button
|
|
v-if="hasPermission('receipt_flow_sync')"
|
|
type="primary"
|
|
:loading="syncing"
|
|
@click="handleSync"
|
|
>
|
|
手动同步流水
|
|
</el-button>
|
|
<el-button
|
|
v-if="hasPermission('receipt_flow_claim')"
|
|
type="primary"
|
|
:disabled="!selectedRows.length"
|
|
@click="openBatchClaim"
|
|
>
|
|
批量认领
|
|
</el-button>
|
|
</div>
|
|
<el-table
|
|
v-loading="loading"
|
|
:data="rows"
|
|
border
|
|
@selection-change="selectedRows = $event"
|
|
>
|
|
<el-table-column type="selection" width="52" align="center" />
|
|
<el-table-column type="index" label="序号" width="64" align="center" />
|
|
<el-table-column
|
|
v-for="column in columns"
|
|
:key="column.prop"
|
|
v-bind="column"
|
|
align="center"
|
|
show-overflow-tooltip
|
|
>
|
|
<template #default="{ row }">
|
|
<el-link v-if="column.link" type="primary" @click="openDetail(row)">
|
|
{{ displayValue(row[column.prop]) }}
|
|
</el-link>
|
|
<el-tag
|
|
v-else-if="column.status"
|
|
:type="statusType(row, column)"
|
|
class="status-text"
|
|
>
|
|
{{ displayValue(row[column.prop]) }}
|
|
</el-tag>
|
|
<span v-else-if="column.money">{{ formatMoney(row[column.prop]) }}</span>
|
|
<span v-else>{{ displayValue(row[column.prop]) }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="操作" width="170" fixed="right" align="center">
|
|
<template #default="{ row }">
|
|
<el-link
|
|
v-if="canClaim(row)"
|
|
type="primary"
|
|
:disabled="pushingId === row.id"
|
|
@click="openClaim(row)"
|
|
>认领</el-link
|
|
>
|
|
<el-link
|
|
v-if="canPush(row)"
|
|
type="warning"
|
|
:disabled="pushingId === row.id"
|
|
@click="handlePush(row)"
|
|
>推送金蝶</el-link
|
|
>
|
|
<span v-if="!canClaim(row) && !canPush(row)">-</span>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<div class="receipt-flow-page__pagination">
|
|
<el-pagination
|
|
v-model:current-page="page.current"
|
|
v-model:page-size="page.size"
|
|
:total="page.total"
|
|
:page-sizes="[10, 20, 50, 100]"
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
@current-change="loadTable"
|
|
@size-change="handleSizeChange"
|
|
/>
|
|
</div>
|
|
</section>
|
|
|
|
<el-dialog
|
|
v-model="detailDialog.visible"
|
|
title="收款流水详情"
|
|
width="960px"
|
|
append-to-body
|
|
destroy-on-close
|
|
>
|
|
<div v-loading="detailDialog.loading">
|
|
<el-descriptions :column="3" border>
|
|
<el-descriptions-item label="认领通知单">
|
|
{{ displayValue(detailDialog.data.receiptNoticeNo) }}
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="付款人">
|
|
{{ displayValue(detailDialog.data.payerName) }}
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="付款金额">
|
|
{{ formatMoney(detailDialog.data.receiptAmount) }}
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="交易时间">
|
|
{{ displayValue(detailDialog.data.transactionTime) }}
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="对方户名">
|
|
{{ displayValue(detailDialog.data.counterpartyName) }}
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="对方开户行">
|
|
{{ displayValue(detailDialog.data.counterpartyBank) }}
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="对方账号">
|
|
{{ displayValue(detailDialog.data.counterpartyAccount) }}
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="明细流水号">
|
|
{{ displayValue(detailDialog.data.detailSerialNo) }}
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="认领状态">
|
|
<el-tag :type="statusType(detailDialog.data, { prop: 'claimStatusName' })">
|
|
{{ displayValue(detailDialog.data.claimStatusName) }}
|
|
</el-tag>
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="已认领金额">
|
|
{{ formatMoney(detailDialog.data.claimedAmount) }}
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="剩余可认领金额">
|
|
{{ formatMoney(detailDialog.data.remainingAmount) }}
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="金蝶未认领金额">
|
|
{{ formatMoney(detailDialog.data.unclaimedAmount) }}
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="推送状态">
|
|
<el-tag :type="statusType(detailDialog.data, { prop: 'pushStatusName' })">
|
|
{{ displayValue(detailDialog.data.pushStatusName) }}
|
|
</el-tag>
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="金蝶收款单号">
|
|
{{ displayValue(detailDialog.data.kingdeeBillNo) }}
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="金蝶状态">
|
|
{{ displayValue(detailDialog.data.kingdeeBillStatusName) }}
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="推送失败原因">
|
|
{{ displayValue(detailDialog.data.pushFailReason) }}
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="摘要">
|
|
{{ displayValue(detailDialog.data.summary) }}
|
|
</el-descriptions-item>
|
|
</el-descriptions>
|
|
|
|
<div class="dialog-section-title receipt-flow-page__detail-title">认领记录</div>
|
|
<el-table :data="detailDialog.claimRecords" border empty-text="暂无认领记录">
|
|
<el-table-column type="index" label="序号" width="64" align="center" />
|
|
<el-table-column prop="createTime" label="认领时间" min-width="170" align="center" />
|
|
<el-table-column label="认领金额" min-width="130" align="right">
|
|
<template #default="{ row }">{{ formatMoney(row.operationAmount) }}</template>
|
|
</el-table-column>
|
|
<el-table-column prop="operatorName" label="认领人" min-width="120" align="center" />
|
|
<el-table-column label="状态变化" min-width="170" align="center">
|
|
<template #default="{ row }">
|
|
{{ row.actionType === 'push' ? row.actionName : claimStatusChange(row) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="content" label="认领说明" min-width="220" />
|
|
</el-table>
|
|
</div>
|
|
<template #footer>
|
|
<el-button @click="detailDialog.visible = false">关闭</el-button>
|
|
</template>
|
|
</el-dialog>
|
|
</basic-container>
|
|
</template>
|
|
|
|
<script>
|
|
import { ArrowDown, ArrowUp } from '@element-plus/icons-vue';
|
|
import { mapGetters } from 'vuex';
|
|
import * as api from '@/api/payment/receiptFlow';
|
|
import { receiptFlowTableColumns } from '@/option/payment/receiptFlow';
|
|
import { isAdministrator } from '@/utils/auth';
|
|
|
|
const emptyQuery = () => ({
|
|
receiptNoticeNo: '',
|
|
counterpartyName: '',
|
|
counterpartyBank: '',
|
|
counterpartyAccount: '',
|
|
summary: '',
|
|
detailSerialNo: '',
|
|
claimStatus: '',
|
|
pushStatus: '',
|
|
kingdeeBillStatus: '',
|
|
receiptAmountStart: undefined,
|
|
receiptAmountEnd: undefined,
|
|
claimerName: '',
|
|
transactionTimeRange: [],
|
|
});
|
|
|
|
export default {
|
|
name: 'ReceiptFlow',
|
|
data() {
|
|
return {
|
|
ArrowDown,
|
|
ArrowUp,
|
|
query: emptyQuery(),
|
|
claimStatusOptions: api.claimStatusOptions,
|
|
pushStatusOptions: api.pushStatusOptions,
|
|
kingdeeBillStatusOptions: api.kingdeeBillStatusOptions,
|
|
columns: receiptFlowTableColumns,
|
|
rows: [],
|
|
selectedRows: [],
|
|
loading: false,
|
|
syncing: false,
|
|
pushingId: null,
|
|
searchExpanded: false,
|
|
page: { current: 1, size: 10, total: 0 },
|
|
detailDialog: { visible: false, loading: false, data: {}, claimRecords: [] },
|
|
};
|
|
},
|
|
computed: {
|
|
...mapGetters(['permission', 'userInfo']),
|
|
isAdmin() {
|
|
return isAdministrator(this.userInfo);
|
|
},
|
|
},
|
|
mounted() {
|
|
this.loadTable();
|
|
},
|
|
methods: {
|
|
unwrapData(response) {
|
|
// 数字 0 是合法返回值(如回写/同步 0 条),须用 ?? 判空避免 0 被信封对象顶掉导致 Number() 得 NaN
|
|
const body = response?.data ?? response ?? {};
|
|
return body?.data ?? body;
|
|
},
|
|
async loadTable() {
|
|
this.loading = true;
|
|
try {
|
|
const range = this.query.transactionTimeRange || [];
|
|
const data = this.unwrapData(
|
|
await api.getList(this.page.current, this.page.size, {
|
|
...this.query,
|
|
transactionTimeRange: undefined,
|
|
transactionStartTime: range[0],
|
|
transactionEndTime: range[1],
|
|
})
|
|
);
|
|
this.rows = data.records || [];
|
|
this.selectedRows = [];
|
|
this.page.total = Number(data.total || 0);
|
|
} finally {
|
|
this.loading = false;
|
|
}
|
|
},
|
|
handleSearch() {
|
|
this.page.current = 1;
|
|
this.loadTable();
|
|
},
|
|
resetSearch() {
|
|
this.query = emptyQuery();
|
|
this.handleSearch();
|
|
},
|
|
handleSizeChange() {
|
|
this.page.current = 1;
|
|
this.loadTable();
|
|
},
|
|
async handleSync() {
|
|
this.syncing = true;
|
|
try {
|
|
const syncedCount = Number(this.unwrapData(await api.sync()) || 0);
|
|
this.$message.success(`流水同步完成,共同步${syncedCount}条认领公告`);
|
|
await this.loadTable();
|
|
} finally {
|
|
this.syncing = false;
|
|
}
|
|
},
|
|
async openDetail(row) {
|
|
this.detailDialog = {
|
|
visible: true,
|
|
loading: true,
|
|
data: { ...row },
|
|
claimRecords: [],
|
|
};
|
|
try {
|
|
const data = this.unwrapData(await api.getDetail(row.id));
|
|
this.detailDialog.data = data || {};
|
|
this.detailDialog.claimRecords = data?.claimRecords || [];
|
|
} finally {
|
|
this.detailDialog.loading = false;
|
|
}
|
|
},
|
|
openClaim(row) {
|
|
this.$router.push({
|
|
path: '/payment/receipt-flow/form',
|
|
query: { mode: 'add', id: row.id },
|
|
});
|
|
},
|
|
openBatchClaim() {
|
|
if (!this.selectedRows.length) {
|
|
this.$message.warning('请先勾选收款流水');
|
|
return;
|
|
}
|
|
const first = this.selectedRows[0];
|
|
const payerName = String(first.payerName || '').trim();
|
|
const counterpartyAccount = String(first.counterpartyAccount || '').trim();
|
|
const sameParty = this.selectedRows.every(
|
|
row =>
|
|
String(row.payerName || '').trim() === payerName &&
|
|
String(row.counterpartyAccount || '').trim() === counterpartyAccount
|
|
);
|
|
if (!sameParty) {
|
|
this.$message.warning('批量认领所选流水的付款人、对方账号必须一致');
|
|
return;
|
|
}
|
|
this.$router.push({
|
|
path: '/payment/receipt-flow/form',
|
|
query: {
|
|
mode: 'add',
|
|
batch: '1',
|
|
ids: this.selectedRows.map(row => row.id).join(','),
|
|
},
|
|
});
|
|
},
|
|
hasPermission(code) {
|
|
return this.isAdmin || this.validData(this.permission?.[code], false);
|
|
},
|
|
canClaim(row) {
|
|
return this.hasPermission('receipt_flow_claim') && Number(row.remainingAmount || 0) > 0;
|
|
},
|
|
canPush(row) {
|
|
return (
|
|
this.hasPermission('receipt_flow_push') &&
|
|
!!row.billId &&
|
|
row.claimStatus === 'claimed' &&
|
|
row.pushStatus !== 'pushed'
|
|
);
|
|
},
|
|
async handlePush(row) {
|
|
try {
|
|
await this.$confirm(
|
|
`确认将流水【${row.receiptNoticeNo || row.detailSerialNo || ''}】推送金蝶生成收款单?`,
|
|
'推送金蝶',
|
|
{ type: 'warning' }
|
|
);
|
|
} catch {
|
|
return;
|
|
}
|
|
this.pushingId = row.id;
|
|
try {
|
|
const data = this.unwrapData(await api.pushKingdee(row.id));
|
|
const billNo = data?.kingdeeBillNo;
|
|
this.$message.success(billNo ? `推送成功,金蝶收款单号:${billNo}` : '推送成功');
|
|
await this.loadTable();
|
|
} finally {
|
|
this.pushingId = null;
|
|
}
|
|
},
|
|
statusType(row, column) {
|
|
if (column?.prop === 'pushStatusName') {
|
|
return { pushed: 'success', failed: 'danger' }[row.pushStatus] || 'info';
|
|
}
|
|
return (
|
|
{ claimed: 'success', partial: 'warning', unclaimed: 'info' }[row.claimStatus] || ''
|
|
);
|
|
},
|
|
claimStatusChange(row) {
|
|
const label = status =>
|
|
({ claimed: '认领完成', partial: '部分认领', unclaimed: '未认领' }[status] || '-');
|
|
return `${label(row.fromStatus)} → ${label(row.toStatus)}`;
|
|
},
|
|
displayValue(value) {
|
|
return value === null || value === undefined || value === '' ? '-' : value;
|
|
},
|
|
formatMoney(value) {
|
|
return Number(value || 0).toFixed(2);
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.receipt-flow-page__search {
|
|
padding: 12px 12px 4px;
|
|
background: #fff;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
|
|
}
|
|
.receipt-flow-page__search-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
gap: 8px 24px;
|
|
}
|
|
.receipt-flow-page__search :deep(.el-form-item) {
|
|
margin-bottom: 8px;
|
|
}
|
|
.receipt-flow-page__search :deep(.el-input),
|
|
.receipt-flow-page__search :deep(.el-select),
|
|
.receipt-flow-page__search :deep(.el-date-editor),
|
|
.receipt-flow-page__search :deep(.el-input-number) {
|
|
width: 100%;
|
|
}
|
|
.receipt-flow-page__search .amount-range {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 4px;
|
|
width: 100%;
|
|
}
|
|
.receipt-flow-page__search-actions {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
gap: 8px;
|
|
margin-bottom: 8px;
|
|
}
|
|
.receipt-flow-page__table-panel {
|
|
margin-top: 8px;
|
|
}
|
|
.receipt-flow-page__toolbar {
|
|
display: flex;
|
|
justify-content: flex-start;
|
|
align-items: center;
|
|
gap: 8px;
|
|
padding: 12px 0;
|
|
}
|
|
.receipt-flow-page__pagination {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
padding: 16px 0;
|
|
}
|
|
.receipt-flow-page__detail-title {
|
|
margin: 20px 0 12px;
|
|
}
|
|
.receipt-flow-page :deep(.el-table) {
|
|
--el-table-border-color: #eff1f7;
|
|
}
|
|
.receipt-flow-page :deep(.el-table .cell .el-link + .el-link) {
|
|
margin-left: 12px;
|
|
}
|
|
.receipt-flow-page :deep(.el-table__row:nth-child(even) > td.el-table__cell) {
|
|
background: #fafafa;
|
|
}
|
|
@media (max-width: 1200px) {
|
|
.receipt-flow-page__search-grid {
|
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
}
|
|
}
|
|
</style>
|