自选项目

main
yanzai 11 months ago
parent 2abe719b8d
commit 14e77f2b47

@ -452,7 +452,7 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4)
if (!isset($groupedData[$keshiName])) {
$groupedData[$keshiName] = [];
}
$groupedData[$keshiName][] = ['desc' => $item->jianjie, 'name' => $item->name,'price'=>$item->price];
$groupedData[$keshiName][] = ['desc' => $item->jianjie, 'name' => $item->name,'price'=>$item->price,'original_price'=>$item->original_price,'id'=>$item->item_id];
//如果有影像科则存储在nmr_list字段
if($item->keshi_name=='影像科'){

@ -1,18 +1,28 @@
<script setup>
import DraggableButton from "@/pages/components/goHome.vue";
/**
import DraggableButton from "@/pages/components/goHome.vue";
/**
* name
* usersa0ChunLuyu
* date2024年9月11日 19:24:50
*/
import { ref } from "vue";
import { $api, $response, $image } from "@/api";
import { onShow } from "@dcloudio/uni-app";
import { useStore } from "@/store";
import {
ref
} from "vue";
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 ID ID
// itemIds ID
const $props = defineProps({
comboId: {
type: String,
default: "",
@ -33,35 +43,38 @@ const $props = defineProps({
type: String,
default: "",
},
});
});
const $store = useStore();
const $store = useStore();
let wj = ref(""); //
let leftList = ref({}); //
let tabIndex = ref(""); //
let rightLeft = ref([]); //
let selectIds = ref([]); // id
let headImg = ref(""); //
let packagePrice = ref(0); //
let packageOriginalPrice = ref(0); //
let optionalPrice = ref(0); //
let optionalOriginalPrice = ref(0); //
let totalPrice = ref(0); //
let totalOriginalPrice = ref(0); //
let total = ref(0); //
let comboId = ref(""); // id
let recommendPackageList = ref([]); //
let popup = ref(null); //
let popupTip = ref(null); //
let groupLength = ref(0); //
let status = ref(0); // 1 2 3 4
let personId = ref(""); // ID
let groupId = ref(""); // id
let losePrice = ref(0); //
// let query = ref(""); //
let wj = ref(""); //
let leftList = ref({}); //
let tabIndex = ref(""); //
let rightLeft = ref([]); //
let selectIds = ref([]); // id
let selectItems = ref([]); //
let BuyInfo = ref(""); //BuyInfo
let headImg = ref(""); //
let packagePrice = ref(0); //
let packageOriginalPrice = ref(0); //
let optionalPrice = ref(0); //
let optionalOriginalPrice = ref(0); //
let totalPrice = ref(0); //
let totalOriginalPrice = ref(0); //
let total = ref(0); //
let comboId = ref(""); // id
let recommendPackageList = ref([]); //
let popup = ref(null); //
let popupTip = ref(null); //
let groupLength = ref(0); //
let status = ref(0); // 1 2 3 4
let personId = ref(""); // ID
let groupId = ref(""); // id
let losePrice = ref(0); //
// let query = ref(""); //
let popupItemList = ref(null); //
const getComboRecommend = async () => {
const getComboRecommend = async () => {
//
const response = await $api("ComboRecommend", {
person_id: personId.value,
@ -76,9 +89,9 @@ const getComboRecommend = async () => {
}
uni.hideLoading();
});
};
};
const getAllItems = async (e) => {
const getAllItems = async (e) => {
//
const response = await $api("GetAllItems", {
search: e?.value,
@ -92,9 +105,9 @@ const getAllItems = async (e) => {
headImg.value = leftList.value[keys[0]].head_img;
}
});
};
};
const getBuyInfo = async () => {
const getBuyInfo = async () => {
//
uni.showLoading({
title: "加载中",
@ -112,23 +125,24 @@ const getBuyInfo = async () => {
}
const response = await $api("BuyInfo", obj);
console.log(response)
if(response.status===false){
if (response.status === false) {
uni.hideLoading();
uni.$lu.toast(response.msg);
return false;
}
$response(response, () => {
groupLength.value = response.data.group_info
? response.data.group_info[0]?.items?.length
: 0;
groupLength.value = response.data.group_info ?
response.data.group_info[0]?.items?.length :
0;
packagePrice.value = response.data.combo_info.price;
packageOriginalPrice.value = response.data.combo_info.original_price;
optionalPrice.value = response.data.items_info.price;
optionalOriginalPrice.value = response.data.items_info.original_price;
BuyInfo.value = response.data;
totalPrice.value = response.data.true_price;
totalOriginalPrice.value = response.data.original_price;
total.value = response.data.pay_item_count;
//total.value = response.data.pay_item_count;
losePrice.value = response.data.lose_price;
if (status.value == 4 && groupLength.value) {
// ID
@ -136,9 +150,9 @@ const getBuyInfo = async () => {
}
uni.hideLoading();
});
};
};
const confirm = async () => {
const confirm = async () => {
//
// status 1 2 3 4
if (status.value == 3) {
@ -180,9 +194,9 @@ const confirm = async () => {
return;
}
toDetails();
};
};
const toDetails = (state) => {
const toDetails = (state) => {
//
if (losePrice.value > 0 && !state) {
// popupTip.value.open("center"); //
@ -193,8 +207,8 @@ const toDetails = (state) => {
if (groupId.value) {
query += "&groupId=" + groupId.value;
}
if($props.wj){
query +="&wj="+$props.wj
if ($props.wj) {
query += "&wj=" + $props.wj
}
console.log($props.comboId || $props.itemIds ? 2 : 1);
let delta = 0;
@ -229,20 +243,20 @@ const toDetails = (state) => {
);
},
});
};
};
const buy = async (item) => {
const buy = async (item) => {
if (item) {
comboId.value = item.combo_id;
selectIds.value=[];
selectIds.value = [];
await getBuyInfo();
}
//
popup.value.close(); //
toDetails();
};
};
const mountedAction = async () => {
const mountedAction = async () => {
selectIds.value = $props.itemIds ? $props.itemIds.split(",") : [];
comboId.value = $props.comboId || "";
personId.value = $store.getUser().person_id || "";
@ -272,41 +286,60 @@ const mountedAction = async () => {
await getAllItems(); //
// await getComboRecommend();
await getBuyInfo(); //
};
};
const config_ref = ref(null);
const configRef = (e) => {
const config_ref = ref(null);
const configRef = (e) => {
if (!config_ref.value) {
config_ref.value = e;
mountedAction();
}
};
const XuanZeItem= async (item)=>{
let doi=""
if(selectIds.value.includes(item.id)){
selectIds.value.splice(selectIds.value.indexOf(item.id),1);
doi="del"
}else{
};
const XuanZeItem = async (item) => {
let doi = ""
if (selectIds.value.includes(item.id)) {
selectIds.value.splice(selectIds.value.indexOf(item.id), 1);
doi = "del"
} else {
selectIds.value.push(item.id);
doi="add"
doi = "add"
}
let a= await getBuyInfo()
if(a===false){
if(doi=="add"){
selectIds.value.splice(selectIds.value.indexOf(item.id),1);
let a = await getBuyInfo()
if (a === false) {
if (doi == "add") {
selectIds.value.splice(selectIds.value.indexOf(item.id), 1);
}
if(doi=="del"){
if (doi == "del") {
selectIds.value.push(item.id);
}
}
}
onShow(() => {
}
const openPopupItemList = () => {
selectItems.value = [];
if (BuyInfo.value.items_info) {
BuyInfo.value.items_info.items.forEach((v, i) => {
v.children.forEach((v2, i2) => {
selectItems.value.push(v2)
})
})
}
if (selectItems.value.length > 0) {
popupItemList.value.open()
}
}
const ClearItems=async()=>{
selectIds.value=[];
await getBuyInfo()
popupItemList.value.close()
}
onShow(() => {
if (!!config_ref.value) {
mountedAction();
}
});
});
</script>
<template>
<DraggableButton />
@ -315,28 +348,50 @@ onShow(() => {
<view :ref="configRef"></view>
</view>
</view>
<uni-popup ref="popupItemList" type="bottom">
<view class="popupItemList-content">
<view style="display: flex;justify-content: space-between;margin-bottom: 34rpx;">
<view style="font-size: 30rpx;">已加购项目</view>
<view style="color: #9E9E9F;display: flex;align-items: center;" @click="ClearItems()">
<uni-icons type="trash" color="#9E9E9F" size="20"></uni-icons>
<view style="font-size: 20rpx;">清空</view>
</view>
</view>
<view v-for="(item,index) in selectItems">
<view class="itemlist_list" @click="XuanZeItem(item)">
<view>
<view style="display: flex; align-items: center;margin-bottom: 20rpx;">
<view class="itemlist_bianhao">{{index+1}}</view>
<view class="itemlist_itemname">{{item.name}}</view>
</view>
<view style="display: flex;align-items: end;">
<view class="itemlist_price"><span style="font-size: 20rpx;"></span>{{item.price}}</view>
<view class="itemlist_org_price line-through">{{item.original_price}}</view>
</view>
</view>
<view :class="{
'!bg-#009fa8 !b-#008e99': selectIds.includes(item.id),
}" class="w-24rpx h-24rpx b-1 b-solid b-#009fa8 bg-#fff rounded-24rpx center">
<image v-if="selectIds.includes(item.id)" class="w-20rpx" src="@/static/assets/select.png"
mode="widthFix" />
</view>
</view>
</view>
</view>
</uni-popup>
<uni-popup ref="popupTip">
<view
class="mb-70rpx bg-#fff text-center box-border pt-80rpx pb-50rpx px-65rpx w-90vw rounded-15rpx"
>
<view
class="w-full text-center text-##090909 text-26rpx line-height-[50rpx]"
>您还剩余
<view class="mb-70rpx bg-#fff text-center box-border pt-80rpx pb-50rpx px-65rpx w-90vw rounded-15rpx">
<view class="w-full text-center text-##090909 text-26rpx line-height-[50rpx]">您还剩余
{{ losePrice }}
元体检额度尚未使用确认提交后剩余体检额度将无法使用!</view
>
元体检额度尚未使用确认提交后剩余体检额度将无法使用!
</view>
<view class="mt-50rpx between">
<button
type="primary"
@click="toDetails(1)"
class="w-196rpx h-68rpx center text-#fff text-24rpx !bg-#239EA3 rounded-8rpx"
>
<button type="primary" @click="toDetails(1)"
class="w-196rpx h-68rpx center text-#fff text-24rpx !bg-#239EA3 rounded-8rpx">
我想好了
</button>
<button
@click="popupTip.close()"
class="w-196rpx h-68rpx center text-#239EA3 text-24rpx !bg-#D9F3F2 rounded-8rpx"
>
<button @click="popupTip.close()"
class="w-196rpx h-68rpx center text-#239EA3 text-24rpx !bg-#D9F3F2 rounded-8rpx">
我再想想
</button>
</view>
@ -346,39 +401,19 @@ onShow(() => {
<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"
class="pt-40rpx pb-15rpx box-border b-0 b-t-1 b-solid b-#E1ECEE"
>
<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
v-if="item.cover"
:src="$image(item.cover)"
class="w-190rpx h-190rpx mr-37rpx"
mode="widthFix"
/>
<image v-if="item.cover" :src="$image(item.cover)" class="w-190rpx h-190rpx mr-37rpx"
mode="widthFix" />
<view class="flex flex-col grow">
<text
>{{ item.name }}</text
>
<text>{{ item.name }}</text>
<view class="mt-13rpx mb-18rpx">
<uni-tag
v-for="(val, i) in item.tags"
:key="i"
size="small"
:inverted="true"
:text="val.text"
class="mr-8rpx"
:custom-style="
<uni-tag v-for="(val, i) in item.tags" :key="i" size="small" :inverted="true"
:text="val.text" class="mr-8rpx" :custom-style="
'background-color:' +
val.color +
';border-color:' +
@ -386,16 +421,11 @@ onShow(() => {
'; 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
>
<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>
@ -405,9 +435,7 @@ onShow(() => {
<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
>
<text class="text-18rpx text-#878787 ml-auto mr-55rpx">已售{{ item.count }}</text>
</view>
</view>
</view>
@ -424,71 +452,47 @@ onShow(() => {
? "增加"
: "减少"
}}
<text class="text-#239EA3"
>{{ item.recommend?.money.replace(/-/, "") }}</text
>
</view>
<button
type="primary"
@click="buy(item)"
class="w-160rpx h-60rpx center text-#fff text-28rpx !bg-#239EA3 rounded-full"
>
<text class="text-#239EA3">{{ item.recommend?.money.replace(/-/, "") }}</text>
</view>
<button type="primary" @click="buy(item)"
class="w-160rpx h-60rpx center text-#fff text-28rpx !bg-#239EA3 rounded-full">
预约
</button>
</view>
</view>
<view class="b-0 b-t-1 b-solid b-#E1ECEE pt-80rpx pb-70rpx">
<button
type="primary"
@click="buy()"
class="w-300rpx h-78rpx center text-#fff text-30rpx !bg-#239EA3 rounded-10rpx"
>
<button type="primary" @click="buy()"
class="w-300rpx h-78rpx center text-#fff text-30rpx !bg-#239EA3 rounded-10rpx">
跳过
</button>
</view>
</view>
</uni-popup>
<view class="bg-#d8edf2">
<uni-search-bar
class="search"
radius="100"
placeholder="请输入关键字搜索"
@clear="getAllItems()"
@cancel="getAllItems()"
@confirm="getAllItems"
/>
<uni-search-bar class="search" radius="100" placeholder="请输入关键字搜索" @clear="getAllItems()"
@cancel="getAllItems()" @confirm="getAllItems" />
</view>
<view class="mt-20rpx flex min-h-100%" style="background-color: #eef7f7;">
<view class="min-w-214rpx max-w-214rpx mr-20rpx min-h-100% text-center">
<view
class="w-100% rounded-r-full text-#0E0E0E text-25rpx px-20rpx w-100% center h-84rpx box-border"
v-for="(item, index) in leftList"
:key="index"
:class="{
<view class="w-100% rounded-r-full text-#0E0E0E text-25rpx px-20rpx w-100% center h-84rpx box-border"
v-for="(item, index) in leftList" :key="index" :class="{
'bg-gradient-to-r from-#edf6f5 to-#bbdfe2': tabIndex == index,
}"
@click="
}" @click="
() => {
tabIndex = index;
rightLeft = item.children;
headImg = item.head_img;
}
"
>
">
{{ item.title }}
</view>
<view style="height: 150rpx;"></view>
</view>
<view class="grow min-h-100% bg-#fff pb-200rpx">
<view
v-for="(item, index) in rightLeft"
:key="index"
:class="{
<view v-for="(item, index) in rightLeft" :key="index" :class="{
'!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">
<view class="w-40% text-#0E0E0E text-24rpx flex items-center">
<text>{{ item.title }}</text>
<uni-tooltip>
@ -504,87 +508,118 @@ onShow(() => {
<uni-icons color="#009fa8" type="help-filled" size="14"></uni-icons>
</uni-tooltip>
</view>
<view
class="w-58% items-end flex justify-between"
@click="XuanZeItem(item)"
>
<view class="w-58% items-end flex justify-between" @click="XuanZeItem(item)">
<text class="text-#EC3D15 text-26rpx">¥ {{ item.price }}</text>
<text class="text-#9e9d9d text-20rpx line-through"
>¥ {{ item.original_price }}</text
>
<view
:class="{
<text class="text-#9e9d9d text-20rpx line-through">¥ {{ item.original_price }}</text>
<view :class="{
'!bg-#009fa8 !b-#008e99': selectIds.includes(item.id),
}"
class="w-24rpx h-24rpx b-1 b-solid b-#c3e9eb bg-#ccecee rounded-8rpx center"
>
<image
v-if="selectIds.includes(item.id)"
class="w-20rpx"
src="@/static/assets/select.png"
mode="widthFix"
/>
}" class="w-24rpx h-24rpx b-1 b-solid b-#c3e9eb bg-#ccecee rounded-8rpx center">
<image v-if="selectIds.includes(item.id)" class="w-20rpx" src="@/static/assets/select.png"
mode="widthFix" />
</view>
</view>
</view>
</view>
</view>
<view
class="fixed bottom-0 left-0 w-100% h-135rpx bg-gradient-to-r from-#7fcfd3 to-#aad7d7 px-20rpx py-30rpx box-border items-center flex justify-between"
>
<text
class="text-26rpx text-#121212 b-r-1 b-r-solid b-#8D9698 pr-12rpx mr-12rpx min-w-120rpx max-w-120rpx"
>
您需付费 \n{{ total }}个项目
</text>
<view class="grow">
<view class="flex items-end" v-if="comboId != 0">
<text class="text-18rpx text-#878787">套餐价格</text>
<text class="text-21rpx text-#ED6907 mx-20rpx"
>¥ {{ packagePrice }}</text
>
<text class="text-18rpx text-#878787 line-through"
>¥ {{ packageOriginalPrice }}</text
>
<view style="z-index: 999;"
class="fixed bottom-0 left-0 w-100% h-150rpx bg-gradient-to-r from-#7fcfd3 to-#aad7d7 px-20rpx py-30rpx box-border items-center flex justify-between">
<view style="position: relative;" class="w-110rpx h-129rpx ml-60rpx mt-5rpx" @click="openPopupItemList()">
<image class="w-110rpx h-129rpx" src="@/static/assets/buy/xiong.png" mode="widthFix" />
<view class="yuandian">
{{ selectIds.length }}
</view>
<view class="flex items-end">
<text class="text-18rpx text-#878787">自选项目价格</text>
<text class="text-21rpx text-#ED6907 mx-20rpx"
>¥ {{ optionalPrice || 0 }}</text
>
<text
v-if="optionalOriginalPrice"
class="text-18rpx text-#878787 line-through"
>¥ {{ optionalOriginalPrice }}</text
>
</view>
<view class="grow" style="margin-left: 10rpx;">
<view class="flex items-end">
<text class="text-18rpx text-#ED6907">合计费用</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-46rpx text-#e95513 ml-20rpx mr-5rpx">¥</text>
<text class="text-46rpx text-#e95513 mr-10rpx font-bold">{{
totalPrice || 0
}}</text>
<text
v-if="totalOriginalPrice"
class="text-18rpx text-#878787 line-through"
>¥ {{ totalOriginalPrice }}</text
>
</view>
</view>
<button
type="primary"
@click="confirm()"
class="text-#F8F8F8 w-240rpx h-hull rounded-full !bg-#239EA3 !mx-0 text-30rpx"
>
确定
</button>
<text v-if="totalOriginalPrice" class="text-26rpx text-#3e3a39 line-through">¥
{{ totalOriginalPrice }}</text>
</view>
</view>
<view @click="confirm()" class="button">
确认项目
</view>
</view>
</template>
<style>
.uni-tooltip-popup {
.uni-tooltip-popup {
background-color: #fff;
}
</style>
<style>
.button {
color: #00828e;
background-color: #fff;
}
height: 58rpx;
line-height: 58rpx;
text-align: center;
width: 174rpx;
border-radius: 24rpx;
margin-right: 20rpx;
}
.popupItemList-content {
padding: 40rpx 40rpx 180rpx 40rpx;
border-radius: 40rpx;
background-color: #fff;
}
.yuandian {
position: absolute;
top: 55rpx;
right: -10rpx;
background-color: #E95513;
height: 26rpx;
width: 26rpx;
border-radius: 13rpx;
color: #fff;
font-size: 20rpx;
text-align: center;
font-weight: 900;
}
.itemlist_org_price {
color: #9E9E9F;
font-weight: bolder;
font-size: 18rpx;
margin-left: 10rpx;
padding-bottom: 5rpx;
}
.itemlist_price {
color: #E95513;
font-weight: bolder;
font-size: 32rpx;
}
.itemlist_itemname {
font-size: 30rpx;
font-weight: bolder;
}
.itemlist_list {
display: flex;
width: 100%;
justify-content: space-between;
border-bottom: 1px solid #00828e;
padding-bottom: 20rpx;
margin-bottom: 20rpx;
align-items: center;
}
.itemlist_bianhao{
height: 26rpx;
width: 26rpx;
margin-right: 10rpx;
border-radius: 26rpx;
line-height: 26rpx;
color: #fff;
font-size: 20rpx;
font-weight: bolder;
text-align: center;
background: linear-gradient(to right, #67a8aa, #8ce7e7);
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Loading…
Cancel
Save