completed.js
2.9 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
var e = require("../../../utils/network.js");
Page({
data: {
ouid: "",
status: 3,
orders: [],
odid: ""
},
my_order: function() {
var t = this;
e.POST({
url: "User/my_order",
header: "application/x-www-form-urlencoded",
params: {
ouid: t.data.ouid,
status: t.data.status
},
success: function(e) {
(e.data.state = "success") && t.setData({
orders: e.data.orders
});
}
});
},
payment: function() {
wx.redirectTo({
url: "../payment/payment"
});
},
delivery: function() {
wx.redirectTo({
url: "../delivery/delivery"
});
},
shipped: function() {
wx.redirectTo({
url: "../shipped/shipped"
});
},
completed: function() {
wx.redirectTo({
url: "../completed/completed"
});
},
pay: function() {
wx.navigateTo({
url: "../pay/pay?type=3"
});
},
gocomment: function(e) {
var t = e.currentTarget.dataset.odid;
this.setData({
odid: t
}), wx.navigateTo({
url: "../comment/comment?odid=" + this.data.odid
});
},
onLoad: function(e) {},
del_order: function(t) {
var o = t.currentTarget.dataset.id, a = t.currentTarget.dataset.index, n = this.data.orders, d = this;
wx.showModal({
title: "确认删除订单",
content: "确定要删除订单吗?",
success: function(t) {
t.confirm ? e.POST({
url: "User/del_order",
header: "application/x-www-form-urlencoded",
params: {
ouid: d.data.ouid,
id: o
},
success: function(e) {
wx.showLoading({
title: "处理中..."
}), "success" == e.data.state ? (n.splice(a, 1), d.setData({
orders: n
}), wx.hideLoading(), d.my_order()) : wx.showLoading({
title: "处理中..."
});
},
fail: function(e) {}
}) : t.cancel && console.log("用户点击取消");
}
});
},
onReady: function() {},
onShow: function() {
var e = this;
wx.getStorage({
key: "ouid",
success: function(t) {
e.setData({
ouid: t.data
}), e.my_order();
}
});
},
onHide: function() {},
onUnload: function() {},
onPullDownRefresh: function() {},
onReachBottom: function() {},
onShareAppMessage: function() {}
});