From aa0d7cd020e4e15086618a0a11ef056fe2d589bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=BD=B3=E5=AE=87?= <17601616548@163.com> Date: Sat, 14 Sep 2024 02:44:45 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E6=8E=A8=E8=8D=90=E5=A5=97?= =?UTF-8?q?=E9=A4=90=E5=BC=B9=E7=AA=97=EF=BC=8C=E6=9C=AA=E5=AE=8C=E6=88=90?= =?UTF-8?q?=202.=E5=88=9B=E5=BB=BA=E8=87=AA=E9=80=89=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- h5/pages.json | 8 ++ .../main/optionalProject/optionalDetails.vue | 49 +++++++ .../main/optionalProject/optionalProject.vue | 131 ++++++++++++++---- 3 files changed, 159 insertions(+), 29 deletions(-) create mode 100644 h5/pages/main/optionalProject/optionalDetails.vue diff --git a/h5/pages.json b/h5/pages.json index 6b9c544..167a480 100644 --- a/h5/pages.json +++ b/h5/pages.json @@ -71,6 +71,14 @@ "style": { "navigationBarTitleText": "支付完成" } + }, + { + "path": "pages/main/optionalProject/optionalDetails", + "style": { + "navigationBarTitleText": "自选项目详情", + "navigationBarBackgroundColor": "#D8EDF2", + "navigationBarTextStyle": "black" + } } ], "globalStyle": { diff --git a/h5/pages/main/optionalProject/optionalDetails.vue b/h5/pages/main/optionalProject/optionalDetails.vue new file mode 100644 index 0000000..dd2f9db --- /dev/null +++ b/h5/pages/main/optionalProject/optionalDetails.vue @@ -0,0 +1,49 @@ + + + \ No newline at end of file diff --git a/h5/pages/main/optionalProject/optionalProject.vue b/h5/pages/main/optionalProject/optionalProject.vue index bba1ca0..22054a4 100644 --- a/h5/pages/main/optionalProject/optionalProject.vue +++ b/h5/pages/main/optionalProject/optionalProject.vue @@ -10,10 +10,6 @@ import { onShow } from "@dcloudio/uni-app"; import { useStore } from "@/store"; const $props = defineProps({ - hospital: { - type: String, - default: "", - }, comboId: { type: String, default: "", @@ -38,6 +34,22 @@ let optionalOriginalPrice = ref(0); //自选原始价格 let totalPrice = ref(0); // 总折扣价格 let totalOriginalPrice = ref(0); // 总原始价格 let total = ref(0); // 总项目数 +let comboId = ref(0); // 套餐id +let recommendPackageList = ref([]); // 推荐套餐列表 +let popup = ref(null); + +const getComboRecommend = async () => { + const response = await $api("ComboRecommend", { + person_id: $store.save_info.user_id || 1, + item_ids: selectIds.value, + }); + $response(response, () => { + recommendPackageList.value = response.data.combos; + if (recommendPackageList.value.length) { + popup.value.open("center"); + } + }); +}; const getAllItems = async (e) => { // 获取全部项目 @@ -56,11 +68,15 @@ const getAllItems = async (e) => { }; const getBuyInfo = async () => { - const response = await $api("BuyInfo", { + // 获取购买信息 + let obj = { item_ids: selectIds.value, - hospital: $props.hospital, - combo_id: $props.comboId, - }); + hospital: $store.save_info.hospital, + }; + if (comboId.value) { + obj.combo_id = comboId.value; + } + const response = await $api("BuyInfo", obj); $response(response, () => { packagePrice.value = response.data.combo_info.price; packageOriginalPrice.value = response.data.combo_info.original_price; @@ -74,8 +90,12 @@ const getBuyInfo = async () => { const mountedAction = () => { selectIds.value = $props.itemIds?.split(",") || []; + comboId.value = Number($props.comboId); getAllItems(); // 获取全部项目 - getBuyInfo(); // 获取购买信息 + getComboRecommend(); + if (comboId.value) { + getBuyInfo(); // 获取购买信息 + } }; const config_ref = ref(null); @@ -98,6 +118,17 @@ onShow(() => { + + + + 推荐套餐 + + + + + + + { 'bg-gradient-to-r from-#edf6f5 to-#bbdfe2': tabIndex == index, }" @click=" - (tabIndex = index), - (rightLeft = item.children), - (headImg = item.head_img) + () => { + tabIndex = index; + rightLeft = item.children; + headImg = item.head_img; + } " > {{ item.title }} - + { '!b-0': index == rightLeft.length - 1, }" class="flex justify-between center py-30rpx px-20rpx b-b-1px b-b-solid b-b-#e5e5e5" - @click=" - () => { - if (selectIds.includes(item.id)) { - selectIds.splice(selectIds.indexOf(item.id), 1); - } else { - selectIds.push(item.id); - } - getBuyInfo(); - } - " > - {{ item.title }} - + + {{ item.title }} + + + + + + + + + ¥ {{ item.price }} ¥ {{ item.original_price }} { 您需付费 \n{{ total }}个项目 - + 套餐价格 ¥ {{ packagePrice }} { -