list.vue 13 KB

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