list.vue 16 KB

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