2
This commit is contained in:
@@ -5,8 +5,7 @@ const API_OF = {
|
||||
sale: "/api/orders",
|
||||
purchase: "/api/purchase-orders",
|
||||
collect: "/api/payments",
|
||||
fund: "/api/other-transactions",
|
||||
stock: "/api/inventories/logs"
|
||||
fund: "/api/other-transactions"
|
||||
};
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
@@ -16,18 +15,19 @@ const _sfc_main = {
|
||||
{ key: "sale", name: "出货" },
|
||||
{ key: "purchase", name: "进货" },
|
||||
{ key: "collect", name: "收款" },
|
||||
{ key: "fund", name: "资金" },
|
||||
{ key: "stock", name: "盘点" }
|
||||
{ key: "fund", name: "资金" }
|
||||
],
|
||||
range: "month",
|
||||
query: { kw: "" },
|
||||
items: [],
|
||||
page: 1,
|
||||
size: 20,
|
||||
size: 15,
|
||||
finished: false,
|
||||
loading: false,
|
||||
startDate: "",
|
||||
endDate: ""
|
||||
endDate: "",
|
||||
nonVipRetentionDays: 0,
|
||||
isVip: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -56,7 +56,7 @@ const _sfc_main = {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
common_vendor.index.__f__("log", "at pages/detail/index.vue:102", "[detail] onLoad route = pages/detail/index");
|
||||
common_vendor.index.__f__("log", "at pages/detail/index.vue:104", "[detail] onLoad route = pages/detail/index");
|
||||
} catch (e) {
|
||||
}
|
||||
this.computeRange();
|
||||
@@ -133,12 +133,43 @@ const _sfc_main = {
|
||||
if (list.length < this.size)
|
||||
this.finished = true;
|
||||
this.page += 1;
|
||||
await this.hintIfNonVipOutOfWindow();
|
||||
} catch (e) {
|
||||
common_vendor.index.showToast({ title: "加载失败", icon: "none" });
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
async hintIfNonVipOutOfWindow() {
|
||||
try {
|
||||
if (this.isVip && this.isVip === true)
|
||||
return;
|
||||
if (!this.nonVipRetentionDays) {
|
||||
const v = await common_http.get("/api/vip/status");
|
||||
this.isVip = !!(v == null ? void 0 : v.isVip);
|
||||
this.nonVipRetentionDays = Number((v == null ? void 0 : v.nonVipRetentionDays) || 60);
|
||||
if (this.isVip)
|
||||
return;
|
||||
}
|
||||
if (!this.startDate)
|
||||
return;
|
||||
const start = new Date(this.startDate).getTime();
|
||||
const threshold = Date.now() - this.nonVipRetentionDays * 24 * 3600 * 1e3;
|
||||
if (start < threshold) {
|
||||
common_vendor.index.showModal({
|
||||
title: "提示",
|
||||
content: `普通用户仅显示近${this.nonVipRetentionDays}天数据,开通VIP可查看全部历史。`,
|
||||
confirmText: "去开通VIP",
|
||||
cancelText: "我知道了",
|
||||
success: (r) => {
|
||||
if (r.confirm)
|
||||
common_vendor.index.navigateTo({ url: "/pages/my/vip" });
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
},
|
||||
formatDate(s) {
|
||||
if (!s)
|
||||
return "";
|
||||
@@ -201,8 +232,14 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
};
|
||||
})
|
||||
} : {}, {
|
||||
p: common_vendor.o((...args) => $options.loadMore && $options.loadMore(...args)),
|
||||
q: common_vendor.o((...args) => $options.onCreate && $options.onCreate(...args))
|
||||
p: $data.items.length && !$data.finished
|
||||
}, $data.items.length && !$data.finished ? {
|
||||
q: $data.loading
|
||||
} : {}, {
|
||||
r: $data.finished && $data.items.length
|
||||
}, $data.finished && $data.items.length ? {} : {}, {
|
||||
s: common_vendor.o((...args) => $options.loadMore && $options.loadMore(...args)),
|
||||
t: common_vendor.o((...args) => $options.onCreate && $options.onCreate(...args))
|
||||
});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
|
||||
Reference in New Issue
Block a user