list.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <a-card size="small" :bordered="false" class="accountManagementList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch" class="table-page-search-wrapper">
  6. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  7. <a-row :gutter="15">
  8. <a-col :xl="6" :lg="6" :md="12" :sm="24">
  9. <a-form-item label="交易时间">
  10. <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :xl="6" :lg="6" :md="6" :sm="6">
  14. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="outboundOrderList-refresh" >查询</a-button>
  15. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="outboundOrderList-reset">重置</a-button>
  16. </a-col>
  17. </a-row>
  18. </a-form>
  19. </div>
  20. <div style="margin:10px 0">
  21. <div style="display: flex;align-items: center;">
  22. 账户余额:<span>{{ pageInfo?toThousands(pageInfo.totalAmount,2):'--' }}</span>
  23. </div>
  24. </div>
  25. <s-table
  26. class="sTable fixPagination"
  27. ref="table"
  28. :style="{ height: tableHeight+77+'px' }"
  29. size="small"
  30. :rowKey="(record) => record.id"
  31. :columns="columns"
  32. :data="loadData"
  33. :scroll="{ y:tableHeight }"
  34. :defaultLoadData="false"
  35. bordered>
  36. </s-table>
  37. </a-spin>
  38. </a-card>
  39. </template>
  40. <script>
  41. import { commonMixin } from '@/utils/mixin'
  42. import moment from 'moment'
  43. import { STable } from '@/components'
  44. import rangeDate from '@/views/common/rangeDate.vue'
  45. import { queryTradeFlowPage, merchantCashOutDetail } from '@/api/merchant'
  46. import { toThousands } from '@/libs/tools.js'
  47. export default {
  48. mixins: [commonMixin],
  49. components: { STable, rangeDate },
  50. data () {
  51. return {
  52. toThousands,
  53. spinning: false,
  54. disabled: false,
  55. tableHeight: 0,
  56. showModal: false,
  57. currentData: null,
  58. pageInfo: null,
  59. time: [],
  60. queryParam: {
  61. beginDate: '',
  62. endDate: ''
  63. },
  64. columns: [
  65. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  66. { title: '交易时间', dataIndex: 'tradeTime', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  67. { title: '交易说明', dataIndex: 'bizInfo', width: '30%', align: 'left', customRender: function (text) { return text || '--' } },
  68. { title: '交易类型', dataIndex: 'bizType', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  69. { title: '交易金额', dataIndex: 'amount', width: '10%', align: 'right', customRender: function (text) { return toThousands(text, 2) || '--' } },
  70. { title: '手续费', dataIndex: 'totalChannelFee ', width: '10%', align: 'center', customRender: function (text) { return toThousands(text, 2) || '--' } },
  71. { title: '账户变动', dataIndex: 'tradeAmount', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  72. { title: '变动后余额', dataIndex: 'afterBalance', width: '10%', align: 'right', customRender: function (text) { return toThousands(text, 2) || '--' } }
  73. ],
  74. // 加载数据方法 必须为 Promise 对象
  75. loadData: parameter => {
  76. const _this = this
  77. _this.disabled = true
  78. _this.spinning = true
  79. const paramsPage = Object.assign(parameter, this.queryParam) // 有分页
  80. paramsPage.merchantNo = this.pageInfo ? this.pageInfo.merchantNo : ''
  81. return queryTradeFlowPage(paramsPage).then(res => {
  82. let data
  83. if (res.status == 200) {
  84. data = res.data
  85. // this.getCount(paramsPage)
  86. const no = (data.pageNo - 1) * data.pageSize
  87. for (var i = 0; i < data.list.length; i++) {
  88. data.list[i].no = no + i + 1
  89. }
  90. this.disabled = false
  91. }
  92. this.spinning = false
  93. return data
  94. })
  95. }
  96. }
  97. },
  98. methods: {
  99. // 时间改变
  100. dateChange (date) {
  101. console.log(date, 'date')
  102. this.queryParam.beginDate = date[0] ? moment(date[0]).format('YYYY-MM-DD') : ''
  103. this.queryParam.endDate = date[1] ? moment(date[1]).format('YYYY-MM-DD') : ''
  104. },
  105. getPageInfo () {
  106. merchantCashOutDetail({}).then(res => {
  107. console.log(res, '===========')
  108. if (res.status == 200) {
  109. this.pageInfo = res.data
  110. this.$refs.table.refresh(true)
  111. } else {
  112. this.pageInfo = null
  113. }
  114. })
  115. },
  116. // 重置
  117. resetSearchForm () {
  118. this.time = []
  119. this.$refs.rangeDate.resetDate(this.time)
  120. this.$refs.table.refresh(true)
  121. },
  122. // 申请提现
  123. handleTX () {
  124. this.showModal = true
  125. },
  126. setTableH () {
  127. const tableSearchH = this.$refs.tableSearch.offsetHeight
  128. this.tableHeight = window.innerHeight - tableSearchH - 265
  129. },
  130. pageInit () {
  131. const _this = this
  132. this.$nextTick(() => { // 页面渲染完成后的回调
  133. _this.setTableH()
  134. })
  135. _this.getPageInfo()
  136. }
  137. },
  138. mounted () {
  139. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  140. this.pageInit()
  141. this.resetSearchForm()
  142. }
  143. },
  144. watch: {
  145. advanced (newValue, oldValue) {
  146. const _this = this
  147. setTimeout(() => {
  148. _this.setTableH()
  149. }, 400)
  150. },
  151. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  152. this.setTableH()
  153. }
  154. },
  155. activated () {
  156. // 如果是新页签打开,则重置当前页面
  157. if (this.$store.state.app.isNewTab) {
  158. this.pageInit()
  159. this.resetSearchForm()
  160. }
  161. // 仅刷新列表,不重置页面
  162. if (this.$store.state.app.updateList) {
  163. this.pageInit()
  164. this.$refs.table.refresh()
  165. }
  166. },
  167. beforeRouteEnter (to, from, next) {
  168. next(vm => {})
  169. }
  170. }
  171. </script>
  172. <style lang="less">
  173. .accountManagementList-wrap{
  174. }
  175. </style>