list.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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.receipt || productTotal.receipt==0)) ? toThousands(productTotal.receipt) : '--' }}</strong> ,
  60. 已收合计 <strong>{{ (productTotal&&(productTotal.receipt || productTotal.receipt==0)) ? toThousands(productTotal.receipt) : '--' }}</strong> ,
  61. 待收合计 <strong>{{ (productTotal&&(productTotal.receipt || productTotal.receipt==0)) ? toThousands(productTotal.receipt) : '--' }}</strong> ,
  62. 应付合计 <strong>{{ (productTotal&&(productTotal.pay || productTotal.pay==0)) ? toThousands(productTotal.pay) : '--' }}</strong> ;
  63. 已付合计 <strong>{{ (productTotal&&(productTotal.receipt || productTotal.receipt==0)) ? toThousands(productTotal.receipt) : '--' }}</strong> ,
  64. 待付合计 <strong>{{ (productTotal&&(productTotal.receipt || productTotal.receipt==0)) ? toThousands(productTotal.receipt) : '--' }}</strong> ,
  65. 折让合计 <strong>{{ (productTotal&&(productTotal.receipt || productTotal.receipt==0)) ? toThousands(productTotal.receipt) : '--' }}</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%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  144. { title: '已收金额', dataIndex: 'unSettleAmountReceipt', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  145. { title: '待收金额', dataIndex: 'unSettleAmountReceipt', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  146. { title: '应付金额', dataIndex: 'unSettleAmountPay', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  147. { title: '已付金额', dataIndex: 'unSettleAmountReceipt', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  148. { title: '未付金额', dataIndex: 'unSettleAmountReceipt', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  149. { title: '折让金额', dataIndex: 'unSettleAmountReceipt', width: '9%', 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 params = Object.assign(parameter, this.queryParam)
  157. this.getTotal(params)
  158. return settleUnitClientList(params).then(res => {
  159. let data
  160. if (res.status == 200) {
  161. data = res.data
  162. const no = (data.pageNo - 1) * data.pageSize
  163. for (var i = 0; i < data.list.length; i++) {
  164. data.list[i].no = no + i + 1
  165. // 应付金额 值为负,应显示为正
  166. data.list[i].unSettleAmountPay = Math.abs(data.list[i].unSettleAmountPay) || 0
  167. }
  168. this.disabled = false
  169. this.total = data.count || 0
  170. }
  171. this.spinning = false
  172. return data
  173. })
  174. },
  175. total: 0, // 总条数
  176. productTotal: null // 金额统计
  177. }
  178. },
  179. methods: {
  180. // 导出
  181. handleExport () {
  182. const _this = this
  183. const params = this.queryParam
  184. this.exportLoading = true
  185. _this.spinning = true
  186. exportClientUnSettle(params).then(res => {
  187. this.exportLoading = false
  188. _this.spinning = false
  189. downloadExcel(res, '单位收付款客户')
  190. })
  191. },
  192. // 详情
  193. handleDetail (row) {
  194. const clientName = row.settleClientType == 'CUSTOMER' ? row.settleClientNameCurrent : row.settleClientName
  195. this.$router.push({ name: 'companyReceivablePayableNewDetail', params: { sn: row.settleClientSn, name: clientName, type: row.settleClientType } })
  196. },
  197. // 金额合计
  198. getTotal (param) {
  199. settleInfoQuerySum(param).then(res => {
  200. if (res.status == 200 && res.data) {
  201. this.productTotal = res.data
  202. } else {
  203. this.productTotal = null
  204. }
  205. })
  206. },
  207. // 去收付款
  208. handleCollectionPayment (row) {
  209. const clientName = row.settleClientType == 'CUSTOMER' ? row.settleClientNameCurrent : row.settleClientName
  210. this.$router.push({ name: 'companyReceivablePayableNewCollectionPayment', params: { sn: row.settleClientSn, name: clientName, type: row.settleClientType } })
  211. },
  212. // 重置
  213. resetSearchForm () {
  214. this.$refs.rangeDate.resetDate(this.auditTime)
  215. this.queryParam.auditBeginDate = getDate.getMonthDays(3).starttime
  216. this.queryParam.auditEndDate = getDate.getMonthDays(3).endtime
  217. this.queryParam.settleClientNameCurrent = ''
  218. this.queryParam.settleClientType = undefined
  219. this.$refs.table.refresh(true)
  220. },
  221. // 初始化
  222. pageInit () {
  223. const _this = this
  224. this.$nextTick(() => { // 页面渲染完成后的回调
  225. _this.setTableH()
  226. })
  227. },
  228. // 计算表格高度
  229. setTableH () {
  230. const tableSearchH = this.$refs.tableSearch.offsetHeight
  231. this.tableHeight = window.innerHeight - tableSearchH - 265
  232. }
  233. },
  234. watch: {
  235. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  236. this.setTableH()
  237. }
  238. },
  239. mounted () {
  240. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  241. this.pageInit()
  242. this.resetSearchForm()
  243. }
  244. },
  245. activated () {
  246. // 如果是新页签打开,则重置当前页面
  247. if (this.$store.state.app.isNewTab) {
  248. this.pageInit()
  249. this.resetSearchForm()
  250. }
  251. // 仅刷新列表,不重置页面
  252. if (this.$store.state.app.updateList) {
  253. this.pageInit()
  254. this.$refs.table.refresh()
  255. }
  256. },
  257. beforeRouteEnter (to, from, next) {
  258. next(vm => {})
  259. }
  260. }
  261. </script>
  262. <style lang="less">
  263. .crpnList-wrap{
  264. .sTable{
  265. margin-top: 10px;
  266. }
  267. }
  268. </style>