cb_list.js
30.7 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
//logs.js
var util = require('../../utils/util.js')
var uri=require('../../utils/uri.js')
// var recorderManager=wx.getRecorderManager();
var plugin = requirePlugin("WechatSI")
var manager = plugin.getRecordRecognitionManager();
Page({
data: {
toview:'',
scrollTop:0,
mlistData:[],
typelistData:[],
atn_ishidden:true,
dtn_ishidden:true,
mtop:0,
sellerid:'',
set_status:0,
set_odrer:0,
nothingHeight:0,
blockhide:true, //语音录菜
reminderInfo:'格式:红烧肉20元',//语音录菜提示
startPageY:0, //记录语音点菜开始距离
endPageY:0, //记录语音点菜结束距离
voice_active:'', //语音面板是否显示,以此改变语音录菜按钮样式
animate:'', //语音动画是否执行
start_status:false, //语音面板开始显示状态
cancel_status:true, //语音面板上滑显示状态
mtn_ishidden:true, //选择标签、删除弹出框
line:[1,2,3,4,5],
},
onLoad:function(opt){
console.log(opt)
var that=this;
util.setBarTitle('菜品管理');
this.setData({
sellerid: util.cache("sellerid"),
tid:opt.tid ? opt.tid : null,
headerheight:util.cache('headerHeight')
})
console.log(opt)
wx.getSystemInfo({
success: function(res) {
var ratio=750/res.windowWidth;
that.setData({
windowHeight:res.windowHeight,
ratio:ratio,
})
console.log(res)
}
})
},
onShow:function(){
this.setData({
mtn_ishidden:true
})
var that=this;
if(util.cache('kindfood')){
this.setData({
thisid:util.cache('kindfood').id
})
console.log(this.data.toview)
wx.removeStorage({key:'kindfood'})
}
this.alert=this.selectComponent('#alert');
this.typeList();
util.postSuccessFun=function(json,uri_code){
switch (uri_code){
case uri.CGI__USER_GETCOOKBOOKCLASSBYSELLERID__CODE: //菜品分类列表
var list = json.data[0]
//菜品分类跳转
var class_type;
var classid;
if(that.data.tid){
list.forEach(function(v,i){
v.style='';
if(v.id==that.data.tid){
v.style='active';
class_type=v.class_type;
classid=that.data.tid;
}
})
}else{
list[0].style='active';
class_type=list[0].class_type;
classid=list[0].id;
}
if(class_type==1){
that.marketlist(classid)
}else{
that.cookList(classid);
}
var fnum=Math.ceil(list.length/3)*90+40;
that.setData({
typelistData:list,
class_type:class_type,
tid:classid,
mtop:Math.round(fnum/that.data.ratio),
specialHeight:Math.round(that.data.windowHeight-(Math.round(fnum/that.data.ratio))),
})
break;
case uri.CGI__USER_GETCOOKBOOKBYCLASSID__CODE: //菜品列表
var flag=false
if(json.ret==200){
var list=json.data.data;
var flag=Math.round((list.length*120+160)/that.data.ratio)>that.data.specialHeight ? true : false;
var orderlist=[];
for(var i=1;i<=list.length;i++){
if(Number(list[i-1].order_o)!=i){
util.post(uri.CGI__USER_SETCOOKBOOKORDERBYID,{
id:list[i-1].id,
order:i,
},uri.CGI__USER_SETCOOKBOOKORDERBYID__CODE);
}
orderlist.push(i)
}
that.setData({
listData:list,
toview:that.data.thisid ? 'intoview'+that.data.thisid : '',
orderlist:orderlist
});
}else{
that.setData({
listData:'',
orderlist:[]
});
}
that.setData({
showshadow:flag,
blockhide:true
})
break;
case uri.CGI__USER_GETCOOKBOOKBYMCLASSID__CODE: //营销菜品
console.log(json.data[0].list)
if(json.ret==200){
var list=json.data[0].list;
var orderlist=[];
for(var i=1;i<=list.length;i++){
orderlist.push(i)
}
that.setData({
listData:list,
orderlist:orderlist
});
}else{
that.setData({
listData:""
});
}
break;
case uri.CGI__USER_SETCOOKBOOKBYID__CODE: //开关后刷新
console.log(that.data.tid)
if(that.data.class_type==1){
that.marketlist(that.data.tid)
}else{
that.cookList(that.data.tid)
}
break;
case uri.CGI__USER_DELCOOKBOOKBYID__CODE: //删除
that.setData({
dtn_ishidden:true,
})
that.cookList(that.data.tid);
break;
case uri.CGI__USER_ADDCOOKBOOK__CODE: //添加菜品
if(json.ret==200){
console.log(json.data.data)
setTimeout(function(){
that.setData({
blockhide:true,
reminderInfo:'开始录菜',
name:'',
price:'',
textStr:'',
isScroll:true,
voice_active:'',
thisid:json.data.data,
})
wx.showToast({
title: '添加成功',
icon: 'success',
duration: 1000,
mask:true
})
},500)
that.cookList(that.data.tid);
}else{
that.setData({
reminderInfo:json.msg.split(':')[1],
textStr:'',
name:'',
price:'',
})
}
break;
case uri.CGI__USER_SETCOOKBOOKBYMARKETINGCLASS__CODE:
that.marketlist(that.data.tid);
break;
case uri.CGI__USER_SETCOOKBOOKORDERBYID__CODE:
that.cookList(that.data.tid);
break;
case uri.CGI_USER_QUERYVEGETABLE__CODE:
if(json.ret==200){
that.setData({
image:json.data.path ? 'http://'+json.data.path : null,
desc:json.data.content && json.data.content!='' ? json.data.content : null
})
that.addcook();
}else{
that.setData({
image:null,
desc:null
})
that.addcook();
}
break;
}
}
},
//长按录菜
startVoice:function(e){
console.log(e)
console.log('start',e.touches[0].pageY)
if(util.powercontro('修改菜品')==true){
this.setData({
reminderInfo:'格式:红烧肉20元',
blockhide:false,
isScroll:false,
voice_active:'active',
animate:'active',
startPageY:e.touches[0].pageY,
textStr:'',
time_dur:e.timeStamp,
cancel_status:true,
start_status:false,
})
// this.Record();
this.startrecord();
}else{
this.alert.show('您当前没有权限添加菜品');
}
},
//开始录音
startrecord:function(){
manager.onStart = function(res) {
console.log("成功开始录音识别", res)
}
var that=this;
manager.onStop = function(res) {
console.log("record file path", res.tempFilePath)
console.log("result", res.result)
var textstr=res.result!=undefined ? res.result.replace(/,|,/g,'') : '';
that.setData({
textStr:textstr!='' ? textstr.slice(0,-1).replace(/,|,/g,'') : ''
})
console.log(that)
if(textstr==''){
that.setData({
reminderInfo:'声音太小,请大声点'
})
}else{
that.setData({
reminderInfo:'听到'
})
if(textstr.indexOf('元')!=-1){
textstr=textstr.slice(0,-1);
that.setData({
textStr:textstr
})
var len=textstr.length;
if(textstr[len-1]=='元'){
var obj=that.strToNumber(textstr);
console.log(obj)
if(obj && obj.name){
that.setData({
name:obj.name,
price:obj.price
})
that.matchcook(that.data.name)
}
}else{
that.setData({
reminderInfo:'说话时间太短,请重说'
})
}
}else{
console.log('xxxxxxxx',that.data.textStr)
that.setData({
reminderInfo:'格式:红烧肉20元'
})
}
}
}
manager.start({duration:30000, lang: "zh_CN"})
},
// endrecord:function(){
// manager.stop();
// var that=this;
// manager.onStop = function(res) {
// console.log("record file path", res.tempFilePath)
// console.log("result", res.result)
// that.setData({
// reminderInfo:'声音太小,请大声点',
// })
// setTimeout(function(){
// that.setData({
// blockhide:true,
// voice_active:'',
// reminderInfo:'格式:红烧肉20元',
// animate:'',
// textStr:'',
// })
// },100)
// }
// },
// Record:function(){
// var that = this;
// var recorderManager=wx.getRecorderManager();
// recorderManager.onStart(function(){
// console.log('recorder start');
//
// })
// const options = {
// duration: 60000,
// sampleRate: 16000,
// numberOfChannels: 1,
// encodeBitRate: 24000,
// format: 'mp3',
// frameSize: 50
// }
//
// recorderManager.start(options);
// },
//取消录音/结束录音
endVoice:function(e){
var that=this;
this.setData({
time_dur_end:e.timeStamp
})
var endTime=parseInt(this.data.time_dur_end);
var startTime=parseInt(this.data.time_dur)
if(endTime-startTime>200){
// recorderManager.stop();
// recorderManager.onStop(function(res){
// console.log(res)
// that.setData({
// reminderInfo:'正在识别',
// animate:'',
// tempFilePath:res.tempFilePath
// })
// console.log('gtgtgt',that.data.startPageY)
// console.log('gtgtgt',that.data.endPageY)
// if(that.data.startPageY-that.data.endPageY>80){
//
// }else{
// var tempFilePath = res.tempFilePath;
// wx.uploadFile({
// url: "https://xt05.colorcun.com/?s=App.Record.CreateRecord",
// filePath: tempFilePath,
// name: "file",
// header: {
// 'content-type': 'multipart/form-data'
// }, // 设置请求的 header
// success: function (res) {
// console.log(res);
// var query_clone = JSON.parse(res.data);
// that.setData({
// textStr: decodeURI(query_clone.data)
// })
// var textstr=that.data.textStr;
// if(textstr==''){
// that.setData({
// reminderInfo:'声音太小,请大声点'
// })
// setTimeout(function(){
// that.setData({
// blockhide:true,
// voice_active:'',
// reminderInfo:'格式:红烧肉20元',
// animate:'',
// textStr:'',
// })
// },2000)
// }else{
// that.setData({
// reminderInfo:'听到'
// })
// if(textstr.indexOf('元')!=-1){
// var len=textstr.length;
// if(textstr[len-1]=='元'){
// var obj=that.strToNumber(textstr)
// that.setData({
// name:obj.name,
// price:obj.price
// })
// var t=setInterval(function(){
// that.addcook();
// clearInterval(t)
// },2000)
// }else{
// that.setData({
// reminderInfo:'说话时间太短,请重说'
// })
// setTimeout(function(){
// that.setData({
// blockhide:true,
// voice_active:'',
// reminderInfo:'格式:红烧肉20元',
// animate:'',
// textStr:'',
// })
// },2000)
// }
//
// }else{
// that.setData({
// reminderInfo:'格式:红烧肉20元'
// })
// setTimeout(function(){
// that.setData({
// blockhide:true,
// voice_active:''
// })
// },2000)
// }
// }
// },
// fail: function (res){
// that.setData({
// reminderInfo:'时间太短'
// })
// console.log(res);
// }
// });
// }
// })
manager.stop();
this.setData({
reminderInfo:'正在识别',
animate:'',
})
if(!that.data.name){
setTimeout(function(){
that.setData({
blockhide:true,
voice_active:'',
reminderInfo:'格式:红烧肉20元',
animate:'',
textStr:'',
})
},2000)
}
}else{
manager.stop();
that.setData({
reminderInfo:'请长按录菜'
})
setTimeout(function(){
that.setData({
blockhide:true,
voice_active:'',
reminderInfo:'格式:红烧肉20元',
animate:'',
textStr:'',
})
},2000)
}
if(this.data.startPageY-this.data.endPageY>100){
this.setData({
reminderInfo:'格式:红烧肉20元',
animate:'',
textStr:'',
blockhide:true,
voice_active:'',
})
}else{
this.setData({
animate:''
})
}
},
//上滑
cancel:function(e){
console.log('move',e.touches[0].pageY)
this.setData({
endPageY:e.touches[0].pageY,
})
if(this.data.startPageY-this.data.endPageY>80){
this.setData({
start_status:true,
cancel_status:false
})
}else{
this.setData({
start_status:false,
cancel_status:true
})
}
},
closehide:function(){
this.setData({
reminderInfo:'格式:红烧肉20元',
animate:'',
textStr:'',
blockhide:true,
voice_active:'',
})
},
//添加菜品
addcook:function(){
var formdata={};
formdata['cid']=this.data.tid
formdata['name']=this.data.name;
if(this.data.price==0){
formdata['price']='';
}else{
formdata['price']=this.data.price;
}
if(this.data.image){
formdata.image=this.data.image
}
if(this.data.desc){
formdata.desc=this.data.desc
}
formdata['sellerid']=this.data.sellerid;
formdata['unit']="份"
console.log(formdata)
util.post(uri.CGI__USER_ADDCOOKBOOK,formdata,uri.CGI__USER_ADDCOOKBOOK__CODE);
},
//菜品更多类目点击
moreTypeName:function(e){
console.log(e.currentTarget.dataset.id)
this.setData({
mtn_ishidden:false,
id:e.currentTarget.dataset.id
})
console.log(this.data.tid)
},
closeMore:function () {
this.setData({
mtn_ishidden:true,
})
},
//更换10道必点菜
changeClear:function(e){
if(util.powercontro('修改菜品')==true){
wx.navigateTo({
url:'../marketing/ca_list?cid='+e.currentTarget.dataset.id+'&mid='+this.data.tid+'<ype=2',
});
}else{
this.alert.show('您当前没有权限修改菜品');
}
},
//普通分类下菜品修改 type:order/status
setcommonCook:function(e){
if(util.powercontro('修改菜品')==true){
var target=e.currentTarget.dataset;
var data={
sellerid:this.data.sellerid,
id:target.id,
};
if(target.type=='order'){
util.post(uri.CGI__USER_SETCOOKBOOKORDERBYID,{
id:target.id,
order:parseInt(e.detail.value)+1
},uri.CGI__USER_SETCOOKBOOKORDERBYID__CODE);
}else{
data.status=e.detail.value==false ? 0 : 1;
util.post(uri.CGI__USER_SETCOOKBOOKBYID,data,uri.CGI__USER_SETCOOKBOOKBYID__CODE);
}
console.log(data)
}else{
this.alert.show('您当前没有权限修改菜品');
}
},
//营销分类下菜品修改 type:order/status
setmarketCook:function (e) {
if(util.powercontro('修改菜品')==true){
var target=e.currentTarget.dataset;
var data={
sellerid:this.data.sellerid,
cid:target.cid,
mclassid:target.mclassid
}
if(target.type=='order'){
data.order_o=parseInt(e.detail.value)+1;
}
util.post(uri.CGI__USER_SETCOOKBOOKBYMARKETINGCLASS,data,uri.CGI__USER_SETCOOKBOOKBYMARKETINGCLASS__CODE)
}else{
this.alert.show('您当前没有权限修改菜品');
}
},
//点击菜品分类切换
typelink:function(e){
var _id = e.currentTarget.dataset.id;
var typelistData = this.data.typelistData
var class_type;
typelistData.map(function(r,n){
if(r.id==_id){
r.style="active"
class_type=r.class_type
}else{
r.style=""
}
})
this.setData({
tid:_id,
typelistData:typelistData,
class_type:class_type
})
console.log(this.data.tid,this.data.class_type)
if(class_type=='1'){
this.marketlist(_id);
}else{
this.cookList(_id);
}
},
//菜品分类列表
typeList:function(){
util.post(uri.CGI__USER_GETCOOKBOOKCLASSBYSELLERID,{SellerId:this.data.sellerid},uri.CGI__USER_GETCOOKBOOKCLASSBYSELLERID__CODE)
},
//菜品列表
cookList:function(classid){
util.post(uri.CGI__USER_GETCOOKBOOKBYCLASSID,{ClassId:classid,type:1},uri.CGI__USER_GETCOOKBOOKBYCLASSID__CODE)
},
//营销菜品列表
marketlist:function(classid){
util.post(uri.CGI__USER_GETCOOKBOOKBYMCLASSID,{sellerid:this.data.sellerid,mclassid:classid},uri.CGI__USER_GETCOOKBOOKBYMCLASSID__CODE)
},
cancelModel:function(){
this.setData({
atn_ishidden:true,
})
},
//点击名称进入详情页
updateCname:function(e){
if(util.powercontro('修改菜品')==true){
wx.navigateTo({
url: 'cb_sadd?id='+e.currentTarget.dataset.id+'&cid='+e.currentTarget.dataset.cid,
})
}else{
this.alert.show('您当前没有权限修改菜品');
}
if(util.cache('cook_name')){
wx.removeStorage({key:'cook_name'})
}
if(util.cache('practice')){
wx.removeStorage({key:'practice'})
wx.removeStorage({key:'wayadd'})
}
if(util.cache('spec')){
wx.removeStorage({key:'spec'})
wx.removeStorage({key:'ggadd'})
}
},
//点击添加菜品,进入添加页
addCname:function(){
if(util.powercontro('添加菜品')==true){
wx.navigateTo({
url: 'cb_fadd?cid='+this.data.tid,
})
}else{
this.alert.show('您当前没有权限添加菜品');
}
if(util.cache('cook_name')){
wx.removeStorage({key:'cook_name'})
}
if(util.cache('practice')){
wx.removeStorage({key:'practice'})
wx.removeStorage({key:'wayadd'})
}
if(util.cache('spec')){
wx.removeStorage({key:'spec'})
wx.removeStorage({key:'ggadd'})
}
},
//点击删除按钮
deleteCookName:function(e){
if(util.powercontro('删除菜品')==true){
console.log(e.currentTarget.dataset.id)
this.setData({
dtn_ishidden:false,
ceid:e.currentTarget.dataset.id,
mtn_ishidden:true
})
}else{
this.setData({
mtn_ishidden:true
})
this.alert.show('您当前没有权限删除菜品');
}
},
//选择标签
selectlabel:function(){
if(util.powercontro('修改菜品')==true){
wx.navigateTo({
url:'../cookbook/cb_label?foodid='+this.data.id
})
}else{
this.setData({
mtn_ishidden:true
})
this.alert.show('您当前没有权限删除菜品');
}
},
deleteCancelModel:function(){
this.setData({
dtn_ishidden:true,
})
},
//确认删除
deleteConfirmModel:function(e){
console.log('gyui',this.data.ceid)
util.post(uri.CGI__USER_DELCOOKBOOKBYID,{
id:this.data.ceid
},uri.CGI__USER_DELCOOKBOOKBYID__CODE)
},
//排序
byOrder:function(e){
var order=e.currentTarget.dataset.order;
var listData=this.data.listData;
if(order==0){
order=1;
}else{
order=0
}
this.setData({
set_order:order,
listData:listData.reverse()
})
},
//状态排序
byStatus:function(e){
var status=e.currentTarget.dataset.status;
var list=this.data.listData;
var listOn=[];
var listOff=[];
console.log(list)
list.forEach(function(v,i){
if(v.status==1){
listOn.push(v)
}else{
listOff.push(v)
}
})
if(status==0){
list=listOn.concat(listOff);
status=1
}else if(status==1){
list=listOff.concat(listOn);
status=2
}else{
status=0
this.onShow();
}
this.setData({
listData:list,
set_status:status
})
},
//菜名与价格分割 汉字与数字转化 1、判断字符串是否含有数字 2、转化数字 textstr服务器返回字符串,最后一个字是元
strToNumber:function(textstr){
//字符串转化数组
var numberIf=['一','二','两','三','四','五','六','七','八','九','十','百','千','万','零']; //用于价格转换
var numberMatch={'零':0,'一':1,'二':2,'两':2,'三':3,'四':4,'五':5,'六':6,'七':7,'八':8,'九':9}; //价格转换
var intMatch={'十':10,'百':100,'千':1000,'万':10000};
var numbernumber=['1','2','3','4','5','6','7','8','9','0'];
var arr=textstr.split('');
console.log(arr)
var str=[];
arr.forEach(function(v,i){
if(numberIf.indexOf(v)!=-1){
str.push({
name_number:v,
number_index:i
})
}
if(numbernumber.indexOf(v)!=-1){
console.log(i)
str.push({
name_number:v,
number_index:i
})
}
})
//数字开始边界,用于分割菜名和价格
console.log(str)
var border,startindex=0
if(str.length>1){
if(str[1]['number_index']-str[0]['number_index']==1){
border=str[0]['number_index'];
}else{
border=str[1]['number_index'];
startindex=1
}
}else{
if(str.length==1){
border=str[0]['number_index'];
}
}
var cookname=textstr.slice(0,border);
var cookprice=textstr.slice(border,-1); //汉字版
console.log(cookprice)
var pre; //前一位数字
var after; //下一位数字
var current; //当前循环数字
var sum=0,transerprice='';
for(var i=startindex;i<str.length;i++){
transerprice+=str[i].name_number;
}
if(Number(cookprice)!=transerprice){
for(var i=0;i<cookprice.length;i++){
current=cookprice[i];
if(i-1>=0){
pre=cookprice[i-1];
}
if(i+1<cookprice.length){
after=cookprice[i+1];
}
if(current in intMatch){
var currentInt=intMatch[current];
if(pre!=undefined){
sum+=numberMatch[pre]*currentInt
}else{
sum+=1*currentInt;
}
}else{
if(after!=undefined){
if(after in intMatch==false){
sum+=numberMatch[current]
}
}else{
sum+=numberMatch[current]
}
}
}
}
return {name:cookname,price:Number(cookprice)!=transerprice ? sum : Number(cookprice)}
},
matchcook:function(cname){
console.log('mmmmm',cname)
util.post(uri.CGI_USER_QUERYVEGETABLE,{cname:cname},uri.CGI_USER_QUERYVEGETABLE__CODE)
},
netchange:function(){
this.onShow();
}
});