list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <div class="jg-page-wrap">
  3. <a-card size="small" :bordered="false" class="table-page-search-wrapper">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch">
  6. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  7. <a-row :gutter="15">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="客户名称">
  10. <a-input id="crpnList-settleClientName" v-model.trim="queryParam.settleClientNameCurrent" allowClear placeholder="请输入客户名称"/>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="单位类型">
  15. <v-select
  16. v-model="queryParam.settleClientType"
  17. ref="settleClientType"
  18. id="crpnList-settleClientType"
  19. code="SETTLE_CLIENT_TYPE"
  20. placeholder="请选择单位类型"
  21. allowClear></v-select>
  22. </a-form-item>
  23. </a-col>
  24. <a-col :span="6">
  25. <a-form-item label="审核时间">
  26. <rangeDate
  27. id="crpnList-auditdate"
  28. allowClear
  29. :hasDisabledAreaTime="false"
  30. ref="rangeDate"
  31. :value="auditTime"
  32. @change="auditDateChange" />
  33. </a-form-item>
  34. </a-col>
  35. <a-col :md="6" :sm="24">
  36. <span class="table-page-search-submitButtons">
  37. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="crpnList-refresh">查询</a-button>
  38. <a-button style="margin-left: 8px" @click="resetSearchForm()" :disabled="disabled" id="crpnList-reset">重置</a-button>
  39. <a-button
  40. type="primary"
  41. v-if="$hasPermissions('B_collectionPaymentExoprt')"
  42. class="button-warning"
  43. @click="handleExport"
  44. :disabled="disabled"
  45. :loading="exportLoading"
  46. id="companyCollectionPaymentList-export">导出</a-button>
  47. </span>
  48. </a-col>
  49. </a-row>
  50. </a-form>
  51. </div>
  52. </a-card>
  53. <a-card size="small" :bordered="false" class="crpnList-wrap">
  54. <a-spin :spinning="spinning" tip="Loading...">
  55. <!-- 统计 -->
  56. <div class="table-operator">
  57. <div slot="message">
  58. 共 <strong>{{ total }}</strong> 条记录,
  59. 应收合计 <strong>{{ (productTotal&&(productTotal.unsettleAmountReceipt || productTotal.unsettleAmountReceipt==0)) ? toThousands(productTotal.unsettleAmountReceipt) : '--' }}</strong> ,
  60. 已收合计 <strong>{{ (productTotal&&(productTotal.settleAmountReceipt || productTotal.settleAmountReceipt==0)) ? toThousands(productTotal.settleAmountReceipt) : '--' }}</strong> ,
  61. 待收合计 <strong>{{ (productTotal&&(productTotal.waitSettleAmountReceipt || productTotal.waitSettleAmountReceipt==0)) ? toThousands(productTotal.waitSettleAmountReceipt) : '--' }}</strong> ,
  62. 应付合计 <strong>{{ (productTotal&&(productTotal.unsettleAmountPay || productTotal.unsettleAmountPay==0)) ? toThousands(productTotal.unsettleAmountPay) : '--' }}</strong> ;
  63. 已付合计 <strong>{{ (productTotal&&(productTotal.settleAmountPay || productTotal.settleAmountPay==0)) ? toThousands(productTotal.settleAmountPay) : '--' }}</strong> ,
  64. 待付合计 <strong>{{ (productTotal&&(productTotal.waitSettleAmountPay || productTotal.waitSettleAmountPay==0)) ? toThousands(productTotal.waitSettleAmountPay) : '--' }}</strong> ,
  65. 折让合计 <strong>{{ (productTotal&&(productTotal.discountAmount || productTotal.discountAmount==0)) ? toThousands(productTotal.discountAmount) : '--' }}</strong> ;
  66. </div>
  67. </div>
  68. <!-- 列表 -->
  69. <s-table
  70. class="sTable fixPagination"
  71. ref="table"
  72. :style="{ height: tableHeight+84.5+'px' }"
  73. size="small"
  74. :rowKey="(record) => record.no"
  75. rowKeyName="no"
  76. :columns="columns"
  77. :data="loadData"
  78. :scroll="{ y: tableHeight }"
  79. :defaultLoadData="false"
  80. bordered>
  81. <!-- 客户名称 -->
  82. <template slot="customerName" slot-scope="text, record">
  83. <span v-if="record.settleClientType&&record.settleClientType=='CUSTOMER'">{{ record.settleClientNameCurrent||'--' }}</span>
  84. <span v-else>{{ record.settleClientName||'--' }}</span>
  85. </template>
  86. <!-- 操作 -->
  87. <template slot="action" slot-scope="text, record">
  88. <a-button
  89. v-if="$hasPermissions('M_collectionPayment')"
  90. size="small"
  91. type="link"
  92. class="button-primary"
  93. @click="handleCollectionPayment(record)"
  94. :id="'crpnList-collectionPayment-pay-'+record.id">收付款</a-button>
  95. <a-button
  96. size="small"
  97. type="link"
  98. class="button-success"
  99. @click="handleDetail(record)"
  100. :id="'crpnList-collectionPayment-detail-'+record.id"
  101. v-if="$hasPermissions('M_companyReceivablePayable_detail')">详情</a-button>
  102. <span v-if="!$hasPermissions('M_collectionPayment') && !$hasPermissions('M_companyReceivablePayable_detail')">--</span>
  103. </template>
  104. </s-table>
  105. </a-spin>
  106. </a-card>
  107. </div>
  108. </template>
  109. <script>
  110. import { commonMixin } from '@/utils/mixin'
  111. import { downloadExcel } from '@/libs/JGPrint.js'
  112. import { STable, VSelect } from '@/components'
  113. import getDate from '@/libs/getDate.js'
  114. import rangeDate from '@/views/common/rangeDate.vue'
  115. import { settleUnitClientList, settleInfoQuerySum, exportClientUnSettle } from '@/api/settle'
  116. export default {
  117. name: 'CollectionPaymentList',
  118. components: { STable, VSelect, rangeDate },
  119. mixins: [commonMixin],
  120. data () {
  121. const _this = this
  122. return {
  123. spinning: false,
  124. disabled: false, // 查询、重置按钮是否可操作
  125. tableHeight: 0, // 表格高度
  126. exportLoading: false,
  127. auditTime: [ // 创建时间
  128. getDate.getMonthDays(3).starttime,
  129. getDate.getMonthDays(3).endtime
  130. ],
  131. // 查询参数
  132. queryParam: {
  133. settleClientNameCurrent: '', // 客户名称
  134. settleClientType: undefined, // 单位类型
  135. auditBeginDate: '', // 开始审核时间
  136. auditEndDate: '' // 结束审核时间
  137. },
  138. // 表头
  139. columns: [
  140. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  141. { title: '客户名称', width: '15%', align: 'center', scopedSlots: { customRender: 'customerName' } },
  142. { title: '单位类型', dataIndex: 'settleClientTypeDictValue', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
  143. { title: '应收金额', dataIndex: 'unsettleAmountReceipt', width: '9%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  144. { title: '已收金额', dataIndex: 'settleAmountReceipt', width: '9%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  145. { title: '待收金额', dataIndex: 'waitSettleAmountReceipt', width: '9%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  146. { title: '应付金额', dataIndex: 'unsettleAmountPay', width: '9%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  147. { title: '已付金额', dataIndex: 'settleAmountPay', width: '9%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  148. { title: '待付金额', dataIndex: 'waitSettleAmountPay', width: '9%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  149. { title: '折让金额', dataIndex: 'discountAmount', width: '9%', sorter: true, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  150. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  151. ],
  152. // 加载数据方法 必须为 Promise 对象
  153. loadData: parameter => {
  154. this.disabled = true
  155. this.spinning = true
  156. const sortFiled = {
  157. 'unsettleAmountReceipt': 'UNSETTLE_AMOUNT_RECEIPT',
  158. 'settleAmountReceipt': 'SETTLE_AMOUNT_RECEIPT',
  159. 'waitSettleAmountReceipt': 'WAIT_SETTLE_AMOUNT_RECEIPT',
  160. 'unsettleAmountPay': 'UNSETTLE_AMOUNT_PAY',
  161. 'settleAmountPay': 'SETTLE_AMOUNT_PAY',
  162. 'waitSettleAmountPay': 'WAIT_SETTLE_AMOUNT_PAY',
  163. 'discountAmount': 'DISCOUNT_AMOUNT'
  164. }
  165. const sortOrder = { 'descend': 'desc', 'ascend': 'asc' }
  166. const params = Object.assign(parameter, this.queryParam, { sortField: sortFiled[parameter.sortField], sortOrder: sortOrder[parameter.sortOrder] })
  167. this.getTotal(params)
  168. return settleUnitClientList(params).then(res => {
  169. let data
  170. if (res.status == 200) {
  171. data = res.data
  172. const no = (data.pageNo - 1) * data.pageSize
  173. for (var i = 0; i < data.list.length; i++) {
  174. data.list[i].no = no + i + 1
  175. // 应付金额 值为负,应显示为正
  176. data.list[i].unSettleAmountPay = Math.abs(data.list[i].unSettleAmountPay) || 0
  177. }
  178. this.disabled = false
  179. this.total = data.count || 0
  180. }
  181. this.spinning = false
  182. return data
  183. })
  184. },
  185. total: 0, // 总条数
  186. productTotal: null // 金额统计
  187. }
  188. },
  189. methods: {
  190. // 导出
  191. handleExport () {
  192. const _this = this
  193. const params = this.queryParam
  194. this.exportLoading = true
  195. _this.spinning = true
  196. exportClientUnSettle(params).then(res => {
  197. this.exportLoading = false
  198. _this.spinning = false
  199. downloadExcel(res, '单位收付款客户')
  200. })
  201. },
  202. // 详情
  203. handleDetail (row) {
  204. const clientName = row.settleClientType == 'CUSTOMER' ? row.settleClientNameCurrent : row.settleClientName
  205. this.$router.push({ name: 'companyReceivablePayableNewDetail', params: { sn: row.settleClientSn, name: clientName, type: row.settleClientType } })
  206. },
  207. // 金额合计
  208. getTotal (param) {
  209. settleInfoQuerySum(param).then(res => {
  210. if (res.status == 200 && res.data) {
  211. this.productTotal = res.data
  212. } else {
  213. this.productTotal = null
  214. }
  215. })
  216. },
  217. // 去收付款
  218. handleCollectionPayment (row) {
  219. const clientName = row.settleClientType == 'CUSTOMER' ? row.settleClientNameCurrent : row.settleClientName
  220. this.$router.push({ name: 'companyReceivablePayableNewCollectionPayment', params: { sn: row.settleClientSn, name: clientName, type: row.settleClientType } })
  221. },
  222. // 重置
  223. resetSearchForm () {
  224. this.$refs.rangeDate.resetDate(this.auditTime)
  225. this.queryParam.auditBeginDate = getDate.getMonthDays(3).starttime
  226. this.queryParam.auditEndDate = getDate.getMonthDays(3).endtime
  227. this.queryParam.settleClientNameCurrent = ''
  228. this.queryParam.settleClientType = undefined
  229. this.$refs.table.refresh(true)
  230. },
  231. // 初始化
  232. pageInit () {
  233. const _this = this
  234. this.$nextTick(() => { // 页面渲染完成后的回调
  235. _this.setTableH()
  236. })
  237. },
  238. // 计算表格高度
  239. setTableH () {
  240. const tableSearchH = this.$refs.tableSearch.offsetHeight
  241. this.tableHeight = window.innerHeight - tableSearchH - 265
  242. }
  243. },
  244. watch: {
  245. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  246. this.setTableH()
  247. }
  248. },
  249. mounted () {
  250. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  251. this.pageInit()
  252. this.resetSearchForm()
  253. }
  254. },
  255. activated () {
  256. // 如果是新页签打开,则重置当前页面
  257. if (this.$store.state.app.isNewTab) {
  258. this.pageInit()
  259. this.resetSearchForm()
  260. }
  261. // 仅刷新列表,不重置页面
  262. if (this.$store.state.app.updateList) {
  263. this.pageInit()
  264. this.$refs.table.refresh()
  265. }
  266. },
  267. beforeRouteEnter (to, from, next) {
  268. next(vm => {})
  269. }
  270. }
  271. </script>
  272. <style lang="less">
  273. .crpnList-wrap{
  274. .sTable{
  275. margin-top: 10px;
  276. }
  277. }
  278. </style>