| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <template>
- <view class='content'>
- <view class="guess-section">
- <view v-for="(item, index) in repurchaseList" :key="index" class="guess-item" @click="navToDetailPage(item)">
- <view class="image-wrapper"><image :src="item.image" mode="scaleToFill"></image></view>
- <text class="title clamp margin-c-20">{{ item.store_name }}</text>
- <view class="cmy-hr"></view>
- <view class="price margin-c-20 flex">
- <view>
- <text class="font-size-sm ">¥</text>
- {{ item.price }}
- </view>
- <view class="font-size-sm">
- <text class="font-color-gray">{{ item.sales }}人购买</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { loadIndexs } from '@/api/index.js';
- export default {
- data() {
- return{
- repurchaseList:[]
- }
- },
- onLoad() {
- this.loadData()
- },
- methods:{
- loadData(){
- loadIndexs({}).then(( { data } ) => {
- console.log('-----',data)
- // this.carouselList = data.banner;
- // this.bastList = data.info.vipList.slice(0,6); // VIP
- this.repurchaseList = data.info.repurchaseList.slice(0,6); // 复购专区
- // this.bastBanner = data.info.integralList.slice(0,6); // 积分专区
- })
- },
- // 跳转普通商品
- navToDetailPage(item) {
- uni.navigateTo({
- url: '/pages/product/product?id=' + item.id
- })
- }
- }
- }
- </script>
- <style lang='scss'>
- .guess-section {
- display: flex;
- flex-wrap: wrap;
- padding: 0 30rpx;
- background: linear-gradient(180deg, #FFFFFF, #f8f8f8);
- // background-color: pink;
- .guess-item {
- overflow: hidden;
- display: flex;
- flex-direction: column;
- width: 48%;
- margin-bottom: 4%;
- border-radius: $border-radius-sm;
- background-color: white;
-
- &:nth-child(2n + 1) {
- margin-right: 4%;
- }
- }
- .image-wrapper {
- width: 100%;
- height: 330rpx;
- border-radius: 3px;
- overflow: hidden;
- image {
- width: 100%;
- height: 100%;
- opacity: 1;
- }
- }
- .title {
- font-size: $font-base;
- color: $font-color-dark;
- font-weight: bold;
- line-height: 80rpx;
- }
- .price {
- font-size: $font-lg;
- color: $font-color-base;
- font-weight: bold;
- line-height: 1;
- line-height: 80rpx;
- }
-
- .icon {
- // @extend %icon;
- }
-
- .detail {
- line-height: 1;
- }
- .tip {
- color: white;
- background-color: $color-yellow;
- line-height: 1.5;
- // font-size: $font-sm;
- padding-left: 20rpx;
- }
- }
- </style>
|