1.增加推荐套餐弹窗,未完成

2.创建自选详情页面
wenjuan
刘佳宇 1 year ago
parent b9746a1279
commit aa0d7cd020

@ -71,6 +71,14 @@
"style": { "style": {
"navigationBarTitleText": "支付完成" "navigationBarTitleText": "支付完成"
} }
},
{
"path": "pages/main/optionalProject/optionalDetails",
"style": {
"navigationBarTitleText": "自选项目详情",
"navigationBarBackgroundColor": "#D8EDF2",
"navigationBarTextStyle": "black"
}
} }
], ],
"globalStyle": { "globalStyle": {

@ -0,0 +1,49 @@
<script setup>
/**
* name
* usersa0ChunLuyu
* date2024年9月11日 19:24:50
*/
import {
ref
} from 'vue'
import {
$api,
$response
} from '@/api'
import {
onShow
} from '@dcloudio/uni-app'
import {
useStore
} from '@/store'
const $store = useStore()
const mountedAction = () => {
}
const config_ref = ref(null)
const configRef = (e) => {
if (!config_ref.value) {
config_ref.value = e
mountedAction()
}
}
onShow(() => {
if (!!config_ref.value) {
mountedAction()
}
})
</script>
<template>
<view>
<view v-if="!!$store.config">
<view :ref="configRef"></view>
</view>
</view>
</template>
<style scoped>
</style>

@ -10,10 +10,6 @@ import { onShow } from "@dcloudio/uni-app";
import { useStore } from "@/store"; import { useStore } from "@/store";
const $props = defineProps({ const $props = defineProps({
hospital: {
type: String,
default: "",
},
comboId: { comboId: {
type: String, type: String,
default: "", default: "",
@ -38,6 +34,22 @@ let optionalOriginalPrice = ref(0); //自选原始价格
let totalPrice = ref(0); // let totalPrice = ref(0); //
let totalOriginalPrice = ref(0); // let totalOriginalPrice = ref(0); //
let total = 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) => { const getAllItems = async (e) => {
// //
@ -56,11 +68,15 @@ const getAllItems = async (e) => {
}; };
const getBuyInfo = async () => { const getBuyInfo = async () => {
const response = await $api("BuyInfo", { //
let obj = {
item_ids: selectIds.value, item_ids: selectIds.value,
hospital: $props.hospital, hospital: $store.save_info.hospital,
combo_id: $props.comboId, };
}); if (comboId.value) {
obj.combo_id = comboId.value;
}
const response = await $api("BuyInfo", obj);
$response(response, () => { $response(response, () => {
packagePrice.value = response.data.combo_info.price; packagePrice.value = response.data.combo_info.price;
packageOriginalPrice.value = response.data.combo_info.original_price; packageOriginalPrice.value = response.data.combo_info.original_price;
@ -74,8 +90,12 @@ const getBuyInfo = async () => {
const mountedAction = () => { const mountedAction = () => {
selectIds.value = $props.itemIds?.split(",") || []; selectIds.value = $props.itemIds?.split(",") || [];
comboId.value = Number($props.comboId);
getAllItems(); // getAllItems(); //
getBuyInfo(); // getComboRecommend();
if (comboId.value) {
getBuyInfo(); //
}
}; };
const config_ref = ref(null); const config_ref = ref(null);
@ -98,6 +118,17 @@ onShow(() => {
<view :ref="configRef"></view> <view :ref="configRef"></view>
</view> </view>
</view> </view>
<uni-popup ref="popup">
<view class="bg-#fff rounded-15rpx w-95vw px-20rpx box-border">
<view class="center relative pt-47rpx pb-32rpx text-36rpx">
<text class="line-height-[1]">推荐套餐</text>
<uni-icons @click="popup.close()" type="closeempty" color="#A6A6A6" size="26" class="absolute right-40rpx top-30rpx"></uni-icons>
</view>
<view v-for="(item, index) in recommendPackageList" :key="index">
<image :src="$image(item.cover)" mode="widthFix" />
</view>
</view>
</uni-popup>
<view class="bg-#d8edf2"> <view class="bg-#d8edf2">
<uni-search-bar <uni-search-bar
class="search" class="search"
@ -118,15 +149,17 @@ onShow(() => {
'bg-gradient-to-r from-#edf6f5 to-#bbdfe2': tabIndex == index, 'bg-gradient-to-r from-#edf6f5 to-#bbdfe2': tabIndex == index,
}" }"
@click=" @click="
(tabIndex = index), () => {
(rightLeft = item.children), tabIndex = index;
(headImg = item.head_img) rightLeft = item.children;
headImg = item.head_img;
}
" "
> >
{{ item.title }} {{ item.title }}
</view> </view>
</view> </view>
<view class="grow h-100% bg-#fff"> <view class="grow h-100% bg-#fff pb-200rpx">
<image class="w-full" mode="widthFix" :src="$image(headImg)"></image> <image class="w-full" mode="widthFix" :src="$image(headImg)"></image>
<view <view
v-for="(item, index) in rightLeft" v-for="(item, index) in rightLeft"
@ -135,19 +168,35 @@ onShow(() => {
'!b-0': index == rightLeft.length - 1, '!b-0': index == rightLeft.length - 1,
}" }"
class="flex justify-between center py-30rpx px-20rpx b-b-1px b-b-solid b-b-#e5e5e5" 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();
}
"
> >
<text class="w-40% text-#0E0E0E text-25rpx">{{ item.title }}</text> <view class="w-40% text-#0E0E0E text-25rpx flex items-center">
<view class="w-58% items-end flex justify-between"> <text>{{ item.title }}</text>
<uni-tooltip>
<!-- 定义插槽插槽名为 content -->
<template v-slot:content>
<!-- 在这里编写自定义的 HTML 或组件 -->
<view class="w-30vw">
<text>{{ item.desc }}</text>
</view>
</template>
<!-- 触发提示的按钮 -->
<uni-icons color="#239ea4" type="help-filled" size="14"></uni-icons>
</uni-tooltip>
</view>
<view
class="w-58% items-end flex justify-between"
@click="
() => {
if (selectIds.includes(item.id)) {
selectIds.splice(selectIds.indexOf(item.id), 1);
} else {
selectIds.push(item.id);
}
getBuyInfo();
}
"
>
<text class="text-#EC3D15 text-26rpx">¥ {{ item.price }}</text> <text class="text-#EC3D15 text-26rpx">¥ {{ item.price }}</text>
<text class="text-#9e9d9d text-20rpx line-through" <text class="text-#9e9d9d text-20rpx line-through"
>¥ {{ item.original_price }}</text >¥ {{ item.original_price }}</text
@ -178,7 +227,7 @@ onShow(() => {
您需付费 \n{{ total }}个项目 您需付费 \n{{ total }}个项目
</text> </text>
<view class="grow"> <view class="grow">
<view class="flex items-end"> <view class="flex items-end" v-if="comboId != 0">
<text class="text-18rpx text-#878787">套餐价格</text> <text class="text-18rpx text-#878787">套餐价格</text>
<text class="text-21rpx text-#ED6907 mx-20rpx" <text class="text-21rpx text-#ED6907 mx-20rpx"
>¥ {{ packagePrice }}</text >¥ {{ packagePrice }}</text
@ -209,14 +258,38 @@ onShow(() => {
</view> </view>
<button <button
type="primary" type="primary"
@click="
async () => {
if (comboId) {
//
uni.navigateBack({ delta: 1 });
} else {
//
if (!selectIds.value.length) {
uni.$lu.toast('请选择项目');
return;
}
if (selectIds.value.length <= 1) {
//
uni.navigateTo('/pages/main/optionalProject/optionalDetails');
return;
}
if (selectIds.value.length > 1) {
//
getComboRecommend();
return;
}
}
}
"
class="text-#F8F8F8 w-240rpx h-hull rounded-full !bg-#239EA3 !mx-0 text-30rpx" class="text-#F8F8F8 w-240rpx h-hull rounded-full !bg-#239EA3 !mx-0 text-30rpx"
> >
确定 确定
</button> </button>
</view> </view>
</template> </template>
<style scoped> <style>
.search > .uni-searchbar__box { .uni-tooltip-popup {
justify-content: flex-start !important; background-color: #fff;
} }
</style> </style>

Loading…
Cancel
Save