wallet.vue 4.4 KB

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