mygx.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="status_bar"><!-- 这里是状态栏 --></view>
  5. <view class="body-title">
  6. <view class="goback-box" @click="toBack"><image class="goback" src="../../static/icon/fanhui.png" mode=""></image></view>
  7. <view class="header">我的分红积分</view>
  8. </view>
  9. <view class="content-bg"><image src="../../static/img/mygx.png" mode=""></image></view>
  10. <view class="money-box">
  11. <view class="money">{{ my_point }}</view>
  12. <view>我的分红积分</view>
  13. <view>1分红积分价值{{ price * 1}}</view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import { spreadCommission, userBalance } from '@/api/wallet.js';
  20. import { getMoneyStyle } from '@/utils/rocessor.js';
  21. import { share } from '@/api/user.js';
  22. import { mapState, mapMutations } from 'vuex';
  23. import uniLoadMore from '@/uview-ui/components/u-loadmore/u-loadmore.vue';
  24. import empty from '@/uview-ui/components/u-empty/u-empty.vue';
  25. export default {
  26. filters: {
  27. getMoneyStyle
  28. },
  29. computed: {
  30. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  31. },
  32. components: {
  33. empty,
  34. uniLoadMore
  35. },
  36. onReady(res) {
  37. var _this = this;
  38. uni.getSystemInfo({
  39. success: resu => {
  40. const query = uni.createSelectorQuery();
  41. query.select('.swiper-box').boundingClientRect();
  42. query.exec(function(res) {
  43. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  44. console.log('打印页面的剩余高度', _this.height);
  45. });
  46. },
  47. fail: res => {}
  48. });
  49. },
  50. data() {
  51. return {
  52. // 头部图高度
  53. maxheight: '',
  54. tabCurrentIndex: 0,
  55. price: 0,
  56. my_point: 0,
  57. navList: [
  58. {
  59. state: 0,
  60. text: '收入',
  61. loadingType: 'more',
  62. orderList: [],
  63. page: 1, //当前页数
  64. limit: 10, //每次信息条数
  65. loaded: false
  66. },
  67. {
  68. state: 1,
  69. text: '支出',
  70. loadingType: 'more',
  71. orderList: [],
  72. page: 1, //当前页数
  73. limit: 10, //每次信息条数
  74. loaded: false
  75. }
  76. ],
  77. money: ''
  78. };
  79. },
  80. onLoad(options) {},
  81. onShow() {
  82. share().then(({data}) =>{
  83. this.price = data.price;
  84. this.my_point = data.my_point;
  85. console.log(data);
  86. })
  87. this.loadData();
  88. },
  89. methods: {
  90. // 页面跳转
  91. navto(e) {
  92. uni.navigateTo({
  93. url: e
  94. });
  95. },
  96. // 点击返回 我的页面
  97. toBack() {
  98. uni.navigateBack({});
  99. },
  100. //获取收入支出信息
  101. async loadData(source) {
  102. //这里是将订单挂载到tab列表下
  103. let index = this.tabCurrentIndex;
  104. let navItem = this.navList[index];
  105. let state = navItem.state + 3;
  106. if (source == 'tabChange' && navItem.loaded == true) {
  107. //tab切换只有第一次需要加载数据
  108. return;
  109. }
  110. if (navItem.loadingType == 'loading' || navItem.loadingType == 'noMore') {
  111. //防止重复加载
  112. return;
  113. }
  114. // 修改当前对象状态为加载中
  115. navItem.loadingType = 'loading';
  116. spreadCommission(
  117. {
  118. page: navItem.page,
  119. limit: navItem.limit
  120. },
  121. state
  122. )
  123. .then(({ data }) => {
  124. if (data.length > 0) {
  125. navItem.orderList = navItem.orderList.concat(data[0].list);
  126. console.log(navItem.orderList);
  127. navItem.page++;
  128. }
  129. if (navItem.limit == data.length) {
  130. //判断是否还有数据, 有改为 more, 没有改为noMore
  131. navItem.loadingType = 'more';
  132. return;
  133. } else {
  134. //判断是否还有数据, 有改为 more, 没有改为noMore
  135. navItem.loadingType = 'noMore';
  136. }
  137. uni.hideLoading();
  138. this.$set(navItem, 'loaded', true);
  139. })
  140. .catch(e => {
  141. console.log(e);
  142. });
  143. },
  144. //swiper 切换
  145. changeTab(e) {
  146. this.tabCurrentIndex = e.target.current;
  147. this.loadData('tabChange');
  148. },
  149. //顶部tab点击
  150. tabClick(index) {
  151. this.tabCurrentIndex = index;
  152. }
  153. }
  154. };
  155. </script>
  156. <style lang="scss">
  157. page {
  158. background: #f1f1f1;
  159. height: 100%;
  160. }
  161. .status_bar {
  162. height: var(--status-bar-height);
  163. width: 100%;
  164. }
  165. .content-money {
  166. position: relative;
  167. height: 480rpx;
  168. .content-bg {
  169. position: absolute;
  170. top: 0;
  171. left: 0;
  172. right: 0;
  173. width: 750rpx;
  174. height: 480rpx;
  175. image {
  176. width: 100%;
  177. height: 100%;
  178. }
  179. }
  180. .body-title {
  181. height: 80rpx;
  182. text-align: center;
  183. font-size: 35rpx;
  184. position: relative;
  185. .header {
  186. position: absolute;
  187. left: 0;
  188. top: 0;
  189. width: 100%;
  190. font-size: 36rpx;
  191. font-family: PingFang SC;
  192. font-weight: bold;
  193. color: #fffeff;
  194. height: 80rpx;
  195. font-size: 36rpx;
  196. font-weight: 700;
  197. z-index: 9;
  198. display: flex;
  199. justify-content: center;
  200. align-items: center;
  201. }
  202. .goback-box {
  203. position: absolute;
  204. left: 18rpx;
  205. top: 0;
  206. height: 80rpx;
  207. display: flex;
  208. align-items: center;
  209. }
  210. .goback {
  211. z-index: 100;
  212. width: 34rpx;
  213. height: 34rpx;
  214. }
  215. }
  216. }
  217. .info-box {
  218. width: 670rpx;
  219. height: 186rpx;
  220. background: #ffffff;
  221. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  222. border-radius: 20rpx;
  223. margin: -100rpx auto 0;
  224. position: relative;
  225. z-index: 2;
  226. .info-item {
  227. width: 50%;
  228. display: flex;
  229. flex-direction: column;
  230. align-items: center;
  231. line-height: 1;
  232. .info-font {
  233. font-size: 30rpx;
  234. font-family: PingFang SC;
  235. font-weight: bold;
  236. color: #999999;
  237. }
  238. .info-num {
  239. margin-top: 30rpx;
  240. font-size: 30rpx;
  241. font-family: PingFang SC;
  242. font-weight: bold;
  243. color: #181818;
  244. }
  245. }
  246. .shu {
  247. width: 2rpx;
  248. height: 74rpx;
  249. background: #dcdfe6;
  250. }
  251. }
  252. .money-box {
  253. position: relative;
  254. z-index: 2;
  255. padding-top: 90rpx;
  256. color: #ffffff;
  257. text-align: center;
  258. .money {
  259. font-size: 72rpx;
  260. font-family: PingFang SC;
  261. font-weight: bold;
  262. color: #ffffff;
  263. }
  264. .text {
  265. font-size: 30rpx;
  266. }
  267. }
  268. .money-btn {
  269. position: relative;
  270. z-index: 2;
  271. color: #ffffff;
  272. padding-right: 50rpx;
  273. text-align: right;
  274. font-size: 30rpx;
  275. font-family: PingFang SC;
  276. font-weight: bold;
  277. color: #ffffff;
  278. text {
  279. display: inline-block;
  280. padding-left: 10rpx;
  281. }
  282. }
  283. .navbar {
  284. margin-top: 20rpx;
  285. display: flex;
  286. height: 88rpx;
  287. padding: 0 5px;
  288. background: #fff;
  289. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  290. position: relative;
  291. z-index: 10;
  292. .nav-item {
  293. flex: 1;
  294. display: flex;
  295. justify-content: center;
  296. align-items: center;
  297. height: 100%;
  298. font-size: 15px;
  299. color: #999999;
  300. position: relative;
  301. &.current {
  302. color: #000;
  303. &:after {
  304. content: '';
  305. position: absolute;
  306. left: 50%;
  307. bottom: 0;
  308. transform: translateX(-50%);
  309. width: 44px;
  310. height: 0;
  311. border-bottom: 2px solid #fe5b38;
  312. }
  313. }
  314. }
  315. }
  316. //列表
  317. .swiper-box {
  318. .order-item:last-child {
  319. margin-bottom: 60rpx;
  320. }
  321. .order-item {
  322. padding: 20rpx 30rpx;
  323. line-height: 1.5;
  324. .title-box {
  325. .title {
  326. font-size: $font-lg;
  327. color: $font-color-base;
  328. }
  329. .time {
  330. font-size: $font-base;
  331. color: $font-color-light;
  332. }
  333. }
  334. .money {
  335. color: #fd5b23;
  336. font-size: $font-lg;
  337. text-align: right;
  338. .status {
  339. color: $font-color-light;
  340. }
  341. }
  342. }
  343. }
  344. .list-scroll-content {
  345. background: #ffffff;
  346. height: 100%;
  347. }
  348. .content {
  349. height: 100%;
  350. .empty-content {
  351. background-color: #ffffff;
  352. }
  353. }
  354. .btn-box {
  355. width: 674rpx;
  356. height: 88rpx;
  357. background: linear-gradient(0deg, #2e58ff, #32c6ff);
  358. border-radius: 44rpx;
  359. font-size: 36rpx;
  360. font-family: PingFang SC;
  361. font-weight: 500;
  362. color: #ffffff;
  363. text-align: center;
  364. line-height: 88rpx;
  365. position: fixed;
  366. bottom: 48rpx;
  367. left: 0;
  368. right: 0;
  369. margin: 0 auto;
  370. }
  371. </style>