wpfw_ewei_wxapp/pages/order/waitpay/index.js
2023-02-26 08:10:18 +08:00

101 lines
2.9 KiB
JavaScript

var t = getApp(), e = t.requirejs("core"), a = t.requirejs("biz/order");
Page({
data: {
icons: t.requirejs("icons"),
status: "",
list: [],
page: 1,
code: !1,
cancel: a.cancelArray,
cancelindex: 0,
can_sync_goodscircle: !1
},
onLoad: function(e) {
var a = this;
t.checkAuth(), wx.getSetting({
success: function(s) {
if (s.authSetting["scope.userInfo"] && (a.setData({
options: e,
orderid: e.orderid
}), t.getCache("userinfo_openid"))) {
var i = getCurrentPages(), o = i[i.length - 1].options.status;
a.setData({
page: 1,
list: [],
status: o
}), a.get_list();
}
}
});
},
onShow: function() {},
get_list: function() {
var a = this;
a.setData({
loading: !0,
isgoods: t.globalData.isgoods
}), e.get("order/waitpay", {
id: a.data.orderid
}, function(t) {
0 == t.error ? (a.setData({
loading: !1,
show: !0,
total: t.total,
empty: !0,
can_sync_goodscircle: t.can_sync_goodscircle
}), t.list.length > 0 && a.setData({
page: a.data.page + 1,
list: a.data.list.concat(t.list)
}), t.list.length < t.pagesize && a.setData({
loaded: !0
})) : e.toast(t.message, "loading");
}, this.data.show);
},
selected: function(t) {
var a = e.data(t).type;
this.setData({
list: [],
page: 1,
status: a,
empty: !1
}), this.get_list();
var s = getCurrentPages();
s[s.length - 1].options.status = a;
},
onReachBottom: function() {
this.data.loaded || this.data.list.length == this.data.total || this.get_list();
},
code: function(t) {
var a = this, s = e.data(t).orderid;
e.post("verify/qrcode", {
id: s
}, function(t) {
0 == t.error ? a.setData({
code: !0,
qrcode: t.url
}) : e.alert(t.message);
}, !0);
},
close: function() {
this.setData({
code: !1
});
},
cancel: function(t) {
var s = e.data(t).orderid;
a.cancel(s, t.detail.value, "/pages/order/index?status=" + this.data.status);
},
delete: function(t) {
var s = e.data(t).type, i = e.data(t).orderid;
a.delete(i, s, "/pages/order/index", this);
},
finish: function(t) {
e.data(t).type;
var s = e.data(t).orderid;
a.finish(s, "/pages/order/index");
},
onShareAppMessage: function() {
return e.onShareAppMessage();
}
});