wallet.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. <template>
  2. <view class="content">
  3. <view class="title-box">
  4. <view class="yue-box">
  5. <view class="yue-top">
  6. 我的余额(元)
  7. </view>
  8. <view class="yue-bottom">
  9. {{money || 0}}
  10. </view>
  11. </view>
  12. <view class="box">
  13. <view class="cz" @click="navTo('/pages/money/recharge')">
  14. 充值
  15. </view>
  16. <view class="cz" @click="navTo('/pages/money/withdrawal')">
  17. 提现
  18. </view>
  19. </view>
  20. </view>
  21. <view class="center-box">
  22. <view class="centet-left">
  23. <view class="top">
  24. {{userInfo.recharge || 0}}
  25. </view>
  26. <view class="bottom">
  27. 历史充值(元)
  28. </view>
  29. </view>
  30. <view class="" style="width: 2rpx;height: 54rpx;background: #EEEEEE;"></view>
  31. <view class="centet-left">
  32. <view class="top">
  33. {{userInfo.extraxt|| 0}}
  34. </view>
  35. <view class="bottom">
  36. 历史提现(元)
  37. </view>
  38. </view>
  39. </view>
  40. <scroll-view class="good-content" scroll-y @scrolltolower="loadData" :style="{'height': height}">
  41. <!-- 空白页 -->
  42. <!-- <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty> -->
  43. <!-- 订单列表 -->
  44. <view class="detail" v-for="item in orderList">
  45. <view class="det-left">
  46. <view class="det-top">
  47. {{ item.title }}
  48. </view>
  49. <view class="det-bottom">
  50. {{ item.add_time }}
  51. </view>
  52. </view>
  53. <view class="det-right">
  54. {{ (item.pm == 0 ? '-' : '+') + item.number }}
  55. </view>
  56. </view>
  57. <uni-load-more :status="loadingType"></uni-load-more>
  58. </scroll-view>
  59. </view>
  60. </template>
  61. <script>
  62. import { mapState, mapMutations } from 'vuex';
  63. import {
  64. getUserInfo
  65. } from '@/api/user.js';
  66. import {
  67. spreadCommission,
  68. userBalance
  69. } from '@/api/wallet.js';
  70. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  71. import empty from '@/components/empty';
  72. export default {
  73. components: {
  74. empty,
  75. uniLoadMore
  76. },
  77. data() {
  78. return {
  79. tabCurrentIndex: 0,
  80. height: '',
  81. state: 0,
  82. loadingType: 'more',
  83. orderList: [],
  84. page: 1, //当前页数
  85. limit: 10 ,//每次信息条数
  86. money: '',
  87. cz: '',//历史充值
  88. tx: '',//历史提现
  89. };
  90. },
  91. onReady(res) {
  92. var obj = this;
  93. uni.getSystemInfo({
  94. success: resu => {
  95. const query = uni.createSelectorQuery();
  96. query.select('.good-content').boundingClientRect();
  97. query.exec(function(res) {
  98. obj.height = resu.windowHeight - res[0].top + 'px';
  99. console.log(obj.height)
  100. });
  101. },
  102. fail: res => {}
  103. });
  104. },
  105. onLoad() {
  106. this.loadData()
  107. this.getUserInfo()
  108. },
  109. methods: {
  110. ...mapState('user', ['hasLogin', 'userInfo']),
  111. getUserInfo() {
  112. getUserInfo().then(res => {
  113. this.money = res.data.now_money*1
  114. })
  115. },
  116. navTo(url) {
  117. uni.navigateTo({
  118. url
  119. })
  120. },
  121. //获取收入支出信息
  122. async loadData(source) {
  123. let obj = this
  124. if (obj.loadingType === 'loading' || obj.loadingType === 'noMore') {
  125. //防止重复加载
  126. return;
  127. }
  128. // 修改当前对象状态为加载中
  129. obj.loadingType = 'loading';
  130. spreadCommission({
  131. page: obj.page,
  132. limit: obj.limit
  133. },
  134. obj.state
  135. )
  136. .then(({
  137. data
  138. }) => {
  139. if (data.length > 0) {
  140. obj.orderList = obj.orderList.concat(data[0].list);
  141. console.log(obj.orderList);
  142. obj.page++;
  143. }
  144. if (obj.limit == data.length) {
  145. //判断是否还有数据, 有改为 more, 没有改为noMore
  146. obj.loadingType = 'more';
  147. return;
  148. } else {
  149. //判断是否还有数据, 有改为 more, 没有改为noMore
  150. obj.loadingType = 'noMore';
  151. }
  152. uni.hideLoading();
  153. this.$set(obj, 'loaded', true);
  154. })
  155. .catch(e => {
  156. console.log(e);
  157. });
  158. },
  159. //swiper 切换
  160. changeTab(e) {
  161. this.tabCurrentIndex = e.target.current;
  162. this.loadData('tabChange');
  163. },
  164. //顶部tab点击
  165. tabClick(index) {
  166. this.tabCurrentIndex = index;
  167. }
  168. }
  169. }
  170. </script>
  171. <style lang="scss">
  172. page,
  173. .content {
  174. height: 100%;
  175. width: 750rpx;
  176. background: #111111;
  177. .title-box {
  178. padding-left: 30rpx;
  179. // margin-top: 100rpx;
  180. display: flex;
  181. justify-content: space-between;
  182. align-items: center;
  183. .yue-box {
  184. display: flex;
  185. flex-direction: column;
  186. .yue-top {
  187. font-size: 26rpx;
  188. font-family: PingFang SC;
  189. font-weight: 400;
  190. color: #999999;
  191. }
  192. .yue-bottom {
  193. font-size: 60rpx;
  194. font-family: PingFang SC;
  195. font-weight: bold;
  196. color: #A581FF;
  197. }
  198. }
  199. .box {
  200. .cz {
  201. margin: 20rpx 0;
  202. text-align: center;
  203. font-size: 30rpx;
  204. font-weight: bold;
  205. color: #FFFFFF;
  206. width: 140rpx;
  207. height: 64rpx;
  208. border: 2rpx solid #FFFFFF;
  209. border-radius: 32rpx 0px 0px 32rpx;
  210. line-height: 64rpx;
  211. }
  212. }
  213. }
  214. .center-box {
  215. display: flex;
  216. justify-content: space-around;
  217. align-items: center;
  218. margin: 30rpx 25rpx;
  219. height: 120rpx;
  220. background: #181818;
  221. border-radius: 10rpx;
  222. .centet-left {
  223. display: flex;
  224. flex-direction: column;
  225. align-items: center;
  226. }
  227. .top {
  228. font-size: 32rpx;
  229. font-weight: 400;
  230. color: #FFFFFF;
  231. line-height: 48rpx;
  232. }
  233. .bottom {
  234. font-size: 26rpx;
  235. font-family: PingFang SC;
  236. font-weight: 400;
  237. color: #666666;
  238. line-height: 48rpx;
  239. }
  240. }
  241. }
  242. .detail {
  243. display: flex;
  244. height: 120rpx;
  245. justify-content: space-between;
  246. align-items: center;
  247. border-bottom: 1rpx solid #F0F0F0;
  248. margin: 0 25rpx;
  249. .det-left {
  250. display: flex;
  251. flex-direction: column;
  252. .det-top {
  253. line-height: 40rpx;
  254. font-size: 28rpx;
  255. font-family: PingFang SC;
  256. font-weight: 500;
  257. color: #FFFFFF;
  258. }
  259. .det-bottom {
  260. line-height: 40rpx;
  261. font-size: 22rpx;
  262. font-family: PingFang SC;
  263. font-weight: 400;
  264. color: #999999;
  265. }
  266. }
  267. .det-right {
  268. font-size: 30rpx;
  269. font-family: PingFang SC;
  270. font-weight: bold;
  271. color: #A581FF;
  272. }
  273. }
  274. .navbar {
  275. display: flex;
  276. height: 40px;
  277. padding: 0 5px;
  278. background: #fff;
  279. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  280. position: relative;
  281. z-index: 10;
  282. .nav-item {
  283. flex: 1;
  284. display: flex;
  285. justify-content: center;
  286. align-items: center;
  287. height: 100%;
  288. font-size: 15px;
  289. color: $font-color-dark;
  290. position: relative;
  291. &.current {
  292. color: $base-color;
  293. &:after {
  294. content: '';
  295. position: absolute;
  296. left: 50%;
  297. bottom: 0;
  298. transform: translateX(-50%);
  299. width: 44px;
  300. height: 0;
  301. border-bottom: 2px solid $base-color;
  302. }
  303. }
  304. }
  305. }
  306. </style>