"use strict"; const common_vendor = require("../../common/vendor.js"); const common_http = require("../../common/http.js"); const common_assets = require("../../common/assets.js"); const _sfc_main = { data() { return { todayAmount: "0.00", monthProfit: "0.00", stockQty: "0.00", activeTab: "home", notices: [], loadingNotices: false, noticeError: "", features: [ { 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: "💳" }, { key: "supplier", title: "供应商", img: "/static/icons/supplier.png", emoji: "🚚" }, { key: "purchase", title: "进货", img: "/static/icons/purchase.png", emoji: "🛒" }, { key: "otherPay", title: "其他支出", img: "/static/icons/other-pay.png", emoji: "💸" }, { key: "vip", title: "VIP会员", img: "/static/icons/vip.png", emoji: "👑" }, { key: "report", title: "报表", img: "/static/icons/report.png", emoji: "📊" }, { key: "more", title: "更多", img: "/static/icons/more.png", emoji: "⋯" } ] }; }, onLoad() { this.fetchNotices(); }, methods: { async fetchNotices() { this.loadingNotices = true; this.noticeError = ""; try { const list = await common_http.get("/api/notices"); this.notices = Array.isArray(list) ? list.map((n) => ({ text: n.content || n.title || "", tag: n.tag || "" })) : []; } catch (e) { this.noticeError = e && e.message || "公告加载失败"; } finally { this.loadingNotices = false; } }, onFeatureTap(item) { common_vendor.index.showToast({ title: item.title + "(开发中)", icon: "none" }); }, onCreateOrder() { common_vendor.index.showToast({ title: "开单(开发中)", icon: "none" }); }, onNoticeTap(n) { common_vendor.index.showModal({ title: "公告", content: n && (n.text || n.title || n.content) || "", showCancel: false }); }, onNoticeList() { common_vendor.index.showToast({ title: "公告列表(开发中)", icon: "none" }); }, onIconError(item) { item.img = ""; } } }; 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 }, $data.loadingNotices ? {} : $data.noticeError ? { g: common_vendor.t($data.noticeError) } : !$data.notices.length ? {} : { i: common_vendor.f($data.notices, (n, idx, i0) => { return common_vendor.e({ a: common_vendor.t(n.text), b: n.tag }, n.tag ? { c: common_vendor.t(n.tag) } : {}, { d: common_vendor.o(($event) => $options.onNoticeTap(n), idx), e: idx }); }) }, { f: $data.noticeError, h: !$data.notices.length, j: common_vendor.o((...args) => $options.onNoticeList && $options.onNoticeList(...args)), k: common_vendor.f($data.features, (item, k0, i0) => { return common_vendor.e({ a: item.img }, item.img ? { b: item.img, c: common_vendor.o(($event) => $options.onIconError(item), item.key) } : item.emoji ? { e: common_vendor.t(item.emoji) } : {}, { d: item.emoji, f: common_vendor.t(item.title), g: item.key, h: common_vendor.o(($event) => $options.onFeatureTap(item), item.key) }); }), 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") }); } const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]); wx.createPage(MiniProgramPage); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/index.js.map