28 lines
1014 B
JavaScript
28 lines
1014 B
JavaScript
const { request } = require("../../utils/request");
|
|
Page({
|
|
data: { loading: true, error: "", item: null },
|
|
onLoad(options) {
|
|
request("/public/offerings/" + encodeURIComponent(options.id))
|
|
.then((item) => this.setData({ item, loading: false }))
|
|
.catch(() => this.setData({ loading: false, error: "详情加载失败" }));
|
|
},
|
|
submit() {
|
|
const cta = this.data.item?.cta || {};
|
|
if (cta.type === "inquiry") {
|
|
const formId = cta.config?.formId;
|
|
return wx.navigateTo({
|
|
url: "/pages/inquiry/index" + (formId ? "?formId=" + encodeURIComponent(formId) : ""),
|
|
});
|
|
}
|
|
if (cta.type === "external-link") {
|
|
return wx.showToast({ title: "请在支持外链的环境打开", icon: "none" });
|
|
}
|
|
if (cta.type === "contact") {
|
|
return wx.showToast({ title: "请从品牌主页查看联系方式", icon: "none" });
|
|
}
|
|
wx.navigateTo({
|
|
url: "/pages/booking/index?serviceId=" + encodeURIComponent(this.data.item?.id || ""),
|
|
});
|
|
},
|
|
});
|