diff --git a/.env b/.env index 5d55bdf..7612733 100644 --- a/.env +++ b/.env @@ -33,12 +33,12 @@ VITE_OAUTH2_SOCIAL_CLIENT='social:social' # 是否开启websocket 消息接受, VITE_WEBSOCKET_ENABLE = true # --------------------------- start 开发环境 start ---------------------------------- -# VITE_APP_DEV_SERVICE = https://www.zianxin.com/api -VITE_APP_DEV_SERVICE = https://dzc-test-1.fy.takin.cc +VITE_APP_DEV_SERVICE = https://www.zianxin.com/api +# VITE_APP_DEV_SERVICE = https://dzc-test-1.fy.takin.cc # VITE_APP_DEV_SERVICE = http://127.0.0.1:9999 -# VITE_IMAGE_DEV_PATH = https://www.zianxin.com/api -VITE_IMAGE_DEV_PATH = https://dzc-test-1.fy.takin.cc +VITE_IMAGE_DEV_PATH = https://www.zianxin.com/api +# VITE_IMAGE_DEV_PATH = https://dzc-test-1.fy.takin.cc # VITE_IMAGE_DEV_PATH = http://127.0.0.1:9999 # ----------------------------- end 开发环境 end ------------------------------------ diff --git a/src/manifest.json b/src/manifest.json index 8f21990..9d861fc 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,8 +2,8 @@ "name" : "资安信", "appid" : "__UNI__1BFE88F", "description" : "资安信后勤管理系统", - "versionName" : "1.5.08", - "versionCode" : 1508, + "versionName" : "1.5.12", + "versionCode" : 1512, "transformPx" : false, /* 5+App特有相关 */ "app-plus" : { diff --git a/src/pages/canteen/daily-menu-detail.vue b/src/pages/canteen/daily-menu-detail.vue index becb016..0f67e4c 100644 --- a/src/pages/canteen/daily-menu-detail.vue +++ b/src/pages/canteen/daily-menu-detail.vue @@ -5,14 +5,14 @@ import { onLoad } from "@dcloudio/uni-app" import { foodApi } from "@@/api" import type { DailyMenuComboItem, DailyMenuDetail } from "@@/components/order/daily-menu-types" -import { hooks } from "@@/index" +import { hooks, router } from "@@/index" import { filePath } from "@@/utils/file" -/** 页面请求和展示状态,由详情接口统一驱动。 */ +/** 页面请求和展示状态,由每日菜谱商品详情接口统一驱动。 */ const state = reactive({ /** 路由传入的每日菜谱记录 ID。 */ detailId: "", - /** 当前每日菜谱详情;请求失败或记录不存在时为空。 */ + /** 当前商品详情;请求失败或记录不存在时为空。 */ detail: null as DailyMenuDetail | null, /** 首次加载和重试期间的骨架屏状态。 */ loading: false, @@ -25,6 +25,9 @@ const state = reactive({ /** 当前菜品是否为套餐,兼容服务端将协议值返回为字符串的情况。 */ const isCombo = computed(() => Number(state.detail?.spuType) === 2) +/** 商品类型展示名称;除协议值 2 外均按单品兜底,与服务端默认类型规则保持一致。 */ +const productTypeLabel = computed(() => (isCombo.value ? "套餐" : "单品")) + /** 套餐组成按服务端排序值展示,复制数组以避免修改接口响应对象。 */ const comboItems = computed(() => { const items = Array.isArray(state.detail?.comboItems) ? state.detail.comboItems : [] @@ -90,13 +93,13 @@ const menuDateParts = computed(() => { /** 是否存在有效市场价,只有高于销售价时才展示划线价。 */ const hasMarketPrice = computed(() => Number(state.detail?.marketPrice || 0) > Number(state.detail?.price || 0)) -/** 菜谱补充信息按移动端扫描顺序组织,详情页只保留分类。 */ +/** 商品补充信息按移动端扫描顺序组织,详情页只保留分类。 */ const menuInfoItems = computed(() => [ { key: "category", icon: "apps-line", iconColor: "#475467", - label: "菜品分类", + label: "商品分类", value: state.detail?.categoryName || "未分类", }, ]) @@ -113,6 +116,16 @@ const comboItemQuantity = (quantity?: number) => { /** 套餐总份数由有效数量汇总,异常数量按一份处理。 */ const comboTotalQuantity = computed(() => comboItems.value.reduce((total, item) => total + comboItemQuantity(item.quantity), 0)) +/** 套餐子项使用 SPU ID 进入通用商品详情;每日菜谱记录 ID 只用于当前套餐详情。 */ +const openComboItemDetail = (comboItem: DailyMenuComboItem) => { + const spuId = String(comboItem.childSpuId || "").trim() + if (!spuId) { + uni.showToast({ title: "套餐商品信息缺失,暂时无法查看详情", icon: "none" }) + return + } + router.jump("/pages/canteen/product-detail", { id: spuId, source: "daily" }) +} + /** 将富文本图片转换为跨 H5、iOS、Android 可访问的完整地址。 */ const normalizeDescription = (description?: string) => { if (!description) return "" @@ -125,10 +138,10 @@ const normalizeDescription = (description?: string) => { }) } -/** 查询每日菜谱详情;失败时保留当前路由并提供可重试状态。 */ +/** 查询每日菜谱中的商品详情;单品与套餐使用相同接口,失败时保留当前路由并提供可重试状态。 */ const loadDetail = async () => { if (!state.detailId) { - state.errorMessage = "菜谱信息缺失,暂时无法查看详情" + state.errorMessage = "商品信息缺失,暂时无法查看详情" return } state.loading = true @@ -137,12 +150,12 @@ const loadDetail = async () => { const response: any = await foodApi.detail(state.detailId) if (response?.code != null && Number(response.code) !== 0) { state.detail = null - state.errorMessage = response?.msg || "菜谱详情加载失败,请稍后重试" + state.errorMessage = response?.msg || "商品详情加载失败,请稍后重试" return } if (!response?.data?.id) { state.detail = null - state.errorMessage = "该菜谱已下架或不存在" + state.errorMessage = "该商品已下架或不存在" return } state.detail = { @@ -171,9 +184,9 @@ onLoad((options: any) => {