This commit is contained in:
2025-09-27 22:57:59 +08:00
parent 8a458ff0a4
commit ed26244cdb
12585 changed files with 1914308 additions and 3474 deletions

View File

@@ -12,17 +12,19 @@ const _sfc_main = {
notices: [],
loadingNotices: false,
noticeError: "",
consultLabel: "咨询",
consultDialogVisible: false,
consultMessage: "",
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: "💳" },
{ 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: "⋯" }
{ key: "customer", title: "客户", img: "/static/icons/webwxgetmsgimg.png", emoji: "👥" },
{ key: "sale", title: "销售", img: "/static/icons/webwxgetmsgimg.jpg", emoji: "💰" },
{ key: "account", title: "账户", img: "/static/icons/icons8-profile-50.png", emoji: "💳" },
{ key: "supplier", title: "供应商", img: "/static/icons/icons8-supplier-50.png", emoji: "🚚" },
{ key: "purchase", title: "进货", img: "/static/icons/icons8-dollar-ethereum-exchange-50.png", emoji: "🛒" },
{ key: "otherPay", title: "其他支出", img: "/static/icons/icons8-expenditure-64.png", emoji: "💸" },
{ key: "vip", title: "VIP会员", img: "/static/icons/icons8-vip-48.png", emoji: "👑" },
{ key: "report", title: "报表", img: "/static/icons/icons8-graph-report-50.png", emoji: "📊" }
]
};
},
@@ -42,6 +44,7 @@ const _sfc_main = {
}
this.fetchMetrics();
this.fetchNotices();
this.fetchLatestConsult();
},
methods: {
async fetchMetrics() {
@@ -58,6 +61,59 @@ const _sfc_main = {
} catch (e) {
}
},
async fetchLatestConsult() {
try {
const d = await common_http.get("/api/consults");
if (d && d.replied)
this.consultLabel = "已回复";
else
this.consultLabel = "咨询";
this._latestConsult = d;
} catch (e) {
this.consultLabel = "咨询";
}
},
onConsultTap() {
if (this.consultLabel === "已回复" && this._latestConsult && this._latestConsult.id) {
const msg = this._latestConsult.latestReply ? this._latestConsult.latestReply : this._latestConsult.message || "";
common_vendor.index.showModal({ title: "咨询回复", content: msg || "暂无内容", showCancel: false, success: async (res) => {
if (!res || res.confirm !== true)
return;
try {
const r = await common_http.put(`/api/consults/${this._latestConsult.id}/ack`, {});
this.consultLabel = "咨询";
this._latestConsult = null;
setTimeout(() => this.fetchLatestConsult(), 200);
} catch (e) {
try {
common_vendor.index.showToast({ title: e && e.message || "已读同步失败", icon: "none" });
} catch (_) {
}
}
} });
return;
}
this.consultMessage = "";
this.consultDialogVisible = true;
},
closeConsultDialog() {
this.consultDialogVisible = false;
},
async submitConsult() {
const text = String(this.consultMessage || "").trim();
if (!text) {
common_vendor.index.showToast({ title: "请输入咨询内容", icon: "none" });
return;
}
try {
await common_http.post("/api/consults", { message: text });
this.consultDialogVisible = false;
common_vendor.index.showToast({ title: "已提交", icon: "success" });
setTimeout(() => this.fetchLatestConsult(), 300);
} catch (e) {
common_vendor.index.showToast({ title: e && e.message || "提交失败", icon: "none" });
}
},
async fetchNotices() {
this.loadingNotices = true;
this.noticeError = "";
@@ -128,7 +184,7 @@ const _sfc_main = {
},
goDetail() {
try {
common_vendor.index.__f__("log", "at pages/index/index.vue:198", "[index] goDetail → /pages/detail/index");
common_vendor.index.__f__("log", "at pages/index/index.vue:253", "[index] goDetail → /pages/detail/index");
} catch (e) {
}
common_vendor.index.switchTab({ url: "/pages/detail/index" });
@@ -150,11 +206,32 @@ const _sfc_main = {
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $data.loadingNotices
a: common_vendor.t($data.consultLabel),
b: common_vendor.o((...args) => $options.onConsultTap && $options.onConsultTap(...args)),
c: $data.KPI_ICONS.todaySales,
d: common_vendor.t($data.kpi.todaySales),
e: $data.KPI_ICONS.monthSales,
f: common_vendor.t($data.kpi.monthSales),
g: $data.KPI_ICONS.monthProfit,
h: common_vendor.t($data.kpi.monthProfit),
i: $data.KPI_ICONS.stockCount,
j: common_vendor.t($data.kpi.stockCount),
k: $data.consultDialogVisible
}, $data.consultDialogVisible ? {
l: $data.consultMessage,
m: common_vendor.o(($event) => $data.consultMessage = $event.detail.value),
n: common_vendor.o((...args) => $options.closeConsultDialog && $options.closeConsultDialog(...args)),
o: common_vendor.o((...args) => $options.submitConsult && $options.submitConsult(...args)),
p: common_vendor.o(() => {
}),
q: common_vendor.o(() => {
})
} : {}, {
r: $data.loadingNotices
}, $data.loadingNotices ? {} : $data.noticeError ? {
c: common_vendor.t($data.noticeError)
t: common_vendor.t($data.noticeError)
} : !$data.notices.length ? {} : {
e: common_vendor.f($data.notices, (n, idx, i0) => {
w: common_vendor.f($data.notices, (n, idx, i0) => {
return common_vendor.e({
a: common_vendor.t(n.text),
b: n.tag
@@ -166,17 +243,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
});
})
}, {
b: $data.noticeError,
d: !$data.notices.length,
f: $data.KPI_ICONS.todaySales,
g: common_vendor.t($data.kpi.todaySales),
h: $data.KPI_ICONS.monthSales,
i: common_vendor.t($data.kpi.monthSales),
j: $data.KPI_ICONS.monthProfit,
k: common_vendor.t($data.kpi.monthProfit),
l: $data.KPI_ICONS.stockCount,
m: common_vendor.t($data.kpi.stockCount),
n: common_vendor.f($data.features, (item, k0, i0) => {
s: $data.noticeError,
v: !$data.notices.length,
x: common_vendor.f($data.features, (item, k0, i0) => {
return common_vendor.e({
a: item.img
}, item.img ? {