rmodal.js
1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import App from '../../utils/api.js'
import util from '../../utils/util.js'
Component({
properties:{
fooditem:Object,
},
data:{
num:5,
rmodalhidden:true
},
observers: {
},
attached(){
},
methods:{
showrmodal(){
this.setData({
rmodalhidden:false
})
this.getcartlist();
},
hidermodal(){
this.setData({
rmodalhidden:true
})
},
actfood(e){
console.log('reduce')
this.triggerEvent('tellfood',{action:e.detail.action,classid:this.data.fooditem.cid,id:this.data.fooditem.id});
this.getcartlist();
},
getcartlist(){
App.Orders.GetCartByOpenid({sellerid:this.data.fooditem.sellerid,openid:util.cache('openid'),cookbookid:this.data.fooditem.id}).then((json)=>{
console.log(json,'yyyyyyy')
if(json.ret==200){
if(json.data.length==0){
this.hidermodal();
}else{
this.setData({
bookfood:json.data
})
}
// json.data.forEach((v,i)=>{
// v.price=Number(v.price);
// v.member_price=Number(v.member_price);
// })
// this.setData({
// cartlist:json.data
// })
}
})
},
}
})