myorder.js
6.4 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
var state = GetQueryString("state");
console.log(state);
new Vue({
el: '#mineorder',
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(obj){
var oid=obj.oid;
window.event.stopPropagation();
$.ajax({
url:"/index.php/Flow/goPayFromUserCenter2",
data:{
unique_id:localStorage.getItem('unique_id'),
oid:oid,
from:2
},
type:"POST",
dataType:"JSON",
success: function (data) {
console.log(data);
wx.chooseWXPay({
timestamp: data.data.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
nonceStr: data.data.nonceStr, // 支付签名随机串,不长于 32 位
package: data.data.package, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
signType: data.data.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
paySign: data.data.paySign, // 支付签名
success: function (res) {
// 支付成功后的回调函数
}
});
}
})
},
//未支付订单的取消订单
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='/index.php?g=&m=template&a=evaluate&oid=' + oid
},
//再来一单
againorder:function(obj){
window.event.stopPropagation();
window.location.href = '/index.php?g=&m=template&a=index';
},
//导航去取货
navigation:function(obj){
var oid=obj.oid;
$.ajax({
url:"/index.php?g=&m=template&a=myorder",
data:{
oid:oid,
},
type:"POST",
dataType:"JSON",
success: function (data) {
//console.log(data.data);
lng=parseFloat(data.data.lng);
lat=parseFloat(data.data.lat);
wx.openLocation({
latitude: lat, // 纬度,浮点数,范围为90 ~ -90
longitude: lng, // 经度,浮点数,范围为180 ~ -180。
name: data.data.spot_name, // 位置名
address: data.data.address, // 地址详情说明
scale: 16, // 地图缩放级别,整形值,范围从1~28。默认为最大
infoUrl: '' // 在查看位置界面底部显示的超链接,可点击跳转
});
}
})
},
//定位
// 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 = '/index.php?g=&m=template&a=paydetails&oid=' + oid
} else if(status == "2") {
window.location.href = '/index.php?g=&m=template&a=makedetails&oid=' + oid
} else if(status == "3") {
window.location.href = '/index.php?g=&m=template&a=takedetails&oid=' + oid
} else if(status == "4") {
window.location.href ='/index.php?g=&m=template&a=evaluatedetails&oid=' + oid
} else if(status == "5") {
window.location.href = '/index.php?g=&m=template&a=finishdetails&oid=' + oid
}
}
}
})
//});