wallet.vue 6.8 KB

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