123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496 |
- <template>
- <div class="financialCollectionAddwrap">
- <a-spin :spinning="spinning" tip="Loading...">
- <a-page-header :ghost="false" :backIcon="false" class="financialCollectionAddcont" >
- <!-- 自定义的二级文字标题 -->
- <template slot="subTitle">
- <a id="purchaseOrderEdit-back-btn" href="javascript:;" @click="handleBack(0)"><a-icon type="left" /> 返回列表</a>
- </template>
- </a-page-header>
- <a-collapse :activeKey="['1']" class="financialCollectionAddcont" v-if="detailData">
- <a-collapse-panel key="1" header="基础信息">
- <div slot="extra" style="padding: 0 20px; color: #00aaff;" @click.stop="handleEditBase" >
- <a-icon type="edit" /> 编辑基础信息
- </div>
- <a-descriptions :column="{ xs: 2, sm: 3, md: 3}">
- <a-descriptions-item label="创建时间">{{ detailData&&detailData.createDate || '--' }}</a-descriptions-item>
- <a-descriptions-item label="申请人">{{ detailData&&detailData.applyPersonName || '--' }}</a-descriptions-item>
- <a-descriptions-item label="审核时间">{{ detailData&&detailData.auditDate || '--' }}</a-descriptions-item>
- <a-descriptions-item span="2" label="收款事由">{{ detailData&&detailData.bookReason || '--' }}</a-descriptions-item>
- <a-descriptions-item label="状态">{{ detailData&&detailData.statusDictValue || '--' }}</a-descriptions-item>
- <a-descriptions-item label="付款方类型">{{ detailData&&detailData.payerTypeDictValue || '--' }}</a-descriptions-item>
- <a-descriptions-item label="付款方">{{ detailData&&detailData.payerName || '--' }}</a-descriptions-item>
- <a-descriptions-item label="备注" :span="3">{{ detailData&&detailData.remarks||'--' }}</a-descriptions-item>
- <a-descriptions-item label="附件" :span="3">
- <a target="_blank" style="color: #00aaff;text-decoration: underline;margin-right: 15px;" :href="item.filePath" v-for="item in detailData.attachmentList" :key="item.id">
- {{ item.fileName }}
- </a>
- </a-descriptions-item>
- </a-descriptions>
- </a-collapse-panel>
- </a-collapse>
- <!-- 财务明细 -->
- <a-card :bordered="false" size="small" class="financialCollectionAddcont" v-if="$route.params.sn">
- <div slot="title">
- <div style="display: flex;justify-content: space-between;align-items: center;">
- <div>财务明细</div>
- <div>
- <a-button size="small" class="button-error" type="primary" @click="handleEdit">新增收款明细</a-button>
- </div>
- </div>
- </div>
- <a-alert type="info" style="margin-bottom:10px" v-if="detailData">
- <div slot="message">
- 共 {{ total }} 条,
- 订单金额合计 {{ toThousands(detailData.orderTotalAmount ||0)}},
- 收款金额合计 {{ toThousands(detailData.receiptTotalAmount ||0)}},
- 使用授信合计 {{ toThousands(detailData.useTotalAmount||0) }},
- 授信还款合计 {{ toThousands(detailData.payTotalAmount||0) }},
- 余款抵扣合计 {{ toThousands(detailData.balanceTotalAmount||0) }}
- </div>
- </a-alert>
- <!-- 列表 -->
- <s-table
- class="sTable fixPagination"
- ref="table"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :defaultLoadData="false"
- :showPagination="false"
- bordered>
- <template slot="expandedRowRender" slot-scope="record">
- <div style="padding:10px;overflow: hidden;" v-if="record.detailItemUseList.length || record.detailItemPayList.length">
- <a-table
- style="width:45%;background:#fff;float:left;border-bottom: 1px solid #eee;"
- :bordered="false"
- :pagination="false"
- :columns="useCol"
- :data-source="record.detailItemUseList">
- </a-table>
- <a-table
- :bordered="false"
- style="width:45%;background:#fff;float:left;border-bottom: 1px solid #eee;margin-left:2%;"
- :pagination="false"
- :columns="payCol"
- :data-source="record.detailItemPayList">
- </a-table>
- </div>
- <div style="padding:10px;text-align:center;" v-else>暂无数据</div>
- </template>
- <!-- 付款账户(营业执照) -->
- <template slot="payerAccountInfo" slot-scope="record">
- {{ record.payerAccountInfo || '--' }}
- </template>
- <template slot="action" slot-scope="text,record">
- <a-button
- size="small"
- type="link"
- class="button-info"
- @click="handleEdit(record)"
- >编辑</a-button>
- <a-button
- size="small"
- type="link"
- class="button-error"
- @click="handleDel(record)"
- >删除</a-button>
- </template>
- </s-table>
- </a-card>
- <!-- 关联单据 -->
- <a-card :bordered="false" size="small" class="financialCollectionAddcont" v-if="$route.params.sn">
- <div slot="title">
- <div style="display: flex;justify-content: space-between;align-items: center;">
- <div>关联单据</div>
- <div>
- <a-button size="small" class="button-info" type="primary" @click="showGlSalseModal=true">选择销售单</a-button>
- <a-button size="small" class="button-info" type="primary" @click="showGlAllocaModal=true">选择调拨单</a-button>
- </div>
- </div>
- </div>
- <a-alert type="info" style="margin-bottom:10px" v-if="detailGlData">
- <div slot="message">
- 共 {{ detailGlData.total }} 条,
- 总售价:¥{{ detailGlData.totalAmount }}
- </div>
- </a-alert>
- <!-- 列表 -->
- <s-table
- class="sTable fixPagination"
- ref="gltable"
- size="small"
- :rowKey="(record) => record.id"
- :columns="glcolumns"
- :data="glloadData"
- :showPagination="false"
- bordered>
- <template slot="action" slot-scope="text,record">
- <a-button
- size="small"
- type="link"
- class="button-error"
- @click="handleGlDel(record)"
- >删除</a-button>
- </template>
- </s-table>
- </a-card>
- </a-spin>
- <div class="affix-cont">
- <a-button
- type="primary"
- class="button-primary"
- :disabled="spinning"
- id="financialCollectionAddsubmit-btn"
- size="large"
- @click="beforeSubmit"
- style="padding: 0 60px;">提交</a-button>
- </div>
- <!-- 基础信息 -->
- <baseModal
- ref="baseModal"
- @refashData="refashData"
- :show="openBaseModal"
- :bookSn="$route.params.sn"
- @cancel="openBaseModal=false"></baseModal>
- <!-- 明细弹框 -->
- <fcDetailModal
- ref="fcDetailModal"
- @refashData="fcDetailOk"
- :show="openFcDetailModal"
- :bookSn="$route.params.sn"
- :bookNo="detailData?detailData.bookNo:''"
- @cancel="openFcDetailModal=false"></fcDetailModal>
- <!-- 选择审核人员 -->
- <chooseDepartUserModal :openModal="openDepartUserModal" @close="openDepartUserModal=false" @submit="handleSubmit"></chooseDepartUserModal>
- <!-- 关联单据 -->
- <selectGlSalesModal
- ref="selGlSalesModal"
- modalTit="选择销售单"
- :loading="spinning"
- :dealerSn="detailData&&detailData.dealerSn"
- :chooseData="glList"
- :openModal="showGlSalseModal"
- @choose="addGlOrder"
- @cancel="showGlSalseModal=false"></selectGlSalesModal>
- <selectGlAllocatModal
- ref="selGlAllocatModal"
- modalTit="选择调拨单"
- :loading="spinning"
- :dealerSn="detailData&&detailData.dealerSn"
- :chooseData="glList"
- :openModal="showGlAllocaModal"
- @choose="addGlOrder"
- @cancel="showGlAllocaModal=false"></selectGlAllocatModal>
- </div>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { VSelect, STable } from '@/components'
- import baseModal from './baseModal.vue'
- import fcDetailModal from './fcDetailModal.vue'
- import selectGlSalesModal from './selectGlSalesModal'
- import selectGlAllocatModal from './selectGlAllocatModal'
- import chooseDepartUserModal from '../../expenseManagement/expenseReimbursement/chooseDepartUserModal.vue'
- import { financeBookFindBySn, financeBookDetailDelete, financeBookDetailQueryList, financeBookSubmit, querySettleReceiptFinanceBookList, deleteSettleReceiptFinanceBook, saveSettleReceiptFinanceBook } from '@/api/financeBook.js'
- export default {
- name: 'FinancialCollectionEdit',
- mixins: [commonMixin],
- components: { VSelect, STable, baseModal, fcDetailModal, chooseDepartUserModal, selectGlSalesModal, selectGlAllocatModal },
- data () {
- return {
- spinning: false,
- detailData: null,
- openBaseModal: false,
- openDepartUserModal: false,
- openFcDetailModal: false, // 财务明细弹框
- total: 0,
- loadData: parameter => {
- const params = Object.assign(parameter, { bookSn: this.$route.params.sn })
- this.disabled = true
- this.spinning = true
- return financeBookDetailQueryList(params).then(res => {
- let data
- if (res.status == 200) {
- data = res.data
- const no = 0
- for (var i = 0; i < data.length; i++) {
- data[i].no = no + i + 1
- // 计算使用授信和授信还款的合计
- data[i].useTotalAmount = this.getTotal(data[i].detailItemUseList)
- data[i].payTotalAmount = this.getTotal(data[i].detailItemPayList)
- }
- this.total = data.length
- this.disabled = false
- this.spinning = false
- }
- return data
- })
- },
- columns: [
- { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
- { title: '收款日期', dataIndex: 'receiptDate', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
- { title: '付款方类型', dataIndex: 'payerTypeDictValue', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
- { title: '付款方', dataIndex: 'payerName', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
- { title: '财务编码', dataIndex: 'dealerEntity.kdMidCustomerFnumber', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
- { title: '付款账户(营业执照)', scopedSlots: { customRender: 'payerAccountInfo' }, align: 'center', width: '7%' },
- { title: '订单金额', dataIndex: 'orderAmount', align: 'right', width: '5%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
- { title: '收款金额', dataIndex: 'receiptAmount', align: 'right', width: '5%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
- { title: '使用授信', dataIndex: 'useTotalAmount', align: 'right', width: '5%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
- { title: '授信还款', dataIndex: 'payTotalAmount', align: 'right', width: '5%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
- { title: '余款抵扣', dataIndex: 'balanceAmount', align: 'right', width: '5%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
- { title: '跨月打款', dataIndex: 'nextMonthAmount', align: 'right', width: '5%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
- { title: '户名', dataIndex: 'bankAccount', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
- { title: '汇入银行', dataIndex: 'bankName', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
- { title: '足额打款', dataIndex: 'fullPaymentFlagDictValue', align: 'center', width: '5%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
- { title: '说明', dataIndex: 'explainInfo', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
- ],
- useCol: [
- { title: '使用授信项目', dataIndex: 'itemName', width: '50%', align: 'center' },
- { title: '使用授信金额', dataIndex: 'itemAmount', width: '50%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') }
- ],
- payCol: [
- { title: '授信还款项目', dataIndex: 'itemName', width: '50%', align: 'center' },
- { title: '授信还款金额', dataIndex: 'itemAmount', width: '50%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') }
- ],
- // 关联单据
- detailGlData: {
- total: 0,
- totalAmount: 0
- },
- glList: [],
- showGlSalseModal: false,
- showGlAllocaModal: false,
- glloadData: parameter => {
- const params = Object.assign(parameter, { bookSn: this.$route.params.sn })
- return querySettleReceiptFinanceBookList(params).then(res => {
- console.log(res)
- let data
- let totalAmount = 0
- if (res.status == 200) {
- data = res.data
- this.glList = data
- for (var i = 0; i < data.length; i++) {
- data[i].no = i + 1
- const cons = data[i].bizType == 'DISPATCH' ? {
- createDate:data[i].dispatchBill.createDate,
- buyerName: data[i].dispatchBill.buyerName,
- receiverName: data[i].dispatchBill.receiverName,
- sendNo: data[i].dispatchBill.sendNo,
- totalCategory: data[i].dispatchBill.totalCategory,
- totalQty: data[i].dispatchBill.totalQty,
- totalAmount: data[i].dispatchBill.totalAmount,
- billStatusDictValue: data[i].dispatchBill.billStatusDictValue,
- financialStatusDictValue: data[i].dispatchBill.financialStatusDictValue,
- dispatchBillSn: data[i].dispatchBill.dispatchBillSn,
- salesBillSn: data[i].dispatchBill.salesBillSn
- } : {
- createDate:data[i].allocateBill.createDate,
- buyerName: data[i].allocateBill.targetName,
- receiverName: data[i].allocateBill.receiverName,
- sendNo: data[i].allocateBill.sendNo,
- totalCategory: data[i].allocateBill.totalCategory,
- totalQty: data[i].allocateBill.totalQty,
- totalAmount: data[i].allocateBill.totalPrice,
- billStatusDictValue: data[i].allocateBill.stateDictValue,
- allocateNo: data[i].allocateBill.allocateNo,
- allocateSn: data[i].allocateBill.allocateSn
- }
- data[i] = Object.assign(data[i], cons)
- totalAmount = totalAmount + Number(data[i].totalAmount)
- }
- this.detailGlData.total = data.length
- this.detailGlData.totalAmount = totalAmount
- }
- return data
- })
- },
- glcolumns: [
- { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
- { title: '单据类型', dataIndex: 'bizTypeDictValue', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
- { title: '单据创建时间', dataIndex: 'createDate', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
- { title: '单据号', dataIndex: 'bizNo', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
- { title: '客户名称', dataIndex: 'buyerName', align: 'center', width: '13%', customRender: function (text) { return text || '--' } },
- { title: '收货客户名称', dataIndex: 'receiverName', align: 'center', width: '13%', customRender: function (text) { return text || '--' } },
- { title: '发货编号', dataIndex: 'sendNo', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
- { title: '产品款数', dataIndex: 'totalCategory', align: 'center', width: '6%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
- { title: '产品数量', dataIndex: 'totalQty', align: 'center', width: '6%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
- { title: '总售价', dataIndex: 'totalAmount', align: 'center', width: '6%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
- { title: '业务状态', dataIndex: 'billStatusDictValue', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
- { title: '财务状态', dataIndex: 'financialStatusDictValue', align: 'center', width: '6%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
- ]
- }
- },
- methods: {
- // 新增关联单据
- addGlOrder (data) {
- this.spinning = true
- saveSettleReceiptFinanceBook({
- bookSn: this.detailData.bookSn,
- bookNo: this.detailData.bookNo,
- ...data
- }).then(res => {
- if (res.status == 200) {
- this.$refs.gltable.refresh()
- } else {
- if (data.bizType == 'DISPATCH') {
- this.$refs.selGlSalesModal.handleDel(data)
- } else {
- this.$refs.selGlAllocatModal.handleDel(data)
- }
- }
- this.spinning = false
- })
- },
- // 删除关联单据
- handleGlDel (row) {
- this.spinning = true
- deleteSettleReceiptFinanceBook({ id: row.id }).then(res => {
- if (res.status == 200) {
- this.$refs.gltable.refresh()
- this.$message.info(res.message)
- }
- this.spinning = false
- })
- },
- // ---------------
- getTotal (data) {
- let ret = 0
- data.map(item => {
- ret = ret + item.itemAmount
- })
- return ret.toFixed(2)
- },
- // 编辑基础信息
- handleEditBase (event) {
- this.openBaseModal = true
- this.$refs.baseModal.getDetail()
- },
- refashData () {
- this.getDetail(1)
- },
- // 财务单基础详情
- getDetail (type) {
- this.spinning = true
- this.disabled = true
- financeBookFindBySn({ bookSn: this.$route.params.sn }).then(res => {
- if (res.status == 200) {
- this.detailData = res.data
- if (!type) {
- // 刷新明细列表
- this.$refs.table.refresh()
- } else {
- this.spinning = false
- this.disabled = false
- }
- }
- })
- },
- // 新增明细成功
- fcDetailOk () {
- this.openFcDetailModal = false
- this.getDetail(false)
- },
- // 新增、编辑明细
- handleEdit (row) {
- this.openFcDetailModal = true
- if (row && row.bookDetailSn) {
- this.$refs.fcDetailModal.getDetail(row.bookDetailSn, this.detailData)
- } else {
- this.$refs.fcDetailModal.setDetail(this.detailData)
- }
- },
- // 删除明细
- handleDel (row) {
- const _this = this
- this.$confirm({
- title: '提示',
- content: '确认要删除吗?',
- centered: true,
- closable: true,
- onOk () {
- _this.spinning = true
- financeBookDetailDelete({ bookDetailSn: row.bookDetailSn }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.getDetail(false)
- _this.spinning = false
- } else {
- _this.spinning = false
- }
- })
- }
- })
- },
- beforeSubmit () {
- if (this.total) {
- this.openDepartUserModal = true
- } else {
- this.$message.info('请新增财务明细')
- }
- },
- // 提交信息
- handleSubmit (data) {
- this.spinning = true
- financeBookSubmit({ bookSn: this.$route.params.sn, ...data }).then(res => {
- if (res.status == '200') {
- this.$message.success(res.message)
- this.handleBack()
- }
- this.spinning = false
- })
- },
- // 返回
- handleBack (data) {
- this.$router.push({ name: 'financialCollectionList' })
- },
- pageInit () {
- if (this.$route.params.sn) { // 编辑页
- this.getDetail(false)
- }
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
- this.pageInit()
- }
- },
- activated () {
- // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
- if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
- this.pageInit()
- } else {
- // 刷新明细列表
- this.$refs.table.refresh()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
- <style lang="less">
- .financialCollectionAddwrap{
- position: relative;
- height: 100%;
- padding-bottom: 51px;
- box-sizing: border-box;
- >.ant-spin-nested-loading{
- overflow-y: scroll;
- height: 100%;
- }
- .financialCollectionAddcont{
- margin-bottom: 10px;
- }
- .affix{
- .ant-affix{
- z-index: 101;
- }
- }
- }
- </style>
|