This commit is contained in:
2025-09-27 22:57:59 +08:00
parent 8a458ff0a4
commit ed26244cdb
12585 changed files with 1914308 additions and 3474 deletions

View File

@@ -11,9 +11,29 @@ const _sfc_main = {
onLoad(query) {
if (query && query.id) {
this.id = Number(query.id);
this.load();
}
},
methods: {
async load() {
if (!this.id)
return;
try {
const d = await common_http.get(`/api/suppliers/${this.id}`);
this.form = {
name: (d == null ? void 0 : d.name) || "",
contactName: (d == null ? void 0 : d.contactName) || "",
mobile: (d == null ? void 0 : d.mobile) || "",
phone: (d == null ? void 0 : d.phone) || "",
address: (d == null ? void 0 : d.address) || "",
apOpening: Number((d == null ? void 0 : d.apOpening) || 0),
apPayable: Number((d == null ? void 0 : d.apPayable) || 0),
remark: (d == null ? void 0 : d.remark) || ""
};
} catch (e) {
common_vendor.index.showToast({ title: (e == null ? void 0 : e.message) || "加载失败", icon: "none" });
}
},
async save() {
if (!this.form.name)
return common_vendor.index.showToast({ title: "请填写供应商名称", icon: "none" });

View File

@@ -25,12 +25,22 @@ const _sfc_main = {
common_vendor.index.navigateTo({ url: "/pages/supplier/form" });
},
select(s) {
const opener = getCurrentPages()[getCurrentPages().length - 2];
if (opener && opener.$vm) {
opener.$vm.order.supplierId = s.id;
opener.$vm.supplierName = s.name;
try {
const pages = getCurrentPages();
const opener = pages && pages.length >= 2 ? pages[pages.length - 2] : null;
const vm = opener && opener.$vm ? opener.$vm : null;
const canPick = !!(vm && vm.order);
if (canPick) {
vm.order.supplierId = s.id;
if (Object.prototype.hasOwnProperty.call(vm, "supplierName"))
vm.supplierName = s.name;
common_vendor.index.navigateBack();
} else {
common_vendor.index.navigateTo({ url: `/pages/supplier/form?id=${s.id}` });
}
} catch (_) {
common_vendor.index.navigateTo({ url: `/pages/supplier/form?id=${s.id}` });
}
common_vendor.index.navigateBack();
}
}
};