exchange.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view class="exchange">
  3. <view class="bg">
  4. <!-- <image src="@/static/img/bargainBg.jpg" mode=""></image> -->
  5. </view>
  6. <view class="header">
  7. <view class="data">
  8. <view class="title">
  9. 我的金豆
  10. </view>
  11. <view class="quantity">
  12. {{ userInfo.integral }}
  13. </view>
  14. <view class="button">
  15. 查看明细
  16. </view>
  17. </view>
  18. </view>
  19. <view class="line">
  20. 热门兑换
  21. </view>
  22. <view class="dataList">
  23. <data-list :data='data'></data-list>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import { getProducts } from '@/api/product.js';
  29. import dataList from '@/components/datalist.vue';
  30. import { mapState, mapMutations } from 'vuex';
  31. export default {
  32. data() {
  33. return {
  34. data: {
  35. page: 1,
  36. limit: 10,
  37. loadingType: 'loadmore',
  38. data: []
  39. }
  40. }
  41. },
  42. components: {
  43. dataList
  44. },
  45. computed: {
  46. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  47. },
  48. onLoad() {
  49. this.getData()
  50. },
  51. methods: {
  52. // 點擊搜索框
  53. clickSearch() {
  54. uni.navigateTo({
  55. url: '/pages/product/search'
  56. });
  57. },
  58. getData() {
  59. const obj = this
  60. getProducts({
  61. page: this.page,
  62. limit: this.limit,
  63. is_gold: 1
  64. })
  65. .then(function(res) {
  66. obj.data = res.data
  67. })
  68. .catch(res => {
  69. });
  70. }
  71. }
  72. }
  73. </script>
  74. <style lang="scss" scoped>
  75. $grey: #95A0B1;
  76. $text: #333333;
  77. $red: #FF4C4C;
  78. .exchange {
  79. .bg {
  80. width: 100%;
  81. height: 400rpx;
  82. background-color: $red;
  83. image {
  84. width: 100%;
  85. }
  86. }
  87. .header {
  88. .data {
  89. padding-top: 120rpx;
  90. width: 100%;
  91. text-align: center;
  92. position: absolute;
  93. top: 0;
  94. color: #fff;
  95. height: 400rpx;
  96. .quantity,.title,.button {
  97. margin: 10rpx auto;
  98. }
  99. .title {
  100. font-size: 24rpx;
  101. }
  102. .quantity {
  103. font-size: 54rpx;
  104. font-weight: bold;
  105. }
  106. .button {
  107. padding: 10rpx;
  108. border: solid 1rpx #fff;
  109. border-radius: 40rpx;
  110. font-size: 24rpx;
  111. width: 160rpx;
  112. }
  113. }
  114. }
  115. .line {
  116. background-color: #fff;
  117. font-size: 28rpx;
  118. padding: 30rpx;
  119. color: $red;
  120. font-weight: bold;
  121. text-align: center;
  122. }
  123. .dataList {
  124. background-color: #fff;
  125. }
  126. }
  127. </style>