9.16/1
This commit is contained in:
47
frontend/unpackage/dist/dev/mp-weixin/pages/account/select.js
vendored
Normal file
47
frontend/unpackage/dist/dev/mp-weixin/pages/account/select.js
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const common_http = require("../../common/http.js");
|
||||
const TYPE_MAP = { cash: "现金", bank: "银行", alipay: "支付宝", wechat: "微信", other: "其他" };
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return { accounts: [] };
|
||||
},
|
||||
async onLoad() {
|
||||
try {
|
||||
const res = await common_http.get("/api/accounts");
|
||||
this.accounts = Array.isArray(res) ? res : (res == null ? void 0 : res.list) || [];
|
||||
} catch (e) {
|
||||
common_vendor.index.showToast({ title: "加载失败", icon: "none" });
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
select(a) {
|
||||
const opener = getCurrentPages()[getCurrentPages().length - 2];
|
||||
if (opener && opener.$vm) {
|
||||
opener.$vm.selectedAccountId = a.id;
|
||||
opener.$vm.selectedAccountName = a.name;
|
||||
}
|
||||
common_vendor.index.navigateBack();
|
||||
},
|
||||
typeLabel(t) {
|
||||
return TYPE_MAP[t] || t;
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.f($data.accounts, (a, k0, i0) => {
|
||||
var _a;
|
||||
return {
|
||||
a: common_vendor.t(a.name),
|
||||
b: common_vendor.t($options.typeLabel(a.type)),
|
||||
c: common_vendor.t(((_a = a.balance) == null ? void 0 : _a.toFixed) ? a.balance.toFixed(2) : a.balance),
|
||||
d: a.id,
|
||||
e: common_vendor.o(($event) => $options.select(a), a.id)
|
||||
};
|
||||
})
|
||||
};
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/account/select.js.map
|
||||
4
frontend/unpackage/dist/dev/mp-weixin/pages/account/select.json
vendored
Normal file
4
frontend/unpackage/dist/dev/mp-weixin/pages/account/select.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "选择账户",
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
frontend/unpackage/dist/dev/mp-weixin/pages/account/select.wxml
vendored
Normal file
1
frontend/unpackage/dist/dev/mp-weixin/pages/account/select.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="page"><scroll-view scroll-y class="list"><view wx:for="{{a}}" wx:for-item="a" wx:key="d" class="item" bindtap="{{a.e}}"><view class="name">{{a.a}}</view><view class="meta">{{a.b}} · 余额:{{a.c}}</view></view></scroll-view></view>
|
||||
11
frontend/unpackage/dist/dev/mp-weixin/pages/account/select.wxss
vendored
Normal file
11
frontend/unpackage/dist/dev/mp-weixin/pages/account/select.wxss
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
.page { display:flex; flex-direction: column; height: 100vh;
|
||||
}
|
||||
.list { flex:1;
|
||||
}
|
||||
.item { padding: 20rpx 24rpx; background:#fff; border-bottom: 1rpx solid #f1f1f1;
|
||||
}
|
||||
.name { color:#333; margin-bottom: 6rpx;
|
||||
}
|
||||
.meta { color:#888; font-size: 24rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user