menu.js
3.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const common_hotel = require("../../common/hotel.js");
require("../../common/request.js");
require("../../config.js");
require("../../common/login.js");
require("../../common/api.js");
const _sfc_main = {
__name: "menu",
setup(__props) {
getApp();
const data = common_vendor.reactive({
menu: [],
money: 0,
meunNum: 0,
detail: {}
});
const {
menu,
meunNum,
money,
detail
} = common_vendor.toRefs(data);
let menuId = "";
let activeId = "";
common_vendor.onLoad((options) => {
console.log(options);
menuId = options.id;
activeId = options.activeId;
if ("detail" in options) {
detail.value = JSON.parse(decodeURIComponent(options.detail));
}
getList();
common_vendor.index.setNavigationBarTitle({
title: detail.value.name
});
});
function getList() {
common_vendor.index.showLoading({
title: "加载中"
});
common_hotel.getMenuById(menuId).then((res) => {
menu.value = res.rows;
for (let m of menu.value) {
m.num = 0;
if (m.category == 0) {
m.categoryName = "早餐";
} else if (m.category == 1) {
m.categoryName = "午餐";
} else {
m.categoryName = "晚餐";
}
}
common_vendor.index.hideLoading();
});
}
function goNext(food) {
var food = encodeURIComponent(JSON.stringify(food));
let path = `/pages_hotel/eat/order?activeId=${activeId}&food=${food}&menuId=${menuId}&orderName=${detail.value.name}&address=${detail.value.addName}`;
common_vendor.index.navigateTo({
url: path
});
}
return (_ctx, _cache) => {
var _a;
return {
a: common_vendor.f((_a = common_vendor.unref(detail).photos) == null ? void 0 : _a.split(","), (pic, index, i0) => {
return {
a: pic,
b: index
};
}),
b: _ctx.indicatorDots,
c: _ctx.autoplay,
d: _ctx.interval,
e: _ctx.duration,
f: common_vendor.t(common_vendor.unref(detail).name),
g: common_assets._imports_0$2,
h: common_vendor.t(common_vendor.unref(detail).addName),
i: common_assets._imports_1$2,
j: common_vendor.unref(detail).introduction,
k: common_vendor.f(common_vendor.unref(menu), (r, k0, i0) => {
return {
a: r.photos,
b: common_vendor.t(r.name),
c: r.category == 0,
d: r.category == 1,
e: r.category == 2,
f: common_vendor.t(r.psStart),
g: common_vendor.t(r.psEnd),
h: common_vendor.t(r.address),
i: common_vendor.t(r.foodPrice),
j: common_vendor.o(($event) => goNext(r), r.id),
k: r.id
};
})
};
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-351851fc"], ["__file", "/Users/yangyang/project/j-mini/Venue/pages_hotel/eat/menu.vue"]]);
_sfc_main.__runtimeHooks = 6;
wx.createPage(MiniProgramPage);