1.增加商品列表页面

yj-dev
杨杰 3 years ago
parent fa2371bdf4
commit a50e938d73
  1. 1
      pages.json
  2. 110
      pages/goods/goods-list/goods-list.vue
  3. 10
      pages/tabBar/home/home.vue
  4. BIN
      static/img/fqhed.png
  5. BIN
      static/img/headzq.png
  6. BIN
      static/img/jbhed.png

@ -137,7 +137,6 @@
{ {
"path": "pages/goods/goods-list/goods-list", "path": "pages/goods/goods-list/goods-list",
"style": { "style": {
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#0083f5", "navigationBarBackgroundColor": "#0083f5",
"backgroundColorTop": "#0083f5", "backgroundColorTop": "#0083f5",
"navigationBarTextStyle": "white", "navigationBarTextStyle": "white",

@ -1,28 +1,6 @@
<template> <template>
<view> <view>
<!-- 商品数据 -->
<!-- <view class="header" :style="{position:headerPosition,top:headerTop}">
<view class="target" v-for="(target,index) in orderbyList" @tap="select(index)" :key="index" :class="[target.selected?'on':'']">
{{target.text}}
<view v-if="target.orderbyicon" class="icon" :class="target.orderbyicon[target.orderby]"></view>
</view>
</view> -->
<!-- 占位 -->
<view class="place"></view>
<!-- 商品列表 -->
<view class="goods-list">
<view class="product-list">
<view class="product" v-for="(goods) in goodsList" :key="goods.goods_id" @tap="toGoods(goods)">
<image mode="widthFix" :src="goods.img"></image>
<view class="name">{{goods.name}}</view>
<view class="info">
<view class="price">{{goods.price}}</view>
<view class="slogan">{{goods.slogan}}</view>
</view>
</view>
</view>
<view class="loading-text">{{loadingText}}</view>
</view>
</view> </view>
</template> </template>
@ -30,35 +8,44 @@
export default { export default {
data() { data() {
return { return {
goodsList:[ goodsList: [],
{ goods_id: 0, img: '/static/img/goods/p1.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' },
{ goods_id: 1, img: '/static/img/goods/p2.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' },
{ goods_id: 2, img: '/static/img/goods/p3.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' },
{ goods_id: 3, img: '/static/img/goods/p4.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' },
{ goods_id: 4, img: '/static/img/goods/p5.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' },
{ goods_id: 5, img: '/static/img/goods/p6.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' },
{ goods_id: 6, img: '/static/img/goods/p7.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' },
{ goods_id: 7, img: '/static/img/goods/p8.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' },
{ goods_id: 8, img: '/static/img/goods/p9.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' },
{ goods_id: 9, img: '/static/img/goods/p10.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' }
],
loadingText: "正在加载...", loadingText: "正在加载...",
headerTop: "0px", headerTop: "0px",
headerPosition: "fixed", headerPosition: "fixed",
orderbyList:[ orderbyList: [{
{text:"销量",selected:true,orderbyicon:false,orderby:0}, text: "销量",
{text:"价格",selected:false,orderbyicon:['sheng','jiang'],orderby:0}, selected: true,
{text:"好评",selected:false,orderbyicon:false,orderby:0} orderbyicon: false,
orderby: 0
},
{
text: "价格",
selected: false,
orderbyicon: ['sheng', 'jiang'],
orderby: 0
},
{
text: "好评",
selected: false,
orderbyicon: false,
orderby: 0
}
], ],
orderby: "sheng" orderby: "sheng"
}; };
}, },
onLoad: function(option) { //optionobject onLoad: function(option) { //optionobject
console.log(option.cid); // console.log(option.cid); //
if (option.id == 1) {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: option.name title: '商品列表'
}); });
}
if (option.id == 2) {
uni.setNavigationBarTitle({
title: '金币列表'
});
}
//H5 //H5
// #ifdef H5 // #ifdef H5
//onLoadhead //onLoadhead
@ -88,7 +75,9 @@
}, },
//page.json"onReachBottomDistance" //page.json"onReachBottomDistance"
onReachBottom() { onReachBottom() {
uni.showToast({title: '触发上拉加载'}); uni.showToast({
title: '触发上拉加载'
});
let len = this.goodsList.length; let len = this.goodsList.length;
if (len >= 40) { if (len >= 40) {
this.loadingText = "到底了"; this.loadingText = "到底了";
@ -99,7 +88,13 @@
let end_goods_id = this.goodsList[len - 1].goods_id; let end_goods_id = this.goodsList[len - 1].goods_id;
for (let i = 1; i <= 10; i++) { for (let i = 1; i <= 10; i++) {
let goods_id = end_goods_id + i; let goods_id = end_goods_id + i;
let p = { goods_id: goods_id, img: '/static/img/goods/p'+(goods_id%10==0?10:goods_id%10)+'.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' }; let p = {
goods_id: goods_id,
img: '/static/img/goods/p' + (goods_id % 10 == 0 ? 10 : goods_id % 10) + '.jpg',
name: '商品名称商品名称商品名称商品名称商品名称',
price: '¥168',
slogan: '1235人付款'
};
this.goodsList.push(p); this.goodsList.push(p);
} }
}, },
@ -111,13 +106,22 @@
let end_goods_id = 0; let end_goods_id = 0;
for (let i = 1; i <= 10; i++) { for (let i = 1; i <= 10; i++) {
let goods_id = end_goods_id + i; let goods_id = end_goods_id + i;
let p = { goods_id: goods_id, img: '/static/img/goods/p'+(goods_id%10==0?10:goods_id%10)+'.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' }; let p = {
goods_id: goods_id,
img: '/static/img/goods/p' + (goods_id % 10 == 0 ? 10 : goods_id % 10) + '.jpg',
name: '商品名称商品名称商品名称商品名称商品名称',
price: '¥168',
slogan: '1235人付款'
};
this.goodsList.push(p); this.goodsList.push(p);
} }
}, },
// //
toGoods(e) { toGoods(e) {
uni.showToast({title: '商品'+e.goods_id,icon:"none"}); uni.showToast({
title: '商品' + e.goods_id,
icon: "none"
});
uni.navigateTo({ uni.navigateTo({
url: '../goods' url: '../goods'
}); });
@ -140,7 +144,10 @@
this.orderbyList[i].selected = false; this.orderbyList[i].selected = false;
} }
} }
uni.showToast({title:tmpTis,icon:"none"}); uni.showToast({
title: tmpTis,
icon: "none"
});
} }
} }
@ -151,6 +158,7 @@
.icon { .icon {
font-size: 26upx; font-size: 26upx;
} }
.header { .header {
width: 92%; width: 92%;
padding: 0 4%; padding: 0 4%;
@ -163,6 +171,7 @@
z-index: 10; z-index: 10;
background-color: #fff; background-color: #fff;
border-bottom: solid 1upx #eee; border-bottom: solid 1upx #eee;
.target { .target {
width: 20%; width: 20%;
height: 60upx; height: 60upx;
@ -172,6 +181,7 @@
font-size: 28upx; font-size: 28upx;
margin-bottom: -2upx; margin-bottom: -2upx;
color: #aaa; color: #aaa;
&.on { &.on {
color: #555; color: #555;
border-bottom: 4upx solid #0083f5; border-bottom: 4upx solid #0083f5;
@ -182,12 +192,14 @@
} }
} }
.place { .place {
background-color: #ffffff; background-color: #ffffff;
height: 100upx; height: 100upx;
} }
.goods-list { .goods-list {
.loading-text { .loading-text {
width: 100%; width: 100%;
@ -198,22 +210,26 @@
color: #979797; color: #979797;
font-size: 24upx; font-size: 24upx;
} }
.product-list { .product-list {
width: 92%; width: 92%;
padding: 0 4% 3vw 4%; padding: 0 4% 3vw 4%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
flex-wrap: wrap; flex-wrap: wrap;
.product { .product {
width: 48%; width: 48%;
border-radius: 20upx; border-radius: 20upx;
background-color: #fff; background-color: #fff;
margin: 0 0 15upx 0; margin: 0 0 15upx 0;
box-shadow: 0upx 5upx 25upx rgba(0, 0, 0, 0.1); box-shadow: 0upx 5upx 25upx rgba(0, 0, 0, 0.1);
image { image {
width: 100%; width: 100%;
border-radius: 20upx 20upx 0 0; border-radius: 20upx 20upx 0 0;
} }
.name { .name {
width: 92%; width: 92%;
padding: 8upx 4%; padding: 8upx 4%;
@ -224,6 +240,7 @@
overflow: hidden; overflow: hidden;
font-size: 30upx; font-size: 30upx;
} }
.info { .info {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@ -236,6 +253,7 @@
font-size: 30upx; font-size: 30upx;
font-weight: 600; font-weight: 600;
} }
.slogan { .slogan {
color: #807c87; color: #807c87;
font-size: 24upx; font-size: 24upx;

@ -55,7 +55,7 @@
</view> </view>
</view> </view>
<!-- 赠券 --> <!-- 赠券 -->
<view style="width: 91%;margin-left: 5%;"> <view style="width: 91%;margin-left: 5%;" @click="goGoodsList(1)">
<image class="mart30 width100" mode="widthFix" src="../../../static/img/headzq.png"></image> <image class="mart30 width100" mode="widthFix" src="../../../static/img/headzq.png"></image>
</view> </view>
<swiper class="orange-content" style="border: 2px solid #ff5836;" :display-multiple-items="productListleg"> <swiper class="orange-content" style="border: 2px solid #ff5836;" :display-multiple-items="productListleg">
@ -70,7 +70,7 @@
</swiper> </swiper>
<!-- 金币 --> <!-- 金币 -->
<view style="width: 90%;margin-left: 5%;"> <view style="width: 90%;margin-left: 5%;" @click="goGoodsList(2)">
<image class="mart30 width100" mode="widthFix" src="../../../static/img/jbhed.png"></image> <image class="mart30 width100" mode="widthFix" src="../../../static/img/jbhed.png"></image>
</view> </view>
<!-- v-if="goldproductList&&goldproductList.length>0" --> <!-- v-if="goldproductList&&goldproductList.length>0" -->
@ -420,6 +420,12 @@
console.log(err); console.log(err);
}); });
}, },
//
goGoodsList(item){
uni.navigateTo({
url:'../../goods/goods-list/goods-list?id='+item
})
},
// //
toSearch() { toSearch() {
uni.navigateTo({ uni.navigateTo({

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Loading…
Cancel
Save