1.修改就诊人清空所有预选信息

2.完成预存款和积分功能
main
刘佳宇 1 year ago
parent ba00a25f5a
commit 86156076f7

@ -5,56 +5,46 @@ import DraggableButton from "@/pages/components/goHome.vue";
* usersa0ChunLuyu * usersa0ChunLuyu
* date2024年9月11日 19:24:50 * date2024年9月11日 19:24:50
*/ */
import { import { ref } from "vue";
ref import { $api, $image, $response } from "@/api";
} from 'vue' import { onShow } from "@dcloudio/uni-app";
import { import { useStore } from "@/store";
$api, const $store = useStore();
$image,
$response
} from '@/api'
import {
onShow
} from '@dcloudio/uni-app'
import {
useStore
} from '@/store'
const $store = useStore()
const $props = defineProps({ const $props = defineProps({
url: { url: {
type: String, type: String,
default: '' default: "",
} },
}); });
const button_list = ref([]) const button_list = ref([]);
const getButtonList = async (api) => { const getButtonList = async (api) => {
const response = await $api(api) const response = await $api(api);
$response(response, () => { $response(response, () => {
button_list.value = response.data.list button_list.value = response.data.list;
}) });
} };
const checkType = () => { const checkType = () => {
if ($props.url.includes('api://')) { if ($props.url?.includes("api://")) {
let api = $props.url.split('api://')[1] let api = $props.url.split("api://")[1];
if (!!api) { if (!!api) {
getButtonList(api) getButtonList(api);
}
} }
} }
};
const mountedAction = () => { const mountedAction = () => {
checkType() checkType();
} };
const config_ref = ref(null) const config_ref = ref(null);
const configRef = (e) => { const configRef = (e) => {
if (!config_ref.value) { if (!config_ref.value) {
config_ref.value = e config_ref.value = e;
mountedAction() mountedAction();
}
} }
};
const buttonClick = (info) => { const buttonClick = (info) => {
if (!!info.url) { if (!!info.url) {
@ -62,18 +52,18 @@ import DraggableButton from "@/pages/components/goHome.vue";
$store.setCheckupTypeId({ id: info.id }); $store.setCheckupTypeId({ id: info.id });
} }
uni.navigateTo({ uni.navigateTo({
url: info.url url: info.url,
}) });
} else { } else {
uni.$lu.toast('暂未开放') uni.$lu.toast("暂未开放");
}
} }
};
onShow(() => { onShow(() => {
if (!!config_ref.value) { if (!!config_ref.value) {
mountedAction() mountedAction();
} }
}) });
</script> </script>
<template> <template>
<DraggableButton /> <DraggableButton />
@ -83,7 +73,12 @@ import DraggableButton from "@/pages/components/goHome.vue";
</view> </view>
<view class="button_list_wrapper"> <view class="button_list_wrapper">
<view @click="buttonClick(i)" class="button_item_wrapper" v-for="(i,k) in button_list" :key="k"> <view
@click="buttonClick(i)"
class="button_item_wrapper"
v-for="(i, k) in button_list"
:key="k"
>
<view class="button_icon_wrapper"> <view class="button_icon_wrapper">
<image :src="$image(i.logo)"></image> <image :src="$image(i.logo)"></image>
</view> </view>
@ -105,7 +100,7 @@ import DraggableButton from "@/pages/components/goHome.vue";
.button_item_wrapper { .button_item_wrapper {
width: 552rpx; width: 552rpx;
height: 140rpx; height: 140rpx;
background: #FFFFFF; background: #ffffff;
box-shadow: 0rpx 1rpx 4rpx 0rpx rgba(0, 164, 172, 0.16); box-shadow: 0rpx 1rpx 4rpx 0rpx rgba(0, 164, 172, 0.16);
border-radius: 15rpx; border-radius: 15rpx;
margin: 50rpx auto 0; margin: 50rpx auto 0;

@ -25,6 +25,10 @@ let integral = ref(0);
let couponList = ref([]); let couponList = ref([]);
let selectStatus = ref(null); let selectStatus = ref(null);
let selectIndex = ref(0); let selectIndex = ref(0);
let netReceiptsPrice = ref(0);
let yucunkuan = ref(0); //
let jifen = ref(0); //
let keyong_jifen = ref(0); //
const mountedAction = async () => { const mountedAction = async () => {
uni.showLoading({ uni.showLoading({
@ -54,6 +58,30 @@ const GetPersonIntegralSaveMoneyCouponInfo = async () => {
}); });
}; };
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) => { const selectDiscount = (status) => {
// //
if (status == 2) { if (status == 2) {
@ -67,21 +95,19 @@ const selectDiscount = (status) => {
if (status == 1) { if (status == 1) {
// //
if (integral.value) { if (!jifen.value && !netReceiptsPrice.value) {
selectStatus.value = status; uni.$lu.toast("实际金额已为0元无需使用积分");
popup.value.open("bottom"); return;
if (yytjInfo.value.pointsPrice) {
selectIndex.value = 1;
} else {
selectIndex.value = 0;
}
} else {
uni.$lu.toast("暂无积分");
} }
UsableIntegralSaveMoney();
} }
if (status == 3) { if (status == 3) {
// //
if (!yucunkuan.value && !netReceiptsPrice.value) {
uni.$lu.toast("实际金额已为0元无需使用预付款");
return;
}
if (save_money.value) { if (save_money.value) {
selectStatus.value = status; selectStatus.value = status;
if (yytjInfo.value.prepaidPrice) { if (yytjInfo.value.prepaidPrice) {
@ -101,18 +127,43 @@ const comfrimSelect = () => {
if (selectStatus.value == 1) { if (selectStatus.value == 1) {
// //
if (selectIndex.value) { if (selectIndex.value) {
yytjInfo.value.pointsPrice = integral.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;
$store.setYytjInfo(yytjInfo.value); $store.setYytjInfo(yytjInfo.value);
} else { } else {
if (yytjInfo.value.pointsPrice) {
netReceiptsPrice.value = netReceiptsPrice.value + Number(jifen.value);
}
yytjInfo.value.pointsPrice = 0; yytjInfo.value.pointsPrice = 0;
jifen.value = 0;
$store.setYytjInfo(yytjInfo.value); $store.setYytjInfo(yytjInfo.value);
} }
} else { } else {
console.log(selectIndex.value);
// //
if (selectIndex.value) { if (selectIndex.value) {
yytjInfo.value.prepaidPrice = save_money.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;
$store.setYytjInfo(yytjInfo.value); $store.setYytjInfo(yytjInfo.value);
} else { } else {
if (yytjInfo.value.prepaidPrice) {
// 使
netReceiptsPrice.value =
netReceiptsPrice.value + Number(yucunkuan.value);
}
yucunkuan.value = 0;
yytjInfo.value.prepaidPrice = 0; yytjInfo.value.prepaidPrice = 0;
$store.setYytjInfo(yytjInfo.value); $store.setYytjInfo(yytjInfo.value);
} }
@ -133,6 +184,34 @@ const getnmrList = async () => {
comboInfo.value = response.data.combo_info; comboInfo.value = response.data.combo_info;
itemsInfo.value = response.data.items_info; itemsInfo.value = response.data.items_info;
truePrice.value = response.data.true_price; truePrice.value = response.data.true_price;
netReceiptsPrice.value = response.data.true_price;
if (yytjInfo.value.couponPrice) {
//
netReceiptsPrice.value =
netReceiptsPrice.value - yytjInfo.value.couponPrice;
}
if (yytjInfo.value.prepaidPrice) {
//
yucunkuan.value =
yytjInfo.value.prepaidPrice > netReceiptsPrice.value
? netReceiptsPrice.value
: yytjInfo.value.prepaidPrice;
netReceiptsPrice.value = netReceiptsPrice.value - yucunkuan.value;
} 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;
} else {
jifen.value = 0;
}
if (!yytjInfo.value?.nmr_list?.length) { if (!yytjInfo.value?.nmr_list?.length) {
yytjInfo.value.nmr_list = response.data.nmr_list.map((val) => { yytjInfo.value.nmr_list = response.data.nmr_list.map((val) => {
@ -191,6 +270,8 @@ const comfrimyy = async () => {
plan_nmr_id: plan_nmr_id, plan_nmr_id: plan_nmr_id,
doctor: yytjInfo.value?.doctor_name || "", doctor: yytjInfo.value?.doctor_name || "",
duo_xuan_yi: $store.getDuoXuanYi(), duo_xuan_yi: $store.getDuoXuanYi(),
jifen: jifen.value,
yucunkuan: yucunkuan.value,
}; };
console.log(obj); console.log(obj);
@ -288,7 +369,7 @@ const toRouter = (url, status) => {
}}</text> }}</text>
<view class="mr-auto text-#888787"> <view class="mr-auto text-#888787">
剩余<text class="text-#FB670E">{{ 剩余<text class="text-#FB670E">{{
selectStatus == 1 ? integral : save_money selectStatus == 1 ? keyong_jifen : save_money
}}</text }}</text
>) >)
</view> </view>
@ -318,9 +399,29 @@ const toRouter = (url, status) => {
@click="selectIndex = 1" @click="selectIndex = 1"
> >
<text v-if="selectStatus == 1" <text v-if="selectStatus == 1"
>抵扣{{ integral }}使用{{ integral }}积分</text >抵扣{{
jifen
? jifen
: keyong_jifen > netReceiptsPrice
? netReceiptsPrice
: keyong_jifen
}}使用{{
jifen
? jifen
: keyong_jifen > netReceiptsPrice
? netReceiptsPrice
: keyong_jifen
}}积分</text
>
<text v-else
>使用剩余预存款中的{{
yucunkuan
? yucunkuan
: save_money > netReceiptsPrice
? netReceiptsPrice
: save_money
}}</text
> >
<text v-else>{{ save_money }}使{{ save_money }}</text>
<uni-icons <uni-icons
:type="selectIndex ? 'checkbox-filled' : 'circle'" :type="selectIndex ? 'checkbox-filled' : 'circle'"
:color="selectIndex ? '#239EA3' : '#A6A6A6'" :color="selectIndex ? '#239EA3' : '#A6A6A6'"
@ -542,9 +643,7 @@ const toRouter = (url, status) => {
> >
</view> </view>
<view class="ml-auto mr-20rpx"> <view class="ml-auto mr-20rpx">
<text class="text-#FB4F1A" v-if="yytjInfo.pointsPrice" <text class="text-#FB4F1A" v-if="jifen">-¥{{ jifen }}</text>
>-¥{{ yytjInfo.pointsPrice }}</text
>
<text class="text-#070707" v-else></text> <text class="text-#070707" v-else></text>
</view> </view>
<uni-icons type="right" size="12"></uni-icons> <uni-icons type="right" size="12"></uni-icons>
@ -578,13 +677,11 @@ const toRouter = (url, status) => {
<view> <view>
<text class="text-#050505">预存款</text> <text class="text-#050505">预存款</text>
<text v-if="save_money" class="text-#828383" <text v-if="save_money" class="text-#828383"
>{{ save_money }}</text >剩余{{ save_money }}</text
> >
</view> </view>
<view class="ml-auto mr-20rpx"> <view class="ml-auto mr-20rpx">
<text class="text-#FB4F1A" v-if="yytjInfo.prepaidPrice" <text class="text-#FB4F1A" v-if="yucunkuan">-¥{{ yucunkuan }}</text>
>-¥{{ yytjInfo.prepaidPrice }}</text
>
<text class="text-#070707" v-else></text> <text class="text-#070707" v-else></text>
</view> </view>
<uni-icons type="right" size="12"></uni-icons> <uni-icons type="right" size="12"></uni-icons>
@ -666,7 +763,7 @@ const toRouter = (url, status) => {
> >
<view class="text-#ED6907 text-48rpx center items-end line-height-[1]"> <view class="text-#ED6907 text-48rpx center items-end line-height-[1]">
<text class="text-24rpx">¥</text> <text class="text-24rpx">¥</text>
<text>{{ truePrice }}</text> <text>{{ netReceiptsPrice }}</text>
</view> </view>
<button <button
@click="comfrimyy" @click="comfrimyy"

@ -5,61 +5,52 @@ import DraggableButton from "@/pages/components/goHome.vue";
* usersa0ChunLuyu * usersa0ChunLuyu
* date2024年9月11日 19:24:50 * date2024年9月11日 19:24:50
*/ */
import { import { ref } from "vue";
ref import { $api, $image, $response } from "@/api";
} from 'vue' import { onShow } from "@dcloudio/uni-app";
import { import { useStore } from "@/store";
$api, const $store = useStore();
$image, const person_list = ref([]);
$response
} from '@/api'
import {
onShow
} from '@dcloudio/uni-app'
import {
useStore
} from '@/store'
const $store = useStore()
const person_list = ref([])
const getPersonList = async () => { const getPersonList = async () => {
const response = await $api('GetPersonList') const response = await $api("GetPersonList");
$response(response, () => { $response(response, () => {
person_list.value = response.data.list person_list.value = response.data.list;
}) });
} };
const config_ref = ref(null) const config_ref = ref(null);
const configRef = (e) => { const configRef = (e) => {
if (!config_ref.value) { if (!config_ref.value) {
config_ref.value = e config_ref.value = e;
getPersonList() getPersonList();
}
} }
};
const getUserInfo = async () => { const getUserInfo = async () => {
const response = await $api('UserInfo') const response = await $api("UserInfo");
$response(response, () => { $response(response, () => {
// $store.user = response.data.info // $store.user = response.data.info
$store.setUser(response.data.info); $store.setUser(response.data.info);
uni.$lu.toast('切换成功') $store.setYytjInfo({}); //
uni.$lu.toast("切换成功");
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1,
}) });
}) });
} };
const choosePersonClick = async (info) => { const choosePersonClick = async (info) => {
const response = await $api('SetDefaultPerson', { const response = await $api("SetDefaultPerson", {
person_id: info.id person_id: info.id,
}) });
$response(response, () => { $response(response, () => {
getUserInfo(); getUserInfo();
}) });
} };
onShow(() => { onShow(() => {
if (!!config_ref.value) { if (!!config_ref.value) {
getPersonList() getPersonList();
} }
}) });
</script> </script>
<template> <template>
<DraggableButton /> <DraggableButton />
@ -76,13 +67,22 @@ import DraggableButton from "@/pages/components/goHome.vue";
<view class="person_info_wrapper"> <view class="person_info_wrapper">
<view class="person_text_wrapper"> <view class="person_text_wrapper">
<view class="person_name_wrapper">{{ i.name }}</view> <view class="person_name_wrapper">{{ i.name }}</view>
<view class="person_sex_wrapper">{{ i.sex === 1 ? '男' : '女' }}</view> <view class="person_sex_wrapper"
>{{ i.sex === 1 ? "男" : "女" }}</view
>
</view> </view>
<view class="person_idnumber_wrapper">{{ i.id_number }}</view> <view class="person_idnumber_wrapper">{{ i.id_number }}</view>
</view> </view>
<view v-if="!!i.relation" class="person_type_wrapper">{{ i.relation }}</view> <view v-if="!!i.relation" class="person_type_wrapper">{{
i.relation
}}</view>
<view class="person_type_wrapper">本人</view> <view class="person_type_wrapper">本人</view>
<view v-if="i.is_default === 2" @click="choosePersonClick(i)" class="person_choose_wrapper"></view> <view
v-if="i.is_default === 2"
@click="choosePersonClick(i)"
class="person_choose_wrapper"
>切换</view
>
</view> </view>
</view> </view>
</view> </view>
@ -97,7 +97,7 @@ import DraggableButton from "@/pages/components/goHome.vue";
.person_item_wrapper { .person_item_wrapper {
width: 690rpx; width: 690rpx;
height: 166rpx; height: 166rpx;
background: #FFFFFF; background: #ffffff;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.04); box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.04);
border-radius: 15rpx; border-radius: 15rpx;
position: relative; position: relative;
@ -131,20 +131,20 @@ import DraggableButton from "@/pages/components/goHome.vue";
.person_name_wrapper { .person_name_wrapper {
font-weight: 500; font-weight: 500;
font-size: 32rpx; font-size: 32rpx;
color: #0E0E0E; color: #0e0e0e;
line-height: 1; line-height: 1;
} }
.person_sex_wrapper { .person_sex_wrapper {
font-size: 24rpx; font-size: 24rpx;
color: #9E9E9E; color: #9e9e9e;
line-height: 1; line-height: 1;
margin-left: 10rpx; margin-left: 10rpx;
} }
.person_idnumber_wrapper { .person_idnumber_wrapper {
font-size: 26rpx; font-size: 26rpx;
color: #0E0E0E; color: #0e0e0e;
line-height: 1; line-height: 1;
margin-top: 20rpx; margin-top: 20rpx;
} }
@ -153,13 +153,13 @@ import DraggableButton from "@/pages/components/goHome.vue";
position: absolute; position: absolute;
width: 100rpx; width: 100rpx;
height: 46rpx; height: 46rpx;
background: #C0C0C0; background: #c0c0c0;
border-radius: 0rpx 15rpx 0rpx 15rpx; border-radius: 0rpx 15rpx 0rpx 15rpx;
right: 0; right: 0;
top: 0; top: 0;
font-weight: 500; font-weight: 500;
font-size: 24rpx; font-size: 24rpx;
color: #FFFFFF; color: #ffffff;
line-height: 46rpx; line-height: 46rpx;
text-align: center; text-align: center;
} }
@ -170,11 +170,11 @@ import DraggableButton from "@/pages/components/goHome.vue";
bottom: 10rpx; bottom: 10rpx;
width: 130rpx; width: 130rpx;
height: 50rpx; height: 50rpx;
background: #239EA3; background: #239ea3;
border-radius: 25rpx; border-radius: 25rpx;
font-weight: 400; font-weight: 400;
font-size: 22rpx; font-size: 22rpx;
color: #FFFFFF; color: #ffffff;
line-height: 50rpx; line-height: 50rpx;
text-align: center; text-align: center;
} }

Loading…
Cancel
Save