分类完善

This commit is contained in:
pplokijuhyg 2019-12-19 17:22:23 +08:00
parent 0c0acf2540
commit edc8983853
9 changed files with 158 additions and 123 deletions

View File

@ -1,12 +1,13 @@
Component({
properties: {
list:Array
},
data: {},
methods: {
todetail() {
todetail(a) {
console.log(a)
wx.navigateTo({
url: "/pages/product/product"
url: "/pages/product/product?shopid=" + a.currentTarget.dataset.id
})
}
}

View File

@ -1,4 +1,4 @@
.list{
.list {
padding-left: 20rpx;
width: 572rpx;
box-sizing: border-box;
@ -28,6 +28,17 @@
margin-left: 40rpx;
display: flex;
flex-direction: column;
.towline {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
> text {
font-size: 22rpx;
color: #333;

View File

@ -1,5 +1,17 @@
<scroll-view class="list" scroll-y="{{true}}" >
<view class="commodity" bindtap="todetail">
<view class="commodity" bindtap="todetail" wx:for="{{list}}" wx:for-index="j" wx:key="{{j}}" data-id="{{item.goods_id}}">
<view class="content">
<image class="imgthumb " src="{{item.image}}"></image>
<view class="introduce">
<text class="towline">{{item.goods_name}}</text>
<view>
<text>¥{{item.shop_price}}</text>
<text>加入购物车</text>
</view>
</view>
</view>
</view>
<!-- <view class="commodity" bindtap="todetail">
<view class="content">
<image class="imgthumb "></image>
<view class="introduce">
@ -22,17 +34,5 @@
</view>
</view>
</view>
</view>
<view class="commodity" bindtap="todetail">
<view class="content">
<image class="imgthumb "></image>
<view class="introduce">
<text>产品名称产品名称产品名称产品名称产品名称产品</text>
<view>
<text>¥657</text>
<text>加入购物车</text>
</view>
</view>
</view>
</view>
</view> -->
</scroll-view>

View File

@ -1 +1 @@
.list{padding-left:20rpx;width:572rpx;box-sizing:border-box;height:100vh}.list .commodity{width:552rpx;display:flex;align-items:center}.list .commodity .content{width:552rpx;height:100%;display:flex;align-items:center;border-bottom:2rpx solid #eaeaea;padding:30rpx 0}.list .commodity .content .imgthumb{width:105rpx;height:105rpx;margin-left:40rpx;background-color:#333}.list .commodity .content .introduce{width:336rpx;margin-left:40rpx;display:flex;flex-direction:column}.list .commodity .content .introduce>text{font-size:22rpx;color:#333;margin-bottom:22rpx}.list .commodity .content .introduce>view{display:flex;align-items:center;justify-content:space-between}.list .commodity .content .introduce>view>text:first-child{font-size:30rpx;color:#dec499}.list .commodity .content .introduce>view>text:last-child{font-size:22rpx;color:#999}
.list{padding-left:20rpx;width:572rpx;box-sizing:border-box;height:100vh}.list .commodity{width:552rpx;display:flex;align-items:center}.list .commodity .content{width:552rpx;height:100%;display:flex;align-items:center;border-bottom:2rpx solid #eaeaea;padding:30rpx 0}.list .commodity .content .imgthumb{width:105rpx;height:105rpx;margin-left:40rpx;background-color:#333}.list .commodity .content .introduce{width:336rpx;margin-left:40rpx;display:flex;flex-direction:column}.list .commodity .content .introduce .towline{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.list .commodity .content .introduce>text{font-size:22rpx;color:#333;margin-bottom:22rpx}.list .commodity .content .introduce>view{display:flex;align-items:center;justify-content:space-between}.list .commodity .content .introduce>view>text:first-child{font-size:30rpx;color:#dec499}.list .commodity .content .introduce>view>text:last-child{font-size:22rpx;color:#999}

View File

@ -12,6 +12,7 @@ Component({
this.setData({
id: a.target.dataset.id
})
this.triggerEvent("select",{id:a.target.dataset.id})
}
}
})

View File

@ -40,7 +40,6 @@
align-items: center;
justify-content: space-between;
> text:first-child {
font-size: 30rpx;
color: #dec499;
}
@ -56,4 +55,4 @@
height: 102rpx;
background-color: #3fb66e;
}
}
}

View File

@ -25,9 +25,14 @@ Component({
*/
methods: {
rm() {
if (this.data.num == 0) {
return
} else {
this.setData({
num: this.data.num - 1
})
request({
url:"Cart/updateNum",
urldata:{
@ -35,14 +40,15 @@ Component({
num:this.data.num - 1
}
}).then((res)=>{
this.setData({
num: this.data.num - 1
})
})
}
},
add() {
this.setData({
num: this.data.num + 1
})
request({
url:"Cart/updateNum",
urldata:{
@ -50,9 +56,7 @@ Component({
num:this.data.num + 1
}
}).then((res)=>{
this.setData({
num: this.data.num + 1
})
})
}

View File

@ -6,7 +6,8 @@ Page({
* 页面的初始数据
*/
data: {
type: []
type: [],
list:[]
},
/**
@ -23,11 +24,29 @@ Page({
this.setData({
type: res.data.result
})
this.select({detail:{id:res.data.result[0].id}})
console.log(this.data.type, 150)
})
},
select(a){
// console.log(a)
// a.detail.id
request({
url:'Goods/goodsList',
urldata:{
id:a.detail.id,
sort:'shop_price',
sort_asc:'desc',
p:0
}
}).then((res)=>{
console.log(res)
this.setData({
list:res.data.result.goods_list
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

View File

@ -1,4 +1,4 @@
<view class="box">
<navigation types="{{type}}"></navigation>
<list ></list>
<navigation bindselect="select" types="{{type}}"></navigation>
<list list="{{list}}"></list>
</view>