list.vue 13 KB

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