diff --git a/components/shopping/shoppingitem/shoppingitem.js b/components/shopping/shoppingitem/shoppingitem.js index 4ab5506..388acca 100644 --- a/components/shopping/shoppingitem/shoppingitem.js +++ b/components/shopping/shoppingitem/shoppingitem.js @@ -1,20 +1,23 @@ // components/shopping/shoppingitem/shoppingitem.js +import {request} from "../../../utils/bin" Component({ /** * 组件的属性列表 */ properties: { - shospname: String, + shopname: String, shopdesc: String, price: Number, - pic: String + pic: String, + gid:Number, + num:Number }, /** * 组件的初始数据 */ data: { - num: 5 + }, /** @@ -25,15 +28,31 @@ Component({ if (this.data.num == 0) { return } else { - this.setData({ - num: this.data.num - 1 + request({ + url:"Cart/updateNum", + urldata:{ + id:this.data.gid, + 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:{ + id:this.data.gid, + num:this.data.num + 1 + } + }).then((res)=>{ + this.setData({ + num: this.data.num + 1 + }) }) } diff --git a/components/shopping/shoppingitem/shoppingitem.wxml b/components/shopping/shoppingitem/shoppingitem.wxml index a2fe59f..2753d2d 100644 --- a/components/shopping/shoppingitem/shoppingitem.wxml +++ b/components/shopping/shoppingitem/shoppingitem.wxml @@ -1,7 +1,7 @@ - + {{shopname}} diff --git a/components/shopping/shoppingitem/shoppingitem.wxss b/components/shopping/shoppingitem/shoppingitem.wxss index 34847bd..a24b12e 100644 --- a/components/shopping/shoppingitem/shoppingitem.wxss +++ b/components/shopping/shoppingitem/shoppingitem.wxss @@ -35,13 +35,21 @@ font-size: 26rpx; font-weight: bold; margin-bottom: 18rpx; - margin-top: 35rpx; + margin-top: 20rpx; + text-overflow: ellipsis; + overflow: hidden; + + display: -webkit-box; + + -webkit-box-orient: vertical; + + -webkit-line-clamp: 2; } .shopdesc { color: #666666; font-size: 22rpx; - margin-bottom: 39rpx; + margin-bottom: 20rpx; } .price { diff --git a/pages/product/product.js b/pages/product/product.js index 1ca6965..27c8bdf 100644 --- a/pages/product/product.js +++ b/pages/product/product.js @@ -6,7 +6,8 @@ Page({ * 页面的初始数据 */ data: { - array: ['20粒', '30粒', '50粒', '100粒'] + array: ['20粒', '30粒', '50粒', '100粒'], + userid:0 }, /** @@ -27,6 +28,14 @@ Page({ }) // console.log(this.data.type, 150) }) + request({ + url:"User/validateOpenid" + }).then((res)=>{ + console.log(res) + this.setData({ + userid:res.data.data.user_id + }) + }) }, // goshop() { @@ -38,8 +47,10 @@ Page({ data: { goods_id: this.data.shopid, goods_num: 1, - goods_spec:e.detail.value - } + goods_spec:"", + user_id:this.data.userid + }, + name:"session_id" }).then((res)=>{ console.log(res) wx.switchTab({ diff --git a/pages/product/product.scss b/pages/product/product.scss index ce83366..3476d77 100644 --- a/pages/product/product.scss +++ b/pages/product/product.scss @@ -17,6 +17,7 @@ font-size: 32rpx; color: #333; margin-bottom: 34rpx; + width: 540rpx; } .menery{ font-size: 34rpx; diff --git a/pages/product/product.wxss b/pages/product/product.wxss index df561aa..51450d1 100644 --- a/pages/product/product.wxss +++ b/pages/product/product.wxss @@ -1 +1 @@ -.box{border-top:1rpx solid #eaeaea;display:flex;flex-direction:column;align-items:center}.box .swiper{margin-top:109rpx;width:389rpx;height:657rpx}.box .swiper .image{width:389rpx;height:549rpx;background-color:#000}.box .title{font-size:32rpx;color:#333;margin-bottom:34rpx}.box .menery{font-size:34rpx;color:#666;margin-bottom:70rpx}.box .add{width:308rpx;height:98rpx;background-color:#50CA80;border-radius:49rpx;line-height:98rpx;font-size:34rpx;color:#fff;text-align:center} +.box{border-top:1rpx solid #eaeaea;display:flex;flex-direction:column;align-items:center}.box .swiper{margin-top:109rpx;width:389rpx;height:657rpx}.box .swiper .image{width:389rpx;height:549rpx;background-color:#000}.box .title{font-size:32rpx;color:#333;margin-bottom:34rpx;width:540rpx}.box .menery{font-size:34rpx;color:#666;margin-bottom:70rpx}.box .add{width:308rpx;height:98rpx;background-color:#50CA80;border-radius:49rpx;line-height:98rpx;font-size:34rpx;color:#fff;text-align:center} diff --git a/pages/shopping/shopping.js b/pages/shopping/shopping.js index 1988121..02f0f12 100644 --- a/pages/shopping/shopping.js +++ b/pages/shopping/shopping.js @@ -6,7 +6,7 @@ Page({ * 页面的初始数据 */ data: { - list:[1,1,1], + list:[], userid:0 }, @@ -21,6 +21,9 @@ Page({ } }).then((res)=>{ console.log(res) + this.setData({ + list:res.data.result + }) }) }, onLoad: function(options) { diff --git a/pages/shopping/shopping.wxml b/pages/shopping/shopping.wxml index ffaa067..563d88f 100644 --- a/pages/shopping/shopping.wxml +++ b/pages/shopping/shopping.wxml @@ -1,6 +1,6 @@ - - + +