purchase.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view class='content'>
  3. <view class="guess-section">
  4. <view v-for="(item, index) in repurchaseList" :key="index" class="guess-item" @click="navToDetailPage(item)">
  5. <view class="image-wrapper"><image :src="item.image" mode="scaleToFill"></image></view>
  6. <text class="title clamp margin-c-20">{{ item.store_name }}</text>
  7. <view class="cmy-hr"></view>
  8. <view class="price margin-c-20 flex">
  9. <view>
  10. <text class="font-size-sm ">¥</text>
  11. {{ item.price }}
  12. </view>
  13. <view class="font-size-sm">
  14. <text class="font-color-gray">{{ item.sales }}人购买</text>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import { loadIndexs } from '@/api/index.js';
  23. export default {
  24. data() {
  25. return{
  26. repurchaseList:[]
  27. }
  28. },
  29. onLoad() {
  30. this.loadData()
  31. },
  32. methods:{
  33. loadData(){
  34. loadIndexs({}).then(( { data } ) => {
  35. console.log('-----',data)
  36. // this.carouselList = data.banner;
  37. // this.bastList = data.info.vipList.slice(0,6); // VIP
  38. this.repurchaseList = data.info.repurchaseList.slice(0,6); // 复购专区
  39. // this.bastBanner = data.info.integralList.slice(0,6); // 积分专区
  40. })
  41. },
  42. // 跳转普通商品
  43. navToDetailPage(item) {
  44. uni.navigateTo({
  45. url: '/pages/product/product?id=' + item.id
  46. })
  47. }
  48. }
  49. }
  50. </script>
  51. <style lang='scss'>
  52. .guess-section {
  53. display: flex;
  54. flex-wrap: wrap;
  55. padding: 0 30rpx;
  56. background: linear-gradient(180deg, #FFFFFF, #f8f8f8);
  57. // background-color: pink;
  58. .guess-item {
  59. overflow: hidden;
  60. display: flex;
  61. flex-direction: column;
  62. width: 48%;
  63. margin-bottom: 4%;
  64. border-radius: $border-radius-sm;
  65. background-color: white;
  66. &:nth-child(2n + 1) {
  67. margin-right: 4%;
  68. }
  69. }
  70. .image-wrapper {
  71. width: 100%;
  72. height: 330rpx;
  73. border-radius: 3px;
  74. overflow: hidden;
  75. image {
  76. width: 100%;
  77. height: 100%;
  78. opacity: 1;
  79. }
  80. }
  81. .title {
  82. font-size: $font-base;
  83. color: $font-color-dark;
  84. font-weight: bold;
  85. line-height: 80rpx;
  86. }
  87. .price {
  88. font-size: $font-lg;
  89. color: $font-color-base;
  90. font-weight: bold;
  91. line-height: 1;
  92. line-height: 80rpx;
  93. }
  94. .icon {
  95. // @extend %icon;
  96. }
  97. .detail {
  98. line-height: 1;
  99. }
  100. .tip {
  101. color: white;
  102. background-color: $color-yellow;
  103. line-height: 1.5;
  104. // font-size: $font-sm;
  105. padding-left: 20rpx;
  106. }
  107. }
  108. </style>