9.17/1
This commit is contained in:
@@ -11,6 +11,7 @@ const _sfc_main = {
|
||||
loadingNotices: false,
|
||||
noticeError: "",
|
||||
features: [
|
||||
{ key: "product", title: "货品", img: "/static/icons/product.png", emoji: "📦" },
|
||||
{ key: "customer", title: "客户", img: "/static/icons/customer.png", emoji: "👥" },
|
||||
{ key: "sale", title: "销售", img: "/static/icons/sale.png", emoji: "💰" },
|
||||
{ key: "account", title: "账户", img: "/static/icons/account.png", emoji: "💳" },
|
||||
@@ -30,12 +31,14 @@ const _sfc_main = {
|
||||
methods: {
|
||||
async fetchMetrics() {
|
||||
try {
|
||||
const d = await common_http.get("/api/metrics/overview");
|
||||
const d = await common_http.get("/api/dashboard/overview");
|
||||
const toNum = (v) => typeof v === "number" ? v : Number(v || 0);
|
||||
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"
|
||||
...this.kpi,
|
||||
todaySales: toNum(d && d.todaySalesAmount).toFixed(2),
|
||||
monthSales: toNum(d && d.monthSalesAmount).toFixed(2),
|
||||
monthProfit: toNum(d && d.monthGrossProfit).toFixed(2),
|
||||
stockCount: String((d && d.stockTotalQuantity) != null ? d.stockTotalQuantity : 0)
|
||||
};
|
||||
} catch (e) {
|
||||
}
|
||||
@@ -56,8 +59,16 @@ const _sfc_main = {
|
||||
}
|
||||
},
|
||||
onFeatureTap(item) {
|
||||
if (item.key === "product") {
|
||||
common_vendor.index.navigateTo({ url: "/pages/product/list" });
|
||||
return;
|
||||
}
|
||||
common_vendor.index.showToast({ title: item.title + "(开发中)", icon: "none" });
|
||||
},
|
||||
goProduct() {
|
||||
this.activeTab = "product";
|
||||
common_vendor.index.navigateTo({ url: "/pages/product/list" });
|
||||
},
|
||||
onCreateOrder() {
|
||||
common_vendor.index.navigateTo({ url: "/pages/order/create" });
|
||||
},
|
||||
@@ -116,7 +127,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
l: $data.activeTab === "home" ? 1 : "",
|
||||
m: common_vendor.o(($event) => $data.activeTab = "home"),
|
||||
n: $data.activeTab === "product" ? 1 : "",
|
||||
o: common_vendor.o(($event) => $data.activeTab = "product"),
|
||||
o: common_vendor.o((...args) => $options.goProduct && $options.goProduct(...args)),
|
||||
p: common_vendor.o((...args) => $options.onCreateOrder && $options.onCreateOrder(...args)),
|
||||
q: $data.activeTab === "detail" ? 1 : "",
|
||||
r: common_vendor.o(($event) => $data.activeTab = "detail"),
|
||||
|
||||
Reference in New Issue
Block a user