信息确认页

main
yanzai 11 months ago
parent 005d4bdc62
commit d3dab0cc4c

@ -237,7 +237,7 @@
query +="&wj="+$props.wj
}
uni.navigateTo({
url: "/pages/main/tj/tjzx_new?" + query,
url: "/pages/main/tj/tjzx?" + query,
});
};

@ -0,0 +1,735 @@
<script setup>
import DraggableButton from "@/pages/components/goHome.vue";
/**
* name
* useryytjsj
* date2024年9月25日 10:25:00
*/
import { ref } from "vue";
import { $api, $response, $image } from "@/api";
import { onShow } from "@dcloudio/uni-app";
import wx from "weixin-js-sdk";
import { useStore } from "@/store";
const $store = useStore();
let buyInfo = ref({}); //
let groupInfo = ref({});
let comboInfo = ref({});
let itemsInfo = ref({});
let userInfo = ref(""); //
let truePrice = ref(0); //
let yytjInfo = ref({}); //
let popup = ref(null);
let save_money = ref(0);
let integral = ref(0);
let couponList = ref([]);
let selectStatus = ref(null);
let selectIndex = ref(0);
let netReceiptsPrice = ref(0);
let yucunkuan = ref(0); //
let jifen = ref(0); //
let keyong_jifen = ref(0); //
let erxianInfo=ref(null);
const mountedAction = async () => {
uni.showLoading({
title: "加载中",
});
console.log($store.getYytjInfo(), "123123");
buyInfo.value = $store.getBuyInfo();
userInfo.value = buyInfo.value.group_id
? $store.getGroupInfo()
: $store.getUser();
let time = setTimeout(() => {
getnmrList();
GetPersonIntegralSaveMoneyCouponInfo();
clearTimeout(time);
}, 500);
};
const GetPersonIntegralSaveMoneyCouponInfo = async () => {
// , ,
const response = await $api("GetPersonIntegralSaveMoneyCouponInfo", {
person_id: $store.getUser()?.person_id,
combo_id:buyInfo.value.combo_id
});
$response(response, () => {
couponList.value = response.data.coupon_list;
save_money.value = response.data.save_money;
integral.value = response.data.integral;
});
};
const UsableIntegralSaveMoney = async () => {
//
const response = await $api("UsableIntegralSaveMoney", {
person_id: $store.getUser()?.person_id,
ysje: netReceiptsPrice.value,
ssje: truePrice.value,
type: 1,
});
$response(response, () => {
keyong_jifen.value = response.data.keyong_jifen;
if (keyong_jifen.value) {
selectStatus.value = 1;
popup.value.open("bottom");
if (yytjInfo.value.pointsPrice) {
selectIndex.value = 1;
} else {
selectIndex.value = 0;
}
} else {
uni.$lu.toast("暂无积分");
}
});
};
const selectDiscount = (status) => {
//
if (status == 2) {
//
if (couponList.value.length) {
toRouter("/pages/main/coupon/coupon");
} else {
uni.$lu.toast("暂无优惠券");
}
}
if (status == 1) {
//
if (!jifen.value && !netReceiptsPrice.value) {
uni.$lu.toast("实际金额已为0元无需使用积分");
return;
}
UsableIntegralSaveMoney();
}
if (status == 3) {
//
if (!yucunkuan.value && !netReceiptsPrice.value) {
uni.$lu.toast("实际金额已为0元无需使用预付款");
return;
}
if (save_money.value) {
selectStatus.value = status;
if (yytjInfo.value.prepaidPrice) {
selectIndex.value = 1;
} else {
selectIndex.value = 0;
}
popup.value.open("bottom");
} else {
uni.$lu.toast("暂无预付款");
}
}
};
const comfrimSelect = () => {
//
if (selectStatus.value == 1) {
//
if (selectIndex.value) {
yytjInfo.value.pointsPrice = keyong_jifen.value;
// 使 使
if (keyong_jifen.value > netReceiptsPrice.value) {
jifen.value = netReceiptsPrice.value;
} else {
jifen.value = keyong_jifen.value;
}
netReceiptsPrice.value = (netReceiptsPrice.value - jifen.value).toFixed(
2
);
$store.setYytjInfo(yytjInfo.value);
} else {
if (yytjInfo.value.pointsPrice) {
console.log(jifen.value);
console.log(netReceiptsPrice.value);
netReceiptsPrice.value = (
Number(netReceiptsPrice.value) + Number(jifen.value)
).toFixed(2);
}
yytjInfo.value.pointsPrice = 0;
jifen.value = 0;
$store.setYytjInfo(yytjInfo.value);
}
} else {
console.log(selectIndex.value);
//
if (selectIndex.value) {
yytjInfo.value.prepaidPrice = save_money.value;
// 使 使
if (save_money.value > netReceiptsPrice.value) {
yucunkuan.value = netReceiptsPrice.value;
} else {
yucunkuan.value = save_money.value;
}
netReceiptsPrice.value = (
netReceiptsPrice.value - yucunkuan.value
).toFixed(2);
$store.setYytjInfo(yytjInfo.value);
} else {
if (yytjInfo.value.prepaidPrice) {
// 使
netReceiptsPrice.value = (
Number(netReceiptsPrice.value) + Number(yucunkuan.value)
).toFixed(2);
}
yucunkuan.value = 0;
yytjInfo.value.prepaidPrice = 0;
$store.setYytjInfo(yytjInfo.value);
}
}
popup.value.close();
};
const getnmrList = async () => {
//
yytjInfo.value = $store.getYytjInfo();
console.log(yytjInfo.value);
const response = await $api("BuyInfo", buyInfo.value);
$response(response, () => {
if (buyInfo.value.group_id && response.data.group_info.length) {
//
groupInfo.value = response.data.group_info[0];
}
comboInfo.value = response.data.combo_info;
itemsInfo.value = response.data.items_info;
truePrice.value = response.data.true_price;
erxianInfo.value=response.data.nmr_list2;
netReceiptsPrice.value = response.data.true_price;
if(itemsInfo.value.items?.length){//
let cailiao_price=0
let cailiao_keshi_key=false;
itemsInfo.value.items.forEach((v,i)=>{
if(v.keshi_name=="材料费"){
cailiao_keshi_key=i
v.children.forEach((v2,i2)=>{
cailiao_price=(Number(cailiao_price)+Number(v2.price)).toFixed(2);
})
}
})
if(cailiao_keshi_key){
itemsInfo.value.items[cailiao_keshi_key]={keshi_name:"材料费",children:[{name:"材料",desc:"",price:cailiao_price}]}
}
}
if (yytjInfo.value.couponPrice) {
//
// netReceiptsPrice.value = (
// netReceiptsPrice.value - yytjInfo.value.couponPrice
// ).toFixed(2);
}
if (yytjInfo.value.prepaidPrice) {
//
yucunkuan.value =
yytjInfo.value.prepaidPrice > netReceiptsPrice.value
? netReceiptsPrice.value
: yytjInfo.value.prepaidPrice;
netReceiptsPrice.value = (
netReceiptsPrice.value - yucunkuan.value
).toFixed(2);
} else {
yucunkuan.value = 0;
}
if (yytjInfo.value.pointsPrice) {
//
jifen.value =
yytjInfo.value.pointsPrice > netReceiptsPrice.value
? netReceiptsPrice.value
: yytjInfo.value.pointsPrice;
netReceiptsPrice.value = (netReceiptsPrice.value - jifen.value).toFixed(
2
);
} else {
jifen.value = 0;
}
if (!yytjInfo.value?.nmr_list?.length) {
yytjInfo.value.nmr_list = response.data.nmr_list.map((val) => {
return {
...val,
time: "",
id: "",
};
});
yytjInfo.value.nmr_list.push({
item_id: -1,
name: "体检时间",
time: "",
id: "",
});
}
uni.hideLoading();
});
};
const comfrimyy = async () => {
let plan_id = "";
let plan_nmr_id = "";
uni.showLoading();
console.log(yytjInfo.value?.nmr_list);
for (let i = 0; i < yytjInfo.value?.nmr_list?.length; i++) {
if (!yytjInfo.value?.nmr_list[i].id) {
uni.$lu.toast("请完善预约时间");
uni.hideLoading();
return;
}
}
if (yytjInfo.value?.nmr_list?.length > 1) {
plan_nmr_id = yytjInfo.value?.nmr_list[0]?.id;
}
if (yytjInfo.value?.nmr_list?.length > 0) {
plan_id = yytjInfo.value?.nmr_list[yytjInfo.value?.nmr_list.length - 1]?.id;
}
console.log(groupInfo.value);
let obj = {
person_id: buyInfo.value.person_id,
type: buyInfo.value.group_id ? 2 : 1,
hospital: buyInfo.value.hospital,
group_id: buyInfo.value.group_id,
combo_id:
buyInfo.value?.combo_id ||
(groupInfo.value?.combo_id ? "" : userInfo.value?.combo_id) ||
"",
item_ids: buyInfo.value.item_ids,
plan_id: plan_id,
plan_nmr_info:yytjInfo.value?.nmr_list || null,
doctor: yytjInfo.value?.doctor_name || "",
duo_xuan_yi: $store.getDuoXuanYi(),
jifen: Math.ceil(jifen.value),
yucunkuan: yucunkuan.value,
coupon_id:yytjInfo.value?.couponId || null,
wj: buyInfo.value.wj,
erxian_info:erxianInfo.value,
peiou_info:$store.getPeiOuUser()//
};
console.log(obj);
const response = await $api("OrderCreate", obj);
$response(response, () => {
if (response.status) {
if (response.data.action == "pay") {
StartPay(response.data.orderid);
} else {
uni.navigateTo({
url: "/pages/buy/done/done?id=" + response.data.orderid,
});
}
}
uni.hideLoading();
});
};
const StartPay = async (id) => {
//
uni.showLoading();
const response = await $api("StartPay", {
openid: localStorage.getItem("OPENID"),
id: id,
});
uni.hideLoading();
$response(response, () => {
if (response.status) {
let info = response.data.info;
let p =
"&appid=" +
info.appid +
"&sub_org_code=" +
info.sub_org_code +
"&ghzid=" +
info.ghzid +
"&orderid=" +
info.orderid +
"&order_desc=" +
info.order_desc +
"&amount=" +
info.amount +
"&notify_url=" +
info.notify_url +
"&timestamp=" +
info.timestamp +
"&nonce=" +
info.nonce +
"&signature=" +
info.signature;
console.log(p);
wx.miniProgram.navigateTo({
url:
"/pages/other/entry/index?path=/pages/physical-examination/payment/index" +
p,
});
}
});
};
const config_ref = ref(null);
const configRef = (e) => {
if (!config_ref.value) {
config_ref.value = e;
mountedAction();
}
};
onShow(() => {
if (!!config_ref.value) {
mountedAction();
}
});
const toRouter = (url, status, index) => {
let i = index;
if (status) {
if (
yytjInfo.value.nmr_list.length > 1 &&
yytjInfo.value.nmr_list[0].time == ""
) {
//
i = 0;
}
// if (yytjInfo.value.nmr_list.length == 1 && yytjInfo.value.nmr_list[yytjInfo.value.nmr_list.length - 1].time == "") {
// //
// if(index = -1){
// //
// }else{
// //
// }
// nmrIndex.value = 1;
// moreTime(null, 1);
// return;
// }
yytjInfo.value.nmrIndex = i;
console.log(yytjInfo.value);
uni.setStorageSync("yytjInfoS", yytjInfo.value);
$store.setYytjInfo(yytjInfo.value);
//
yytjInfo.value.nmr_list.forEach((vv,ii)=>{
if(vv.item_id=='-1' && vv.time){
yytjInfo.value.doctor_date=vv.time.substr(0,10)
}
})
if ((yytjInfo.value.doctor_name || yytjInfo.value.doctor_date) && i == -1) {
uni.navigateTo({
url: `/pages/main/selectDoctor/selectDoctor?date=${yytjInfo.value.doctor_date}`,
});
return;
}
}
uni.navigateTo({
url: url,
});
};
</script>
<template>
<DraggableButton />
<uni-popup ref="popup">
<view
class="center relative px-10rpx pb-30rpx text-36rpx bg-#fff rounded-t-15rpx box-border col"
>
<view
class="text-28rpx p-[40rpx_50rpx_25rpx_50rpx] between w-full bs b-b-1 b-#DEDEDE box-border"
>
<text class="line-height-[1] text-#171717 mr-10rpx">{{
selectStatus == 1 ? "积分" : "预存款"
}}</text>
<view class="mr-auto text-#888787">
剩余<text class="text-#FB670E">{{
selectStatus == 1 ? keyong_jifen : save_money
}}</text
>)
</view>
<uni-icons
@click="popup.close()"
type="closeempty"
color="#A6A6A6"
size="26"
class=""
></uni-icons>
</view>
<view class="text-#171717 text-28rpx px-40rpx box-border w-full">
<view
class="between pl-20rpx pr-10rpx box-border bs b-b-1 b-#E1ECEE h-90rpx"
@click="selectIndex = 0"
>
<text>暂不使用{{ selectStatus == 1 ? "积分" : "预存款" }}</text>
<uni-icons
:type="!selectIndex ? 'checkbox-filled' : 'circle'"
:color="!selectIndex ? '#239EA3' : '#A6A6A6'"
size="20"
class=""
></uni-icons>
</view>
<view
class="between pl-20rpx pr-10rpx box-border bs b-b-1 b-#E1ECEE h-90rpx"
@click="selectIndex = 1"
>
<text v-if="selectStatus == 1"
>抵扣{{
jifen
? jifen
: keyong_jifen > netReceiptsPrice
? netReceiptsPrice
: keyong_jifen
}}使用{{
Math.ceil(
jifen
? jifen
: keyong_jifen > netReceiptsPrice
? netReceiptsPrice
: keyong_jifen
)
}}积分</text
>
<text v-else
>使用剩余预存款中的{{
yucunkuan
? yucunkuan
: save_money > netReceiptsPrice
? netReceiptsPrice
: save_money
}}</text
>
<uni-icons
:type="selectIndex ? 'checkbox-filled' : 'circle'"
:color="selectIndex ? '#239EA3' : '#A6A6A6'"
size="20"
class=""
></uni-icons>
</view>
</view>
<view
@click="comfrimSelect"
class="text-#fff text-34rpx rounded-full bg-#239EA3 mt-80rpx ma w-520rpx h-100rpx center"
>
确定
</view>
</view>
</uni-popup>
<view >
<view v-if="!!$store.config">
<view :ref="configRef"></view>
</view>
<view class="px-30rpx box-border pb-200rpx comboInfo">
<view
style="box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.04)"
class="p-20rpx pb-20rpx pt-30rpx rounded-15rpx bg-#fff my-16rpx"
>
<view
class="text-#0E0E0E text-30rpx b-0 b-solid b-b-1 b-#E1ECEE pb-20rpx mb-35rpx"
>预约人信息</view
>
<view>
<view style="display: flex;justify-content: space-between;padding-right: 10rpx;">
<view>
<view class="text-28rpx text-#000 mb-20rpx" style="font-weight: bolder;">{{
userInfo.name
}}</view>
<view class="text-24rpx text-#8B8B8B mb-30rpx between">
<text>{{ userInfo.sex == 1 ? "男性" : "女性" }}</text>
<text class="ml-20rpx">{{
userInfo.married == 1
? "已婚"
: userInfo.married == 2
? "未婚"
: "未知"
}}</text>
<text class="ml-20rpx mr-auto">{{ userInfo.phone }}</text>
<!-- <button
v-if="!buyInfo.group_id"
@click="toRouter('/pages/user/choose/choose')"
class="text-24rpx text-#fff bg-#31AEB6 rounded-full px-26rpx h55rpx !m-0 center !ml-auto"
>
更改预约人
</button> -->
</view>
</view>
<uni-icons @click="toRouter('/pages/user/choose/choose')" type="trash" color="#31AEB6" size="25"></uni-icons>
</view>
</view>
</view>
<view v-if="integral"
style="box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.04)"
class="p-38rpx pr-17rpx rounded-15rpx bg-#fff between text-24rpx line-height-[1] mb-15rpx"
@click="selectDiscount(1)"
>
<view>
<text class="text-#050505">积分抵扣</text>
<text class="text-#828383"
>{{ integral }}</text
>
</view>
<view class="ml-auto mr-20rpx">
<text class="text-#FB4F1A" v-if="jifen"
>-¥{{ Math.ceil(jifen) }}</text
>
<text class="text-#070707" v-else></text>
</view>
<uni-icons type="right" size="12"></uni-icons>
</view>
<view v-if="couponList.length"
style="box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.04)"
class="p-38rpx pr-17rpx rounded-15rpx bg-#fff between text-24rpx line-height-[1] mb-15rpx"
@click="selectDiscount(2)"
>
<view>
<text class="text-#050505">优惠券</text>
<text class="text-#828383"
>{{ couponList.length }}</text
>
</view>
<view class="ml-auto mr-20rpx">
<text class="text-#FB4F1A" v-if="yytjInfo.couponName"
>{{ yytjInfo.couponName }}</text
>
<text class="text-#070707" v-else></text>
</view>
<uni-icons type="right" size="12"></uni-icons>
</view>
<view v-if="save_money"
style="box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.04)"
class="p-38rpx pr-17rpx rounded-15rpx bg-#fff between text-24rpx line-height-[1] mb-15rpx"
@click="selectDiscount(3)"
>
<view>
<text class="text-#050505">预存款</text>
<text class="text-#828383"
>剩余{{ save_money }}</text
>
</view>
<view class="ml-auto mr-20rpx">
<text class="text-#FB4F1A" v-if="yucunkuan">-¥{{ yucunkuan }}</text>
<text class="text-#070707" v-else></text>
</view>
<uni-icons type="right" size="12"></uni-icons>
</view>
<view class="text-#E95513 text-20rpx mb-40rpx mt-40rpx pl-20rpx pr-20rpx">
<view class="flex items-center mt-20rpx mb-40rpx">
<uni-icons
type="info-filled"
class="rotate-180"
color="#E95513"
size="18"
></uni-icons>
<text>选择预约人体检时间请点击提交按钮,完成预约</text>
</view>
<view class="flex items-center mt-30rpx">
<uni-icons
type="info-filled"
class="rotate-180"
color="#E95513"
size="18"
></uni-icons>
<text
>购买后如需退款未到预约体检日期者可在我的订单中点击申请退款体检当日取消或逾期未检者须至健康管理中心服务台办理
</text>
</view>
</view>
<view
style="box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.04)"
class="px-16rpx rounded-15rpx bg-#fff"
>
<view
class="pt-42rpx pb-36rpx b-0 b-solid b-b-1 b-#E1ECEE"
v-if="
(comboInfo && comboInfo?.items?.length) || groupInfo?.items?.length
"
>
<view class="text-#0E0E0E text-30rpx mb-35rpx">套餐名称</view>
<view class="text-24rpx between">
<text class="text-#0E0E0E">{{
comboInfo?.combo_name || groupInfo?.combo_name
}}</text>
<text
>¥{{ comboInfo?.price || groupInfo?.sixi_zong_ji_jin_e }}</text
>
</view>
</view>
<view
class="pt-42rpx pb-36rpx b-0 b-solid b-b-1 b-#E1ECEE"
v-if="itemsInfo && itemsInfo?.items?.length"
>
<view class="text-#0E0E0E text-30rpx mb-35rpx">自选项目</view>
<view
class="text-24rpx"
v-for="(val, index) in itemsInfo?.items"
:key="index"
>
<view
v-for="(v, i) in val.children"
:key="i"
class="between mb-30rpx"
:class="{
'!mb-0':
index == itemsInfo?.items?.length - 1 &&
i == val.children.length - 1,
}"
>
<text class="text-#8B8B8B">{{ val.keshi_name }} -</text>
<text class="text-#0E0E0E mr-auto ml-20rpx">{{ v.name }}</text>
<text class="text-#6D6D6D">¥{{ v.price }}</text>
</view>
</view>
</view>
</view>
<button
@click="comfrimyy"
class="w-210rpx h-42rpx center text-#fff text-30rpx rounded-full bg-#239EA3 !m-0 button"
>
确认支付
</button>
</view>
</view>
</template>
<style scoped lang="scss">
.activeTime {
background-color: #239ea3;
color: #fff;
}
.acitvetc {
background-color: #e0f1f2;
}
.comboInfo {
position: relative;
z-index: 1;
background-color: #D8EEF3;
padding-top: 20rpx;
min-height: calc(100vh - 80rpx);
.active {
color: #239ea3;
font-weight: bold;
position: relative;
&::after {
content: "";
width: 26rpx;
height: 3rpx;
background-color: #239ea3;
position: absolute;
left: 50%;
bottom: -10rpx;
transform: translateX(-50%);
}
}
}
.button{
position: fixed;
bottom: 80rpx;
right: 40rpx;
}
</style>
Loading…
Cancel
Save