47 lines
1.9 KiB
JavaScript
47 lines
1.9 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
__name: "profile",
|
|
setup(__props) {
|
|
const orders = common_vendor.ref([]);
|
|
const todayCount = common_vendor.computed(() => {
|
|
const today = (/* @__PURE__ */ new Date()).toDateString();
|
|
return orders.value.filter((o) => new Date(o.timestamp).toDateString() === today).length;
|
|
});
|
|
const todayAmount = common_vendor.computed(() => {
|
|
const today = (/* @__PURE__ */ new Date()).toDateString();
|
|
return orders.value.filter((o) => new Date(o.timestamp).toDateString() === today).reduce((sum, o) => sum + o.totalAmount, 0);
|
|
});
|
|
const totalCount = common_vendor.computed(() => orders.value.length);
|
|
const goToPrice = () => {
|
|
common_vendor.index.navigateTo({ url: "/pages/price/price" });
|
|
};
|
|
const goToBluetooth = () => {
|
|
common_vendor.index.navigateTo({ url: "/pages/bluetooth/bluetooth" });
|
|
};
|
|
const showAbout = () => {
|
|
common_vendor.index.showModal({
|
|
title: "关于我们",
|
|
content: "易分宝现场回收 v1.0.0\n\n致力于为回收行业提供便捷的现场回收解决方案",
|
|
showCancel: false
|
|
});
|
|
};
|
|
common_vendor.onMounted(() => {
|
|
const data = common_vendor.index.getStorageSync("orders");
|
|
orders.value = data ? JSON.parse(data) : [];
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return {
|
|
a: common_vendor.t(todayCount.value),
|
|
b: common_vendor.t(todayAmount.value.toFixed(2)),
|
|
c: common_vendor.t(totalCount.value),
|
|
d: common_vendor.o(goToPrice),
|
|
e: common_vendor.o(goToBluetooth),
|
|
f: common_vendor.o(showAbout)
|
|
};
|
|
};
|
|
}
|
|
});
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f6b4f04d"]]);
|
|
wx.createPage(MiniProgramPage);
|