Commit 8f622f43 by 匡雅琴

商品横向滚动完成

1 parent ecbbebc9
Component({
data: {},
properties: {
goodsItem: {
type: Object,
value: {}
}
},
methods: {}
})
\ No newline at end of file
{
"component": true
}
\ No newline at end of file
<view class="goods-item">
<image class="goods-img" src="{{goodsItem.goodsUrl}}" />
<view class="goods-content-box">
<view class="goods-title-box">
<view class="goods-title-tips {{goodsItem.goodsStatus == 1 ? 'goods-title-tips-new': 'goods-title-tips-miao'}}">
{{goodsItem.goodsStatus == 1 ? '上新' : '秒杀'}}
</view>
<view class="goods-title-text">{{goodsItem.name}}</view>
</view>
<view class="goods-msg">{{goodsItem.view}}查看 | 售出{{goodsItem.sale}}</view>
<view class="goods-price-box">
<view class="goods-new-price-box">
<text class="goods-new-price-icon">¥</text>
<text class="goods-new-price-text">{{goodsItem.newPrice}}</text>
</view>
<view class="goods-old-price-box">¥{{goodsItem.oldPrice}}</view>
</view>
</view>
</view>
\ No newline at end of file
.goods-item {
background: #ffffff;
}
.goods-img {
width: 276rpx;
height: 280rpx;
border-radius: 8rpx 8rpx 0 0;
-webkit-border-radius: 8rpx 8rpx 0 0;
-moz-border-radius: 8rpx 8rpx 0 0;
-ms-border-radius: 8rpx 8rpx 0 0;
-o-border-radius: 8rpx 8rpx 0 0;
}
.goods-content-box {
padding: 20rpx;
}
.goods-title-box {
display: flex;
max-width: 236rpx;
}
.goods-title-tips {
width: 60rpx;
height: 28rpx;
border-radius: 4rpx;
font-weight: 400;
font-size: 20rpx;
color: #ffffff;
line-height: 28rpx;
text-align: center;
}
.goods-title-tips-new {
background: #70b2ff;
}
.goods-title-tips-miao {
background: #f94a36;
}
.goods-title-text {
font-weight: 500;
font-size: 26rpx;
color: #333333;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.goods-msg {
font-weight: 400;
font-size: 20rpx;
color: #d79736;
margin-top: 8rpx;
}
.goods-price-box {
display: flex;
align-items: baseline;
margin-top: 12rpx;
}
.goods-new-price-box {
font-weight: 600;
color: #ec3c1f;
}
.goods-new-price-icon {
font-size: 24rpx;
}
.goods-new-price-text {
font-size: 40rpx;
}
.goods-old-price-box {
font-weight: 400;
font-size: 22rpx;
color: #999999;
text-decoration: line-through;
}
Component({
data: {},
properties: {
goodsList: {
type: Array,
value: []
}
},
methods: {}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {
"goods-item": "../GoodsItem/GoodsItem"
}
}
\ No newline at end of file
<view class="goods-swiper">
<scroll-view class="goods-list" enable-flex scroll-x>
<view class="cell" wx:for="{{goodsList}}" wx:key="index">
<goods-item goodsItem="{{item}}"></goods-item>
</view>
</scroll-view>
</view>
\ No newline at end of file
.goods-list {
height: 448rpx;
display: flex;
flex-direction: row;
box-sizing: border-box;
}
.goods-list .cell {
margin: 0 12rpx 0 0;
}
.goods-list .cell:last-child {
margin: 0;
}
\ No newline at end of file
// packageIndex/pages/carLife/index.js
import {tripMenu,maintainCarMenu} from '../constant/lifeConstant'
import {tripMenu,maintainCarMenu,goodsList} from '../constant/lifeConstant'
Page({
/**
......@@ -7,7 +7,8 @@ Page({
*/
data: {
tripMenu,
maintainCarMenu
maintainCarMenu,
goodsList
},
/**
......
{
"usingComponents": {
"main-title": "../../components/MainTitle/MainTitle",
"menu-box": "../../components/MenuBox/MenuBox"
"menu-box": "../../components/MenuBox/MenuBox",
"goods-swiper": "../../components/GoodsSwiper/GoodsSwiper"
},
"navigationBarTitleText": "车生活"
}
\ No newline at end of file
......@@ -11,4 +11,5 @@
<view class="title-box">
<main-title title="甄选车品"></main-title>
</view>
<goods-swiper goodsList="{{goodsList}}"></goods-swiper>
</view>
......@@ -88,9 +88,49 @@ const maintainCarMenu = [
}
]
const goodsList = [
{
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
},
{
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
}
]
export {
recreationMenu,
foodMenu,
tripMenu,
maintainCarMenu
maintainCarMenu,
goodsList
}
\ 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!