updated
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user