This commit is contained in:
Mauve
2026-10-26 09:33:21 +08:00
parent 3f8930df4c
commit 0338dfb427
7 changed files with 39 additions and 10 deletions
+28 -4
View File
@@ -437,6 +437,10 @@
showWhenScreenshot: true,
opt: '',
isDaylight:false,
// 仅点击 extension 时刷新一次,拿到 expDate;后续不再重复触发
hasExtendedRefresh:false,
// 缓存上一次刷新获取的 expDate,非刷新调用时用它避免被 db 缓存覆盖
cachedExpDate:null,
}
},
onLoad(opt) {
@@ -557,7 +561,7 @@
return this.showWhenScreenshot ? data : "-";
},
// 數據方法
async getBookingByConf(conf,id){
async getBookingByConf(conf,id,isRefresh=false){
uni.showLoading({
title: this.$t("common.loading")
});
@@ -565,6 +569,7 @@
try{
let params = {};
params.conf = conf;
params.refresh = isRefresh;
requestBody = JSON.stringify(params);
const res = await getBookingByConf(params);
if(res!=null && res.success==true){
@@ -591,6 +596,14 @@
}else{
this.bookingData = res.data[0];
}
// 只有 isRefresh=true 时后端才返回 expDate;
// 非刷新调用需保留上一次刷新拿到的 expDate,避免被 db 缓存覆盖
if(isRefresh){
this.cachedExpDate = this.bookingData.expDate;
this.hasExtendedRefresh = true;
}else if(this.bookingData.expDate==null || this.bookingData.expDate==''){
this.bookingData.expDate = this.cachedExpDate;
}
if(this.bookingData.requestedCoDate!=null){
let ciDate = this.bookingData.checkoutDate;
let coDatge = dayjs(this.bookingData.requestedCoDate).format("YYYY-MM-DD");
@@ -907,6 +920,10 @@
this.showMsg = true;
return;
}
// 仅用户点击 extension 时刷新一次以拿回 expDate,之后不再重复触发
if(!this.hasExtendedRefresh && this.opt && this.opt.conf){
await this.getBookingByConf(this.opt.conf, this.opt.id, true);
}
await this.buildCalendar();
this.showCalendar = true;
},
@@ -1023,11 +1040,18 @@
this.getBooking(this.opt);
}else{
this.iconPath = '../../static/images/ico_err.png';
this.popMsgStr = this.$t("bookingDetail.changeMiscChargeFail");
let popStr = res.message != null ? ("\n" + res.message) : "";
this.popMsgStr = this.$t("bookingDetail.changeMisChargeFail") + popStr;
this.showMsgBox = true;
this.showETAMsg = false;
this.showMisChargeMsg = false;
if (popStr != '') {
const amountMatch = popStr.match(/Amount cannot be less than original:\s*(\d+(?:\.\d+)?)\s*$/);
if (amountMatch) {
this.bookingData.miscCharge = Number(amountMatch[1]);
}
}
}
}catch(e){
@@ -2088,4 +2112,4 @@
.font-m{
font-size: 15px;
}
</style>
</style>
@@ -560,6 +560,7 @@
RoomType: allRoomType,
StartDate: dateRange.startDate,
EndDate: dateRange.endDate,
category: this.currentProperty.category,
};
},
getUniqueCodes(codes) {
+2 -2
View File
@@ -139,10 +139,10 @@
<!-- <view class="hz-font-bolder hz-font-lg" >{{ handleShowWhenScreenshot(bookingData.eta) }}</view> -->
</view>
</view>
<view v-if="bookingData.mischarge!=null" class="hz-flex-row">
<view v-if="bookingData.miscCharge!=null" class="hz-flex-row">
<view style="width:100%">
<view class="hz-font-color-black hz-font-sm">{{ $t("common.misCharge") }}</view>
<view class="hz-font-bolder hz-font-lg">{{ bookingData.mischarge || "-" }}</view>
<view class="hz-font-bolder hz-font-lg">{{ bookingData.miscCharge || "-" }}</view>
</view>
</view>
</view>