123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- <template>
- <div class="jg-page-wrap">
- <a-card size="small" :bordered="false" class="table-page-search-wrapper">
- <!-- 搜索条件 -->
- <div ref="tableSearch">
- <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
- <a-row :gutter="15">
- <a-col :md="6" :sm="24">
- <a-form-item label="客户名称">
- <a-input id="crpnList-settleClientName" v-model.trim="queryParam.settleClientNameCurrent" allowClear placeholder="请输入客户名称"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="单位类型">
- <v-select
- v-model="queryParam.settleClientType"
- ref="settleClientType"
- id="crpnList-settleClientType"
- code="SETTLE_CLIENT_TYPE"
- placeholder="请选择单位类型"
- allowClear></v-select>
- </a-form-item>
- </a-col>
- <a-col :span="6">
- <a-form-item label="审核时间">
- <rangeDate
- id="crpnList-auditdate"
- allowClear
- :hasDisabledAreaTime="false"
- ref="rangeDate"
- :value="auditTime"
- @change="auditDateChange" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <span class="table-page-search-submitButtons">
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="crpnList-refresh">查询</a-button>
- <a-button style="margin-left: 8px" @click="resetSearchForm()" :disabled="disabled" id="crpnList-reset">重置</a-button>
- <a-button
- type="primary"
- v-if="$hasPermissions('B_collectionPaymentExoprt')"
- class="button-warning"
- @click="handleExport"
- :disabled="disabled"
- :loading="exportLoading"
- id="companyCollectionPaymentList-export">导出</a-button>
- </span>
- </a-col>
- </a-row>
- </a-form>
- </div>
- </a-card>
- <a-card size="small" :bordered="false" class="crpnList-wrap">
- <a-spin :spinning="spinning" tip="Loading...">
- <!-- 统计 -->
- <div class="table-operator">
- <div slot="message">
- 共 <strong>{{ total }}</strong> 条记录,
- 应收合计 <strong>{{ (productTotal&&(productTotal.receiveSettleAmountReceipt || productTotal.receiveSettleAmountReceipt==0)) ? toThousands(productTotal.receiveSettleAmountReceipt) : '--' }}</strong> ,
- 已收合计 <strong>{{ (productTotal&&(productTotal.settleAmountReceipt || productTotal.settleAmountReceipt==0)) ? toThousands(productTotal.settleAmountReceipt) : '--' }}</strong> ,
- 待收合计 <strong>{{ (productTotal&&(productTotal.unsettleAmountReceipt || productTotal.unsettleAmountReceipt==0)) ? toThousands(productTotal.unsettleAmountReceipt) : '--' }}</strong> ,
- 应付合计 <strong>{{ (productTotal&&(productTotal.receiveSettleAmountPay || productTotal.receiveSettleAmountPay==0)) ? toThousands(productTotal.receiveSettleAmountPay) : '--' }}</strong> ;
- 已付合计 <strong>{{ (productTotal&&(productTotal.settleAmountPay || productTotal.settleAmountPay==0)) ? toThousands(productTotal.settleAmountPay) : '--' }}</strong> ,
- 待付合计 <strong>{{ (productTotal&&(productTotal.unsettleAmountPay || productTotal.unsettleAmountPay==0)) ? toThousands(productTotal.unsettleAmountPay) : '--' }}</strong> ,
- 折让合计 <strong>{{ (productTotal&&(productTotal.discountAmount || productTotal.discountAmount==0)) ? toThousands(productTotal.discountAmount) : '--' }}</strong> ;
- 余额合计 <strong>{{ (productTotal&&(productTotal.balance || productTotal.balance==0)) ? toThousands(productTotal.balance) : '--' }}</strong> ;
- </div>
- </div>
- <!-- 列表 -->
- <s-table
- class="sTable fixPagination"
- ref="table"
- :style="{ height: tableHeight+84.5+'px' }"
- size="small"
- :rowKey="(record) => record.no"
- rowKeyName="no"
- :columns="columns"
- :data="loadData"
- :scroll="{ y: tableHeight }"
- :defaultLoadData="false"
- bordered>
- <!-- 客户名称 -->
- <template slot="customerName" slot-scope="text, record">
- <span v-if="record.settleClientType&&record.settleClientType=='CUSTOMER'">{{ record.settleClientNameCurrent||'--' }}</span>
- <span v-else>{{ record.settleClientName||'--' }}</span>
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button
- v-if="$hasPermissions('M_collectionPayment')"
- size="small"
- type="link"
- class="button-primary"
- @click="handleCollectionPayment(record)"
- :id="'crpnList-collectionPayment-pay-'+record.id">收付款</a-button>
- <a-button
- size="small"
- type="link"
- class="button-success"
- @click="handleDetail(record)"
- :id="'crpnList-collectionPayment-detail-'+record.id"
- v-if="$hasPermissions('M_companyReceivablePayable_detail')">详情</a-button>
- <span v-if="!$hasPermissions('M_collectionPayment') && !$hasPermissions('M_companyReceivablePayable_detail')">--</span>
- </template>
- </s-table>
- </a-spin>
- </a-card>
- </div>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { downloadExcel } from '@/libs/JGPrint.js'
- import { STable, VSelect } from '@/components'
- import getDate from '@/libs/getDate.js'
- import rangeDate from '@/views/common/rangeDate.vue'
- import { settleUnitClientList, settleInfoQuerySum, exportClientUnSettle } from '@/api/settle'
- export default {
- name: 'CollectionPaymentList',
- components: { STable, VSelect, rangeDate },
- mixins: [commonMixin],
- data () {
- const _this = this
- return {
- spinning: false,
- disabled: false, // 查询、重置按钮是否可操作
- tableHeight: 0, // 表格高度
- exportLoading: false,
- auditTime: [ // 创建时间
- getDate.getMonthDays(3).starttime,
- getDate.getMonthDays(3).endtime
- ],
- // 查询参数
- queryParam: {
- settleClientNameCurrent: '', // 客户名称
- settleClientType: undefined, // 单位类型
- beginDate: '', // 开始审核时间
- endDate: '' // 结束审核时间
- },
- // 表头
- columns: [
- { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
- { title: '客户名称', width: '15%', align: 'center', scopedSlots: { customRender: 'customerName' } },
- { title: '单位类型', dataIndex: 'settleClientTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '应收金额', dataIndex: 'receiveSettleAmountReceipt', width: '8%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '已收金额', dataIndex: 'settleAmountReceipt', width: '8%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '待收金额', dataIndex: 'unsettleAmountReceipt', width: '8%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '应付金额', dataIndex: 'receiveSettleAmountPay', width: '8%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '已付金额', dataIndex: 'settleAmountPay', width: '8%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '待付金额', dataIndex: 'unsettleAmountPay', width: '8%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '折让金额', dataIndex: 'discountAmount', width: '8%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '余额', dataIndex: 'balance', width: '8%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.spinning = true
- const sortFiled = {
- 'receiveSettleAmountReceipt': 'RECEIVE_SETTLE_AMOUNT_RECEIPT',
- 'settleAmountReceipt': 'SETTLE_AMOUNT_RECEIPT',
- 'unsettleAmountReceipt': 'UNSETTLE_AMOUNT_RECEIPT',
- 'receiveSettleAmountPay': 'RECEIVE_SETTLE_AMOUNT_PAY',
- 'settleAmountPay': 'SETTLE_AMOUNT_PAY',
- 'unsettleAmountPay': 'UNSETTLE_AMOUNT_PAY',
- 'discountAmount': 'DISCOUNT_AMOUNT',
- 'balance': 'BALANCE'
- }
- const sortOrder = { 'descend': 'desc', 'ascend': 'asc' }
- const params = Object.assign(parameter, this.queryParam, { sortField: sortFiled[parameter.sortField], sortOrder: sortOrder[parameter.sortOrder] })
- this.getTotal(params)
- return settleUnitClientList(params).then(res => {
- let data
- if (res.status == 200) {
- data = res.data
- const no = (data.pageNo - 1) * data.pageSize
- for (var i = 0; i < data.list.length; i++) {
- data.list[i].no = no + i + 1
- // 应付金额 值为负,应显示为正
- data.list[i].receiveSettleAmountPay = Math.abs(data.list[i].receiveSettleAmountPay) || 0
- }
- this.disabled = false
- this.total = data.count || 0
- }
- this.spinning = false
- return data
- })
- },
- total: 0, // 总条数
- productTotal: null // 金额统计
- }
- },
- methods: {
- // 选择审核时间
- auditDateChange (date) {
- this.auditTime = date
- this.queryParam.beginDate = date[0]
- this.queryParam.endDate = date[1]
- },
- // 导出
- handleExport () {
- const _this = this
- const params = this.queryParam
- this.exportLoading = true
- _this.spinning = true
- exportClientUnSettle(params).then(res => {
- this.exportLoading = false
- _this.spinning = false
- downloadExcel(res, '单位收付款客户')
- })
- },
- // 详情
- handleDetail (row) {
- const clientName = row.settleClientType == 'CUSTOMER' ? row.settleClientNameCurrent : row.settleClientName
- this.$router.push({ name: 'companyReceivablePayableNewDetail', params: { sn: row.settleClientSn, name: clientName, type: row.settleClientType } })
- },
- // 金额合计
- getTotal (param) {
- settleInfoQuerySum(param).then(res => {
- if (res.status == 200 && res.data) {
- this.productTotal = res.data
- } else {
- this.productTotal = null
- }
- })
- },
- // 去收付款
- handleCollectionPayment (row) {
- const clientName = row.settleClientType == 'CUSTOMER' ? row.settleClientNameCurrent : row.settleClientName
- this.$router.push({ name: 'companyReceivablePayableNewCollectionPayment', params: { sn: row.settleClientSn, name: clientName, type: row.settleClientType } })
- },
- // 重置
- resetSearchForm () {
- this.$refs.rangeDate.resetDate(this.auditTime)
- this.queryParam.beginDate = getDate.getMonthDays(3).starttime
- this.queryParam.endDate = getDate.getMonthDays(3).endtime
- this.queryParam.settleClientNameCurrent = ''
- this.queryParam.settleClientType = undefined
- this.$refs.table.refresh(true)
- },
- // 初始化
- pageInit () {
- const _this = this
- this.$nextTick(() => { // 页面渲染完成后的回调
- _this.setTableH()
- })
- },
- // 计算表格高度
- setTableH () {
- const tableSearchH = this.$refs.tableSearch.offsetHeight
- this.tableHeight = window.innerHeight - tableSearchH - 265
- }
- },
- watch: {
- '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
- this.setTableH()
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
- this.pageInit()
- this.resetSearchForm()
- }
- },
- activated () {
- // 如果是新页签打开,则重置当前页面
- if (this.$store.state.app.isNewTab) {
- this.pageInit()
- this.resetSearchForm()
- }
- // 仅刷新列表,不重置页面
- if (this.$store.state.app.updateList) {
- this.pageInit()
- this.$refs.table.refresh()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
- <style lang="less">
- .crpnList-wrap{
- .sTable{
- margin-top: 10px;
- }
- }
- </style>
|