list.vue 13 KB

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