cc_list.js
4.85 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
var util = require('../../utils/util.js')
var uri=require('../../utils/uri.js')
Page({
data: {
loading:true,
scrollHeight:0,
isscroll:true,
dtn_ishidden:true,
numNo_ishidden:true,
clearlist:[],
spe:[],
specs :[],
sellerid:'',
savelist:[] //用于取消估清时的规格存储
},
onLoad: function () {
var that=this;
//获取系统信息
var sys=wx.getSystemInfo({
success:function(res){
that.setData({
scrollHeight:res.windowHeight,
scrollHeight1:res.windowHeight-93,
scrollHeight2:res.windowHeight-200,
windowWidth:res.windowWidth,
margin:(res.windowWidth*0.92-228)/10
});
}
});
wx.setNavigationBarTitle({
title:'商品沽清',
})
this.setData({
sellerid: util.cache("sellerid"),
});
},
onReady () {
this.setData({ loading:false })
},
onShow:function(){
var that=this;
this.alert=this.selectComponent('#alert');
that.clearlist();
util.postSuccessFun=function(json,uri_code){
switch(uri_code){
case uri.CGI__USER_GETCLEARCOOKBOOKBYSELLERID__CODE: //获取商家所有估清菜品列表(估清管理)
if(json.ret==200){
var thisdata=json.data[0]['list'];
that.setData({
clearlist:thisdata,
})
}
break
case uri.CGI__USER_SETCLEARCOOKBOOKBYID__CODE: //设置商家菜品估清(估清管理)
console.log(json)
that.setData({
numNo_ishidden:true,
})
if(json.ret==200){
console.log(json)
that.onShow();
}
break
}
}
},
clearlist:function(){
util.post(uri.CGI__USER_GETCLEARCOOKBOOKBYSELLERID,{sellerid:this.data.sellerid},uri.CGI__USER_GETCLEARCOOKBOOKBYSELLERID__CODE)
},
//对无规格菜品的弹出框取消
onlyCancelModel:function(){
this.setData({
atn_ishidden:true,
})
},
//取消无规格估清的点击事件,有弹出框
deleteOnlyClear:function(e){
if(util.powercontro('取消沽清')==false){
this.alert.show('您暂没有权限取消沽清菜品')
}else{
this.setData({
dtn_ishidden:false,
title:e.currentTarget.dataset.name,
cookbookid:e.currentTarget.dataset.id
})
}
},
//取消弹出框的取消
deleteCancelModel:function(e){
this.setData({
dtn_ishidden:true,
ltn_ishidden:true
})
},
//取消无规格弹出框的确认
deleteConfirmModel:function(e){
util.post(uri.CGI__USER_SETCLEARCOOKBOOKBYID,{cookbookid:this.data.cookbookid,clear_num:'cancel'},uri.CGI__USER_SETCLEARCOOKBOOKBYID__CODE)
this.setData({
dtn_ishidden:true,
})
},
nospecs:function(e){
if(util.powercontro('修改菜品')==false){
this.alert.show('您暂没有权限修改沽清菜品')
}else{
this.setData({
numNo_ishidden:false,
title:e.currentTarget.dataset.name,
cookbookid:e.currentTarget.dataset.id,
clear_num:e.currentTarget.dataset.clear_num
})
}
},
//对无规格菜品的弹出框取消
onlyCancelModel:function(){
this.setData({
numNo_ishidden:true,
})
},
//对无规格菜品的弹出框确认
onlyConfirmModel:function(e){
util.post(uri.CGI__USER_SETCLEARCOOKBOOKBYID,{cookbookid:this.data.cookbookid,clear_num:this.data.clear_num},uri.CGI__USER_SETCLEARCOOKBOOKBYID__CODE)
},
//获取无规格菜品输入框数据
onlyModalInput:function(e){
console.log(e);
this.setData({
clear_num:e.detail.value
})
},
addClear:function(){
if(util.powercontro('添加沽清')==false){
this.alert.show('您暂没有权限添加沽清菜品')
}else{
wx.navigateTo({
url:'ck_list'
})
}
},
netchange:function(){
this.onShow();
},
editcook:function(e){
if(util.powercontro('修改沽清')==false){
this.alert.show('您暂没有权限修改沽清菜品')
}else{
wx.navigateTo({
url:'../cookbook/cb_sadd?id='+e.currentTarget.dataset.id
})
}
}
})