pplok #29

Manually merged
theluyuan merged 5 commits from pplok into master 2019-12-20 14:17:19 +08:00
2 changed files with 73 additions and 46 deletions
Showing only changes of commit 487fee5b04 - Show all commits

View File

@ -33,6 +33,8 @@ Page({
this.setData({ this.setData({
list: res.data.result list: res.data.result
}) })
this.num()
}) })
}, },
onLoad: function (options) { onLoad: function (options) {
@ -44,6 +46,7 @@ Page({
userid: res.data.data.user_id userid: res.data.data.user_id
}) })
this.getlist() this.getlist()
}) })
}, },
sub() { sub() {
@ -109,7 +112,7 @@ Page({
sel++ sel++
} }
} }
if(sel == this.data.list.length){ if (sel == this.data.list.length && this.data.list.length != 0) {
this.setData({ this.setData({
all: true all: true
}) })
@ -147,5 +150,29 @@ Page({
} }
this.num() this.num()
},
del() {
for (let i in this.data.list) {
// console.log(i)
if (this.data.select[i]) {
// num += parseFloat(this.data.list[i].goods_price)*100
// sel++
request({
url: "Cart/delCart",
urldata: {
id: this.data.list[i].id
}
}).then((res) => {
console.log('删除成功')
this.setData({
list: [],
select: [],
userid: 0,
price: "0.00"
})
this.onLoad()
})
}
}
} }
}) })

View File

@ -18,7 +18,7 @@
<text class="pri">${{price}}</text> <text class="pri">${{price}}</text>
</view> </view>
<view class="right"> <view class="right">
<text class="del">删除</text> <text class="del" bind:tap="del">删除</text>
<text class="sub" bindtap="sub">结算</text> <text class="sub" bindtap="sub">结算</text>
</view> </view>
</view> </view>