JDcool.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="money-box">
  5. <view class="goback-box" @click="toBack">
  6. <image class="goback" src="../../static/img/fanhui.png" mode=""></image>
  7. </view>
  8. <view class="header">基金</view>
  9. <image class="money_bg" src="../../static/img/anchor8.png"></image>
  10. <view class="money">{{jd}}</view>
  11. <view class="tip">
  12. 金豆数量
  13. </view>
  14. </view>
  15. </view>
  16. <view class="title">
  17. - 实时累计 -
  18. </view>
  19. <scroll-view class="swiper-box" scroll-y :style="{'height': height}" @scrolltolower="loadData()">
  20. <!-- 空白页 -->
  21. <!-- <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty> -->
  22. <!-- 订单列表 -->
  23. <template>
  24. <view v-for="(item, index) in dataList" class="order-item flex" >
  25. <view class="left flex">
  26. <view class="avator">
  27. <image :src="item.user.avatar" mode=""></image>
  28. </view>
  29. <view class="order-font">
  30. {{item.user.real_name}}{{item.title}}<text>{{item.use_integral}}</text>
  31. </view>
  32. </view>
  33. <view class="time">
  34. {{item.add_time}}
  35. </view>
  36. </view>
  37. </template>
  38. <uni-load-more :status="loadingType"></uni-load-more>
  39. </scroll-view>
  40. </view>
  41. </template>
  42. <script>
  43. import {
  44. getTime
  45. } from '@/utils/rocessor.js'
  46. import {
  47. jdCoool
  48. } from '@/api/wallet.js';
  49. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  50. import empty from '@/components/empty';
  51. export default {
  52. components: {
  53. empty,
  54. uniLoadMore
  55. },
  56. data() {
  57. return {
  58. height: '',
  59. jd: 0,
  60. loadingType: 'more',
  61. limit: 10, //每次加载多少信息
  62. page: 1, //页数
  63. dataList: []
  64. }
  65. },
  66. onReady(res) {
  67. // 初始化获取页面宽度
  68. var _this = this;
  69. uni.getSystemInfo({
  70. success: resu => {
  71. const query = uni.createSelectorQuery();
  72. query.select('.swiper-box').boundingClientRect();
  73. query.exec(function(res) {
  74. _this.height = resu.windowHeight - res[0].top + 'px';
  75. console.log('打印页面的剩余高度', _this.height);
  76. });
  77. },
  78. fail: res => {}
  79. });
  80. },
  81. onLoad() {
  82. this.loadData();
  83. },
  84. methods: {
  85. toBack() {
  86. uni.switchTab({
  87. url: '/pages/user/user'
  88. });
  89. },
  90. loadData() {
  91. let obj = this
  92. if(obj.loadingType == 'noMore' || obj.loadingType == 'loading'){
  93. return
  94. }
  95. obj.loadingType = 'loading'
  96. jdCoool({
  97. page: obj.page,
  98. limit: obj.limit
  99. }).then(res => {
  100. console.log(res);
  101. obj.jd = res.data.sum
  102. res.data.data = res.data.data.map(item => {
  103. item.add_time = getTime(item.add_time);
  104. let data = item.add_time.split(' ');
  105. item.add_time = data[0]
  106. return item;
  107. })
  108. obj.dataList = obj.dataList.concat(res.data.data)
  109. obj.page++;
  110. //判断是否还有数据,有改为more,没有各位noMore
  111. if(obj.limit == res.data.data.length){
  112. obj.loadingType = 'more'
  113. }else{
  114. obj.loadingType = 'noMore'
  115. }
  116. this.$set(obj.dataList,'loaded',true)
  117. }).catch(e=>{
  118. console.log(e);
  119. })
  120. }
  121. }
  122. };
  123. </script>
  124. <style lang="scss">
  125. page {
  126. background: #ffffff;
  127. height: 100%;
  128. }
  129. .content-money {
  130. background: $page-color-base;
  131. // border: 2px solid #ffffff;
  132. // padding-top: var(--status-bar-height);
  133. .moneyTx {
  134. position: absolute;
  135. top: 120rpx;
  136. right: 0rpx;
  137. // width: 150rpx;
  138. padding: 10rpx 10rpx;
  139. border: 2px solid #ffffff;
  140. border-top-left-radius: 15rpx;
  141. border-bottom-left-radius: 15rpx;
  142. line-height: 1;
  143. font-size: $font-base;
  144. background: #ffffff;
  145. }
  146. .buttom-box {
  147. background-color: #ffffff;
  148. text-align: center;
  149. margin: 0 30rpx;
  150. padding: 20rpx 0;
  151. border-radius: $border-radius-sm;
  152. margin-top: -60rpx;
  153. .buttom {
  154. font-size: $font-lg;
  155. flex-grow: 1;
  156. }
  157. .interval {
  158. width: 2px;
  159. height: 60rpx;
  160. background-color: #eeeeee;
  161. }
  162. .icon {
  163. height: 36rpx;
  164. width: 36rpx;
  165. margin: 0 auto;
  166. .icon-img {
  167. width: 100%;
  168. height: 100%;
  169. }
  170. }
  171. }
  172. }
  173. .money-box {
  174. height: 430rpx;
  175. color: #ffffff;
  176. text-align: center;
  177. position: relative;
  178. background-color: pink;
  179. .header {
  180. position: absolute;
  181. left: 0;
  182. top: 0;
  183. width: 100%;
  184. height: 80rpx;
  185. font-size: 32rpx;
  186. font-weight: 700;
  187. z-index: 99;
  188. display: flex;
  189. justify-content: center;
  190. align-items: center;
  191. }
  192. .goback-box {
  193. position: absolute;
  194. left: 18rpx;
  195. top: 0;
  196. height: 80rpx;
  197. display: flex;
  198. align-items: center;
  199. }
  200. .goback {
  201. z-index: 100;
  202. width: 34rpx;
  203. height: 34rpx;
  204. }
  205. .money_bg {
  206. width: 100%;
  207. height: 430rpx;
  208. display: block;
  209. }
  210. .text {
  211. padding-top: 80rpx;
  212. font-size: $font-lg;
  213. }
  214. .money {
  215. position: absolute;
  216. top: 0;
  217. width: 100%;
  218. padding-top: 186rpx;
  219. font-size: 84rpx;
  220. font-weight: bold;
  221. }
  222. .tip {
  223. position: absolute;
  224. top: 0;
  225. width: 100%;
  226. text-align: center;
  227. padding-top: 304rpx;
  228. font-size: 26rpx;
  229. font-family: PingFang SC;
  230. font-weight: 500;
  231. color: #FFFFFF;
  232. }
  233. }
  234. .title {
  235. height: 82rpx;
  236. line-height: 82rpx;
  237. text-align: center;
  238. font-size: 30rpx;
  239. font-family: PingFang SC;
  240. font-weight: 500;
  241. color: #333333;
  242. border-bottom: 1px solid #f0f0f0;
  243. }
  244. // 列表
  245. .swiper-box {
  246. .order-item {
  247. padding: 18rpx 24rpx 14rpx;
  248. border-bottom: 1px solid #f0f0f0;
  249. .left {
  250. justify-content: flex-start;
  251. .avator {
  252. width: 70rpx;
  253. height: 70rpx;
  254. border-radius: 50rpx;
  255. // background: #03A9F4;
  256. image {
  257. width: 70rpx;
  258. height: 70rpx;
  259. border-radius: 50rpx;
  260. }
  261. }
  262. .order-font {
  263. margin-left: 10rpx;
  264. font-size: 30rpx;
  265. font-family: PingFang SC;
  266. font-weight: 500;
  267. color: #3F454B;
  268. text {
  269. color: #FF4D4C;
  270. }
  271. }
  272. }
  273. .time {
  274. font-size: 22rpx;
  275. font-family: PingFang SC;
  276. font-weight: 400;
  277. color: #999999;
  278. }
  279. }
  280. }
  281. .content {
  282. height: 100%;
  283. .empty-content {
  284. background-color: #ffffff;
  285. }
  286. }
  287. </style>