This commit is contained in:
2025-09-18 21:17:44 +08:00
parent e560e90970
commit bff3d0414d
49 changed files with 1063 additions and 90 deletions

View File

@@ -3,20 +3,27 @@ const common_vendor = require("../../common/vendor.js");
const common_http = require("../../common/http.js");
const _sfc_main = {
data() {
return { kw: "", suppliers: [] };
return { kw: "", debtOnly: false, suppliers: [] };
},
onLoad() {
this.search();
},
methods: {
toggleDebtOnly() {
this.debtOnly = !this.debtOnly;
this.search();
},
async search() {
try {
const res = await common_http.get("/api/suppliers", { kw: this.kw, page: 1, size: 50 });
const res = await common_http.get("/api/suppliers", { kw: this.kw, debtOnly: this.debtOnly, page: 1, size: 50 });
this.suppliers = Array.isArray(res == null ? void 0 : res.list) ? res.list : Array.isArray(res) ? res : [];
} catch (e) {
common_vendor.index.showToast({ title: "加载失败", icon: "none" });
}
},
createSupplier() {
common_vendor.index.navigateTo({ url: "/pages/supplier/form" });
},
select(s) {
const opener = getCurrentPages()[getCurrentPages().length - 2];
if (opener && opener.$vm) {
@@ -33,14 +40,21 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
b: $data.kw,
c: common_vendor.o(($event) => $data.kw = $event.detail.value),
d: common_vendor.o((...args) => $options.search && $options.search(...args)),
e: common_vendor.f($data.suppliers, (s, k0, i0) => {
return {
e: $data.debtOnly ? "primary" : "default",
f: common_vendor.o((...args) => $options.toggleDebtOnly && $options.toggleDebtOnly(...args)),
g: common_vendor.f($data.suppliers, (s, k0, i0) => {
return common_vendor.e({
a: common_vendor.t(s.name),
b: common_vendor.t(s.mobile || "—"),
c: s.id,
d: common_vendor.o(($event) => $options.select(s), s.id)
};
})
c: typeof s.apPayable === "number"
}, typeof s.apPayable === "number" ? {
d: common_vendor.t(Number(s.apPayable).toFixed(2))
} : {}, {
e: s.id,
f: common_vendor.o(($event) => $options.select(s), s.id)
});
}),
h: common_vendor.o((...args) => $options.createSupplier && $options.createSupplier(...args))
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);