2024-09-19 07:20:14 +08:00
|
|
|
"use strict";
|
|
|
|
var __async = (__this, __arguments, generator) => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
var fulfilled = (value) => {
|
|
|
|
try {
|
|
|
|
step(generator.next(value));
|
|
|
|
} catch (e) {
|
|
|
|
reject(e);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var rejected = (value) => {
|
|
|
|
try {
|
|
|
|
step(generator.throw(value));
|
|
|
|
} catch (e) {
|
|
|
|
reject(e);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
|
|
});
|
|
|
|
};
|
2024-10-01 09:15:35 +08:00
|
|
|
const common_vendor = require("../../../common/vendor.js");
|
|
|
|
const utils_http = require("../../../utils/http.js");
|
2024-09-19 07:20:14 +08:00
|
|
|
if (!Array) {
|
|
|
|
const _component_layout_default_uni = common_vendor.resolveComponent("layout-default-uni");
|
|
|
|
_component_layout_default_uni();
|
|
|
|
}
|
|
|
|
const _sfc_main = {
|
|
|
|
__name: "my-service",
|
|
|
|
setup(__props) {
|
|
|
|
const services = common_vendor.ref([]);
|
|
|
|
const fetchServices = () => __async(this, null, function* () {
|
|
|
|
try {
|
|
|
|
const response = yield utils_http.httpPost("/personal-service/list", {
|
|
|
|
pageNo: 1,
|
|
|
|
pageSize: 10
|
|
|
|
});
|
|
|
|
if (response.code == 200) {
|
|
|
|
services.value = response.records || [];
|
|
|
|
} else {
|
|
|
|
common_vendor.index.showToast({ title: "获取服务列表失败", icon: "none" });
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
common_vendor.index.showToast({ title: "获取服务列表失败", icon: "none" });
|
|
|
|
console.error("Error fetching services:", error);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
const editService = (service) => {
|
|
|
|
common_vendor.index.navigateTo({
|
2024-10-01 09:15:35 +08:00
|
|
|
url: `/modules/pet/push/door?id=${service.id}`
|
2024-09-19 07:20:14 +08:00
|
|
|
});
|
|
|
|
};
|
|
|
|
const deleteService = (serviceId) => __async(this, null, function* () {
|
|
|
|
try {
|
|
|
|
const response = yield utils_http.httpPost("/personal-service/delete", { id: serviceId });
|
|
|
|
if (response && response.data) {
|
|
|
|
services.value = services.value.filter((service) => service.id !== serviceId);
|
|
|
|
common_vendor.index.showToast({ title: "服务已删除", icon: "success" });
|
|
|
|
} else {
|
|
|
|
common_vendor.index.showToast({ title: "删除服务失败", icon: "none" });
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
common_vendor.index.showToast({ title: "删除服务失败", icon: "none" });
|
|
|
|
console.error("Error deleting service:", error);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
common_vendor.onMounted(() => {
|
|
|
|
fetchServices();
|
|
|
|
});
|
|
|
|
return (_ctx, _cache) => {
|
|
|
|
return {
|
|
|
|
a: common_vendor.f(services.value, (service, k0, i0) => {
|
|
|
|
return {
|
|
|
|
a: common_vendor.t(service.serviceName),
|
|
|
|
b: common_vendor.o(($event) => editService(service), service.id),
|
|
|
|
c: common_vendor.o(($event) => deleteService(service.id), service.id),
|
|
|
|
d: common_vendor.t(service.description),
|
|
|
|
e: common_vendor.t(service.price),
|
|
|
|
f: common_vendor.t(service.address),
|
|
|
|
g: service.id
|
|
|
|
};
|
|
|
|
})
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
2024-10-01 09:15:35 +08:00
|
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-9e6db675"]]);
|
2024-09-19 07:20:14 +08:00
|
|
|
wx.createPage(MiniProgramPage);
|