list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <a-card size="small" :bordered="false" class="finacialPay-wrap">
  3. <!-- 标签页 -->
  4. <a-tabs type="card" default-active-key="0" @change="handleTabChange" class="finacialPay-tabs">
  5. <a-tab-pane v-for="item in tabPaneData" :key="item.bizType">
  6. <span slot="tab">{{ item.bizName }}({{ item.countNum }})</span>
  7. </a-tab-pane>
  8. </a-tabs>
  9. <!-- 搜索条件 -->
  10. <div class="table-page-search-wrapper">
  11. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  12. <a-row :gutter="15">
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="付款单号"><a-input id="finacialPay-settleNo" v-model.trim="queryParam.settleNo" allowClear placeholder="请输入付款单号" /></a-form-item>
  15. </a-col>
  16. <a-col :md="6" :sm="24">
  17. <a-form-item label="关联单号"><a-input id="finacialPay-bizNo" v-model.trim="queryParam.bizNo" allowClear placeholder="请输入关联单号" /></a-form-item>
  18. </a-col>
  19. <a-col :md="6" :sm="24">
  20. <a-form-item label="商户名称">
  21. <a-input id="finacialPay-settleClientName" v-model.trim="queryParam.settleClientName" allowClear placeholder="请输入商户名称" />
  22. </a-form-item>
  23. </a-col>
  24. <template v-if="advanced">
  25. <a-col :md="6" :sm="24">
  26. <a-form-item label="单据状态">
  27. <v-select
  28. v-model="queryParam.billState"
  29. ref="settleState"
  30. id="finacialPay-settleState"
  31. code="BILL_STATUS"
  32. placeholder="请选择单据状态"
  33. allowClear></v-select>
  34. </a-form-item>
  35. </a-col>
  36. <a-col :md="6" :sm="24">
  37. <a-form-item label="审核时间"><a-range-picker v-model="queryParam.auditDate" id="finacialPay-auditDate" /></a-form-item>
  38. </a-col>
  39. </template>
  40. <a-col :md="6" :sm="24">
  41. <span class="table-page-search-submitButtons">
  42. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="finacialPay-refresh">查询</a-button>
  43. <a-button style="margin-left: 8px" @click="resetSearchForm()" :disabled="disabled" id="finacialPay-reset">重置</a-button>
  44. <a @click="advanced = !advanced" style="margin-left: 8px">
  45. {{ advanced ? '收起' : '展开' }}
  46. <a-icon :type="advanced ? 'up' : 'down'" />
  47. </a>
  48. </span>
  49. </a-col>
  50. </a-row>
  51. </a-form>
  52. </div>
  53. <!-- alert -->
  54. <a-alert type="info" showIcon style="margin-bottom:15px">
  55. <div slot="message">
  56. <strong>{{ totalData.count }}</strong>
  57. 条记录,付款金额合计
  58. <strong>¥{{ totalData.totalAmount }}</strong>
  59. ,其中已付
  60. <strong>¥{{ totalData.settledAmount }}</strong>
  61. ,未付
  62. <strong>¥{{ totalData.unsettleAmount }}</strong>
  63. </div>
  64. </a-alert>
  65. <div style="margin-bottom: 15px">
  66. <a-button type="primary" id="finacialPay-export" :loading="loading" @click="handlePayment">批量付款</a-button>
  67. <span style="margin-left: 8px">
  68. <template v-if="hasSelected">
  69. {{ `已选 ${selectedRowKeys.length} 项` }}
  70. </template>
  71. </span>
  72. </div>
  73. <!-- 列表 -->
  74. <s-table
  75. class="sTable"
  76. ref="table"
  77. size="default"
  78. :row-selection="rowSelection"
  79. :rowKey="record => record.id"
  80. :columns="columns"
  81. :data="loadData"
  82. :scroll="{ x: 1280, y: tableHeight }"
  83. bordered
  84. >
  85. <!-- 操作 -->
  86. <template slot="action" slot-scope="text, record">
  87. <a-button
  88. size="small"
  89. type="link"
  90. class="button-info"
  91. v-if="record.settleState == 'SETTLED'"
  92. @click="handleVoucher(record)"
  93. id="finacialPay-voucher-btn">凭证</a-button>
  94. <a-button
  95. size="small"
  96. type="link"
  97. class="button-warning"
  98. :loading="loading"
  99. v-else
  100. @click="handlePay(record)"
  101. id="finacialPay-pay-btn">付款</a-button>
  102. </template>
  103. </s-table>
  104. <!-- 详情 -->
  105. <detail-modal :openModal="openModal" ref="detailModal" @close="openModal = false" />
  106. </a-card>
  107. </template>
  108. <script>
  109. import { STable, VSelect } from '@/components'
  110. import detailModal from './detailModal.vue'
  111. import { settlePayQuery, queryByTypeSum, settlePayMoney, settlePayQuerySum } from '@/api/settlePay.js'
  112. import moment from 'moment'
  113. export default {
  114. components: { STable, VSelect, detailModal },
  115. data () {
  116. return {
  117. advanced: false, // 高级搜索 展开/关闭
  118. disabled: false, // 查询、重置按钮是否可操作
  119. openModal: false, // 详情弹框
  120. tableHeight: 0,
  121. curBizType: '',
  122. // 查询参数
  123. queryParam: {
  124. bizType: 'ALL',
  125. settleNo: '',
  126. bizNo: '',
  127. settleClientName: '',
  128. billState: '',
  129. auditDate: [],
  130. auditBeginDate: '',
  131. auditEndDate: ''
  132. },
  133. // 总计
  134. totalData: {
  135. settledAmount: 0,
  136. totalAmount: 0,
  137. unsettleAmount: 0,
  138. count: 0
  139. },
  140. // 表头
  141. columns: [
  142. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  143. {
  144. title: '付款单号',
  145. dataIndex: 'settleNo',
  146. width: 140,
  147. align: 'center',
  148. customRender: function (text) {
  149. return text || '--'
  150. }
  151. },
  152. {
  153. title: '关联单号',
  154. dataIndex: 'bizNo',
  155. width: 140,
  156. align: 'center',
  157. customRender: function (text) {
  158. return text || '--'
  159. }
  160. },
  161. {
  162. title: '商户名称',
  163. dataIndex: 'settleClientName',
  164. align: 'center',
  165. customRender: function (text) {
  166. return text || '--'
  167. }
  168. },
  169. {
  170. title: '付款金额',
  171. dataIndex: 'totalAmount',
  172. width: 100,
  173. align: 'center',
  174. customRender: function (text) {
  175. return text || text == 0 ? '¥' + text : '--'
  176. }
  177. },
  178. {
  179. title: '付款类型',
  180. dataIndex: 'bizName',
  181. width: 100,
  182. align: 'center',
  183. customRender: function (text) {
  184. return text || '--'
  185. }
  186. },
  187. {
  188. title: '付款方式',
  189. dataIndex: 'settleStyleName',
  190. width: 100,
  191. align: 'center',
  192. customRender: function (text) {
  193. return text || '--'
  194. }
  195. },
  196. {
  197. title: '付款时间',
  198. dataIndex: 'settleTime',
  199. width: 160,
  200. align: 'center',
  201. customRender: function (text) {
  202. return text || '--'
  203. }
  204. },
  205. {
  206. title: '审核时间',
  207. dataIndex: 'auditTime',
  208. width: 160,
  209. align: 'center',
  210. customRender: function (text) {
  211. return text || '--'
  212. }
  213. },
  214. { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
  215. ],
  216. selectedRowKeys: [], // Check here to configure the default column
  217. loading: false,
  218. // 加载数据方法 必须为 Promise 对象
  219. loadData: parameter => {
  220. this.disabled = true
  221. if (this.tableHeight == 0) {
  222. this.tableHeight = window.innerHeight - 450
  223. }
  224. if (this.queryParam.auditDate.length > 0) {
  225. this.queryParam.auditBeginDate = moment(this.queryParam.auditDate[0]).format('YYYY-MM-DD HH:mm:ss')
  226. this.queryParam.auditEndDate = moment(this.queryParam.auditDate[1]).format('YYYY-MM-DD HH:mm:ss')
  227. }
  228. return settlePayQuery(Object.assign(parameter, this.queryParam)).then(res => {
  229. const data = res.data
  230. const no = (data.pageNo - 1) * data.pageSize
  231. for (var i = 0; i < data.list.length; i++) {
  232. data.list[i].no = no + i + 1
  233. }
  234. this.disabled = false
  235. this.totalData.count = data.count
  236. // 查询总计
  237. this.settlePayQuerySum(Object.assign(parameter, this.queryParam))
  238. return data
  239. })
  240. },
  241. tabPaneData: []
  242. }
  243. },
  244. computed: {
  245. hasSelected () {
  246. return this.selectedRowKeys.length > 0
  247. },
  248. rowSelection () {
  249. return {
  250. selectedRowKeys: this.selectedRowKeys,
  251. onChange: (selectedRowKeys, selectedRows) => {
  252. this.selectedRowKeys = selectedRowKeys
  253. },
  254. getCheckboxProps: record => ({
  255. props: {
  256. disabled: record.settleState == 'FINISH'
  257. }
  258. })
  259. }
  260. }
  261. },
  262. beforeRouteEnter (to, from, next) {
  263. next(vm => {
  264. vm.queryByTypeSum()
  265. })
  266. },
  267. methods: {
  268. // 总计
  269. settlePayQuerySum (params) {
  270. settlePayQuerySum(params).then(res => {
  271. console.log(res)
  272. if (res.status == 200) {
  273. this.totalData = Object.assign(this.totalData, res.data)
  274. }
  275. })
  276. },
  277. // 获取类型
  278. queryByTypeSum () {
  279. queryByTypeSum({}).then(res => {
  280. if (res.data && res.status == 200) {
  281. this.tabPaneData = res.data
  282. this.queryParam.bizType = res.data[0].bizType
  283. }
  284. })
  285. },
  286. // 凭证弹框
  287. handleVoucher (row) {
  288. this.$refs.detailModal.getDetail(row.id)
  289. this.openModal = true
  290. },
  291. // 付款
  292. handlePay (row) {
  293. this.loading = true
  294. settlePayMoney({ id: row.id }).then(res => {
  295. this.loading = false
  296. if (res.status == 200) {
  297. this.$message.success(res.message)
  298. this.selectedRowKeys = []
  299. this.$refs.table.refresh()
  300. }
  301. })
  302. },
  303. // 选择类型
  304. handleTabChange (key) {
  305. this.queryParam.bizType = key
  306. this.$refs.table.refresh(true)
  307. this.curBizType = key
  308. },
  309. // 批量付款
  310. handlePayment () {
  311. if (this.selectedRowKeys.length < 1) {
  312. this.$message.warning('请在列表勾选后再进行批量操作!')
  313. return
  314. }
  315. this.loading = true
  316. settlePayMoney({ settleChangeIds: this.selectedRowKeys }).then(res => {
  317. this.loading = false
  318. if (res.status == 200) {
  319. this.$message.success(res.message)
  320. this.selectedRowKeys = []
  321. this.$refs.table.refresh()
  322. }
  323. })
  324. },
  325. // 重置
  326. resetSearchForm () {
  327. this.queryParam = {
  328. bizType: this.curBizType,
  329. settleNo: '',
  330. bizNo: '',
  331. settleClientName: '',
  332. billState: '',
  333. auditDate: [],
  334. auditBeginDate: '',
  335. auditEndDate: ''
  336. }
  337. this.$refs.table.refresh(true)
  338. }
  339. }
  340. }
  341. </script>
  342. <style lang="less">
  343. .finacialPay-wrap {
  344. .sTable {
  345. margin-top: 15px;
  346. }
  347. .finacialPay-tabs {
  348. margin-bottom: 15px;
  349. }
  350. }
  351. </style>