Commit b62c2797 by 匡雅琴

家生活商品列表

1 parent babd881b
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
.goods-title-box { .goods-title-box {
display: flex; display: flex;
max-width: 236rpx;
} }
.goods-title-tips { .goods-title-tips {
...@@ -41,6 +40,7 @@ ...@@ -41,6 +40,7 @@
} }
.goods-title-text { .goods-title-text {
max-width: 176rpx;
font-weight: 500; font-weight: 500;
font-size: 26rpx; font-size: 26rpx;
color: #333333; color: #333333;
......
...@@ -127,10 +127,97 @@ const goodsList = [ ...@@ -127,10 +127,97 @@ const goodsList = [
} }
] ]
const classifyTitleList = ['超值爆款', '商品分类', '商品分分分类']
const classifyGoodsList1 = [
{
goodsUrl: 'https://img01.glsx.com.cn/group1/M00/0F/3B/wKgFDWTclNCAdRMqAAHIp1r8d3w346.png',
goodsStatus: 1,
name: '360全景导航',
view: 9900,
sale: 1550,
newPrice: 129,
oldPrice: 169
},
{
goodsUrl: 'https://img01.glsx.com.cn/group1/M00/0F/3B/wKgFDWTclNCAdRMqAAHIp1r8d3w346.png',
goodsStatus: 2,
name: '360全景导航导航导航导航',
view: 9900,
sale: 1550,
newPrice: 129,
oldPrice: 169
},
{
goodsUrl: 'https://img01.glsx.com.cn/group1/M00/0F/3B/wKgFDWTclNCAdRMqAAHIp1r8d3w346.png',
goodsStatus: 1,
name: '大闸蟹提货',
view: 9900,
sale: 1550,
newPrice: 129,
oldPrice: 169
},
{
goodsUrl: 'https://img01.glsx.com.cn/group1/M00/0F/3B/wKgFDWTclNCAdRMqAAHIp1r8d3w346.png',
goodsStatus: 1,
name: '大闸蟹提货大闸蟹提货',
view: 9900,
sale: 1550,
newPrice: 129,
oldPrice: 169
}
]
const classifyGoodsList2 = [
{
goodsUrl: 'https://img01.glsx.com.cn/group1/M00/0F/3B/wKgFDWTclNCAdRMqAAHIp1r8d3w346.png',
goodsStatus: 1,
name: '360全景导航',
view: 9900,
sale: 1550,
newPrice: 129,
oldPrice: 169
},
{
goodsUrl: 'https://img01.glsx.com.cn/group1/M00/0F/3B/wKgFDWTclNCAdRMqAAHIp1r8d3w346.png',
goodsStatus: 1,
name: '360全景导航导航导航导航',
view: 9900,
sale: 1550,
newPrice: 129,
oldPrice: 169
}
]
const classifyGoodsList3 = [
{
goodsUrl: 'https://img01.glsx.com.cn/group1/M00/0F/3B/wKgFDWTclNCAdRMqAAHIp1r8d3w346.png',
goodsStatus: 1,
name: '大闸蟹提货',
view: 9900,
sale: 1550,
newPrice: 129,
oldPrice: 169
},
{
goodsUrl: 'https://img01.glsx.com.cn/group1/M00/0F/3B/wKgFDWTclNCAdRMqAAHIp1r8d3w346.png',
goodsStatus: 1,
name: '大闸蟹提货大闸蟹提货',
view: 9900,
sale: 1550,
newPrice: 129,
oldPrice: 169
}
]
export { export {
recreationMenu, recreationMenu,
foodMenu, foodMenu,
tripMenu, tripMenu,
maintainCarMenu, maintainCarMenu,
goodsList goodsList,
classifyTitleList,
classifyGoodsList1,
classifyGoodsList2,
classifyGoodsList3
} }
\ No newline at end of file \ No newline at end of file
// packageIndex/pages/carLife/index.js // packageIndex/pages/carLife/index.js
import {recreationMenu,foodMenu} from '../constant/lifeConstant' import {
recreationMenu,
foodMenu,
classifyTitleList,
classifyGoodsList1,
classifyGoodsList2,
classifyGoodsList3,
} from "../constant/lifeConstant";
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
recreationMenu, recreationMenu,
foodMenu, foodMenu,
strategyList: [] strategyList: [],
classifyTitleList,
titleActive: 0,
goodsList: [],
classifyGoodsList1,
classifyGoodsList2,
classifyGoodsList3,
}, },
/** /**
...@@ -23,62 +35,56 @@ Page({ ...@@ -23,62 +35,56 @@ Page({
wx.p.api.strategyApi wx.p.api.strategyApi
.getStrategyList({ .getStrategyList({
pageNum: 1, pageNum: 1,
pageSize: 100 pageSize: 100,
}) })
.then((res) => { .then((res) => {
console.log(res);
this.setData({ this.setData({
strategyList: res.list, strategyList: res.list,
}); });
}); });
}, },
switchTitle(e) {
const { index } = e.currentTarget.dataset;
const _list = ['classifyGoodsList1', 'classifyGoodsList2', 'classifyGoodsList3']
this.setData({
titleActive: index,
goodsList: this.data[_list[index]]
});
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady() { onReady() {},
},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {},
},
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide() { onHide() {},
},
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload() { onUnload() {},
},
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh() { onPullDownRefresh() {},
},
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom() { onReachBottom() {},
},
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
onShareAppMessage() {},
});
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
"usingComponents": { "usingComponents": {
"main-title": "../../../components/MainTitle/MainTitle", "main-title": "../../../components/MainTitle/MainTitle",
"menu-box": "../../components/MenuBox/MenuBox", "menu-box": "../../components/MenuBox/MenuBox",
"money-saving-tips": "../../../components/MoneySavingTips/MoneySavingTips" "money-saving-tips": "../../../components/MoneySavingTips/MoneySavingTips",
"goods-swiper": "../../components/GoodsSwiper/GoodsSwiper"
}, },
"navigationBarTitleText": "家生活" "navigationBarTitleText": "家生活"
} }
\ No newline at end of file \ No newline at end of file
...@@ -9,4 +9,35 @@ ...@@ -9,4 +9,35 @@
.title-box { .title-box {
margin: 30rpx 0 20rpx 0; margin: 30rpx 0 20rpx 0;
} }
.classify-title-box {
display: flex;
align-items: baseline;
}
.classify-title {
font-weight: 400;
font-size: 32rpx;
color: #333333;
margin-right: 48rpx;
}
.classify-title:last-child {
margin-right: 0;
}
.classify-title-active {
position: relative;
font-weight: 500;
font-size: 36rpx;
color: #333333;
margin-right: 48rpx;
}
.classify-title-active::after {
content: "";
display: block;
/* width: 144rpx; */
width: 100%;
height: 12rpx;
background-image: linear-gradient(90deg, #61a5ff00 0%, #2699fd 100%);
border-radius: 6rpx;
position: absolute;
bottom: 4rpx;
}
} }
...@@ -8,5 +8,11 @@ ...@@ -8,5 +8,11 @@
<main-title title="美食推荐"></main-title> <main-title title="美食推荐"></main-title>
</view> </view>
<menu-box menuList="{{foodMenu}}"></menu-box> <menu-box menuList="{{foodMenu}}"></menu-box>
<view class="title-box classify-title-box">
<view class="{{titleActive === index? 'classify-title-active':'classify-title'}}" wx:for="{{classifyTitleList}}" data-index="{{index}}" bind:tap="switchTitle">
{{item}}
</view>
</view>
<goods-swiper goodsList="{{goodsList.length ? goodsList : classifyGoodsList1}}"></goods-swiper>
</view> </view>
<money-saving-tips list="{{strategyList}}"></money-saving-tips> <money-saving-tips list="{{strategyList}}"></money-saving-tips>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!