list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  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" default-active-key="0" @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: 8px" @click="resetSearchForm()" :disabled="disabled" id="finacialPay-reset">重置</a-button>
  47. <a @click="advanced = !advanced" style="margin-left: 8px">
  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="handlePayment">批量付款</a-button>
  70. <span style="margin-left: 8px" v-if="$hasPermissions('B_financialPaymentPl')">
  71. <template v-if="hasSelected">
  72. {{ `已选 ${selectedRowKeys.length} 项` }}
  73. </template>
  74. </span>
  75. </div>
  76. <!-- 列表 -->
  77. <s-table
  78. class="sTable fixPagination"
  79. ref="table"
  80. :style="{ height: tableHeight+84.5+'px' }"
  81. size="small"
  82. :row-selection="$hasPermissions('B_financialPaymentPl') ? rowSelection : null"
  83. :rowKey="record => record.id"
  84. :columns="columns"
  85. :data="loadData"
  86. :scroll="{ x: 1660, 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_financialPaymentDetail')"
  97. @click="handleVoucher(record)"
  98. id="finacialPay-voucher-btn">凭证</a-button>
  99. <a-button
  100. size="small"
  101. type="link"
  102. class="button-warning"
  103. :loading="loading"
  104. v-else-if="record.settleState != 'SETTLED' && $hasPermissions('B_financialPaymentSing')"
  105. @click="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. </a-card>
  114. </template>
  115. <script>
  116. import { STable, VSelect } from '@/components'
  117. import detailModal from './detailModal.vue'
  118. import { settlePayQuery, queryByTypeSum, settlePayMoney, settlePayQuerySum } from '@/api/settlePay.js'
  119. import rangeDate from '@/views/common/rangeDate.vue'
  120. export default {
  121. components: { STable, VSelect, detailModal, rangeDate },
  122. data () {
  123. return {
  124. spinning: false,
  125. advanced: true, // 高级搜索 展开/关闭
  126. disabled: false, // 查询、重置按钮是否可操作
  127. openModal: false, // 详情弹框
  128. tableHeight: 0,
  129. curBizType: '',
  130. // 查询参数
  131. queryParam: {
  132. bizType: 'ALL',
  133. settleNo: '',
  134. bizNo: '',
  135. settleClientName: '',
  136. billState: '',
  137. auditBeginDate: '',
  138. auditEndDate: ''
  139. },
  140. // 总计
  141. totalData: {
  142. settledAmount: 0,
  143. totalAmount: 0,
  144. unsettleAmount: 0,
  145. count: 0
  146. },
  147. // 表头
  148. columns: [
  149. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  150. { title: '付款单号', dataIndex: 'settleNo', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  151. { title: '关联单号', dataIndex: 'bizNo', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  152. { title: '商户名称', dataIndex: 'settleClientName', align: 'center', customRender: function (text) { return text || '--' } },
  153. { title: '应付金额', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  154. { title: '已付金额', dataIndex: 'settledAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  155. { title: '待付金额', dataIndex: 'unsettleAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  156. { title: '付款类型', dataIndex: 'bizName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  157. { title: '付款方式', dataIndex: 'settleStyleName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  158. { title: '审核时间', dataIndex: 'auditTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  159. { title: '付款时间', dataIndex: 'settleTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  160. { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
  161. ],
  162. selectedRowKeys: [], // Check here to configure the default column
  163. loading: false,
  164. // 加载数据方法 必须为 Promise 对象
  165. loadData: parameter => {
  166. this.disabled = true
  167. this.spinning = true
  168. return settlePayQuery(Object.assign(parameter, this.queryParam)).then(res => {
  169. const data = res.data
  170. const no = (data.pageNo - 1) * data.pageSize
  171. for (var i = 0; i < data.list.length; i++) {
  172. data.list[i].no = no + i + 1
  173. }
  174. this.disabled = false
  175. this.spinning = false
  176. this.totalData.count = data.count || 0
  177. // 查询总计
  178. this.settlePayQuerySum(Object.assign(parameter, this.queryParam))
  179. return data
  180. })
  181. },
  182. tabPaneData: []
  183. }
  184. },
  185. computed: {
  186. hasSelected () {
  187. return this.selectedRowKeys.length > 0
  188. },
  189. rowSelection () {
  190. if (this.$hasPermissions('B_financialPaymentPl')) {
  191. return {
  192. selectedRowKeys: this.selectedRowKeys,
  193. onChange: (selectedRowKeys, selectedRows) => {
  194. this.selectedRowKeys = selectedRowKeys
  195. },
  196. onSelect: (record, selected, selectedRows, nativeEvent) => {
  197. this.onSelectChange(record, selected, selectedRows, nativeEvent)
  198. },
  199. onSelectAll: (selected, selectedRows, changeRows) => {
  200. this.onSelectAllChange(selected, selectedRows, changeRows)
  201. },
  202. getCheckboxProps: record => ({
  203. props: {
  204. disabled: record.settleState == 'SETTLED'
  205. }
  206. })
  207. }
  208. } else {
  209. return null
  210. }
  211. }
  212. },
  213. methods: {
  214. // 时间 change
  215. dateChange (date) {
  216. this.queryParam.auditBeginDate = date[0]
  217. this.queryParam.auditEndDate = date[1]
  218. },
  219. // 总计
  220. settlePayQuerySum (params) {
  221. settlePayQuerySum(params).then(res => {
  222. if (res.status == 200) {
  223. this.totalData = Object.assign(this.totalData, res.data)
  224. }
  225. })
  226. },
  227. // 获取类型
  228. queryByTypeSum () {
  229. queryByTypeSum({}).then(res => {
  230. if (res.data && res.status == 200) {
  231. this.tabPaneData = res.data
  232. this.queryParam.bizType = res.data[0].bizType
  233. }
  234. })
  235. },
  236. // 凭证弹框
  237. handleVoucher (row) {
  238. this.$refs.detailModal.getDetail(row.id)
  239. this.openModal = true
  240. },
  241. // 付款
  242. handlePay (row) {
  243. this.loading = true
  244. this.spinning = true
  245. settlePayMoney([row.id]).then(res => {
  246. this.loading = false
  247. if (res.status == 200) {
  248. this.$message.success(res.message)
  249. this.selectedRowKeys = []
  250. this.$refs.table.refresh()
  251. this.spinning = false
  252. } else {
  253. this.spinning = false
  254. }
  255. })
  256. },
  257. // 选择类型
  258. handleTabChange (key) {
  259. this.queryParam.bizType = key
  260. this.$refs.table.refresh(true)
  261. this.curBizType = key
  262. },
  263. // 批量付款
  264. handlePayment () {
  265. if (this.selectedRowKeys.length < 1) {
  266. this.$message.warning('请在列表勾选后再进行批量操作!')
  267. return
  268. }
  269. this.loading = true
  270. this.spinning = true
  271. settlePayMoney(this.selectedRowKeys).then(res => {
  272. this.loading = false
  273. if (res.status == 200) {
  274. this.$message.success(res.message)
  275. this.selectedRowKeys = []
  276. this.$refs.table.refresh()
  277. this.spinning = false
  278. } else {
  279. this.spinning = false
  280. }
  281. })
  282. },
  283. // 重置
  284. resetSearchForm () {
  285. if (this.advanced) {
  286. this.$refs.rangeDate.resetDate()
  287. }
  288. this.queryParam = {
  289. bizType: this.curBizType,
  290. settleNo: '',
  291. bizNo: '',
  292. settleClientName: '',
  293. billState: '',
  294. auditBeginDate: '',
  295. auditEndDate: ''
  296. }
  297. this.$refs.table.refresh(true)
  298. },
  299. onSelectChange (record, selected, selectedRows, nativeEvent) {
  300. if (selected) { // 选择
  301. this.selectedRows.push(record)
  302. } else { // 取消
  303. this.selectedRows = selectedRows
  304. }
  305. },
  306. // 本页全选/取消全选
  307. onSelectAllChange (selected, selectedRows, changeRows) {
  308. const _this = this
  309. if (selected) { // 选择
  310. this.selectedRows = [...this.selectedRows, ...changeRows]
  311. } else { // 取消
  312. const arrId = []
  313. this.selectedRows.map((item, index) => {
  314. this.selectedRows.map((subItem, ind) => {
  315. if (item.id == subItem.id) {
  316. arrId.push(index)
  317. }
  318. })
  319. })
  320. arrId.map((item, index) => {
  321. _this.selectedRows = _this.selectedRows.slice(item, item + 1)
  322. })
  323. }
  324. },
  325. pageInit () {
  326. const _this = this
  327. this.$nextTick(() => { // 页面渲染完成后的回调
  328. _this.setTableH()
  329. })
  330. this.queryByTypeSum()
  331. },
  332. setTableH () {
  333. const tableSearchH = this.$refs.tableSearch.offsetHeight
  334. this.tableHeight = window.innerHeight - tableSearchH - 330
  335. }
  336. },
  337. watch: {
  338. advanced (newValue, oldValue) {
  339. const _this = this
  340. setTimeout(() => {
  341. _this.setTableH()
  342. }, 400)
  343. }
  344. },
  345. mounted () {
  346. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  347. this.pageInit()
  348. this.resetSearchForm()
  349. }
  350. },
  351. activated () {
  352. // 如果是新页签打开,则重置当前页面
  353. if (this.$store.state.app.isNewTab) {
  354. this.pageInit()
  355. this.resetSearchForm()
  356. }
  357. },
  358. beforeRouteEnter (to, from, next) {
  359. next(vm => {})
  360. }
  361. }
  362. </script>