65 lines
2.8 KiB
JavaScript
65 lines
2.8 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const utils_order = require("../../utils/order.js");
|
|
const utils_price = require("../../utils/price.js");
|
|
if (!Array) {
|
|
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
|
|
_easycom_uni_icons2();
|
|
}
|
|
const _easycom_uni_icons = () => "../../node-modules/@dcloudio/uni-ui/lib/uni-icons/uni-icons.js";
|
|
if (!Math) {
|
|
_easycom_uni_icons();
|
|
}
|
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
__name: "detail",
|
|
setup(__props) {
|
|
const order = common_vendor.ref(null);
|
|
const goBack = () => {
|
|
common_vendor.index.navigateBack();
|
|
};
|
|
const createNewOrder = () => {
|
|
common_vendor.index.switchTab({ url: "/pages/index/index" });
|
|
};
|
|
common_vendor.onLoad(async (options) => {
|
|
if (options == null ? void 0 : options.orderId) {
|
|
const data = common_vendor.index.getStorageSync("orders");
|
|
const orders = data ? JSON.parse(data) : [];
|
|
order.value = orders.find((o) => o.orderId === options.orderId) || null;
|
|
}
|
|
});
|
|
return (_ctx, _cache) => {
|
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
return {
|
|
a: common_vendor.t((_a = order.value) == null ? void 0 : _a.orderId),
|
|
b: common_vendor.t(order.value ? common_vendor.unref(utils_order.formatOrderTime)(order.value.timestamp) : "-"),
|
|
c: common_vendor.t(((_b = order.value) == null ? void 0 : _b.status) === "completed" ? "已完成" : ((_c = order.value) == null ? void 0 : _c.status) === "pending" ? "待处理" : "已取消"),
|
|
d: common_vendor.n((_d = order.value) == null ? void 0 : _d.status),
|
|
e: common_vendor.f((_e = order.value) == null ? void 0 : _e.items, (item, index, i0) => {
|
|
return {
|
|
a: "5511cfa9-0-" + i0,
|
|
b: common_vendor.p({
|
|
type: common_vendor.unref(utils_price.getCategoryIcon)(item.category),
|
|
size: 40,
|
|
color: "#3366ff"
|
|
}),
|
|
c: common_vendor.t(item.name),
|
|
d: common_vendor.t(item.unit === "kg" ? "重量" : "数量"),
|
|
e: common_vendor.t(item.weight || item.count),
|
|
f: common_vendor.t(item.unit === "kg" ? "kg" : "个"),
|
|
g: common_vendor.t(item.unitPrice),
|
|
h: common_vendor.t(item.unit === "kg" ? "kg" : "个"),
|
|
i: common_vendor.t(item.amount.toFixed(2)),
|
|
j: index
|
|
};
|
|
}),
|
|
f: common_vendor.t(((_f = order.value) == null ? void 0 : _f.totalAmount.toFixed(2)) || "0.00"),
|
|
g: common_vendor.t(((_g = order.value) == null ? void 0 : _g.totalAmount.toFixed(2)) || "0.00"),
|
|
h: common_vendor.o(goBack),
|
|
i: common_vendor.o(createNewOrder)
|
|
};
|
|
};
|
|
}
|
|
});
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-5511cfa9"]]);
|
|
wx.createPage(MiniProgramPage);
|