list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  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="审核时间">
  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="financialCollectionList-refresh">查询</a-button>
  46. <a-button style="margin-left: 8px" @click="resetSearchForm()" :disabled="disabled" id="financialCollectionList-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="financialCollectionList-export" :loading="loading" @click="handleCollection">批量收款</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: 1460, 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="financialCollectionList-voucher-btn">凭证</a-button>
  97. <a-button
  98. size="small"
  99. type="link"
  100. :loading="loading"
  101. class="button-warning"
  102. v-else
  103. @click="handleCollectionSing(record)"
  104. id="financialCollectionList-pay-btn">收款</a-button>
  105. </template>
  106. </s-table>
  107. <!-- 详情 -->
  108. <detail-modal :openModal="openModal" ref="detailModal" @close="openModal = false" />
  109. </a-card>
  110. </template>
  111. <script>
  112. import { STable, VSelect } from '@/components'
  113. import detailModal from './detailModal.vue'
  114. import rangeDate from '@/views/common/rangeDate.vue'
  115. import { settleReceiptQuery, queryByTypeSum, settleReceiptMoney, settleReceiptQuerySum } from '@/api/settleReceipt'
  116. export default {
  117. components: { STable, VSelect, detailModal, rangeDate },
  118. data () {
  119. return {
  120. advanced: false, // 高级搜索 展开/关闭
  121. disabled: false, // 查询、重置按钮是否可操作
  122. openModal: false, // 详情弹框
  123. tableHeight: 0,
  124. // 查询参数
  125. queryParam: {
  126. bizType: 'ALL',
  127. settleNo: '',
  128. bizNo: '',
  129. settleClientName: '',
  130. billState: '',
  131. auditBeginDate: '',
  132. auditEndDate: ''
  133. },
  134. // 总计
  135. totalData: {
  136. settledAmount: 0,
  137. totalAmount: 0,
  138. unsettleAmount: 0,
  139. count: 0
  140. },
  141. // 表头
  142. columns: [
  143. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  144. {
  145. title: '收款单号',
  146. dataIndex: 'settleNo',
  147. width: 220,
  148. align: 'center',
  149. customRender: function (text) {
  150. return text || '--'
  151. }
  152. },
  153. {
  154. title: '关联单号',
  155. dataIndex: 'bizNo',
  156. width: 220,
  157. align: 'center',
  158. customRender: function (text) {
  159. return text || '--'
  160. }
  161. },
  162. {
  163. title: '商户名称',
  164. dataIndex: 'settleClientName',
  165. align: 'center',
  166. customRender: function (text) {
  167. return text || '--'
  168. }
  169. },
  170. {
  171. title: '收款金额',
  172. width: 100,
  173. align: 'center',
  174. customRender: function (text, record) {
  175. const val = record.settleState == 'SETTLED' ? record.settledAmount : record.unsettleAmount
  176. return val || val == 0 ? '¥' + val : '--'
  177. }
  178. },
  179. {
  180. title: '收款类型',
  181. dataIndex: 'bizName',
  182. width: 100,
  183. align: 'center',
  184. customRender: function (text) {
  185. return text || '--'
  186. }
  187. },
  188. {
  189. title: '收款方式',
  190. dataIndex: 'settleStyleName',
  191. width: 100,
  192. align: 'center',
  193. customRender: function (text) {
  194. return text || '--'
  195. }
  196. },
  197. {
  198. title: '审核时间',
  199. dataIndex: 'auditTime',
  200. width: 160,
  201. align: 'center',
  202. customRender: function (text) {
  203. return text || '--'
  204. }
  205. },
  206. {
  207. title: '收款时间',
  208. dataIndex: 'settleTime',
  209. width: 160,
  210. align: 'center',
  211. customRender: function (text) {
  212. return text || '--'
  213. }
  214. },
  215. { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
  216. ],
  217. selectedRowKeys: [], // Check here to configure the default column
  218. loading: false,
  219. // 加载数据方法 必须为 Promise 对象
  220. loadData: parameter => {
  221. this.disabled = true
  222. if (this.tableHeight == 0) {
  223. this.tableHeight = window.innerHeight - 450
  224. }
  225. return settleReceiptQuery(Object.assign(parameter, this.queryParam)).then(res => {
  226. const data = res.data
  227. const no = (data.pageNo - 1) * data.pageSize
  228. for (var i = 0; i < data.list.length; i++) {
  229. data.list[i].no = no + i + 1
  230. }
  231. this.disabled = false
  232. this.totalData.count = data.count
  233. // 查询总计
  234. this.settleReceiptQuerySum(Object.assign(parameter, this.queryParam))
  235. return data
  236. })
  237. },
  238. tabPaneData: []
  239. }
  240. },
  241. computed: {
  242. hasSelected () {
  243. return this.selectedRowKeys.length > 0
  244. },
  245. rowSelection () {
  246. return {
  247. selectedRowKeys: this.selectedRowKeys,
  248. onChange: (selectedRowKeys, selectedRows) => {
  249. this.selectedRowKeys = selectedRowKeys
  250. },
  251. getCheckboxProps: record => ({
  252. props: {
  253. disabled: record.settleState == 'SETTLED'
  254. }
  255. })
  256. }
  257. }
  258. },
  259. beforeRouteEnter (to, from, next) {
  260. next(vm => {
  261. vm.queryByTypeSum()
  262. })
  263. },
  264. methods: {
  265. // 时间 change
  266. dateChange (date) {
  267. this.queryParam.auditBeginDate = date[0]
  268. this.queryParam.auditEndDate = date[1]
  269. },
  270. // 总计
  271. settleReceiptQuerySum (params) {
  272. settleReceiptQuerySum(params).then(res => {
  273. console.log(res)
  274. if (res.status == 200) {
  275. this.totalData = Object.assign(this.totalData, res.data)
  276. }
  277. })
  278. },
  279. // 获取类型
  280. queryByTypeSum () {
  281. queryByTypeSum({}).then(res => {
  282. if (res.data && res.status == 200) {
  283. this.tabPaneData = res.data
  284. this.queryParam.bizType = res.data[0].bizType
  285. }
  286. })
  287. },
  288. // 凭证弹框
  289. handleVoucher (row) {
  290. this.$refs.detailModal.getDetail(row.id)
  291. this.openModal = true
  292. },
  293. // 收款
  294. handleCollectionSing (row) {
  295. this.loading = true
  296. settleReceiptMoney([row.id]).then(res => {
  297. this.loading = false
  298. if (res.status == 200) {
  299. this.$message.success(res.message)
  300. this.selectedRowKeys = []
  301. this.$refs.table.refresh()
  302. }
  303. })
  304. },
  305. // 选择类型
  306. handleTabChange (key) {
  307. this.queryParam.bizType = key
  308. this.$refs.table.refresh(true)
  309. this.curBizType = key
  310. },
  311. // 批量收款
  312. handleCollection () {
  313. if (this.selectedRowKeys.length < 1) {
  314. this.$message.warning('请在列表勾选后再进行批量操作!')
  315. return
  316. }
  317. this.loading = true
  318. settleReceiptMoney(this.selectedRowKeys).then(res => {
  319. this.loading = false
  320. if (res.status == 200) {
  321. this.$message.success(res.message)
  322. this.selectedRowKeys = []
  323. this.$refs.table.refresh()
  324. }
  325. })
  326. },
  327. // 重置
  328. resetSearchForm () {
  329. if (this.advanced) {
  330. this.$refs.rangeDate.resetDate()
  331. }
  332. this.queryParam = {
  333. bizType: this.curBizType,
  334. settleNo: '',
  335. bizNo: '',
  336. settleClientName: '',
  337. billState: '',
  338. auditBeginDate: '',
  339. auditEndDate: ''
  340. }
  341. this.$refs.table.refresh(true)
  342. }
  343. }
  344. }
  345. </script>
  346. <style lang="less">
  347. .financialCollectionList-wrap {
  348. .sTable {
  349. margin-top: 15px;
  350. }
  351. .financialCollectionList-tabs {
  352. margin-bottom: 15px;
  353. }
  354. }
  355. </style>