list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. <template>
  2. <a-card size="small" :bordered="false" class="financialCollectionList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 标签页 -->
  5. <a-tabs type="card" v-model="queryParam.bizType" @change="handleTabChange" class="financialCollectionList-tabs ">
  6. <a-tab-pane v-for="item in tabPaneData" :key="item.bizType">
  7. <span slot="tab">{{ item.bizName }}({{ item.countNum }})</span>
  8. </a-tab-pane>
  9. </a-tabs>
  10. <!-- 搜索条件 -->
  11. <div ref="tableSearch" class="table-page-search-wrapper">
  12. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  13. <a-row :gutter="15">
  14. <a-col :md="6" :sm="24">
  15. <a-form-item label="收款单号"><a-input id="financialCollectionList-settleNo" v-model.trim="queryParam.settleNo" allowClear placeholder="请输入收款单号" /></a-form-item>
  16. </a-col>
  17. <a-col :md="6" :sm="24">
  18. <a-form-item label="关联单号"><a-input id="financialCollectionList-bizNo" v-model.trim="queryParam.bizNo" allowClear placeholder="请输入关联单号" /></a-form-item>
  19. </a-col>
  20. <a-col :md="6" :sm="24">
  21. <a-form-item label="商户名称">
  22. <a-input id="financialCollectionList-settleClientName" v-model.trim="queryParam.settleClientName" allowClear placeholder="请输入商户名称" />
  23. </a-form-item>
  24. </a-col>
  25. <template v-if="advanced">
  26. <a-col :md="6" :sm="24">
  27. <a-form-item label="单据状态">
  28. <v-select
  29. v-model="queryParam.billState"
  30. ref="settleState"
  31. id="financialCollectionList-settleState"
  32. code="SETTLE_RECEIVE_STATUS"
  33. placeholder="请选择单据状态"
  34. allowClear
  35. ></v-select>
  36. </a-form-item>
  37. </a-col>
  38. <a-col :md="6" :sm="24">
  39. <a-form-item label="审核时间">
  40. <rangeDate ref="rangeDate" @change="dateChange" />
  41. </a-form-item>
  42. </a-col>
  43. </template>
  44. <a-col :md="6" :sm="24">
  45. <span class="table-page-search-submitButtons">
  46. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="financialCollectionList-refresh">查询</a-button>
  47. <a-button style="margin-left: 5px" @click="resetSearchForm()" :disabled="disabled" id="financialCollectionList-reset">重置</a-button>
  48. <a @click="advanced = !advanced" style="margin-left: 5px">
  49. {{ advanced ? '收起' : '展开' }}
  50. <a-icon :type="advanced ? 'up' : 'down'" />
  51. </a>
  52. </span>
  53. </a-col>
  54. </a-row>
  55. </a-form>
  56. </div>
  57. <!-- alert -->
  58. <a-alert type="info" style="margin-bottom:10px">
  59. <div slot="message">
  60. <strong>{{ totalData&&(totalData.count || totalData.count==0) ? totalData.count : '--' }}</strong>
  61. 条记录,应收金额合计
  62. <strong>{{ totalData&&(totalData.totalAmount || totalData.totalAmount==0) ? '¥'+totalData.totalAmount : '--' }}</strong>
  63. ,其中已收金额
  64. <strong>{{ totalData&&(totalData.settledAmount || totalData.settledAmount==0) ? '¥'+totalData.settledAmount : '--' }}</strong>
  65. ,待收金额
  66. <strong>{{ totalData&&(totalData.unsettleAmount || totalData.unsettleAmount==0) ? '¥'+totalData.unsettleAmount : '--' }}</strong>
  67. </div>
  68. </a-alert>
  69. <div v-if="$hasPermissions('B_financialCollectionPl')" style="margin-bottom: 10px">
  70. <a-button type="primary" id="financialCollectionList-export" :loading="loading" @click="handleCollection">批量收款</a-button>
  71. <span style="margin-left: 8px" v-if="$hasPermissions('B_financialCollectionPl')">
  72. <template v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
  73. </span>
  74. </div>
  75. <!-- 列表 -->
  76. <s-table
  77. class="sTable fixPagination"
  78. ref="table"
  79. :style="{ height: tableHeight+84.5+'px' }"
  80. size="small"
  81. :rowKey="record => record.id"
  82. :row-selection="$hasPermissions('B_financialCollectionPl') ? { columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.settleState == 'SETTLED' } }) } : null"
  83. @rowSelection="rowSelectionFun"
  84. :columns="columns"
  85. :data="loadData"
  86. :scroll="{ y: tableHeight }"
  87. :defaultLoadData="false"
  88. bordered
  89. >
  90. <!-- 操作 -->
  91. <template slot="action" slot-scope="text, record">
  92. <a-button
  93. size="small"
  94. type="link"
  95. class="button-info"
  96. v-if="record.settleState == 'SETTLED' && $hasPermissions('B_financialCollectionDetail')"
  97. @click="handleVoucher(record)"
  98. id="financialCollectionList-voucher-btn">凭证</a-button>
  99. <a-button
  100. size="small"
  101. type="link"
  102. :loading="loading"
  103. class="button-warning"
  104. v-if="(record.settleState == 'UNSETTLE' || record.settleState == 'PART_SETTLED')&&record.satelliteFlag!=1 && $hasPermissions('B_financialCollectionSing')"
  105. @click="handleCollectionSing(record)"
  106. id="financialCollectionList-pay-btn">收款</a-button>
  107. <span v-if="!(record.settleState == 'SETTLED' && $hasPermissions('B_financialCollectionDetail')) && !((record.settleState == 'UNSETTLE' || record.settleState == 'PART_SETTLED')&&record.satelliteFlag!=1 && $hasPermissions('B_financialCollectionSing'))">--</span>
  108. <!-- satelliteFlag为1,是卫星仓 -->
  109. </template>
  110. </s-table>
  111. </a-spin>
  112. <!-- 详情 -->
  113. <detail-modal :openModal="openModal" ref="detailModal" @close="openModal = false" />
  114. </a-card>
  115. </template>
  116. <script>
  117. import { commonMixin } from '@/utils/mixin'
  118. import { STable, VSelect } from '@/components'
  119. import detailModal from './detailModal.vue'
  120. import rangeDate from '@/views/common/rangeDate.vue'
  121. import { settleReceiptQuery, queryByTypeSum, settleReceiptMoney, settleReceiptQuerySum } from '@/api/settleReceipt'
  122. export default {
  123. name: 'FinancialCollectionList',
  124. components: { STable, VSelect, detailModal, rangeDate },
  125. mixins: [commonMixin],
  126. data () {
  127. return {
  128. spinning: false,
  129. advanced: true, // 高级搜索 展开/关闭
  130. disabled: false, // 查询、重置按钮是否可操作
  131. openModal: false, // 详情弹框
  132. tableHeight: 0,
  133. curBizType: 'ALL',
  134. // 查询参数
  135. queryParam: {
  136. bizType: 'ALL',
  137. settleNo: '',
  138. bizNo: '',
  139. settleClientName: '',
  140. billState: '',
  141. auditBeginDate: '',
  142. auditEndDate: ''
  143. },
  144. // 总计
  145. totalData: {
  146. settledAmount: 0,
  147. totalAmount: 0,
  148. unsettleAmount: 0,
  149. count: 0
  150. },
  151. // 表头
  152. columns: [
  153. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  154. { title: '收款单号', dataIndex: 'settleNo', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
  155. { title: '关联单号', dataIndex: 'bizNo', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
  156. { title: '商户名称', dataIndex: 'settleClientName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  157. { title: '应收金额', dataIndex: 'totalAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  158. { title: '已收金额', dataIndex: 'settledAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  159. { title: '待收金额', dataIndex: 'unsettleAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  160. { title: '收款类型', dataIndex: 'bizName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  161. { title: '收款方式', dataIndex: 'settleStyleName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  162. { title: '审核时间', dataIndex: 'auditTime', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  163. { title: '收款时间', dataIndex: 'settleTime', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  164. { title: '操作', scopedSlots: { customRender: 'action' }, width: '5%', align: 'center' }
  165. ],
  166. loading: false,
  167. // 加载数据方法 必须为 Promise 对象
  168. loadData: parameter => {
  169. this.disabled = true
  170. this.spinning = true
  171. return settleReceiptQuery(Object.assign(parameter, this.queryParam)).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. this.disabled = false
  180. this.totalData.count = data.count || 0
  181. // 查询总计
  182. this.settleReceiptQuerySum(Object.assign(parameter, this.queryParam))
  183. }
  184. this.spinning = false
  185. return data
  186. })
  187. },
  188. tabPaneData: [],
  189. rowSelectionInfo: null
  190. }
  191. },
  192. methods: {
  193. // 表格选中项
  194. rowSelectionFun (obj) {
  195. this.rowSelectionInfo = obj || null
  196. },
  197. // 时间 change
  198. dateChange (date) {
  199. this.queryParam.auditBeginDate = date[0]
  200. this.queryParam.auditEndDate = date[1]
  201. },
  202. // 总计
  203. settleReceiptQuerySum (params) {
  204. settleReceiptQuerySum(params).then(res => {
  205. if (res.status == 200) {
  206. this.totalData = Object.assign(this.totalData, res.data)
  207. }
  208. })
  209. },
  210. // 获取类型
  211. queryByTypeSum () {
  212. queryByTypeSum({}).then(res => {
  213. if (res.data && res.status == 200) {
  214. this.tabPaneData = res.data
  215. if (this.$route.query.pageParams) {
  216. this.queryParam.bizType = JSON.parse(this.$route.query.pageParams).bizType
  217. } else {
  218. this.queryParam.bizType = res.data[0].bizType
  219. }
  220. this.$refs.table.refresh(true)
  221. }
  222. })
  223. },
  224. // 凭证弹框
  225. handleVoucher (row) {
  226. this.$refs.detailModal.getDetail(row.id)
  227. this.openModal = true
  228. },
  229. // 收款
  230. handleCollectionSing (row) {
  231. this.loading = true
  232. this.spinning = true
  233. settleReceiptMoney([row.id]).then(res => {
  234. this.loading = false
  235. if (res.status == 200) {
  236. this.$message.success(res.message)
  237. this.$refs.table.refresh()
  238. this.$refs.table.clearSelected() // 清空表格选中项
  239. this.spinning = false
  240. } else {
  241. this.spinning = false
  242. }
  243. })
  244. },
  245. // 选择类型
  246. handleTabChange (key) {
  247. this.queryParam.bizType = key
  248. this.$refs.table.refresh(true)
  249. this.curBizType = key
  250. },
  251. // 批量收款
  252. handleCollection () {
  253. if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
  254. this.$message.warning('请在列表勾选后再进行批量操作!')
  255. return
  256. }
  257. this.loading = true
  258. this.spinning = true
  259. settleReceiptMoney(this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys).then(res => {
  260. this.loading = false
  261. if (res.status == 200) {
  262. this.$message.success(res.message)
  263. this.$refs.table.refresh()
  264. this.$refs.table.clearSelected() // 清空表格选中项
  265. this.spinning = false
  266. } else {
  267. this.spinning = false
  268. }
  269. })
  270. },
  271. // 重置
  272. resetSearchForm () {
  273. this.resetData()
  274. this.$refs.table.refresh(true)
  275. },
  276. // 重置数据
  277. resetData () {
  278. if (this.advanced) {
  279. this.$refs.rangeDate.resetDate()
  280. }
  281. this.queryParam = {
  282. bizType: this.curBizType,
  283. settleNo: '',
  284. bizNo: '',
  285. settleClientName: '',
  286. billState: '',
  287. auditBeginDate: '',
  288. auditEndDate: ''
  289. }
  290. },
  291. pageInit () {
  292. const _this = this
  293. this.$nextTick(() => { // 页面渲染完成后的回调
  294. _this.setTableH()
  295. })
  296. this.queryByTypeSum()
  297. },
  298. setTableH () {
  299. const tableSearchH = this.$refs.tableSearch.offsetHeight
  300. this.tableHeight = window.innerHeight - tableSearchH - 330
  301. }
  302. },
  303. watch: {
  304. advanced (newValue, oldValue) {
  305. const _this = this
  306. this.$nextTick(() => { // 页面渲染完成后的回调
  307. _this.setTableH()
  308. })
  309. },
  310. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  311. this.setTableH()
  312. }
  313. },
  314. mounted () {
  315. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  316. this.resetData()
  317. this.pageInit()
  318. }
  319. },
  320. activated () {
  321. // 如果是新页签打开,则重置当前页面
  322. if (this.$store.state.app.isNewTab) {
  323. this.resetData()
  324. if (this.$route.query.pageParams) {
  325. this.queryParam.bizType = JSON.parse(this.$route.query.pageParams).bizType
  326. this.queryParam.billState = JSON.parse(this.$route.query.pageParams).billState
  327. }
  328. this.pageInit()
  329. }
  330. },
  331. beforeRouteEnter (to, from, next) {
  332. next(vm => {})
  333. }
  334. }
  335. </script>
  336. <style lang="less">
  337. .financialCollectionList-wrap{
  338. .financialCollectionList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-nav-container{
  339. height: 30px!important;
  340. }
  341. .financialCollectionList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab-active{
  342. height: 30px!important;
  343. }
  344. .financialCollectionList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab{
  345. line-height: 26px!important;
  346. height: 30px!important;
  347. }
  348. }
  349. </style>