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

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

@ -1,140 +1,135 @@
<script setup> <script setup>
import DraggableButton from "@/pages/components/goHome.vue"; import DraggableButton from "@/pages/components/goHome.vue";
/** /**
* name * name
* 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 $props = defineProps({
$response url: {
} from '@/api' type: String,
import { default: "",
onShow },
} from '@dcloudio/uni-app' });
import {
useStore
} from '@/store'
const $store = useStore()
const $props = defineProps({
url: {
type: String,
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) {
if(info.id){ if (info.id) {
$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 />
<view> <view>
<view v-if="!!$store.config"> <view v-if="!!$store.config">
<view :ref="configRef"></view> <view :ref="configRef"></view>
</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
<view class="button_icon_wrapper"> @click="buttonClick(i)"
<image :src="$image(i.logo)"></image> class="button_item_wrapper"
</view> v-for="(i, k) in button_list"
<view class="button_name_wrapper">{{ i.name }}</view> :key="k"
<view class="button_right_wrapper"> >
<uni-icons type="right" size="20"></uni-icons> <view class="button_icon_wrapper">
</view> <image :src="$image(i.logo)"></image>
</view> </view>
</view> <view class="button_name_wrapper">{{ i.name }}</view>
</view> <view class="button_right_wrapper">
<uni-icons type="right" size="20"></uni-icons>
</view>
</view>
</view>
</view>
</template> </template>
<style scoped> <style scoped>
.button_list_wrapper { .button_list_wrapper {
width: 750rpx; width: 750rpx;
margin: 0 auto; margin: 0 auto;
overflow-y: auto; overflow-y: auto;
} }
.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;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
.button_icon_wrapper { .button_icon_wrapper {
width: 82rpx; width: 82rpx;
height: 82rpx; height: 82rpx;
margin-left: 48rpx; margin-left: 48rpx;
} }
.button_icon_wrapper image { .button_icon_wrapper image {
width: 82rpx; width: 82rpx;
height: 82rpx; height: 82rpx;
display: inline-block; display: inline-block;
object-fit: contain; object-fit: contain;
} }
.button_name_wrapper { .button_name_wrapper {
font-weight: 500; font-weight: 500;
font-size: 32rpx; font-size: 32rpx;
color: #000000; color: #000000;
line-height: 1; line-height: 1;
} }
.button_right_wrapper { .button_right_wrapper {
margin-right: 48rpx; margin-right: 48rpx;
} }
</style> </style>

@ -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"

@ -1,181 +1,181 @@
<script setup> <script setup>
import DraggableButton from "@/pages/components/goHome.vue"; import DraggableButton from "@/pages/components/goHome.vue";
/** /**
* name * name
* 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 const getPersonList = async () => {
} from '@/api' const response = await $api("GetPersonList");
import { $response(response, () => {
onShow person_list.value = response.data.list;
} from '@dcloudio/uni-app' });
import { };
useStore
} from '@/store'
const $store = useStore()
const person_list = ref([])
const getPersonList = async () => {
const response = await $api('GetPersonList')
$response(response, () => {
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.navigateBack({ uni.$lu.toast("切换成功");
delta: 1 uni.navigateBack({
}) delta: 1,
}) });
} });
const choosePersonClick = async (info) => { };
const response = await $api('SetDefaultPerson', { const choosePersonClick = async (info) => {
person_id: info.id const response = await $api("SetDefaultPerson", {
}) person_id: info.id,
$response(response, () => { });
getUserInfo(); $response(response, () => {
}) getUserInfo();
} });
};
onShow(() => { onShow(() => {
if (!!config_ref.value) { if (!!config_ref.value) {
getPersonList() getPersonList();
} }
}) });
</script> </script>
<template> <template>
<DraggableButton /> <DraggableButton />
<view> <view>
<view v-if="!!$store.config"> <view v-if="!!$store.config">
<view :ref="configRef"></view> <view :ref="configRef"></view>
</view> </view>
<view class="person_list_wrapper"> <view class="person_list_wrapper">
<view class="person_item_wrapper" v-for="(i,k) in person_list" :key="k"> <view class="person_item_wrapper" v-for="(i, k) in person_list" :key="k">
<view class="person_avatar_wrapper"> <view class="person_avatar_wrapper">
<image v-if="i.sex === 1" src="@/static/assets/userm.png"></image> <image v-if="i.sex === 1" src="@/static/assets/userm.png"></image>
<image v-else src="@/static/assets/userw.png"></image> <image v-else src="@/static/assets/userw.png"></image>
</view> </view>
<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"
</view> >{{ i.sex === 1 ? "男" : "女" }}</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 class="person_idnumber_wrapper">{{ i.id_number }}</view>
<view class="person_type_wrapper">本人</view> </view>
<view v-if="i.is_default === 2" @click="choosePersonClick(i)" class="person_choose_wrapper"></view> <view v-if="!!i.relation" class="person_type_wrapper">{{
</view> i.relation
</view> }}</view>
</view> <view class="person_type_wrapper">本人</view>
<view
v-if="i.is_default === 2"
@click="choosePersonClick(i)"
class="person_choose_wrapper"
>切换</view
>
</view>
</view>
</view>
</template> </template>
<style scoped> <style scoped>
.person_list_wrapper { .person_list_wrapper {
width: 750rpx; width: 750rpx;
margin: 0 auto; margin: 0 auto;
overflow-y: auto; overflow-y: auto;
} }
.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;
display: flex; display: flex;
align-items: center; align-items: center;
margin: 20rpx auto 0; margin: 20rpx auto 0;
} }
.person_avatar_wrapper { .person_avatar_wrapper {
width: 105rpx; width: 105rpx;
height: 105rpx; height: 105rpx;
margin-left: 47rpx; margin-left: 47rpx;
} }
.person_avatar_wrapper image { .person_avatar_wrapper image {
width: 105rpx; width: 105rpx;
height: 105rpx; height: 105rpx;
display: inline-block; display: inline-block;
object-fit: contain; object-fit: contain;
} }
.person_info_wrapper { .person_info_wrapper {
margin-left: 38rpx; margin-left: 38rpx;
} }
.person_text_wrapper { .person_text_wrapper {
display: flex; display: flex;
align-items: end; align-items: end;
} }
.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;
} }
.person_type_wrapper { .person_type_wrapper {
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;
} }
.person_choose_wrapper { .person_choose_wrapper {
position: absolute; position: absolute;
right: 10rpx; right: 10rpx;
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;
} }
</style> </style>

Loading…
Cancel
Save