list.vue 12 KB

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