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

@@ -5,7 +5,7 @@ const _sfc_main = {
data() {
return {
id: null,
form: { name: "", level: "", priceLevel: "retail", contactName: "", mobile: "", phone: "", address: "", arOpening: 0, remark: "" },
form: { name: "", priceLevel: "retail", contactName: "", mobile: "", phone: "", address: "", arOpening: 0, remark: "" },
priceLevels: ["零售价", "批发价", "大单报价"],
priceLabels: ["零售价", "批发价", "大单报价"],
priceIdx: 0
@@ -14,6 +14,7 @@ const _sfc_main = {
onLoad(query) {
if (query && query.id) {
this.id = Number(query.id);
this.load();
}
},
methods: {
@@ -21,6 +22,27 @@ const _sfc_main = {
this.priceIdx = Number(e.detail.value);
this.form.priceLevel = this.priceLevels[this.priceIdx];
},
async load() {
if (!this.id)
return;
try {
const d = await common_http.get(`/api/customers/${this.id}`);
this.form = {
name: (d == null ? void 0 : d.name) || "",
priceLevel: (d == null ? void 0 : d.priceLevel) || "零售价",
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) || "",
arOpening: Number((d == null ? void 0 : d.arOpening) || 0),
remark: (d == null ? void 0 : d.remark) || ""
};
const idx = this.priceLevels.indexOf(this.form.priceLevel || "零售价");
this.priceIdx = idx >= 0 ? idx : 0;
} 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" });
@@ -41,27 +63,25 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: $data.form.name,
b: common_vendor.o(($event) => $data.form.name = $event.detail.value),
c: $data.form.level,
d: common_vendor.o(($event) => $data.form.level = $event.detail.value),
e: common_vendor.t($data.priceLabels[$data.priceIdx]),
f: $data.priceLabels,
g: $data.priceIdx,
h: common_vendor.o((...args) => $options.onPriceChange && $options.onPriceChange(...args)),
i: $data.form.contactName,
j: common_vendor.o(($event) => $data.form.contactName = $event.detail.value),
k: $data.form.mobile,
l: common_vendor.o(($event) => $data.form.mobile = $event.detail.value),
m: $data.form.phone,
n: common_vendor.o(($event) => $data.form.phone = $event.detail.value),
o: $data.form.address,
p: common_vendor.o(($event) => $data.form.address = $event.detail.value),
q: $data.form.arOpening,
r: common_vendor.o(common_vendor.m(($event) => $data.form.arOpening = $event.detail.value, {
c: common_vendor.t($data.priceLabels[$data.priceIdx]),
d: $data.priceLabels,
e: $data.priceIdx,
f: common_vendor.o((...args) => $options.onPriceChange && $options.onPriceChange(...args)),
g: $data.form.contactName,
h: common_vendor.o(($event) => $data.form.contactName = $event.detail.value),
i: $data.form.mobile,
j: common_vendor.o(($event) => $data.form.mobile = $event.detail.value),
k: $data.form.phone,
l: common_vendor.o(($event) => $data.form.phone = $event.detail.value),
m: $data.form.address,
n: common_vendor.o(($event) => $data.form.address = $event.detail.value),
o: $data.form.arOpening,
p: common_vendor.o(common_vendor.m(($event) => $data.form.arOpening = $event.detail.value, {
number: true
})),
s: $data.form.remark,
t: common_vendor.o(($event) => $data.form.remark = $event.detail.value),
v: common_vendor.o((...args) => $options.save && $options.save(...args))
q: $data.form.remark,
r: common_vendor.o(($event) => $data.form.remark = $event.detail.value),
s: common_vendor.o((...args) => $options.save && $options.save(...args))
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);