2
This commit is contained in:
75
frontend/unpackage/dist/dev/mp-weixin/pages/my/orders.js
vendored
Normal file
75
frontend/unpackage/dist/dev/mp-weixin/pages/my/orders.js
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const common_http = require("../../common/http.js");
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return { list: [], page: 1, size: 20, loading: false };
|
||||
},
|
||||
onShow() {
|
||||
this.fetch(true);
|
||||
},
|
||||
computed: {
|
||||
isLoggedIn() {
|
||||
try {
|
||||
return !!common_vendor.index.getStorageSync("TOKEN");
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async fetch(reset = false) {
|
||||
if (!this.isLoggedIn)
|
||||
return;
|
||||
if (this.loading)
|
||||
return;
|
||||
this.loading = true;
|
||||
try {
|
||||
const p = reset ? 1 : this.page;
|
||||
const data = await common_http.get("/api/vip/recharges", { page: p, size: this.size });
|
||||
const arr = Array.isArray(data == null ? void 0 : data.list) ? data.list : [];
|
||||
this.list = reset ? arr : (this.list || []).concat(arr);
|
||||
this.page = p + 1;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
fmt(v) {
|
||||
if (!v)
|
||||
return "";
|
||||
const s = String(v);
|
||||
const m = s.match(/^(\d{4}-\d{2}-\d{2})([ T](\d{2}:\d{2}))/);
|
||||
return m ? `${m[1]} ${m[3]}` : s;
|
||||
},
|
||||
toMoney(v) {
|
||||
try {
|
||||
return Number(v).toFixed(2);
|
||||
} catch (_) {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: !$options.isLoggedIn
|
||||
}, !$options.isLoggedIn ? {} : common_vendor.e({
|
||||
b: common_vendor.f($data.list, (it, k0, i0) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t($options.toMoney(it.price)),
|
||||
b: common_vendor.t(it.channel || "支付"),
|
||||
c: common_vendor.t($options.fmt(it.createdAt)),
|
||||
d: common_vendor.t(it.durationDays),
|
||||
e: it.expireTo
|
||||
}, it.expireTo ? {
|
||||
f: common_vendor.t($options.fmt(it.expireTo))
|
||||
} : {}, {
|
||||
g: it.id
|
||||
});
|
||||
}),
|
||||
c: $data.list.length === 0
|
||||
}, $data.list.length === 0 ? {} : {}));
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/my/orders.js.map
|
||||
Reference in New Issue
Block a user