myorder.js
3.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
var state = GetQueryString("state");
console.log(state);
new Vue({
el: '#myorder',
filters:{
orderType: function(value,type){
return value=='1'?'未付款':value=='2'?'制作中':value=='3'?'待取货':value=='4'?'待评价':value=='5'?'已完成':""
},
stoptype:function(type){
return type=='1'?'自提':type=='2'?'堂食':""
}
},
data: {
orderinfo: [],
tempInfo: [],
status: '',
current: 0,
tapType: 0
},
created: function() {
//获取所有订单列表
if(state){
this.tapType = state
this.allfood(state)
}else{
this.allfood();
}
},
methods: {
orderInfo(item) {
var type = item == '0' ? '' : item
this.tapType = item
this.allfood(type);
// this.showPosition();
},
//全部食品
allfood: function(status) {
this.orderinfo = []
var that = this;
var url = '/UserCenter/myOrderList';
var params = {
unique_id: localStorage.getItem('unique_id'),
status: status
}
ajaxsend(url, params, function(res) {
console.log(res);
if(res.status) {
var data = res.data;
that.orderinfo = data;
var orderlist = that.orderinfo;
console.log(that.orderinfo);
var orderlist = that.orderinfo;
}
})
},
//未支付订单的去支付
unpaypay:function(){
window.event.stopPropagation();
alert("支付");
},
//未支付订单的取消订单
cancelorder:function(obj){
window.event.stopPropagation();
//alert("取消订单");
console.log(obj);
var con=confirm("是否删除该订单");
if(con==true){
var oid=obj.oid;
var url = '/UserCenter/cancelOrder'
var params = {
unique_id: localStorage.getItem('unique_id'),
oid: oid
}
ajaxsend(url, params, function(res) {
console.log(res);
if(res.status==true) {
alert("取消成功");
window.location.reload();
}else if(res.status==false){
alert("取消失败");
window.location.reload();
}
})
}
},
//去评价
goevalute:function(obj){
window.event.stopPropagation();
// console.log(obj);
var oid=obj.oid;
window.location.href=linkPath+'/myorder/evaluate.html?oid=' + oid
},
//再来一单
againorder:function(obj){
window.event.stopPropagation();
window.location.href=linkPath+'/index.html'
},
//导航去取货
navigation:function(obj){
window.event.stopPropagation();
var that=this;
var oid=obj.oid;
var url = '/Map/goMap'
var params = {
oid:oid
}
ajaxsend(url, params, function(res) {
/*console.log(JSON.stringify(res))*/
console.log(res);
})
},
//定位
// showPosition:function(position){
// var lat = position.coords.latitude; //纬度
// var lag = position.coords.longitude; //经度
// alert('纬度:'+lat+',经度:'+lag);
// },
//订单详情
orderdetail: function(obj) {
var that = this;
console.log(obj)
var oid = obj.oid;
var status = obj.status;
if(status == "1") {
window.location.href = linkPath+'/myorder/paydetails.html?oid=' + oid
} else if(status == "2") {
window.location.href = linkPath+'/myorder/makedetails.html?oid=' + oid
} else if(status == "3") {
window.location.href = linkPath+'/myorder/takedetails.html?oid=' + oid
} else if(status == "4") {
window.location.href =linkPath+'/myorder/evaluatedetails.html?oid=' + oid
} else if(status == "5") {
window.location.href = linkPath+'/myorder/finishdetails.html?oid=' + oid
}
}
}
})
//});