|
|
|
@ -9,6 +9,8 @@ import { $api, $response, $image } from "@/api";
|
|
|
|
import { onShow } from "@dcloudio/uni-app";
|
|
|
|
import { onShow } from "@dcloudio/uni-app";
|
|
|
|
import { useStore } from "@/store";
|
|
|
|
import { useStore } from "@/store";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// comboId 套餐ID 没有套餐ID就是个人自选项目
|
|
|
|
|
|
|
|
// itemIds 自选ID
|
|
|
|
const $props = defineProps({
|
|
|
|
const $props = defineProps({
|
|
|
|
comboId: {
|
|
|
|
comboId: {
|
|
|
|
type: String,
|
|
|
|
type: String,
|
|
|
|
@ -34,11 +36,12 @@ 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 comboId = ref(""); // 套餐id
|
|
|
|
let recommendPackageList = ref([]); // 推荐套餐列表
|
|
|
|
let recommendPackageList = ref([]); // 推荐套餐列表
|
|
|
|
let popup = ref(null);
|
|
|
|
let popup = ref(null);
|
|
|
|
|
|
|
|
|
|
|
|
const getComboRecommend = async () => {
|
|
|
|
const getComboRecommend = async () => {
|
|
|
|
|
|
|
|
// 获取推荐套餐
|
|
|
|
const response = await $api("ComboRecommend", {
|
|
|
|
const response = await $api("ComboRecommend", {
|
|
|
|
person_id: $store.save_info.user_id || 1,
|
|
|
|
person_id: $store.save_info.user_id || 1,
|
|
|
|
item_ids: selectIds.value,
|
|
|
|
item_ids: selectIds.value,
|
|
|
|
@ -48,6 +51,7 @@ const getComboRecommend = async () => {
|
|
|
|
if (recommendPackageList.value.length) {
|
|
|
|
if (recommendPackageList.value.length) {
|
|
|
|
popup.value.open("center");
|
|
|
|
popup.value.open("center");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uni.hideLoading();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
@ -69,6 +73,9 @@ const getAllItems = async (e) => {
|
|
|
|
|
|
|
|
|
|
|
|
const getBuyInfo = async () => {
|
|
|
|
const getBuyInfo = async () => {
|
|
|
|
// 获取购买信息
|
|
|
|
// 获取购买信息
|
|
|
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
|
|
|
title: "加载中",
|
|
|
|
|
|
|
|
});
|
|
|
|
let obj = {
|
|
|
|
let obj = {
|
|
|
|
item_ids: selectIds.value,
|
|
|
|
item_ids: selectIds.value,
|
|
|
|
hospital: $store.save_info.hospital,
|
|
|
|
hospital: $store.save_info.hospital,
|
|
|
|
@ -85,14 +92,46 @@ const getBuyInfo = async () => {
|
|
|
|
totalPrice.value = response.data.true_price;
|
|
|
|
totalPrice.value = response.data.true_price;
|
|
|
|
totalOriginalPrice.value = response.data.original_price;
|
|
|
|
totalOriginalPrice.value = response.data.original_price;
|
|
|
|
total.value = response.data.pay_item_count;
|
|
|
|
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(",") || [];
|
|
|
|
selectIds.value = $props.itemIds?.split(",") || [];
|
|
|
|
comboId.value = Number($props.comboId);
|
|
|
|
comboId.value = $props.comboId ? $props.comboId : "";
|
|
|
|
getAllItems(); // 获取全部项目
|
|
|
|
await getAllItems(); // 获取全部项目
|
|
|
|
getComboRecommend();
|
|
|
|
// await getComboRecommend();
|
|
|
|
if (comboId.value) {
|
|
|
|
if (comboId.value) {
|
|
|
|
getBuyInfo(); // 获取购买信息
|
|
|
|
getBuyInfo(); // 获取购买信息
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -122,10 +161,100 @@ onShow(() => {
|
|
|
|
<view class="bg-#fff rounded-15rpx w-95vw px-20rpx box-border">
|
|
|
|
<view class="bg-#fff rounded-15rpx w-95vw px-20rpx box-border">
|
|
|
|
<view class="center relative pt-47rpx pb-32rpx text-36rpx">
|
|
|
|
<view class="center relative pt-47rpx pb-32rpx text-36rpx">
|
|
|
|
<text class="line-height-[1]">推荐套餐</text>
|
|
|
|
<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>
|
|
|
|
<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"
|
|
|
|
|
|
|
|
class="pt-40rpx pb-15rpx box-border b-0 b-t-1 b-solid b-#E1ECEE"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<view class="flex w-full">
|
|
|
|
|
|
|
|
<image
|
|
|
|
|
|
|
|
:src="$image(item.cover)"
|
|
|
|
|
|
|
|
class="w-190rpx h-190rpx mr-37rpx"
|
|
|
|
|
|
|
|
mode="widthFix"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<view class="flex flex-col grow">
|
|
|
|
|
|
|
|
<text
|
|
|
|
|
|
|
|
>{{ item.name }} {{ item.sex == 0 ? "(男)" : "(女)" }}</text
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<view class="mt-13rpx mb-18rpx">
|
|
|
|
|
|
|
|
<uni-tag
|
|
|
|
|
|
|
|
v-for="(val, i) in item.tag"
|
|
|
|
|
|
|
|
:key="i"
|
|
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
|
|
:inverted="true"
|
|
|
|
|
|
|
|
:text="val.text"
|
|
|
|
|
|
|
|
class="mr-8rpx"
|
|
|
|
|
|
|
|
:custom-style="
|
|
|
|
|
|
|
|
'background-color:' +
|
|
|
|
|
|
|
|
val.color +
|
|
|
|
|
|
|
|
';border-color:' +
|
|
|
|
|
|
|
|
val.color +
|
|
|
|
|
|
|
|
'; color:' +
|
|
|
|
|
|
|
|
val.text_color +
|
|
|
|
|
|
|
|
';'
|
|
|
|
|
|
|
|
"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view>
|
|
|
|
|
|
|
|
<text
|
|
|
|
|
|
|
|
v-for="(val, i) in item.tags2"
|
|
|
|
|
|
|
|
:key="i"
|
|
|
|
|
|
|
|
class="text-#8B8B8B text-20rpx line-height-[1] px-5rpx b-0 b-r-2 b-solid b-#8B8B8B"
|
|
|
|
|
|
|
|
>{{ val }}</text
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="mt-20rpx w-full flex items-end">
|
|
|
|
|
|
|
|
<text class="text-18rpx text-#EC3D15">¥</text>
|
|
|
|
|
|
|
|
<text class="text-38rpx text-#EC3D15 mx-10rpx -mb-8rpx">{{
|
|
|
|
|
|
|
|
item.price
|
|
|
|
|
|
|
|
}}</text>
|
|
|
|
|
|
|
|
<text class="text-18rpx text-#878787 line-through">{{
|
|
|
|
|
|
|
|
item.original_price
|
|
|
|
|
|
|
|
}}</text>
|
|
|
|
|
|
|
|
<text class="text-18rpx text-#878787 ml-auto mr-55rpx"
|
|
|
|
|
|
|
|
>已售{{ item.count }}</text
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="between mt-30rpx">
|
|
|
|
|
|
|
|
<view class="text-#8B8B8B text-22rpx">
|
|
|
|
|
|
|
|
相似度
|
|
|
|
|
|
|
|
<text class="text-#239EA3">{{ item.recommend?.xiangsidu }}</text>
|
|
|
|
|
|
|
|
,{{ item.recommend?.count > 0 ? "增加" : "减少" }}了
|
|
|
|
|
|
|
|
<text class="text-#239EA3">{{
|
|
|
|
|
|
|
|
Math.abs(item.recommend?.count)
|
|
|
|
|
|
|
|
}}</text>
|
|
|
|
|
|
|
|
个项目,{{ item.recommend?.money > 0 ? "增加" : "减少" }}了
|
|
|
|
|
|
|
|
<text class="text-#239EA3"
|
|
|
|
|
|
|
|
>¥{{ Math.abs(item.recommend?.money) }}</text
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
|
|
@click=""
|
|
|
|
|
|
|
|
class="w-160rpx h-60rpx center text-#fff text-28rpx !bg-#239EA3 rounded-full"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
预约
|
|
|
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view v-for="(item, index) in recommendPackageList" :key="index">
|
|
|
|
<view class="b-0 b-t-1 b-solid b-#E1ECEE pt-80rpx pb-70rpx">
|
|
|
|
<image :src="$image(item.cover)" mode="widthFix" />
|
|
|
|
<button
|
|
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
|
|
@click=""
|
|
|
|
|
|
|
|
class="w-300rpx h-78rpx center text-#fff text-30rpx !bg-#239EA3 rounded-10rpx"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
跳过
|
|
|
|
|
|
|
|
</button>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</uni-popup>
|
|
|
|
</uni-popup>
|
|
|
|
@ -239,9 +368,11 @@ onShow(() => {
|
|
|
|
<view class="flex items-end">
|
|
|
|
<view class="flex items-end">
|
|
|
|
<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"
|
|
|
|
>¥ {{ optionalPrice }}</text
|
|
|
|
>¥ {{ optionalPrice || 0 }}</text
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<text class="text-18rpx text-#878787 line-through"
|
|
|
|
<text
|
|
|
|
|
|
|
|
v-if="optionalOriginalPrice"
|
|
|
|
|
|
|
|
class="text-18rpx text-#878787 line-through"
|
|
|
|
>¥ {{ optionalOriginalPrice }}</text
|
|
|
|
>¥ {{ optionalOriginalPrice }}</text
|
|
|
|
>
|
|
|
|
>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
@ -249,39 +380,18 @@ onShow(() => {
|
|
|
|
<text class="text-18rpx text-#ED6907">合计费用</text>
|
|
|
|
<text class="text-18rpx text-#ED6907">合计费用</text>
|
|
|
|
<text class="text-24rpx text-#ED6907 ml-20rpx mr-5rpx">¥</text>
|
|
|
|
<text class="text-24rpx text-#ED6907 ml-20rpx mr-5rpx">¥</text>
|
|
|
|
<text class="text-36rpx text-#ED6907 mr-20rpx font-bold">{{
|
|
|
|
<text class="text-36rpx text-#ED6907 mr-20rpx font-bold">{{
|
|
|
|
totalPrice
|
|
|
|
totalPrice || 0
|
|
|
|
}}</text>
|
|
|
|
}}</text>
|
|
|
|
<text class="text-18rpx text-#878787 line-through"
|
|
|
|
<text
|
|
|
|
|
|
|
|
v-if="totalOriginalPrice"
|
|
|
|
|
|
|
|
class="text-18rpx text-#878787 line-through"
|
|
|
|
>¥ {{ totalOriginalPrice }}</text
|
|
|
|
>¥ {{ totalOriginalPrice }}</text
|
|
|
|
>
|
|
|
|
>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<button
|
|
|
|
<button
|
|
|
|
type="primary"
|
|
|
|
type="primary"
|
|
|
|
@click="
|
|
|
|
@click="confirm()"
|
|
|
|
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"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
确定
|
|
|
|
确定
|
|
|
|
|