exchange.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. page: 1,
  35. limit: 10,
  36. loadingType: 'loadmore',
  37. data: []
  38. }
  39. },
  40. components: {
  41. dataList
  42. },
  43. computed: {
  44. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  45. },
  46. onLoad() {
  47. this.getData()
  48. },
  49. methods: {
  50. // 點擊搜索框
  51. clickSearch() {
  52. uni.navigateTo({
  53. url: '/pages/product/search'
  54. });
  55. },
  56. getData() {
  57. const obj = this
  58. getProducts({
  59. page: this.page,
  60. limit: this.limit,
  61. is_integral: 1
  62. })
  63. .then(function(res) {
  64. obj.data = res.data
  65. })
  66. .catch(res => {
  67. });
  68. }
  69. }
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. $grey: #95A0B1;
  74. $text: #333333;
  75. $red: #FF4C4C;
  76. .exchange {
  77. .bg {
  78. width: 100%;
  79. height: 400rpx;
  80. background-color: $red;
  81. image {
  82. width: 100%;
  83. }
  84. }
  85. .header {
  86. .data {
  87. padding-top: 120rpx;
  88. width: 100%;
  89. text-align: center;
  90. position: absolute;
  91. top: 0;
  92. color: #fff;
  93. height: 400rpx;
  94. .quantity,.title,.button {
  95. margin: 10rpx auto;
  96. }
  97. .title {
  98. font-size: 24rpx;
  99. }
  100. .quantity {
  101. font-size: 54rpx;
  102. font-weight: bold;
  103. }
  104. .button {
  105. padding: 10rpx;
  106. border: solid 1rpx #fff;
  107. border-radius: 40rpx;
  108. font-size: 24rpx;
  109. width: 160rpx;
  110. }
  111. }
  112. }
  113. .line {
  114. background-color: #fff;
  115. font-size: 28rpx;
  116. padding: 30rpx;
  117. color: $red;
  118. font-weight: bold;
  119. text-align: center;
  120. }
  121. .dataList {
  122. background-color: #fff;
  123. }
  124. }
  125. </style>