list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  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 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="BILL_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" showIcon style="margin-bottom:15px">
  58. <div slot="message">
  59. <strong>{{ totalData.count }}</strong>
  60. 条记录,应付金额合计
  61. <strong>¥{{ totalData.totalAmount }}</strong>
  62. ,其中已付金额
  63. <strong>¥{{ totalData.settledAmount }}</strong>
  64. ,待付金额
  65. <strong>¥{{ totalData.unsettleAmount }}</strong>
  66. </div>
  67. </a-alert>
  68. <div style="margin-bottom: 15px">
  69. <a-button type="primary" id="finacialPay-export" :loading="loading" @click="handlePayment">批量付款</a-button>
  70. <span style="margin-left: 8px">
  71. <template v-if="hasSelected">
  72. {{ `已选 ${selectedRowKeys.length} 项` }}
  73. </template>
  74. </span>
  75. </div>
  76. <!-- 列表 -->
  77. <s-table
  78. class="sTable"
  79. ref="table"
  80. size="default"
  81. :row-selection="rowSelection"
  82. :rowKey="record => record.id"
  83. :columns="columns"
  84. :data="loadData"
  85. :scroll="{ x: 1660, y: tableHeight }"
  86. bordered
  87. >
  88. <!-- 操作 -->
  89. <template slot="action" slot-scope="text, record">
  90. <a-button
  91. size="small"
  92. type="link"
  93. class="button-info"
  94. v-if="record.settleState == 'SETTLED'"
  95. @click="handleVoucher(record)"
  96. id="finacialPay-voucher-btn">凭证</a-button>
  97. <a-button
  98. size="small"
  99. type="link"
  100. class="button-warning"
  101. :loading="loading"
  102. v-else
  103. @click="handlePay(record)"
  104. id="finacialPay-pay-btn">付款</a-button>
  105. </template>
  106. </s-table>
  107. </a-spin>
  108. <!-- 详情 -->
  109. <detail-modal :openModal="openModal" ref="detailModal" @close="openModal = false" />
  110. </a-card>
  111. </template>
  112. <script>
  113. import { STable, VSelect } from '@/components'
  114. import detailModal from './detailModal.vue'
  115. import { settlePayQuery, queryByTypeSum, settlePayMoney, settlePayQuerySum } from '@/api/settlePay.js'
  116. import rangeDate from '@/views/common/rangeDate.vue'
  117. export default {
  118. components: { STable, VSelect, detailModal, rangeDate },
  119. data () {
  120. return {
  121. spinning: false,
  122. advanced: false, // 高级搜索 展开/关闭
  123. disabled: false, // 查询、重置按钮是否可操作
  124. openModal: false, // 详情弹框
  125. tableHeight: 0,
  126. curBizType: '',
  127. // 查询参数
  128. queryParam: {
  129. bizType: 'ALL',
  130. settleNo: '',
  131. bizNo: '',
  132. settleClientName: '',
  133. billState: '',
  134. auditBeginDate: '',
  135. auditEndDate: ''
  136. },
  137. // 总计
  138. totalData: {
  139. settledAmount: 0,
  140. totalAmount: 0,
  141. unsettleAmount: 0,
  142. count: 0
  143. },
  144. // 表头
  145. columns: [
  146. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  147. { title: '付款单号', dataIndex: 'settleNo', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  148. { title: '关联单号', dataIndex: 'bizNo', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  149. { title: '商户名称', dataIndex: 'settleClientName', align: 'center', customRender: function (text) { return text || '--' } },
  150. { title: '应付金额', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  151. { title: '已付金额', dataIndex: 'settledAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  152. { title: '待付金额', dataIndex: 'unsettleAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  153. { title: '付款类型', dataIndex: 'bizName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  154. { title: '付款方式', dataIndex: 'settleStyleName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  155. { title: '审核时间', dataIndex: 'auditTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  156. { title: '付款时间', dataIndex: 'settleTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  157. { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
  158. ],
  159. selectedRowKeys: [], // Check here to configure the default column
  160. loading: false,
  161. // 加载数据方法 必须为 Promise 对象
  162. loadData: parameter => {
  163. this.disabled = true
  164. if (this.tableHeight == 0) {
  165. this.tableHeight = window.innerHeight - 450
  166. }
  167. return settlePayQuery(Object.assign(parameter, this.queryParam)).then(res => {
  168. const data = res.data
  169. const no = (data.pageNo - 1) * data.pageSize
  170. for (var i = 0; i < data.list.length; i++) {
  171. data.list[i].no = no + i + 1
  172. }
  173. this.disabled = false
  174. this.totalData.count = data.count
  175. // 查询总计
  176. this.settlePayQuerySum(Object.assign(parameter, this.queryParam))
  177. return data
  178. })
  179. },
  180. tabPaneData: []
  181. }
  182. },
  183. computed: {
  184. hasSelected () {
  185. return this.selectedRowKeys.length > 0
  186. },
  187. rowSelection () {
  188. return {
  189. selectedRowKeys: this.selectedRowKeys,
  190. onChange: (selectedRowKeys, selectedRows) => {
  191. this.selectedRowKeys = selectedRowKeys
  192. },
  193. getCheckboxProps: record => ({
  194. props: {
  195. disabled: record.settleState == 'SETTLED'
  196. }
  197. })
  198. }
  199. }
  200. },
  201. beforeRouteEnter (to, from, next) {
  202. next(vm => {
  203. vm.queryByTypeSum()
  204. })
  205. },
  206. methods: {
  207. // 时间 change
  208. dateChange (date) {
  209. this.queryParam.auditBeginDate = date[0]
  210. this.queryParam.auditEndDate = date[1]
  211. },
  212. // 总计
  213. settlePayQuerySum (params) {
  214. settlePayQuerySum(params).then(res => {
  215. if (res.status == 200) {
  216. this.totalData = Object.assign(this.totalData, res.data)
  217. }
  218. })
  219. },
  220. // 获取类型
  221. queryByTypeSum () {
  222. queryByTypeSum({}).then(res => {
  223. if (res.data && res.status == 200) {
  224. this.tabPaneData = res.data
  225. this.queryParam.bizType = res.data[0].bizType
  226. }
  227. })
  228. },
  229. // 凭证弹框
  230. handleVoucher (row) {
  231. this.$refs.detailModal.getDetail(row.id)
  232. this.openModal = true
  233. },
  234. // 付款
  235. handlePay (row) {
  236. this.loading = true
  237. this.spinning = true
  238. settlePayMoney([row.id]).then(res => {
  239. this.loading = false
  240. if (res.status == 200) {
  241. this.$message.success(res.message)
  242. this.selectedRowKeys = []
  243. this.$refs.table.refresh()
  244. this.spinning = false
  245. } else {
  246. this.spinning = false
  247. }
  248. })
  249. },
  250. // 选择类型
  251. handleTabChange (key) {
  252. this.queryParam.bizType = key
  253. this.$refs.table.refresh(true)
  254. this.curBizType = key
  255. },
  256. // 批量付款
  257. handlePayment () {
  258. if (this.selectedRowKeys.length < 1) {
  259. this.$message.warning('请在列表勾选后再进行批量操作!')
  260. return
  261. }
  262. this.loading = true
  263. this.spinning = true
  264. settlePayMoney(this.selectedRowKeys).then(res => {
  265. this.loading = false
  266. if (res.status == 200) {
  267. this.$message.success(res.message)
  268. this.selectedRowKeys = []
  269. this.$refs.table.refresh()
  270. this.spinning = false
  271. } else {
  272. this.spinning = false
  273. }
  274. })
  275. },
  276. // 重置
  277. resetSearchForm () {
  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. this.$refs.table.refresh(true)
  291. }
  292. }
  293. }
  294. </script>
  295. <style lang="less">
  296. .finacialPay-wrap {
  297. .sTable {
  298. margin-top: 15px;
  299. }
  300. .finacialPay-tabs {
  301. margin-bottom: 15px;
  302. }
  303. }
  304. </style>