list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <a-card size="small" :bordered="false" class="financialCollectionList-wrap">
  3. <!-- 标签页 -->
  4. <a-tabs type="card" default-active-key="ALL" @change="handleTabChange" class="financialCollectionList-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="financialCollectionList-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="financialCollectionList-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="financialCollectionList-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="financialCollectionList-settleState"
  31. code="BILL_STATUS"
  32. placeholder="请选择单据状态"
  33. allowClear
  34. ></v-select>
  35. </a-form-item>
  36. </a-col>
  37. <a-col :md="6" :sm="24">
  38. <a-form-item label="审核时间"><a-range-picker v-model="queryParam.auditDate" id="financialCollectionList-auditDate" /></a-form-item>
  39. </a-col>
  40. </template>
  41. <a-col :md="6" :sm="24">
  42. <span class="table-page-search-submitButtons">
  43. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="financialCollectionList-refresh">查询</a-button>
  44. <a-button style="margin-left: 8px" @click="resetSearchForm()" :disabled="disabled" id="financialCollectionList-reset">重置</a-button>
  45. <a @click="advanced = !advanced" style="margin-left: 8px">
  46. {{ advanced ? '收起' : '展开' }}
  47. <a-icon :type="advanced ? 'up' : 'down'" />
  48. </a>
  49. </span>
  50. </a-col>
  51. </a-row>
  52. </a-form>
  53. </div>
  54. <!-- alert -->
  55. <a-alert type="info" showIcon style="margin-bottom:15px">
  56. <div slot="message">
  57. <strong>{{ totalData.count }}</strong>
  58. 条记录,收款金额合计
  59. <strong>¥{{ totalData.totalAmount }}</strong>
  60. ,其中已收
  61. <strong>¥{{ totalData.settledAmount }}</strong>
  62. ,未收
  63. <strong>¥{{ totalData.unsettleAmount }}</strong>
  64. </div>
  65. </a-alert>
  66. <div style="margin-bottom: 15px">
  67. <a-button type="primary" id="financialCollectionList-export" :loading="loading" @click="handleCollection">批量收款</a-button>
  68. <span style="margin-left: 8px">
  69. <template v-if="hasSelected">
  70. {{ `已选 ${selectedRowKeys.length} 项` }}
  71. </template>
  72. </span>
  73. </div>
  74. <!-- 列表 -->
  75. <s-table
  76. class="sTable"
  77. ref="table"
  78. size="default"
  79. :row-selection="rowSelection"
  80. :rowKey="record => record.id"
  81. :columns="columns"
  82. :data="loadData"
  83. :scroll="{ x: 1290, y: tableHeight }"
  84. bordered
  85. >
  86. <!-- 操作 -->
  87. <template slot="action" slot-scope="text, record">
  88. <a-button
  89. size="small"
  90. type="link"
  91. class="button-info"
  92. v-if="record.settleState == 'FINISH'"
  93. @click="handleVoucher(record)"
  94. id="financialCollectionList-voucher-btn">凭证</a-button>
  95. <a-button
  96. size="small"
  97. type="link"
  98. :loading="loading"
  99. class="button-warning"
  100. v-else
  101. @click="handleCollectionSing(record)"
  102. id="financialCollectionList-pay-btn">收款</a-button>
  103. </template>
  104. </s-table>
  105. <!-- 详情 -->
  106. <detail-modal :openModal="openModal" ref="detailModal" @close="openModal = false" />
  107. </a-card>
  108. </template>
  109. <script>
  110. import { STable, VSelect } from '@/components'
  111. import detailModal from './detailModal.vue'
  112. import { settleReceiptQuery, queryByTypeSum, settleReceiptMoney, settleReceiptQuerySum } from '@/api/settleReceipt'
  113. import moment from 'moment'
  114. export default {
  115. components: { STable, VSelect, detailModal },
  116. data () {
  117. return {
  118. advanced: false, // 高级搜索 展开/关闭
  119. disabled: false, // 查询、重置按钮是否可操作
  120. openModal: false, // 详情弹框
  121. tableHeight: 0,
  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 settleReceiptQuery(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.settleReceiptQuerySum(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. settleReceiptQuerySum (params) {
  270. settleReceiptQuerySum(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. handleCollectionSing (row) {
  293. this.loading = true
  294. settleReceiptMoney({ 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. handleCollection () {
  311. if (this.selectedRowKeys.length < 1) {
  312. this.$message.warning('请在列表勾选后再进行批量操作!')
  313. return
  314. }
  315. this.loading = true
  316. settleReceiptMoney({ 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. .financialCollectionList-wrap {
  344. .sTable {
  345. margin-top: 15px;
  346. }
  347. .financialCollectionList-tabs {
  348. margin-bottom: 15px;
  349. }
  350. }
  351. </style>