feat: 接入小程序业务提供项详情渲染
This commit is contained in:
1 parent
5e26999c72
commit
8fd399f4c2
7 files changed
+92
-5
No files matched your search
@@ -3,10 +3,15 @@ const { getTemplate } = require("../../utils/templates");
|
||||
Page({
|
||||
data: { loading: true, error: "", services: [], filtered: [], category: "package", labels: {} },
|
||||
onLoad() {
|
||||
Promise.all([request("/public/services"), request("/public/brand")])
|
||||
.then(([services, brand]) => {
|
||||
Promise.all([
|
||||
request("/public/offerings"),
|
||||
request("/public/services"),
|
||||
request("/public/brand"),
|
||||
])
|
||||
.then(([offerings, services, brand]) => {
|
||||
const labels = getTemplate(brand.templateKey);
|
||||
const mapped = services.map((item) => ({
|
||||
const source = offerings.length ? offerings : services;
|
||||
const mapped = source.map((item) => ({
|
||||
...item,
|
||||
coverUrl:
|
||||
item.coverUrl ||
|
||||
@@ -36,6 +41,12 @@ Page({
|
||||
this.setData({ category, filtered });
|
||||
},
|
||||
book(e) {
|
||||
if (e.currentTarget.dataset.offeringId) {
|
||||
wx.navigateTo({
|
||||
url: "/pages/offering/detail?id=" + encodeURIComponent(e.currentTarget.dataset.offeringId),
|
||||
});
|
||||
return;
|
||||
}
|
||||
wx.navigateTo({
|
||||
url: "/pages/booking/index?serviceId=" + encodeURIComponent(e.currentTarget.dataset.id),
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user