This commit is contained in:
pplokijuhyg 2019-12-20 09:51:28 +08:00
parent edc8983853
commit 3cf388faed
6 changed files with 31 additions and 6 deletions

View File

@ -10,7 +10,9 @@ Component({
price: Number,
pic: String,
gid:Number,
num:Number
num:Number,
select:Boolean,
index:Number
},
/**
@ -58,6 +60,9 @@ Component({
}).then((res)=>{
})
},
sel(){
this.triggerEvent('sel', {index:this.data.index,select:this.data.select})
}
}

View File

@ -1,5 +1,5 @@
<view class="shoppingitem">
<view class="select"></view>
<view class="select {{select ? 'selects':''}}" bind:tap="sel"></view>
<view class="pic">
<image src="{{pic}}"></image>
</view>

View File

@ -12,7 +12,9 @@
border-radius: 50%;
margin: auto 0;
}
.selects{
background-color: #45C778;
}
.pic {
/* width: 222rpx;
height: 222rpx; */

View File

@ -7,8 +7,15 @@ Page({
*/
data: {
list:[],
select:[],
userid:0
},
sel(a){
console.log(a)
this.setData({
[`select[${a.detail.index}]`]:!a.detail.select
})
},
/**
* 生命周期函数--监听页面加载
@ -53,7 +60,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function() {
this.onLoad()
},
/**
@ -89,5 +96,10 @@ Page({
*/
onShareAppMessage: function() {
},
num(){
for(let i in this.data.select){
}
}
})

View File

@ -1,6 +1,6 @@
<view class="shopping">
<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>
<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}}" index="{{j}}" select="{{select[j]}}" bindsel="sel"></shopping-item>
</view>
<!-- <view class="item">
<shopping-item shopname="J`adore - Dior" shopdesc="30支 1.30kg" price="61.78"></shopping-item>

View File

@ -14,7 +14,13 @@ let request = function (obj){
url="http://daigou.sdbairui.com/index.php/WXAPI/" + url
let text = ""
for(let i in urldata){
text += `/${i}/${urldata[i]}`
if(urldata[i] == undefined){
text += `/${i}`
}else{
text += `/${i}/${urldata[i]}`
}
}
url+=text
if(method == "POST" || method == "post"){