userCenterMyBalance.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <div class="userCenterMyBalance">
  3. <div class="title">
  4. {{ $t('common.myBalance') }}
  5. ({{ balance | twoDecimal }}{{ $i18n.locale == 'zh' ? '元' : 'CNY' }})
  6. </div>
  7. <div class="table">
  8. <div class="search">
  9. <span :class="{active:params.search1==='全部'}"
  10. @click="activeChange('全部')">{{ $i18n.locale == 'zh' ? '全部' : 'All' }}</span>
  11. <span :class="{active:params.search1==='收入'}"
  12. @click="activeChange('收入')">{{ $i18n.locale == 'zh' ? '收入' : 'income' }}</span>
  13. <span :class="{active:params.search1==='支出'}"
  14. @click="activeChange('支出')">{{ $i18n.locale == 'zh' ? '支出' : 'expend' }}</span>
  15. <el-button type="primary" style="margin: 20px 20px 8px;float: right;" @click="topUp">
  16. {{ $i18n.locale == 'zh' ? '充值' : 'top up' }}
  17. </el-button>
  18. </div>
  19. <el-table
  20. :data="userPaymentDetailsPage"
  21. v-loading="loading"
  22. style="width: 100%"
  23. :header-cell-style="{backgroundColor:'#f8f8f8'}">
  24. <el-table-column
  25. prop="serialNumber"
  26. align="center"
  27. :label="$i18n.locale==='zh'?'流水号':'serial number'"
  28. width="150">
  29. </el-table-column>
  30. <el-table-column
  31. align="center"
  32. :label="$i18n.locale==='zh'?'日期':'date'"
  33. width="150">
  34. <template slot-scope="scope">
  35. <span>{{ scope.row.updateDate | time('YYYY-MM-DD HH:mm:ss') }}</span>
  36. </template>
  37. </el-table-column>
  38. <el-table-column
  39. prop="type"
  40. align="center"
  41. :label="$i18n.locale==='zh'?'类型':'type'"
  42. width="100">
  43. </el-table-column>
  44. <el-table-column
  45. prop="money"
  46. align="center"
  47. :label="$i18n.locale==='zh'?'金额':'money'"
  48. width="120">
  49. </el-table-column>
  50. <el-table-column
  51. prop="balance"
  52. align="center"
  53. :label="$i18n.locale==='zh'?'账户余额(元)':'balance (CNY)'"
  54. width="120">
  55. </el-table-column>
  56. <el-table-column
  57. prop="payment"
  58. align="center"
  59. :label="$i18n.locale==='zh'?'支付方式':'payment'"
  60. width="120">
  61. </el-table-column>
  62. <el-table-column
  63. prop="remark"
  64. align="center"
  65. :label="$i18n.locale==='zh'?'备注':'remark'"
  66. min-width="150">
  67. </el-table-column>
  68. </el-table>
  69. <el-pagination
  70. background
  71. @size-change="(val)=>{page.pageSize = val;}"
  72. @current-change="(val)=>{page.pageNo = val;}"
  73. layout="prev, pager, next"
  74. :total="page.total"
  75. :current-page="page.pageNo"
  76. :page-sizes="[10, 20, 50, 100]"
  77. :page-size="page.pageSize"
  78. style="text-align: center;margin-top: 20px;">
  79. </el-pagination>
  80. </div>
  81. </div>
  82. </template>
  83. <script>
  84. import {
  85. addUmsUserCommodityAddresss,
  86. deleteUmsUserCommodityAddresss,
  87. getSysAreaList,
  88. getUmsUserCommodityAddresss
  89. } from "@/api/user";
  90. import moment from "moment";
  91. export default {
  92. name: "userCenterMyBalance",
  93. data() {
  94. return {
  95. booleanFlag: {},
  96. user: {
  97. umsUser: {}
  98. },
  99. loading: false,
  100. params: {
  101. search1: '全部'
  102. },
  103. page: {
  104. pageNo: 1,
  105. pageSize: 10,
  106. total: 0
  107. },
  108. balance:'10.00',
  109. userPaymentDetailsPage:[
  110. {
  111. serialNumber:'202011110140',
  112. updateDate:1647487082000,
  113. type:'1',
  114. money:'30.00',
  115. balance:'10.00',
  116. payment:'支付宝',
  117. remark:'',
  118. },
  119. {
  120. serialNumber:'202011110140',
  121. updateDate:1647487000000,
  122. type:'0',
  123. money:'30.00',
  124. balance:'40.00',
  125. payment:'余额',
  126. remark:'',
  127. },
  128. ]
  129. }
  130. },
  131. filters:{
  132. twoDecimal(value) {
  133. return parseFloat(String(value)).toFixed(2)
  134. },
  135. time(date, type) {
  136. return moment(date).format(type)
  137. },
  138. },
  139. watch: {
  140. page: {
  141. handler: function () {
  142. this.loading = true
  143. this.getUserPaymentDetailsPage()
  144. },
  145. deep: true
  146. },
  147. params: {
  148. handler: function () {
  149. this.loading = true
  150. },
  151. deep: true
  152. },
  153. },
  154. mounted() {
  155. this.init()
  156. },
  157. methods: {
  158. init() {
  159. this.user = JSON.parse(window.localStorage.getItem('user'));
  160. if (this.user.umsUser.userPic == undefined) {
  161. this.user.umsUser.userPic = ''
  162. }
  163. this.getUserPaymentDetailsPage()
  164. },
  165. getUserPaymentDetailsPage(){
  166. setTimeout(()=>{
  167. this.loading = false
  168. },500)
  169. },
  170. activeChange(value) {
  171. this.params.search1 = value
  172. this.page.pageNo = 1
  173. this.getUserPaymentDetailsPage()
  174. },
  175. topUp(){
  176. alert('topUp()')
  177. }
  178. }
  179. }
  180. </script>
  181. <style scoped lang="less">
  182. .userCenterMyBalance{
  183. .title {
  184. height: 60px;
  185. line-height: 60px;
  186. padding-top: 30px;
  187. margin-left: 30px;
  188. margin-right: 30px;
  189. border-bottom: 1px solid rgba(228, 228, 228, 1);
  190. }
  191. .search {
  192. font-size: 14px;
  193. font-weight: 600;
  194. height: 70px;
  195. line-height: 70px;
  196. span {
  197. cursor: pointer;
  198. margin: 0 30px;
  199. &.active {
  200. color: #60aae3;
  201. }
  202. }
  203. }
  204. }
  205. </style>