account.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <div class="box">
  3. <div class="null-page" v-show="yes"></div>
  4. <div class="my-account">
  5. <div class="account-wrap">
  6. <div class="account-left">
  7. <div class="title">我的可用余额(元)</div>
  8. <div class="money">
  9. <div class="balance-money">
  10. <b>{{ integer }}</b>
  11. .
  12. <span>{{ decimal }}</span>
  13. </div>
  14. <div class="tx" @click="applyWithdrawal">提现</div>
  15. <div class="cz" @click="rechargeList">充值</div>
  16. </div>
  17. </div>
  18. <div class="account-right">
  19. <div class="item-wrap">
  20. <div class="item">
  21. <div class="iconfont icon-ziyuan"></div>
  22. <div class="title">储值余额:</div>
  23. <b class="num">{{ balanceInfo.balance_money }}</b>
  24. </div>
  25. <div class="item">
  26. <div class="iconfont icon-ziyuan"></div>
  27. <div class="title">现金余额:</div>
  28. <b class="num">{{ balanceInfo.balance }}</b>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. <div class="detail" v-loading="loading">
  34. <el-table :data="accountList" border>
  35. <el-table-column prop="type_name" label="来源" width="150"></el-table-column>
  36. <el-table-column prop="account_data" label="金额" width="150"></el-table-column>
  37. <el-table-column prop="remark" class="detail-name" label="详细说明"></el-table-column>
  38. <el-table-column prop="time" label="时间" width="180"></el-table-column>
  39. </el-table>
  40. </div>
  41. <div class="pager">
  42. <el-pagination
  43. background
  44. :pager-count="5"
  45. :total="total"
  46. prev-text="上一页"
  47. next-text="下一页"
  48. :current-page.sync="account.page"
  49. :page-size.sync="account.page_size"
  50. @size-change="handlePageSizeChange"
  51. @current-change="handleCurrentPageChange"
  52. hide-on-single-page
  53. ></el-pagination>
  54. </div>
  55. </div>
  56. </div>
  57. </template>
  58. <script>
  59. import { balance, withdrawConfig, balanceDetail } from "@/api/member/account"
  60. export default {
  61. name: "account",
  62. layout: "member",
  63. components: {},
  64. data: () => {
  65. return {
  66. account: {
  67. page: 1,
  68. page_size: 10
  69. },
  70. balanceInfo: {
  71. balance: 0,
  72. balance_money: 0
  73. },
  74. accountList: [],
  75. total: 0,
  76. integer: 0,
  77. decimal: 0,
  78. loading: true,
  79. yes: true
  80. }
  81. },
  82. created() {
  83. this.getAccount(), this.getAccountList()
  84. },
  85. mounted() {
  86. let self = this;
  87. setTimeout(function() {
  88. self.yes = false
  89. }, 300)
  90. },
  91. methods: {
  92. //获取余额信息
  93. getAccount() {
  94. balance({ account_type: "balance,balance_money" })
  95. .then(res => {
  96. if (res.code == 0 && res.data) {
  97. this.balanceInfo = res.data
  98. const price = (parseFloat(this.balanceInfo.balance) + parseFloat(this.balanceInfo.balance_money)).toFixed(2)
  99. let priceSplit = price.split(".")
  100. this.integer = priceSplit[0]
  101. this.decimal = priceSplit[1]
  102. }
  103. this.loading = false
  104. })
  105. .catch(err => {
  106. this.loading = false
  107. this.$message.error(err.message)
  108. })
  109. },
  110. //获取余额明细
  111. getAccountList() {
  112. balanceDetail({
  113. page_size: this.account.page_size,
  114. page: this.account.page,
  115. account_type: "balance"
  116. })
  117. .then(res => {
  118. if (res.code == 0 && res.data) {
  119. this.accountList = res.data.list
  120. this.total = res.data.count
  121. this.accountList.forEach(item => {
  122. item.time = this.$util.timeStampTurnTime(item.create_time)
  123. })
  124. }
  125. })
  126. .catch(err => {
  127. this.$message.error(err.message)
  128. })
  129. },
  130. handlePageSizeChange(num) {
  131. this.account.page_size = num
  132. this.getAccountList()
  133. },
  134. handleCurrentPageChange(page) {
  135. this.account.page = page
  136. this.getAccountList()
  137. },
  138. applyWithdrawal() {
  139. this.$router.push("/member/apply_withdrawal")
  140. },
  141. rechargeList() {
  142. this.$router.push("/member/recharge_list")
  143. }
  144. }
  145. }
  146. </script>
  147. <style lang="scss" scoped>
  148. .box {
  149. width: 100%;
  150. position: relative;
  151. }
  152. .null-page {
  153. width: 100%;
  154. height: 730px;
  155. background-color: #FFFFFF;
  156. position: absolute;
  157. top: 0;
  158. left: 0;
  159. z-index: 9;
  160. }
  161. .my-account {
  162. background: #ffffff;
  163. padding: 20px;
  164. .account-wrap {
  165. display: flex;
  166. margin-bottom: 10px;
  167. .account-left {
  168. flex: 1;
  169. .title {
  170. font-size: $ns-font-size-base;
  171. font-weight: 600;
  172. }
  173. .money {
  174. display: flex;
  175. .balance-money {
  176. b {
  177. font-size: 30px;
  178. }
  179. span {
  180. font-weight: 600;
  181. }
  182. }
  183. .tx {
  184. color: $base-color;
  185. margin-left: 5px;
  186. margin-top: 20px;
  187. cursor: pointer;
  188. }
  189. .cz {
  190. color: $base-color;
  191. margin-left: 5px;
  192. margin-top: 20px;
  193. cursor: pointer;
  194. }
  195. }
  196. }
  197. .account-right {
  198. flex: 1;
  199. font-size: $ns-font-size-base;
  200. display: flex;
  201. align-items: center;
  202. .item {
  203. display: flex;
  204. align-items: center;
  205. .title {
  206. margin-left: 3px;
  207. }
  208. .num {
  209. margin-left: 3px;
  210. }
  211. }
  212. }
  213. }
  214. .page {
  215. display: flex;
  216. justify-content: center;
  217. align-content: center;
  218. padding-top: 20px;
  219. }
  220. }
  221. </style>