list.vue 12 KB

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