123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287 |
- <template>
- <a-card size="small" :bordered="false" class="companyReceivablePayableList-wrap">
- <a-spin :spinning="spinning" tip="Loading...">
- <!-- 搜索条件 -->
- <div ref="tableSearch" class="table-page-search-wrapper">
- <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="companyReceivablePayableList-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="companyReceivablePayableList-settleClientType"
- code="SETTLE_CLIENT_TYPE"
- placeholder="请选择单位类型"
- allowClear></v-select>
- </a-form-item>
- </a-col>
- <a-col :span="6">
- <a-form-item label="审核时间">
- <rangeDate
- id="companyReceivablePayableList-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="companyReceivablePayableList-refresh">查询</a-button>
- <a-button style="margin-left: 8px" @click="resetSearchForm()" :disabled="disabled" id="companyReceivablePayableList-reset">重置</a-button>
- <a-button
- type="primary"
- v-if="$hasPermissions('B_collectionPaymentExoprt')"
- class="button-warning"
- @click="handleExport"
- :disabled="disabled"
- :loading="exportLoading"
- id="companyReceivablePayableList-export">导出</a-button>
- </span>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- alert -->
- <a-alert type="info" style="margin-bottom:10px">
- <div slot="message">
- 共 <strong>{{ total }}</strong> 条记录,
- 应收合计 <strong>{{ (productTotal&&(productTotal.unsettleAmountReceipt || productTotal.unsettleAmountReceipt==0)) ? toThousands(productTotal.unsettleAmountReceipt) : '--' }}</strong> ,
- 已收合计 <strong>{{ (productTotal&&(productTotal.settleAmountReceipt || productTotal.settleAmountReceipt==0)) ? toThousands(productTotal.settleAmountReceipt) : '--' }}</strong> ,
- 待收合计 <strong>{{ (productTotal&&(productTotal.waitSettleAmountReceipt || productTotal.waitSettleAmountReceipt==0)) ? toThousands(productTotal.waitSettleAmountReceipt) : '--' }}</strong> ,
- 应付合计 <strong>{{ (productTotal&&(productTotal.unsettleAmountPay || productTotal.unsettleAmountPay==0)) ? toThousands(productTotal.unsettleAmountPay) : '--' }}</strong> ;
- 已付合计 <strong>{{ (productTotal&&(productTotal.settleAmountPay || productTotal.settleAmountPay==0)) ? toThousands(productTotal.settleAmountPay) : '--' }}</strong> ,
- 待付合计 <strong>{{ (productTotal&&(productTotal.waitSettleAmountPay || productTotal.waitSettleAmountPay==0)) ? toThousands(productTotal.waitSettleAmountPay) : '--' }}</strong> ,
- 折让合计 <strong>{{ (productTotal&&(productTotal.discountAmount || productTotal.discountAmount==0)) ? toThousands(productTotal.discountAmount) : '--' }}</strong> ;
- </div>
- </a-alert>
- <!-- 列表 -->
- <s-table
- class="sTable fixPagination"
- ref="table"
- :style="{ height: tableHeight+84.5+'px' }"
- size="small"
- :rowKey="(record) => record.settleClientSn"
- rowKeyName="settleClientSn"
- :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="'companyReceivablePayableList-collectionPayment-'+record.id">收付款</a-button>
- <a-button
- v-if="$hasPermissions('M_companyReceivablePayable_detail')"
- size="small"
- type="link"
- class="button-success"
- @click="handleDetail(record)"
- :id="'companyReceivablePayableList-detail-'+record.id">详情</a-button>
- <span v-if="!$hasPermissions('M_collectionPayment') && !$hasPermissions('M_companyReceivablePayable_detail')">--</span>
- </template>
- </s-table>
- </a-spin>
- </a-card>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { STable, VSelect } from '@/components'
- import { downloadExcel } from '@/libs/JGPrint.js'
- 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,
- exportLoading: false,
- disabled: false, // 查询、重置按钮是否可操作
- tableHeight: 0,
- auditTime: [ // 创建时间
- getDate.getMonthDays(3).starttime,
- getDate.getMonthDays(3).endtime
- ],
- // 查询参数
- queryParam: {
- settleClientNameCurrent: '', // 客户名称
- settleClientType: undefined, // 单位类型
- auditBeginDate: '', // 开始审核时间
- auditEndDate: '' // 结束审核时间
- },
- // 表头
- columns: [
- { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
- { title: '客户名称', width: '15%', align: 'center', scopedSlots: { customRender: 'customerName' } },
- { title: '单位类型', dataIndex: 'settleClientTypeDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '应收金额', dataIndex: 'unsettleAmountReceipt', width: '9%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '已收金额', dataIndex: 'settleAmountReceipt', width: '9%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '待收金额', dataIndex: 'waitSettleAmountReceipt', width: '9%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '应付金额', dataIndex: 'unsettleAmountPay', width: '9%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '已付金额', dataIndex: 'settleAmountPay', width: '9%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '未付金额', dataIndex: 'waitSettleAmountPay', width: '9%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '折让金额', dataIndex: 'discountAmount', width: '9%', 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 = {
- 'unsettleAmountReceipt': 'UNSETTLE_AMOUNT_RECEIPT',
- 'settleAmountReceipt': 'SETTLE_AMOUNT_RECEIPT',
- 'waitSettleAmountReceipt': 'WAIT_SETTLE_AMOUNT_RECEIPT',
- 'unsettleAmountPay': 'UNSETTLE_AMOUNT_PAY',
- 'settleAmountPay': 'SETTLE_AMOUNT_PAY',
- 'waitSettleAmountPay': 'WAIT_SETTLE_AMOUNT_PAY',
- 'discountAmount': 'DISCOUNT_AMOUNT'
- }
- 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].unSettleAmountPay = Math.abs(data.list[i].unSettleAmountPay) || 0
- }
- this.disabled = false
- this.total = data.count || 0
- }
- this.spinning = false
- return data
- })
- },
- total: 0, // 总条数
- productTotal: null // 金额合计数据
- }
- },
- methods: {
- // 导出
- 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, '单位收付款客户')
- })
- },
- // 选择审核时间
- auditDateChange (date) {
- this.auditTime = date
- this.queryParam.auditBeginDate = date[0]
- this.queryParam.auditEndDate = date[1]
- },
- // 详情
- handleDetail (row) {
- if (row.settleClientType == 'CUSTOMER') {
- this.$router.push({ path: `/financialManagement/companyReceivablePayable/detail/${row.settleClientSn}/${row.settleClientNameCurrent}/${row.settleClientType}` })
- } else {
- this.$router.push({ path: `/financialManagement/companyReceivablePayable/detail/${row.settleClientSn}/${row.settleClientName}/${row.settleClientType}` })
- }
- },
- // 合计
- getTotal (param) {
- settleInfoQuerySum(param).then(res => {
- if (res.status == 200 && res.data) {
- this.productTotal = res.data
- } else {
- this.productTotal = null
- }
- })
- },
- // 收付款
- handleCollectionPayment (row) {
- if (row.settleClientType == 'CUSTOMER') {
- this.$router.push({ path: `/financialManagement/companyReceivablePayable/collectionPayment/${row.settleClientSn}/${row.settleClientNameCurrent}/${row.settleClientType}` })
- } else {
- this.$router.push({ path: `/financialManagement/companyReceivablePayable/collectionPayment/${row.settleClientSn}/${row.settleClientName}/${row.settleClientType}` })
- }
- },
- // 重置
- resetSearchForm () {
- this.queryParam.settleClientNameCurrent = ''
- this.queryParam.settleClientType = undefined
- this.$refs.rangeDate.resetDate(this.auditTime)
- this.queryParam.auditBeginDate = getDate.getMonthDays(3).starttime
- this.queryParam.auditEndDate = getDate.getMonthDays(3).endtime
- 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 - 236
- }
- },
- 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">
- .companyReceivablePayableList-wrap{
- .sTable{
- margin-top: 10px;
- }
- }
- </style>
|