9.16/1
This commit is contained in:
@@ -5,9 +5,7 @@ const common_assets = require("../../common/assets.js");
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return {
|
||||
todayAmount: "0.00",
|
||||
monthProfit: "0.00",
|
||||
stockQty: "0.00",
|
||||
kpi: { todaySales: "0.00", monthSales: "0.00", monthProfit: "0.00", stockCount: "0" },
|
||||
activeTab: "home",
|
||||
notices: [],
|
||||
loadingNotices: false,
|
||||
@@ -26,9 +24,22 @@ const _sfc_main = {
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.fetchMetrics();
|
||||
this.fetchNotices();
|
||||
},
|
||||
methods: {
|
||||
async fetchMetrics() {
|
||||
try {
|
||||
const d = await common_http.get("/api/metrics/overview");
|
||||
this.kpi = {
|
||||
todaySales: d && d.todaySales || "0.00",
|
||||
monthSales: d && d.monthSales || "0.00",
|
||||
monthProfit: d && d.monthProfit || "0.00",
|
||||
stockCount: d && d.stockCount || "0"
|
||||
};
|
||||
} catch (e) {
|
||||
}
|
||||
},
|
||||
async fetchNotices() {
|
||||
this.loadingNotices = true;
|
||||
this.noticeError = "";
|
||||
@@ -48,18 +59,15 @@ const _sfc_main = {
|
||||
common_vendor.index.showToast({ title: item.title + "(开发中)", icon: "none" });
|
||||
},
|
||||
onCreateOrder() {
|
||||
common_vendor.index.showToast({ title: "开单(开发中)", icon: "none" });
|
||||
common_vendor.index.navigateTo({ url: "/pages/order/create" });
|
||||
},
|
||||
onNoticeTap(n) {
|
||||
common_vendor.index.showModal({
|
||||
title: "公告",
|
||||
title: "广告",
|
||||
content: n && (n.text || n.title || n.content) || "",
|
||||
showCancel: false
|
||||
});
|
||||
},
|
||||
onNoticeList() {
|
||||
common_vendor.index.showToast({ title: "公告列表(开发中)", icon: "none" });
|
||||
},
|
||||
onIconError(item) {
|
||||
item.img = "";
|
||||
}
|
||||
@@ -68,14 +76,15 @@ const _sfc_main = {
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: common_assets._imports_0,
|
||||
b: common_vendor.t($data.todayAmount),
|
||||
c: common_vendor.t($data.monthProfit),
|
||||
d: common_vendor.t($data.stockQty),
|
||||
e: $data.loadingNotices
|
||||
b: common_vendor.t($data.kpi.todaySales),
|
||||
c: common_vendor.t($data.kpi.monthSales),
|
||||
d: common_vendor.t($data.kpi.monthProfit),
|
||||
e: common_vendor.t($data.kpi.stockCount),
|
||||
f: $data.loadingNotices
|
||||
}, $data.loadingNotices ? {} : $data.noticeError ? {
|
||||
g: common_vendor.t($data.noticeError)
|
||||
h: common_vendor.t($data.noticeError)
|
||||
} : !$data.notices.length ? {} : {
|
||||
i: common_vendor.f($data.notices, (n, idx, i0) => {
|
||||
j: common_vendor.f($data.notices, (n, idx, i0) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t(n.text),
|
||||
b: n.tag
|
||||
@@ -87,9 +96,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
});
|
||||
})
|
||||
}, {
|
||||
f: $data.noticeError,
|
||||
h: !$data.notices.length,
|
||||
j: common_vendor.o((...args) => $options.onNoticeList && $options.onNoticeList(...args)),
|
||||
g: $data.noticeError,
|
||||
i: !$data.notices.length,
|
||||
k: common_vendor.f($data.features, (item, k0, i0) => {
|
||||
return common_vendor.e({
|
||||
a: item.img
|
||||
@@ -107,11 +115,15 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
}),
|
||||
l: $data.activeTab === "home" ? 1 : "",
|
||||
m: common_vendor.o(($event) => $data.activeTab = "home"),
|
||||
n: common_vendor.o((...args) => $options.onCreateOrder && $options.onCreateOrder(...args)),
|
||||
o: $data.activeTab === "detail" ? 1 : "",
|
||||
p: common_vendor.o(($event) => $data.activeTab = "detail"),
|
||||
q: $data.activeTab === "me" ? 1 : "",
|
||||
r: common_vendor.o(($event) => $data.activeTab = "me")
|
||||
n: $data.activeTab === "product" ? 1 : "",
|
||||
o: common_vendor.o(($event) => $data.activeTab = "product"),
|
||||
p: common_vendor.o((...args) => $options.onCreateOrder && $options.onCreateOrder(...args)),
|
||||
q: $data.activeTab === "detail" ? 1 : "",
|
||||
r: common_vendor.o(($event) => $data.activeTab = "detail"),
|
||||
s: $data.activeTab === "report" ? 1 : "",
|
||||
t: common_vendor.o(($event) => $data.activeTab = "report"),
|
||||
v: $data.activeTab === "me" ? 1 : "",
|
||||
w: common_vendor.o(($event) => $data.activeTab = "me")
|
||||
});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
|
||||
Reference in New Issue
Block a user