pplok #26

Merged
theluyuan merged 5 commits from pplok into master 2019-12-19 16:00:29 +08:00
9 changed files with 69 additions and 20 deletions

View File

@ -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
})
})
}

View File

@ -1,7 +1,7 @@
<view class="shoppingitem">
<view class="select"></view>
<view class="pic">
<image></image>
<image src="{{pic}}"></image>
</view>
<view class="shopinfo">
<view class="shopname">{{shopname}}</view>

View File

@ -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 {

View File

@ -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({

View File

@ -17,6 +17,7 @@
font-size: 32rpx;
color: #333;
margin-bottom: 34rpx;
width: 540rpx;
}
.menery{
font-size: 34rpx;

View File

@ -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}

View File

@ -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) {

View File

@ -1,6 +1,6 @@
<view class="shopping">
<view class="item" wx:for="{{list}}" wx:for-index="j" wx:if = "{{item == 1}}" wx:key="{{j}}">
<shopping-item shopname="J`adore - Dior" shopdesc="30支 1.30kg" price="61.78"></shopping-item>
<view class="item" wx:for="{{list}}" wx:for-index="j" wx:key="{{j}}">
<shopping-item shopname="{{item.goods_name}}" shopdesc="{{item.spec_key_name||'默认规格'}}" price="{{item.goods_price}}" pic="{{item.image}}" num="{{item.goods_num}}" gid="{{item.id}}"></shopping-item>
</view>
<!-- <view class="item">
<shopping-item shopname="J`adore - Dior" shopdesc="30支 1.30kg" price="61.78"></shopping-item>

View File

@ -7,9 +7,16 @@ let request = function (obj){
header,
dataType,
responseType,
complete
complete,
name,
urldata
} = obj
url="http://daigou.sdbairui.com/index.php/WXAPI/" + url
let text = ""
for(let i in urldata){
text += `/${i}/${urldata[i]}`
}
url+=text
if(method == "POST" || method == "post"){
if(header == undefined){
header ={}
@ -19,7 +26,7 @@ let request = function (obj){
if(data == undefined){
data = {}
}
data.openid = wx.getStorageSync("openid")
data[name || 'openid'] = wx.getStorageSync("openid")
return new Promise((res,rej)=>{
wx.request({
url,