From 67d60a6714c9695bb04923ad826d9ecf6a895b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=BD=B3=E5=AE=87?= <17601616548@163.com> Date: Mon, 23 Sep 2024 00:54:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A5=97=E9=A4=90=E8=AF=A6=E6=83=85+=E8=87=AA?= =?UTF-8?q?=E9=80=89+=E9=97=AE=E5=8D=B7=E8=B0=83=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- h5/pages.json | 17 +- .../main/optionalProject/optionalDetails.vue | 385 ++++++++++-- .../main/optionalProject/optionalProject.vue | 182 ++++-- h5/pages/main/questionnaire/index.vue | 558 ++++++++++++++++++ h5/static/assets/slices/slices@3x.png | Bin 0 -> 47177 bytes h5/unocss.config.js | 1 + 6 files changed, 1059 insertions(+), 84 deletions(-) create mode 100644 h5/pages/main/questionnaire/index.vue create mode 100755 h5/static/assets/slices/slices@3x.png diff --git a/h5/pages.json b/h5/pages.json index 7779c8f..d35747b 100644 --- a/h5/pages.json +++ b/h5/pages.json @@ -1,5 +1,6 @@ { - "pages": [{ + "pages": [ + { "path": "pages/main/index/index", "style": { "navigationBarTitleText": "海南现代妇女儿童医院", @@ -75,9 +76,17 @@ { "path": "pages/main/optionalProject/optionalDetails", "style": { - "navigationBarTitleText": "自选项目详情", - "navigationBarBackgroundColor": "#D8EDF2", - "navigationBarTextStyle": "black" + "navigationBarTitleText": "套餐详情", + "navigationBarBackgroundColor": "#239EA3", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/main/questionnaire/index", + "style": { + "navigationBarTitleText": "问卷调查", + "navigationBarBackgroundColor": "#239EA3", + "navigationBarTextStyle": "white" } }, { diff --git a/h5/pages/main/optionalProject/optionalDetails.vue b/h5/pages/main/optionalProject/optionalDetails.vue index dd2f9db..797890b 100644 --- a/h5/pages/main/optionalProject/optionalDetails.vue +++ b/h5/pages/main/optionalProject/optionalDetails.vue @@ -1,49 +1,346 @@ - \ No newline at end of file + &::after { + content: ""; + width: 26rpx; + height: 3rpx; + background-color: #239ea3; + position: absolute; + left: 50%; + bottom: -10rpx; + transform: translateX(-50%); + } + } +} + diff --git a/h5/pages/main/optionalProject/optionalProject.vue b/h5/pages/main/optionalProject/optionalProject.vue index 22054a4..a5133f5 100644 --- a/h5/pages/main/optionalProject/optionalProject.vue +++ b/h5/pages/main/optionalProject/optionalProject.vue @@ -9,6 +9,8 @@ import { $api, $response, $image } from "@/api"; import { onShow } from "@dcloudio/uni-app"; import { useStore } from "@/store"; +// comboId 套餐ID 没有套餐ID就是个人自选项目 +// itemIds 自选ID const $props = defineProps({ comboId: { type: String, @@ -34,11 +36,12 @@ let optionalOriginalPrice = ref(0); //自选原始价格 let totalPrice = ref(0); // 总折扣价格 let totalOriginalPrice = ref(0); // 总原始价格 let total = ref(0); // 总项目数 -let comboId = ref(0); // 套餐id +let comboId = ref(""); // 套餐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, @@ -48,6 +51,7 @@ const getComboRecommend = async () => { if (recommendPackageList.value.length) { popup.value.open("center"); } + uni.hideLoading(); }); }; @@ -69,6 +73,9 @@ const getAllItems = async (e) => { const getBuyInfo = async () => { // 获取购买信息 + uni.showLoading({ + title: "加载中", + }); let obj = { item_ids: selectIds.value, hospital: $store.save_info.hospital, @@ -85,14 +92,46 @@ const getBuyInfo = async () => { totalPrice.value = response.data.true_price; totalOriginalPrice.value = response.data.original_price; total.value = response.data.pay_item_count; + uni.hideLoading(); }); }; -const mountedAction = () => { +const confirm = async () => { + const itemIds = selectIds.value.length > 0 ? selectIds.value.join(",") : ""; + // 确定 + if (comboId.value) { + // 增加自选 + uni.navigateBack({ + delta: 2, + success: () => { + let time = setTimeout(() => { + uni.navigateTo({ + url: + "/pages/main/optionalProject/optionalDetails?comboId=" + + comboId.value + + "&itemIds=" + + itemIds, + }); + clearTimeout(time); + }, 500); + }, + }); + } else { + // 自选 + if (!selectIds.value.length) { + uni.$lu.toast("请选择项目"); + return; + } + // 自选触发推荐套餐 + getComboRecommend(); + } +}; + +const mountedAction = async () => { selectIds.value = $props.itemIds?.split(",") || []; - comboId.value = Number($props.comboId); - getAllItems(); // 获取全部项目 - getComboRecommend(); + comboId.value = $props.comboId ? $props.comboId : ""; + await getAllItems(); // 获取全部项目 + // await getComboRecommend(); if (comboId.value) { getBuyInfo(); // 获取购买信息 } @@ -122,10 +161,100 @@ onShow(() => { 推荐套餐 - + + + + + + + {{ item.name }} {{ item.sex == 0 ? "(男)" : "(女)" }} + + + + + {{ val }} + + + ¥ + {{ + item.price + }} + {{ + item.original_price + }} + 已售{{ item.count }} + + + + + + 相似度 + {{ item.recommend?.xiangsidu }} + ,{{ item.recommend?.count > 0 ? "增加" : "减少" }}了 + {{ + Math.abs(item.recommend?.count) + }} + 个项目,{{ item.recommend?.money > 0 ? "增加" : "减少" }}了 + ¥{{ Math.abs(item.recommend?.money) }} + + + - - + + @@ -239,9 +368,11 @@ onShow(() => { 自选项目价格 ¥ {{ optionalPrice }}¥ {{ optionalPrice || 0 }} - ¥ {{ optionalOriginalPrice }} @@ -249,39 +380,18 @@ onShow(() => { 合计费用 ¥ {{ - totalPrice + totalPrice || 0 }} - ¥ {{ totalOriginalPrice }}