list.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. <a-range-picker v-model="time" allowClear :disabledDate="disabledDate" format="YYYY-MM-DD" @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;padding: 2px 0;">
  22. <div style="display: flex;align-items: center;">
  23. 可提现金额:<span>{{pageInfo?toThousands(pageInfo.activeAmount,2):'--'}}</span>
  24. <a-button size="small" type="primary" class="button-primary" @click="handleTX">申请提现</a-button>
  25. <span>(提示:① 提现手续费为0.5元/笔;② 资金到账周期为工作日+1天)</span>
  26. </div>
  27. </div>
  28. </div>
  29. <s-table
  30. class="sTable fixPagination"
  31. ref="table"
  32. :style="{ height: tableHeight+77+'px' }"
  33. size="small"
  34. :rowKey="(record) => record.id"
  35. :columns="columns"
  36. :data="loadData"
  37. :scroll="{ y:tableHeight }"
  38. :defaultLoadData="false"
  39. bordered>
  40. </s-table>
  41. </a-spin>
  42. <!-- 申请提现 -->
  43. <applyWithdrawal :isOpenModal="showModal" :currentData="currentData" @close="showModal=false" @refresh="getPageInfo"></applyWithdrawal>
  44. </a-card>
  45. </template>
  46. <script>
  47. import { commonMixin } from '@/utils/mixin'
  48. import moment from 'moment'
  49. import { STable } from '@/components'
  50. import applyWithdrawal from './applyWithdrawal.vue'
  51. import {queryMerchantCashOutPage,merchantCashOutDetail} from '@/api/merchant'
  52. import {toThousands} from '@/libs/tools.js'
  53. export default {
  54. components: { STable, applyWithdrawal, commonMixin },
  55. data () {
  56. return {
  57. toThousands,
  58. spinning: false,
  59. disabled: false,
  60. tableHeight: 0,
  61. showModal: false,
  62. currentData: null,
  63. time: [],
  64. pageInfo:null,
  65. queryParam:{
  66. beginDate:'',
  67. endDate:''
  68. },
  69. columns: [
  70. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  71. { title: '提现单号', dataIndex: 'cashOutNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  72. { title: '提现时间', dataIndex: 'cashOutDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  73. { title: '申请提现金额', dataIndex: 'amount', width: '10%', align: 'right', customRender: function (text) { return toThousands(text,2) || '--' } },
  74. { title: '开户名', dataIndex: 'bankAccount', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  75. { title: '银行卡号', dataIndex: 'bankCard', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
  76. { title: '提现人', dataIndex: 'operName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  77. { title: '状态', dataIndex: 'stateDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  78. { title: '备注', dataIndex: 'remarks', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
  79. ],
  80. // 加载数据方法 必须为 Promise 对象
  81. loadData: parameter => {
  82. const _this = this
  83. _this.disabled = true
  84. _this.spinning = true
  85. const paramsPage = Object.assign(parameter,this.queryParam) // 有分页
  86. paramsPage.merchantSn=this.pageInfo?this.pageInfo.merchantSn:''
  87. paramsPage.merchantType='DEALER'
  88. return queryMerchantCashOutPage(paramsPage).then(res => {
  89. let data
  90. if (res.status == 200) {
  91. data = res.data
  92. const no = (data.pageNo - 1) * data.pageSize
  93. for (var i = 0; i < data.list.length; i++) {
  94. data.list[i].no = no + i + 1
  95. }
  96. this.disabled = false
  97. }
  98. this.spinning = false
  99. return data
  100. })
  101. }
  102. }
  103. },
  104. methods: {
  105. // 时间改变
  106. dateChange (date) {
  107. console.log(date,'date')
  108. this.queryParam.beginDate=moment(date[0]).format('YYYY-MM-DD')
  109. this.queryParam.endDate=moment(date[1]).format('YYYY-MM-DD')
  110. },
  111. // 禁止选择今天之后的日期
  112. disabledDate (current) {
  113. return current && current > moment().endOf('day')
  114. },
  115. getPageInfo () {
  116. merchantCashOutDetail({}).then(res => {
  117. console.log(res, '===========')
  118. if (res.status == 200) {
  119. this.pageInfo = res.data
  120. this.$refs.table.refresh(true)
  121. } else {
  122. this.pageInfo = null
  123. }
  124. })
  125. },
  126. // 重置
  127. resetSearchForm () {
  128. this.time = []
  129. this.$refs.table.refresh(true)
  130. },
  131. // 申请提现
  132. handleTX () {
  133. this.showModal = true
  134. },
  135. setTableH () {
  136. const tableSearchH = this.$refs.tableSearch.offsetHeight
  137. this.tableHeight = window.innerHeight - tableSearchH - 265
  138. },
  139. pageInit () {
  140. const _this = this
  141. this.$nextTick(() => { // 页面渲染完成后的回调
  142. _this.setTableH()
  143. })
  144. _this.getPageInfo()
  145. }
  146. },
  147. mounted () {
  148. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  149. this.pageInit()
  150. this.resetSearchForm()
  151. }
  152. },
  153. watch: {
  154. advanced (newValue, oldValue) {
  155. const _this = this
  156. setTimeout(() => {
  157. _this.setTableH()
  158. }, 400)
  159. },
  160. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  161. this.setTableH()
  162. }
  163. },
  164. activated () {
  165. // 如果是新页签打开,则重置当前页面
  166. if (this.$store.state.app.isNewTab) {
  167. this.pageInit()
  168. this.resetSearchForm()
  169. }
  170. // 仅刷新列表,不重置页面
  171. if (this.$store.state.app.updateList) {
  172. this.pageInit()
  173. this.$refs.table.refresh()
  174. }
  175. },
  176. beforeRouteEnter (to, from, next) {
  177. next(vm => {})
  178. }
  179. }
  180. </script>
  181. <style lang="less">
  182. .accountManagementList-wrap{
  183. }
  184. </style>