# Conflicts:
#	.env
This commit is contained in:
dzc committed 2026-06-08 12:41:22 +08:00
commit 97d72bd4bb
3 files changed
+37 -4

No files matched your search

+31 -3
View File
@@ -130,6 +130,23 @@ const getHeight = () => {
return `calc(100vh - ${uni.upx2px(rpx)}px)`
}
/** functionScope 在部分接口/端上可能是 JSON 字符串 */
const normalizeFunctionScope = (raw: unknown): Record<string, any> => {
if (!raw) return {}
if (typeof raw === "string") {
try {
const parsed = JSON.parse(raw)
return parsed && typeof parsed === "object" ? parsed : {}
} catch {
return {}
}
}
if (typeof raw === "object") return { ...(raw as Record<string, any>) }
return {}
}
const isTruthyFlag = (v: unknown) => v === true || v === 1 || v === "1" || v === "true"
// 获取食堂详情信息
const getDetail = async () => {
if (isEmpty(state.detailId)) {
@@ -138,7 +155,12 @@ const getDetail = async () => {
}
uni.showLoading({ title: "加载中...", mask: true })
const { code, data } = await merchantApi.detail({ id: state.detailId })
if (code == 0) state.canteenDetail = data
if (code == 0 && data) {
state.canteenDetail = {
...data,
functionScope: normalizeFunctionScope(data.functionScope),
}
}
await getTakeOutDetail()
uni.hideLoading()
}
@@ -443,7 +465,7 @@ const doFood = () => {
}
const orderingFoodEnabled = computed(() =>
Boolean(state.canteenDetail?.functionScope?.orderingFoodEnable),
isTruthyFlag(state.canteenDetail?.functionScope?.orderingFoodEnable),
)
const doOrderingFood = () => {
@@ -524,7 +546,7 @@ const doOrderingFood = () => {
</view>
<view v-if="orderingFoodEnabled" class="mch-actions__item" @tap="doOrderingFood">
<view class="mch-actions__icon">
<text class="font-size-28rpx! color-white iconfont icon-baocan" />
<image class="mch-actions__icon-img" src="/static/page/baocan.png" mode="aspectFit" />
</view>
<text class="mch-actions__label">报餐</text>
</view>
@@ -689,6 +711,12 @@ const doOrderingFood = () => {
flex-shrink: 0;
}
.mch-actions__icon-img {
width: 28rpx;
height: 28rpx;
filter: brightness(0) invert(1);
}
.mch-actions__label {
margin-top: 8rpx;
font-size: 22rpx;
+6 -1
View File
@@ -120,4 +120,9 @@
.icon-youjiantou:before {
content: "\e928";
}
}
/* 报餐登记(复用 jilu 字形;e631 在 CDN 字体中无对应图标) */
.icon-baocan:before {
content: "\e664";
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB