wallet.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <view>
  3. <view class="my_top">
  4. <image src="../../static/images/top-bg.png" class="bg"></image>
  5. </view>
  6. <view class="list animated fadeInDown">
  7. <view class="uni-flex uni-row center">
  8. <view class="wallet">
  9. <h1 style="color: blue;">{{ user.wallet }}</h1>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="uni-flex uni-row" style="padding:1rem; ">
  14. <button type="primary" style="-webkit-flex: 1;flex: 1;"
  15. @click="goto('/pages/wallet/topup/edit')">充值</button>
  16. <view class="text" style="width: 15rpx;"></view>
  17. <button type="default" style="-webkit-flex: 1;flex: 1;"
  18. @click="goto('/pages/wallet/topdown/edit')">兑现</button>
  19. </view>
  20. <view class="tab">
  21. <u-tabs :list="tab" @click="click" :lineHeight="5"></u-tabs>
  22. </view>
  23. <view class="goodsList">
  24. <view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
  25. <view class="title">{{ item.tagTypeName }}
  26. <view class="state" v-if="item.tagType == 1 ">
  27. <text class="icon" style="color:#13ce66">&#xe830;</text>
  28. <text>+{{ item.amount }}</text>
  29. </view>
  30. <view class="state" v-if="item.tagType == 2 ">
  31. <text class="icon" style="color:#FF2222">&#xe830;</text>
  32. <text>-{{ item.amount }}</text>
  33. </view>
  34. <view class="state" v-if="item.tagType == 3 ">
  35. <text class="icon" style="color:#CC8855">&#xe830;</text>
  36. <text>-{{ item.amount }}</text>
  37. </view>
  38. </view>
  39. <view class="op">
  40. <view class="date">{{ item.recordTime }}</view>
  41. </view>
  42. </view>
  43. <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  44. <u-empty v-if="!loadMore && list.length == 0"></u-empty>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. export default {
  50. data() {
  51. return {
  52. user: {},
  53. tab: [{
  54. name: '全部',
  55. tagType: ''
  56. },
  57. {
  58. name: '充值',
  59. tagType: '1'
  60. },
  61. {
  62. name: '兑现',
  63. tagType: '2'
  64. },
  65. {
  66. name: '扣除',
  67. tagType: '3'
  68. }
  69. ],
  70. param: {
  71. pageNo: 1,
  72. pageSize: 10,
  73. status:2,
  74. tagType: ''
  75. },
  76. list: [],
  77. loadMore: true,
  78. };
  79. },
  80. onLoad() {
  81. this.user = this.getUser()
  82. },
  83. onShow() {
  84. this.user = this.getUser();
  85. this.getData();
  86. },
  87. methods: {
  88. getData() {
  89. this.param.peopleId = this.user.fkId;
  90. this.http.request({
  91. url: '/level-one-server/app/WalletManage/getList',
  92. loading: 'false',
  93. data: this.param,
  94. success: res => {
  95. this.loadMore = parseInt(res.data.pageCount) > this.param.pageNo;
  96. if (res.data.data) {
  97. this.list = res.data.data;
  98. }
  99. }
  100. });
  101. },
  102. // 点击tab切换
  103. click(e) {
  104. this.param.tagType = e.tagType;
  105. this.refresh()
  106. },
  107. detail(item) {
  108. let urlStr = ''
  109. if (item.tagType == 1) {
  110. urlStr = '/pages/wallet/topup/detail?id='
  111. }
  112. if (item.tagType == 2) {
  113. urlStr = '/pages/wallet/topdown/detail?id='
  114. }
  115. if (item.tagType == 3) {
  116. urlStr = '/pages/wallet/detail?id='
  117. }
  118. uni.navigateTo({
  119. url: urlStr + item.id
  120. });
  121. },
  122. goto(url) {
  123. uni.navigateTo({
  124. url: url
  125. });
  126. },
  127. // 刷新数据
  128. refresh() {
  129. this.loadMore = true;
  130. this.param.pageNo = 1;
  131. this.list = [];
  132. this.getData();
  133. }
  134. },
  135. //下拉刷新
  136. onPullDownRefresh() {
  137. setTimeout(() => {
  138. this.refresh();
  139. uni.stopPullDownRefresh();
  140. }, 1000);
  141. },
  142. //上拉加载
  143. onReachBottom() {
  144. if (this.loadMore) {
  145. this.param.pageNo++;
  146. this.getData();
  147. }
  148. }
  149. };
  150. </script>
  151. <style lang="scss">
  152. page {
  153. background-color: #f5f5f5;
  154. }
  155. .my_top {
  156. position: relative;
  157. overflow: hidden;
  158. image {
  159. width: 100%;
  160. }
  161. }
  162. .uni-flex {
  163. display: flex;
  164. flex-direction: row;
  165. }
  166. .uni-flex-item {
  167. flex: 1;
  168. }
  169. .uni-row {
  170. flex-direction: row;
  171. }
  172. .list {
  173. position: relative;
  174. padding: 0px 20px 10px 20px;
  175. margin-top: -226px;
  176. .center {
  177. -webkit-justify-content: center;
  178. justify-content: center;
  179. text-align: center;
  180. .wallet {
  181. display: flex;
  182. flex-direction: column;
  183. background-color: white;
  184. width: 5rem;
  185. height: 5rem;
  186. line-height: 5rem;
  187. border-radius: 50%;
  188. .num {
  189. color: #0000CC;
  190. font-size: 43px;
  191. }
  192. }
  193. .rbtn {
  194. padding-left: 15px;
  195. width: 60%;
  196. }
  197. }
  198. }
  199. .state {
  200. margin-right: -70px;
  201. }
  202. .down_btn {
  203. color: #f0f4f7;
  204. width: 100px;
  205. background: #f9ae3d;
  206. text-align: center;
  207. border-radius: 10px;
  208. font-size: 12px;
  209. padding: 2px 5px;
  210. }
  211. </style>