93 lines
3.8 KiB
JavaScript
93 lines
3.8 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
if (!Array) {
|
|
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
|
|
_easycom_uni_icons2();
|
|
}
|
|
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
|
|
if (!Math) {
|
|
_easycom_uni_icons();
|
|
}
|
|
const _sfc_main = {
|
|
__name: "detail",
|
|
setup(__props) {
|
|
const positions = common_vendor.ref([
|
|
{ name: "UPRO", code: "UPRO.US", shares: 142, marketValue: "85,932.00", weight: 55, pnl: 12400, pnlPercent: 16.8, iconClass: "bg-blue-100 text-blue" },
|
|
{ name: "TMF", code: "TMF.US", shares: 800, marketValue: "70,308.00", weight: 45, pnl: -3200.5, pnlPercent: -4.3, iconClass: "bg-orange-100 text-orange" }
|
|
]);
|
|
const logs = common_vendor.ref([
|
|
{ date: "02-14", time: "14:30", type: "buy", title: "定期定投 UPRO", amount: "$500.00" },
|
|
{ date: "01-01", time: "09:15", type: "sell", title: "季度再平衡 TMF", amount: "200股" },
|
|
{ date: "12-15", time: "10:00", type: "buy", title: "建仓买入", amount: "¥100,000" },
|
|
{ date: "12-10", time: "11:20", type: "buy", title: "建仓买入", amount: "¥50,000" }
|
|
// 加一条数据撑开高度,测试滚动
|
|
]);
|
|
const goStrategyConfig = () => {
|
|
common_vendor.index.navigateTo({ url: "/pages/strategy/edit?id=1" });
|
|
};
|
|
const handleBuy = () => common_vendor.index.showToast({ title: "买入", icon: "none" });
|
|
const handleSell = () => common_vendor.index.showToast({ title: "卖出", icon: "none" });
|
|
return (_ctx, _cache) => {
|
|
return {
|
|
a: common_vendor.p({
|
|
type: "vip-filled",
|
|
size: "120",
|
|
color: "rgba(255,255,255,0.05)"
|
|
}),
|
|
b: common_vendor.p({
|
|
type: "right",
|
|
size: "12",
|
|
color: "#064E3B"
|
|
}),
|
|
c: common_vendor.o(goStrategyConfig),
|
|
d: common_vendor.f(positions.value, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.t(item.name.charAt(0)),
|
|
b: common_vendor.n(item.iconClass),
|
|
c: common_vendor.t(item.name),
|
|
d: common_vendor.t(item.code),
|
|
e: common_vendor.t(item.shares),
|
|
f: common_vendor.t(item.marketValue),
|
|
g: common_vendor.t(item.weight),
|
|
h: common_vendor.t(item.pnl > 0 ? "+" : ""),
|
|
i: common_vendor.t(item.pnl),
|
|
j: common_vendor.n(item.pnl > 0 ? "text-red" : "text-green"),
|
|
k: common_vendor.t(item.pnlPercent > 0 ? "+" : ""),
|
|
l: common_vendor.t(item.pnlPercent),
|
|
m: common_vendor.n(item.pnlPercent > 0 ? "text-red" : "text-green"),
|
|
n: index
|
|
};
|
|
}),
|
|
e: common_vendor.f(logs.value, (log, k, i0) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.t(log.date),
|
|
b: common_vendor.t(log.time),
|
|
c: common_vendor.n(log.type === "buy" ? "bg-red" : "bg-green"),
|
|
d: k !== logs.value.length - 1
|
|
}, k !== logs.value.length - 1 ? {} : {}, {
|
|
e: common_vendor.t(log.title),
|
|
f: common_vendor.t(log.type === "buy" ? "录入增加" : "结出减少"),
|
|
g: common_vendor.t(log.amount),
|
|
h: k
|
|
});
|
|
}),
|
|
f: common_vendor.p({
|
|
type: "download",
|
|
size: "20",
|
|
color: "#FFFFFF"
|
|
}),
|
|
g: common_vendor.o(handleBuy),
|
|
h: common_vendor.p({
|
|
type: "upload",
|
|
size: "20",
|
|
color: "#064E3B"
|
|
}),
|
|
i: common_vendor.o(handleSell)
|
|
};
|
|
};
|
|
}
|
|
};
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-eca06f3c"]]);
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/detail/detail.js.map
|