order 7.23

This commit is contained in:
2020-07-23 14:56:20 +08:00
parent 2e087313d4
commit be9f2ec1c7
9 changed files with 209 additions and 142 deletions

View File

@@ -39,6 +39,7 @@ export default {
goodsClass: Array,
},
created() {
// console.log(this.goodsClass);
// console.log(this.couponInfo);
},
filters: {
@@ -51,9 +52,6 @@ export default {
}
},
methods: {
exchange() {
this.$emit('exchange', this.couponInfo.vouchertemplate_id);
},
use() {
this.$emit('use', this.couponInfo);
},
@@ -64,6 +62,7 @@ export default {
.c-coupon {
position: relative;
z-index: 9;
margin-bottom: 30rpx;
@mixin coupon-image($url) {
width: 690rpx;
height: 194rpx;

View File

@@ -3,19 +3,13 @@
<view class="top">
商品推荐
</view>
<!-- <view class="label">
<text v-for="item in classifyList" :key="item.gc_id">{{ item.gc_name }}</text>
</view>
<view class="item">
<item v-for="item in goodsList" :key="item.goods_id" :info="item"></item>
</view> -->
<view>
<u-tabs-swiper ref="uTabs" :list="classifyList" name="gc_name" :is-scroll="true" active-color="#FF780F" :current="current" font-size="24" :show-bar="false" @change="tabsChange" height="60" ></u-tabs-swiper>
</view>
<swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish" >
<swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish" :style="{height: swiperHeight}">
<swiper-item class="swiper-item" v-for="(_, index) in classifyList" :key="index">
<!-- <scroll-view scroll-y style="height: 800rpx;width: 100%;"> -->
<view class="item">
<view class="goods-item">
<item v-for="item in goodsList" :key="item.goods_id" :info="item"></item>
</view>
<u-empty text="暂无商品" mode="list" color="#000" v-if="!goodsList.length"></u-empty>
@@ -30,17 +24,16 @@ export default {
name:"list",
data() {
return {
current: Number,
current: -1,
swiperCurrent: 0,
goodsList: [],
classifyList: [],
swiperHeight: '',
}
},
components:{
item
},
props: {
classifyList: Array
},
watch: {
current(index) {
const id = this.classifyList[index].gc_id;
@@ -48,21 +41,35 @@ export default {
}
},
created() {
this.current = 0;
console.log(this.classifyList);
this.getGoodsClassRecommend();
},
methods: {
getGoodsClassRecommend(gc_id) {
this.$u.api.getGoodsClassRecommend().then(res => {
if (res.errCode == 0) {
// 初始化 current
this.current = 0;
this.classifyList = res.data.gc_recommend;
// this.getGoodsRecommend(this.classifyList[0].gc_id);
}
})
},
getGoodsRecommend(gc_id) {
this.$u.api.getGoodsRecommend({
page: 1,
gc_id: gc_id,
}).then((res)=>{
}).then(res => {
if (res.errCode == 0) {
this.goodsList = res.data.goodsList;
console.log(this.goodsList);
// console.log(this.goodsList);
this.setSwiperHeight();
}
})
},
setSwiperHeight() {
// height: 230px, margin-bottom: 13
this.swiperHeight = Math.ceil(this.goodsList.length / 2) * (230 + 13) + 'px';
},
// tabs通知swiper切换
tabsChange(index) {
this.swiperCurrent = index;
@@ -108,5 +115,11 @@ export default {
// margin-top: 20rpx;
// }
.goods-item {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-top: 20rpx;
}
}
</style>

View File

@@ -4,7 +4,7 @@
<view class="info">
<text class="title u-line-1">{{ info.goods_name }}</text>
<text class="jianjie u-line-2">{{ info.goods_advword }}</text>
<text class="price">{{ info.goods_price }}</text>
<text class="price">{{ info.goods_price }}</text>
</view>
</view>
</template>
@@ -16,43 +16,53 @@ export default {
},
methods: {
toDetailsPage() {
this.$u.route({
url: 'pageB/sdetails/index',
params: {
id: this.info.goods_id
this.$u.api.getGoodsDetails({ id: this.info.goods_id }).then((res)=>{
if (res.errCode == 0) {
const goods = {
goods: res.data,
type: 1,
}
this.$store.commit('setGoodsDetails', goods);
this.$store.commit('setGoodsId', this.info.goods_id);
this.$u.route({
url: 'pageB/sdetails/index',
})
// console.log(this.goodsInfo.mobile_body);
}
})
})
}
},
}
</script>
<style lang="scss" scoped>
.item{
width: 330rpx;
height: 469rpx;
margin-bottom: 27rpx;
height: 460rpx;
margin-bottom: 26rpx;
background-color: #f8f8f8;
border-radius: 10rpx;
overflow: hidden;
border-radius: 10rpx 10rpx 0rpx 0rpx;
.img{
width: 100%;
height: 272rpx;
width: 330rpx;
height: 272rpx;
background: rgba(245,245,245,1);
border-radius: 10rpx 10rpx 0rpx 0rpx;
margin-bottom: 24rpx;
}
.info{
width: 320rpx;
padding: 0 12rpx;
padding: 0 12rpx 28rpx;
display: flex;
flex-direction: column;
justify-content: space-around;
.title{
font-size: 30rpx;
color: #333;
margin-bottom: 13rpx;
}
.jianjie{
font-size: 26rpx;
color: #666;
margin-bottom: 20rpx;
}
.price{
color: #FF3131;