|
|
|
|
@ -25,6 +25,10 @@ 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); // 可用积分
|
|
|
|
|
|
|
|
|
|
const mountedAction = async () => {
|
|
|
|
|
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) => {
|
|
|
|
|
// 选择折扣
|
|
|
|
|
if (status == 2) {
|
|
|
|
|
@ -67,21 +95,19 @@ const selectDiscount = (status) => {
|
|
|
|
|
|
|
|
|
|
if (status == 1) {
|
|
|
|
|
// 积分
|
|
|
|
|
if (integral.value) {
|
|
|
|
|
selectStatus.value = status;
|
|
|
|
|
popup.value.open("bottom");
|
|
|
|
|
if (yytjInfo.value.pointsPrice) {
|
|
|
|
|
selectIndex.value = 1;
|
|
|
|
|
} else {
|
|
|
|
|
selectIndex.value = 0;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
uni.$lu.toast("暂无积分");
|
|
|
|
|
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) {
|
|
|
|
|
@ -101,18 +127,43 @@ const comfrimSelect = () => {
|
|
|
|
|
if (selectStatus.value == 1) {
|
|
|
|
|
// 积分
|
|
|
|
|
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);
|
|
|
|
|
} else {
|
|
|
|
|
if (yytjInfo.value.pointsPrice) {
|
|
|
|
|
netReceiptsPrice.value = netReceiptsPrice.value + Number(jifen.value);
|
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
$store.setYytjInfo(yytjInfo.value);
|
|
|
|
|
} else {
|
|
|
|
|
if (yytjInfo.value.prepaidPrice) {
|
|
|
|
|
// 不使用预存款的话 把扣掉的预存款加上
|
|
|
|
|
netReceiptsPrice.value =
|
|
|
|
|
netReceiptsPrice.value + Number(yucunkuan.value);
|
|
|
|
|
}
|
|
|
|
|
yucunkuan.value = 0;
|
|
|
|
|
yytjInfo.value.prepaidPrice = 0;
|
|
|
|
|
$store.setYytjInfo(yytjInfo.value);
|
|
|
|
|
}
|
|
|
|
|
@ -133,6 +184,34 @@ const getnmrList = async () => {
|
|
|
|
|
comboInfo.value = response.data.combo_info;
|
|
|
|
|
itemsInfo.value = response.data.items_info;
|
|
|
|
|
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) {
|
|
|
|
|
yytjInfo.value.nmr_list = response.data.nmr_list.map((val) => {
|
|
|
|
|
@ -191,6 +270,8 @@ const comfrimyy = async () => {
|
|
|
|
|
plan_nmr_id: plan_nmr_id,
|
|
|
|
|
doctor: yytjInfo.value?.doctor_name || "",
|
|
|
|
|
duo_xuan_yi: $store.getDuoXuanYi(),
|
|
|
|
|
jifen: jifen.value,
|
|
|
|
|
yucunkuan: yucunkuan.value,
|
|
|
|
|
};
|
|
|
|
|
console.log(obj);
|
|
|
|
|
|
|
|
|
|
@ -288,7 +369,7 @@ const toRouter = (url, status) => {
|
|
|
|
|
}}</text>
|
|
|
|
|
<view class="mr-auto text-#888787">
|
|
|
|
|
(剩余<text class="text-#FB670E">{{
|
|
|
|
|
selectStatus == 1 ? integral : save_money
|
|
|
|
|
selectStatus == 1 ? keyong_jifen : save_money
|
|
|
|
|
}}</text
|
|
|
|
|
>)
|
|
|
|
|
</view>
|
|
|
|
|
@ -318,9 +399,29 @@ const toRouter = (url, status) => {
|
|
|
|
|
@click="selectIndex = 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
|
|
|
|
|
:type="selectIndex ? 'checkbox-filled' : 'circle'"
|
|
|
|
|
:color="selectIndex ? '#239EA3' : '#A6A6A6'"
|
|
|
|
|
@ -542,9 +643,7 @@ const toRouter = (url, status) => {
|
|
|
|
|
>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="ml-auto mr-20rpx">
|
|
|
|
|
<text class="text-#FB4F1A" v-if="yytjInfo.pointsPrice"
|
|
|
|
|
>-¥{{ yytjInfo.pointsPrice }}</text
|
|
|
|
|
>
|
|
|
|
|
<text class="text-#FB4F1A" v-if="jifen">-¥{{ jifen }}</text>
|
|
|
|
|
<text class="text-#070707" v-else>去选择</text>
|
|
|
|
|
</view>
|
|
|
|
|
<uni-icons type="right" size="12"></uni-icons>
|
|
|
|
|
@ -578,13 +677,11 @@ const toRouter = (url, status) => {
|
|
|
|
|
<view>
|
|
|
|
|
<text class="text-#050505">预存款</text>
|
|
|
|
|
<text v-if="save_money" class="text-#828383"
|
|
|
|
|
>(共{{ save_money }}个)</text
|
|
|
|
|
>(剩余{{ save_money }})</text
|
|
|
|
|
>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="ml-auto mr-20rpx">
|
|
|
|
|
<text class="text-#FB4F1A" v-if="yytjInfo.prepaidPrice"
|
|
|
|
|
>-¥{{ yytjInfo.prepaidPrice }}</text
|
|
|
|
|
>
|
|
|
|
|
<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>
|
|
|
|
|
@ -666,7 +763,7 @@ const toRouter = (url, status) => {
|
|
|
|
|
>
|
|
|
|
|
<view class="text-#ED6907 text-48rpx center items-end line-height-[1]">
|
|
|
|
|
<text class="text-24rpx">¥</text>
|
|
|
|
|
<text>{{ truePrice }}</text>
|
|
|
|
|
<text>{{ netReceiptsPrice }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<button
|
|
|
|
|
@click="comfrimyy"
|
|
|
|
|
|