list.vue 16 KB

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