list.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. <template>
  2. <a-card size="small" :bordered="false" class="finacialPay-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 标签页 -->
  5. <a-tabs type="card" size="small" v-model="queryParam.bizType" @change="handleTabChange" class="finacialPay-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="searchForm">
  13. <a-row :gutter="15">
  14. <a-col :md="6" :sm="24">
  15. <a-form-item label="付款单号"><a-input id="finacialPay-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="finacialPay-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="finacialPay-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="finacialPay-settleState"
  32. code="SETTLE_PAY_STATUS"
  33. placeholder="请选择单据状态"
  34. allowClear></v-select>
  35. </a-form-item>
  36. </a-col>
  37. <a-col :md="6" :sm="24">
  38. <a-form-item label="创建时间">
  39. <rangeDate ref="createDate" @change="createDateChange" />
  40. </a-form-item>
  41. </a-col>
  42. <a-col :md="6" :sm="24">
  43. <a-form-item label="审核时间">
  44. <rangeDate ref="rangeDate" @change="dateChange" />
  45. </a-form-item>
  46. </a-col>
  47. <a-col :md="6" :sm="24">
  48. <a-form-item label="收款时间">
  49. <rangeDate ref="settleDate" @change="settleChange" />
  50. </a-form-item>
  51. </a-col>
  52. </template>
  53. <a-col :md="6" :sm="24">
  54. <span class="table-page-search-submitButtons">
  55. <a-button type="primary" @click="searchForm()" :disabled="disabled" id="finacialPay-refresh">查询</a-button>
  56. <a-button style="margin-left: 5px" @click="resetSearchForm()" :disabled="disabled" id="finacialPay-reset">重置</a-button>
  57. <a @click="advanced = !advanced" style="margin-left: 5px">
  58. {{ advanced ? '收起' : '展开' }}
  59. <a-icon :type="advanced ? 'up' : 'down'" />
  60. </a>
  61. </span>
  62. </a-col>
  63. </a-row>
  64. </a-form>
  65. </div>
  66. <!-- alert -->
  67. <a-alert type="info" style="margin-bottom:10px">
  68. <div slot="message">
  69. <strong>{{ totalData&&(totalData.count || totalData.count==0) ? totalData.count : '--' }}</strong>
  70. 条记录,应付金额合计
  71. <strong>{{ totalData&&(totalData.totalAmount || totalData.totalAmount==0) ? '¥'+totalData.totalAmount : '--' }}</strong>
  72. ,其中已付金额
  73. <strong>{{ totalData&&(totalData.settledAmount || totalData.settledAmount==0) ? '¥'+totalData.settledAmount : '--' }}</strong>
  74. ,待付金额
  75. <strong>{{ totalData&&(totalData.unsettleAmount || totalData.unsettleAmount==0) ? '¥'+totalData.unsettleAmount : '--' }}</strong>
  76. </div>
  77. </a-alert>
  78. <div v-if="$hasPermissions('B_financialPaymentPl')" style="margin-bottom: 10px">
  79. <a-button type="primary" id="finacialPay-export" :loading="loading" @click="enableFundAccount ? handleSettleAcountPay(null,1) : handlePayment()">批量付款</a-button>
  80. <span style="margin-left: 8px" v-if="$hasPermissions('B_financialPaymentPl')">
  81. <template v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
  82. <template v-if="selectTotalAmount">,合计¥{{ selectTotalAmount }}</template>
  83. </span>
  84. </div>
  85. <!-- 列表 -->
  86. <s-table
  87. class="sTable fixPagination"
  88. ref="table"
  89. :style="{ height: tableHeight+84.5+'px' }"
  90. size="small"
  91. :rowKey="record => record.id"
  92. :row-selection="$hasPermissions('B_financialPaymentPl') ? { columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.settleState == 'SETTLED' } }) } : null"
  93. @rowSelection="rowSelectionFun"
  94. :columns="columns"
  95. :data="loadData"
  96. :scroll="{ y: tableHeight }"
  97. :defaultLoadData="false"
  98. bordered
  99. >
  100. <!-- 关联单号 -->
  101. <template slot="bizNo" slot-scope="text, record">
  102. <span class="table-td-link" @click="handleDetail(record)">{{ record.bizNo }}</span>
  103. </template>
  104. <!-- 操作 -->
  105. <template slot="action" slot-scope="text, record">
  106. <a-button
  107. size="small"
  108. type="link"
  109. class="button-primary"
  110. v-if="record.settleState == 'SETTLED' && $hasPermissions('B_financialPaymentDetail')"
  111. @click="handleVoucher(record)"
  112. id="finacialPay-voucher-btn">凭证</a-button>
  113. <a-button
  114. size="small"
  115. type="link"
  116. class="button-error"
  117. :loading="loading"
  118. v-else-if="record.settleState != 'SETTLED' && $hasPermissions('B_financialPaymentSing')"
  119. @click="enableFundAccount ? handleSettleAcountPay(record,0) : handlePay(record)"
  120. id="finacialPay-pay-btn">付款</a-button>
  121. <span v-else>--</span>
  122. </template>
  123. </s-table>
  124. </a-spin>
  125. <!-- 详情 -->
  126. <detail-modal :openModal="openModal" ref="detailModal" @close="openModal = false" />
  127. <!-- 收付款弹框 -->
  128. <settleModal ref="settleModal" @ok="settleAcountPay" :openModal="openSettleModal" @close="openSettleModal=false"></settleModal>
  129. <!-- 关联单号详情 -->
  130. <a-modal
  131. centered
  132. class="bizOrderDetail-modal"
  133. :footer="null"
  134. :maskClosable="false"
  135. :bodyStyle="{padding:'12px'}"
  136. :title="curBizTitle"
  137. v-model="openDetailModal"
  138. v-if="openDetailModal"
  139. @cancel="handleDetailClose"
  140. width="80%">
  141. <div style="max-height: 700px;overflow-y: auto;">
  142. <!-- 采购入库 -->
  143. <salesDetailModal v-if="fcBizType=='SELL'" :outBizSn="orderSn" />
  144. </div>
  145. </a-modal>
  146. </a-card>
  147. </template>
  148. <script>
  149. import { commonMixin } from '@/utils/mixin'
  150. import { mapActions } from 'vuex'
  151. import { STable, VSelect } from '@/components'
  152. import detailModal from './detailModal.vue'
  153. import settleModal from '../settleModal/settleModal.vue'
  154. import { settlePayQuery, queryByTypeSum, settlePayMoney, settlePayQuerySum } from '@/api/settlePay.js'
  155. import rangeDate from '@/views/common/rangeDate.vue'
  156. export default {
  157. name: 'FinancialPaymentList',
  158. components: { STable, VSelect, detailModal, rangeDate, settleModal },
  159. mixins: [commonMixin],
  160. data () {
  161. return {
  162. spinning: false,
  163. advanced: true, // 高级搜索 展开/关闭
  164. disabled: false, // 查询、重置按钮是否可操作
  165. openModal: false, // 详情弹框
  166. openSettleModal: false, // 打开付款弹框
  167. enableFundAccount: false, // 是否开启资金账户管理
  168. tableHeight: 0,
  169. curBizType: 'ALL',
  170. openDetailModal: false, // 关联单详情
  171. curBizTitle: '',
  172. fcBizType: '',
  173. orderSn: null,
  174. // 查询参数
  175. queryParam: {
  176. bizType: 'ALL',
  177. settleNo: '',
  178. bizNo: '',
  179. settleClientName: '',
  180. billState: '',
  181. auditBeginDate: '',
  182. auditEndDate: '',
  183. settleBeginDate: '',
  184. settleEndDate: ''
  185. },
  186. // 总计
  187. totalData: {
  188. settledAmount: 0,
  189. totalAmount: 0,
  190. unsettleAmount: 0,
  191. count: 0
  192. },
  193. // 表头
  194. columns: [
  195. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  196. { title: '付款单号', dataIndex: 'settleNo', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  197. { title: '关联单号', dataIndex: 'bizNo', scopedSlots: { customRender: 'bizNo' }, width: '14%', align: 'center' },
  198. { title: '商户名称', dataIndex: 'settleClientName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  199. { title: '应付金额', dataIndex: 'totalAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  200. { title: '已付金额', dataIndex: 'settledAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  201. { title: '待付金额', dataIndex: 'unsettleAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  202. { title: '单据类型', dataIndex: 'bizName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  203. { title: '付款方式', dataIndex: 'settleStyleName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  204. // { title: '创建时间', dataIndex: 'createDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  205. { title: '审核时间', dataIndex: 'auditTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  206. { title: '付款时间', dataIndex: 'settleTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  207. { title: '操作', scopedSlots: { customRender: 'action' }, width: '5%', align: 'center' }
  208. ],
  209. loading: false,
  210. // 加载数据方法 必须为 Promise 对象
  211. loadData: parameter => {
  212. this.disabled = true
  213. this.spinning = true
  214. return settlePayQuery(Object.assign(parameter, this.queryParam)).then(res => {
  215. let data
  216. if (res.status == 200) {
  217. data = res.data
  218. const no = (data.pageNo - 1) * data.pageSize
  219. for (var i = 0; i < data.list.length; i++) {
  220. data.list[i].no = no + i + 1
  221. }
  222. this.disabled = false
  223. this.totalData.count = data.count || 0
  224. // 查询总计
  225. this.settlePayQuerySum(Object.assign(parameter, this.queryParam))
  226. }
  227. this.spinning = false
  228. return data
  229. })
  230. },
  231. tabPaneData: [],
  232. rowSelectionInfo: null
  233. }
  234. },
  235. computed: {
  236. selectTotalAmount () {
  237. let ret = 0
  238. if (this.rowSelectionInfo && this.rowSelectionInfo.selectedRows) {
  239. this.rowSelectionInfo.selectedRows.map(item => {
  240. ret = ret + item.unsettleAmount
  241. })
  242. }
  243. return ret ? Number(ret).toFixed(2) : 0
  244. }
  245. },
  246. methods: {
  247. // 查看关联单号
  248. handleDetail (row) {
  249. console.log(row)
  250. this.orderSn = row.bizSn
  251. this.fcBizType = row.bizType
  252. this.curBizTitle = row.bizTypeDictValue + '详情'
  253. this.openDetailModal = true
  254. },
  255. handleDetailClose () {
  256. this.openDetailModal = false
  257. this.fcBizType = null
  258. this.orderSn = null
  259. },
  260. ...mapActions(['GetSettleAccountState']),
  261. // 表格选中项
  262. rowSelectionFun (obj) {
  263. console.log(obj)
  264. this.rowSelectionInfo = obj || null
  265. },
  266. // 时间 change
  267. dateChange (date) {
  268. this.queryParam.auditBeginDate = date[0]
  269. this.queryParam.auditEndDate = date[1]
  270. },
  271. createDateChange (date) {
  272. this.queryParam.beginDate = date[0]
  273. this.queryParam.endDate = date[1]
  274. },
  275. settleChange (date) {
  276. this.queryParam.settleBeginDate = date[0]
  277. this.queryParam.settleEndDate = date[1]
  278. },
  279. // 总计
  280. settlePayQuerySum (params) {
  281. settlePayQuerySum(params).then(res => {
  282. if (res.status == 200) {
  283. this.totalData = Object.assign(this.totalData, res.data)
  284. const tab = this.tabPaneData.find(item => item.bizType == this.queryParam.bizType)
  285. tab.countNum = this.totalData.count || 0
  286. }
  287. })
  288. },
  289. // 获取类型
  290. queryByTypeSum () {
  291. queryByTypeSum({}).then(res => {
  292. if (res.data && res.status == 200) {
  293. this.tabPaneData = res.data
  294. if (this.curBizType == 'ALL') {
  295. this.queryParam.bizType = res.data[0].bizType
  296. }
  297. this.$refs.table.refresh(true)
  298. }
  299. })
  300. },
  301. // 凭证弹框
  302. handleVoucher (row) {
  303. this.$refs.detailModal.getDetail(row.id)
  304. this.openModal = true
  305. },
  306. // 开启结算账户功能付款, type:0 单条付款,1 批量付款
  307. handleSettleAcountPay (row, type) {
  308. this.openSettleModal = true
  309. const data = {
  310. totalAmount: type ? this.selectTotalAmount : row && row.unsettleAmount || 0,
  311. settleClientName: type ? '' : row && row.settleClientName || '',
  312. title: '付款',
  313. type,
  314. row
  315. }
  316. this.$nextTick(() => {
  317. this.$refs.settleModal.setData(data)
  318. })
  319. },
  320. // 去付款
  321. settleAcountPay (form, data) {
  322. const _this = this
  323. const params =
  324. {
  325. 'settleIds': data.type ? _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys : [data.row.id]
  326. }
  327. // 资金管理开启
  328. if (this.enableFundAccount) {
  329. params.settleStyleSn = form.settleStyleSn
  330. params.settleAccountSn = form.settleAccountSn
  331. }
  332. _this.loading = true
  333. _this.spinning = true
  334. settlePayMoney(params).then(res => {
  335. _this.loading = false
  336. if (res.status == 200) {
  337. _this.$message.success(res.message)
  338. _this.$refs.table.refresh()
  339. _this.$refs.table.clearSelected() // 清空表格选中项
  340. _this.spinning = false
  341. } else {
  342. _this.spinning = false
  343. }
  344. })
  345. },
  346. // 付款
  347. handlePay (row) {
  348. const _this = this
  349. this.$confirm({
  350. title: '提示',
  351. content: '确认付款吗?',
  352. centered: true,
  353. closable: true,
  354. onOk () {
  355. _this.settleAcountPay(null, { type: 0, row: row })
  356. }
  357. })
  358. },
  359. // 选择类型
  360. handleTabChange (key) {
  361. this.queryParam.bizType = key
  362. this.$refs.table.refresh(true)
  363. this.curBizType = key
  364. },
  365. // 批量付款
  366. handlePayment () {
  367. if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
  368. this.$message.warning('请在列表勾选后再进行批量操作!')
  369. return
  370. }
  371. const _this = this
  372. this.$confirm({
  373. title: '提示',
  374. content: <div><p style="margin-top:20px;">合计金额¥{ this.selectTotalAmount } </p><p>确认批量付款吗?</p></div>,
  375. centered: true,
  376. closable: true,
  377. onOk () {
  378. _this.settleAcountPay(null, { type: 1, row: null })
  379. }
  380. })
  381. },
  382. // 查询
  383. searchForm () {
  384. this.$refs.table.clearSelected() // 清空表格选中项
  385. this.$refs.table.refresh(true)
  386. },
  387. // 重置
  388. resetSearchForm () {
  389. this.resetData()
  390. this.$refs.table.refresh(true)
  391. },
  392. // 重置数据
  393. resetData () {
  394. if (this.advanced) {
  395. this.$refs.rangeDate.resetDate()
  396. this.$refs.createDate.resetDate()
  397. this.$refs.settleDate.resetDate()
  398. }
  399. this.$refs.table.clearSelected() // 清空表格选中项
  400. this.queryParam = {
  401. bizType: this.curBizType,
  402. settleNo: '',
  403. bizNo: '',
  404. settleClientName: '',
  405. billState: '',
  406. beginDate: '',
  407. endDate: '',
  408. auditBeginDate: '',
  409. auditEndDate: '',
  410. settleBeginDate: '',
  411. settleEndDate: ''
  412. }
  413. },
  414. pageInit () {
  415. const _this = this
  416. this.$nextTick(() => { // 页面渲染完成后的回调
  417. _this.setTableH()
  418. })
  419. this.queryByTypeSum()
  420. },
  421. setTableH () {
  422. const tableSearchH = this.$refs.tableSearch.offsetHeight
  423. this.tableHeight = window.innerHeight - tableSearchH - 330
  424. }
  425. },
  426. watch: {
  427. advanced (newValue, oldValue) {
  428. const _this = this
  429. this.$nextTick(() => { // 页面渲染完成后的回调
  430. _this.setTableH()
  431. })
  432. },
  433. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  434. this.setTableH()
  435. }
  436. },
  437. mounted () {
  438. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  439. this.resetData()
  440. this.pageInit()
  441. }
  442. },
  443. activated () {
  444. // 是否从首页点击进入
  445. const isHomeNav = this.getIsHomeNav()[this.$route.name]
  446. console.log(this.getIsHomeNav(), isHomeNav, this.$route.name)
  447. // 待办查询
  448. if (isHomeNav && isHomeNav.type == 'todo') {
  449. this.curBizType = isHomeNav.pageParams.bizType
  450. this.resetData()
  451. this.queryParam = Object.assign(this.queryParam, isHomeNav.pageParams)
  452. this.$refs.createDate.resetDate([this.queryParam.beginDate, this.queryParam.endDate])
  453. this.pageInit()
  454. } else {
  455. // 如果是新页签打开,则重置当前页面
  456. if (this.$store.state.app.isNewTab) {
  457. this.curBizType = 'ALL'
  458. this.resetData()
  459. this.pageInit()
  460. }
  461. }
  462. // 结算账户状态查询
  463. if (this.$hasPermissions('M_fundAccountList') && this.$hasPermissions('B_fundAccountEnable')) {
  464. this.GetSettleAccountState().then(res => {
  465. if (res.status == 200) {
  466. this.enableFundAccount = res.data.functionEnableFlag == 1
  467. }
  468. })
  469. }
  470. },
  471. beforeRouteEnter (to, from, next) {
  472. next(vm => {})
  473. }
  474. }
  475. </script>
  476. <style lang="less">
  477. .finacialPay-wrap{
  478. .finacialPay-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-nav-container{
  479. height: 30px!important;
  480. }
  481. .finacialPay-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab-active{
  482. height: 30px!important;
  483. }
  484. .finacialPay-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab{
  485. line-height: 26px!important;
  486. height: 30px!important;
  487. }
  488. }
  489. </style>