|
|
<template> <view class="app"> <view class="qwl-search"> <input placeholder="搜索商品" class="qwl-search-input"/> <image src="/static/base/search.png" class="qwl-search-icon"></image> </view> <view class="product-section"> <view class="product-left"> <view class="product-left-item" v-for="(item,index) in productList" :key=index @click="leftSelect(index)" :style="{backgroundColor:currentIndex==index?'white':'#F5F5F5'}"> <text class="product-left-item-title">全部</text> <view v-if="currentIndex==index" class="product-left-item-line"></view> </view> </view> <view class="product-right"> <view class="product-source"> <text class="product-source-grade">供货上级</text> <text class="product-source-grade product-source-name">轻未来公司(张三)</text> </view> <view class="product-right-item" v-for="(item,index) in 4" :key=index> <image class="product-right-img" src="/static/shop/677088217d8a00aa.jpg"></image> <view class="product-right-section"> <text class="product-right-section-title">轻未来超纤维阻燃粉</text> <view class="product-right-section-des" style="margin: 6rpx 0rpx 20rpx;"> <text class="product-right-section-number">库存:2个</text> <text class="product-right-section-label">物料</text> </view> <view class="product-right-section-des"> <text class="product-right-section-price">¥5999</text> <view> <text class="product-right-btn product-remove">-</text> <text class="product-right-section-sale" :style="{color:1==1?'#EDAF8B':'#DDDDDD'}">1</text> <text class="product-right-btn product-add">+</text> </view> </view> </view> </view> </view> </view> <view class="product-footer"> <view class="product-footer-left"> <text class="product-footer-title">总计:</text> <text class="product-footer-summary">¥5999</text> </view> <text class="product-footer-pay">结算</text> </view>
</view> </template>
<script>
export default { components: { }, data() { return { navList: [],//导航列表
advertList: [],//广告列表
hotList: [],//热门推荐
indicatorDots: true, autoplay: true, interval: 2000, duration: 500, productList:['全部','物料','公司产品','活动产品'], rightList:['1','2','3','4'], currentIndex:0, } }, computed: { changeIndicatorDots(e) { this.indicatorDots = !this.indicatorDots }, changeAutoplay(e) { this.autoplay = !this.autoplay }, intervalChange(e) { this.interval = e.target.value }, durationChange(e) { this.duration = e.target.value }, midAdvert(){ if(this.advertList.length === 0) return {}; const res = this.advertList.filter(item=> item.advert_type === 'middle'); return res.length > 0 ? res[0]: {}; }, carousel(){ return this.advertList.filter(item=> item.advert_type === 'carousel'); } }, onLoad() { this.loadAdvert(); this.loadNavList(); setTimeout(()=>{ //this.navTo('/pages/address/list')
}, 1000) }, methods: { leftSelect(index){ this.currentIndex=index }, //加载广告 缓存10分钟
async loadAdvert(){ const res = await this.$request('advert', 'getAdvertList', {}, { cache: 10*60 }); this.advertList = res.data; this.log(res); }, //加载导航 缓存1小时
async loadNavList(){ const res = await this.$request('advert', 'getNavList', {}, { cache: 60*60*0, }); this.navList = res.data; }, } } </script>
<style> page{ background-color: white; } </style> <style scoped lang="scss"> /* 分类 */ .swiper{ background-color: yellow; height: 750rpx; } .swiper-item{
} .swiper-img{ width: 100%; height: 750rpx; } .qwl-search{ position: relative; margin: 30rpx 30rpx 20rpx 30rpx; } .qwl-search-input{ background-color: red; height: 75rpx; text-indent: 80rpx; background-color: #F5F5F5; border-radius: 10rpx; } .qwl-search-icon{ top: 20rpx; left: 30rpx; position: absolute; width: 35rpx; height: 35rpx; } .product-section{ display: flex; flex-direction: row; justify-content: flex-start; align-items: flex-start; } .product-left{ background-color:#F5F5F5 ; height:calc(100vh - 95rpx); // height:calc(100vh - 200rpx);
} .product-left-item{ display: flex; flex-direction: column; justify-content: center; align-items: center; } .product-left-item-title{ width: 200rpx; text-align: center; display: block; font-size: 15px; font-weight: bold; color: #333333; height: 130rpx; line-height: 130rpx; // line-height: 92px;
} .product-left-item-line{ // margin: 0px auto;
position: relative; top: -30rpx; background-color: #EDAF8B; height:5rpx ; width: 30rpx; } .product-right{ flex: 1; } .product-source{ height: 100rpx; background: #EDAF8B; } .product-source-grade{ margin: 0rpx 20rpx; font-size: 30rpx; font-weight: 500; color: #FFFFFF; line-height: 100rpx; } .product-source-name{ margin: 0px 20rpx; } .product-right{ } .product-right-item{ margin: 30rpx 0rpx; display: flex; flex-direction: row; justify-content: flex-start; align-items: center; } .product-right-img{ margin: 0rpx 30rpx; width: 170rpx; height: 170rpx; border-radius: 10rpx; } .product-right-section-title{ font-size: 15px; font-weight: bold; color: #333333; // line-height: 48px;
} .product-right-section-des{ display: flex; flex-direction: row; justify-content: space-between; align-items: center; } .product-right-section-number{ font-size: 13px; font-weight: 500; color: #999999; // line-height: 48px;
} .product-right-section-label{ border: 1px solid #EDAF8B; border-radius: 4px; font-size: 13px; font-weight: 500; color: #EDAF8B; padding: 4rpx 8rpx; } .product-right-section-price{ font-size: 18px; font-weight: bold; color: #EDAF8B; } .product-right-btn{ width: 36rpx; height: 36rpx; border-radius: 50%; display: inline-block; text-align: center; color: white; } .product-add{ background-color: #EDAF8B; } .product-remove{ background-color: #DDDDDD; } .product-right-section-sale{ position: relative; // top: -10rpx;
font-size: 13px; font-weight: 500; color: #DDDDDD; height: 30rpx; line-height: 30rpx; margin: 0rpx 16rpx; } .product-footer{ border-top: 1rpx solid $separatorColor; position: absolute; position: fixed; // bottom: 32rpx;
bottom: 0rpx; left: 0rpx; right: 0rpx; background-color: white; height: 90rpx; line-height: 90rpx; display: flex; justify-content: space-between; align-items: center; } .product-footer-pay{ background: #EDAF8B; font-size: 18px; font-weight: 500; color: #FFFFFF; height: 90rpx; line-height: 90rpx; width: 250rpx; text-align: center; } .product-footer-summary{ font-size: 18px; font-weight: 500; color: #EDAF8B; font-weight: bold; } .product-footer-title{ margin: 0rpx 4rpx 0rpx 60rpx; font-size: 13px; font-weight: 500; color: #333333; } // .menu-item{
// display: flex;
// flex-direction: row;
// align-items: center;
// }
// .menu-txt{
// height: 90rpx;
// line-height: 90rpx;
// text-align: center;
// flex: 1;
// font-size: 18px;
// font-weight: 500;
// color: #EDAF8B;
// border: 1px solid #EDAF8B;
// }
// .product-section{
// margin: 36rpx 64rpx 30rpx 40rpx;
// }
// .prduct-title{
// font-size: 18px;
// font-weight: bold;
// color: #333333;
// line-height: 50rpx;
// // line-height: 48px;
// }
// .product-des{
// margin: 30rpx 0rpx;
// display: flex;
// flex-direction: row;
// justify-content: space-between;
// align-items: flex-end;
// }
// .product-price-sale{
// font-size: 28px;
// font-weight: bold;
// color: #EDAF8B;
// }
// .product-price-show{
// font-size: 13px;
// font-weight: 500;
// text-decoration: line-through;
// color: #999999;
// }
// .product-number{
// font-size: 13px;
// font-weight: 500;
// color: #999999;
// }
// .separator-section{
// background-color: $separatorColor;
// height: 20rpx;
// }
// .product-detail{
// margin: 60rpx 40rpx 10rpx;
// }
// .product-detail-title{
// display: block;
// font-size: 18px;
// font-weight: bold;
// color: #333333;
// }
// .product-detail-wrap{
// margin: 30rpx 0rpx;
// }
// .product-detail-txt{
// line-height: 30rpx;
// font-size: 13px;
// // font-weight: 500;
// color: #999999;
// }
// .product-detail-img{
// width: 100%;
// height: 600rpx;
// border-radius: 10rpx;
// }
</style>
|