wallet.vue 6.4 KB

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