9.20/1
This commit is contained in:
@@ -4,9 +4,10 @@ const common_http = require("../../common/http.js");
|
||||
const TYPE_MAP = { cash: "现金", bank: "银行", alipay: "支付宝", wechat: "微信", other: "其他" };
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return { accounts: [] };
|
||||
return { accounts: [], mode: "view" };
|
||||
},
|
||||
async onLoad() {
|
||||
async onLoad(q) {
|
||||
this.mode = q && q.mode || "view";
|
||||
try {
|
||||
const res = await common_http.get("/api/accounts");
|
||||
this.accounts = Array.isArray(res) ? res : (res == null ? void 0 : res.list) || [];
|
||||
@@ -16,12 +17,19 @@ const _sfc_main = {
|
||||
},
|
||||
methods: {
|
||||
select(a) {
|
||||
const opener = getCurrentPages()[getCurrentPages().length - 2];
|
||||
if (opener && opener.$vm) {
|
||||
opener.$vm.selectedAccountId = a.id;
|
||||
opener.$vm.selectedAccountName = a.name;
|
||||
if (this.mode === "pick") {
|
||||
const opener = getCurrentPages()[getCurrentPages().length - 2];
|
||||
if (opener && opener.$vm) {
|
||||
opener.$vm.selectedAccountId = a.id;
|
||||
opener.$vm.selectedAccountName = a.name;
|
||||
}
|
||||
common_vendor.index.navigateBack();
|
||||
} else {
|
||||
common_vendor.index.navigateTo({ url: `/pages/account/ledger?id=${a.id}` });
|
||||
}
|
||||
common_vendor.index.navigateBack();
|
||||
},
|
||||
create() {
|
||||
common_vendor.index.navigateTo({ url: "/pages/account/form" });
|
||||
},
|
||||
typeLabel(t) {
|
||||
return TYPE_MAP[t] || t;
|
||||
@@ -39,7 +47,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
d: a.id,
|
||||
e: common_vendor.o(($event) => $options.select(a), a.id)
|
||||
};
|
||||
})
|
||||
}),
|
||||
b: common_vendor.o((...args) => $options.create && $options.create(...args))
|
||||
};
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
|
||||
Reference in New Issue
Block a user