push them all
This commit is contained in:
@@ -868,7 +868,7 @@
|
||||
}
|
||||
// 保存失敗彈出錯誤提示框
|
||||
else {
|
||||
var message = resBook.errorCode != null && resBook.errorCode != "" ? resBook.errorCode :
|
||||
var message = resBook.errorCode ? resBook.errorCode :
|
||||
resBook.message;
|
||||
this.buttonStr = this.$t("common.ok");
|
||||
this.iconPath = '../../static/images/ico_err.png';
|
||||
@@ -1151,7 +1151,7 @@
|
||||
this.showDirBtn = true;
|
||||
this.showMsgBox = true;
|
||||
} else {
|
||||
var message = res.errorCode != "" ? res.errorCode : res.message;
|
||||
var message = res.errorCode ? res.errorCode : res.message;
|
||||
this.buttonStr = this.$t("common.ok");
|
||||
this.iconPath = '../../static/images/ico_err.png';
|
||||
this.msgStr = this.$t("common.saveFail") + ". " + this.$t("common.errorMsg") + ": " +
|
||||
@@ -1451,7 +1451,7 @@
|
||||
this.showDirBtn = true;
|
||||
this.showMsgBox = true;
|
||||
} else {
|
||||
var message = res.errorCode != "" ? res.errorCode : res.message;
|
||||
var message = res.errorCode ? res.errorCode : res.message;
|
||||
this.buttonStr = this.$t("common.ok");
|
||||
this.iconPath = '../../static/images/ico_err.png';
|
||||
this.msgStr = this.$t("common.saveFail") + ". " + this.$t("common.errorMsg") + ": " +
|
||||
|
||||
@@ -185,7 +185,7 @@
|
||||
</view>
|
||||
<view class="hz-flex-row hz-mr-t-30">
|
||||
<view style="width:100%">
|
||||
<view class="hz-font-color-black hz-font-lg">{{$t("approval.pendingResponse")}}: {{bookingData.approver || '-'}}</view>
|
||||
<view class="hz-font-color-black hz-font-lg">{{$t("approval.pendingResponse")}}: {{bookingData.approverName || '-'}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -219,13 +219,15 @@
|
||||
<!-- DUE_OUT -->
|
||||
<view v-else-if="currentBookingStatus == 'DUE_OUT'" class="hz-flex-row hz-spacing" style=" display: flex; justify-content: space-around;" :style="showExtendLayout() ? {width:'100%'}:{width:'34%'}">
|
||||
<view @click="popupLang()" class="hz-btn hz-bg-primary hz-font-lg hz-font-bold hz-font-color-white hz-text-center">{{$t("bookingDetail.saveImage")}}</view>
|
||||
<view v-if="showExtendLayout()" @click="popupCalendar()" class="hz-btn hz-bg-primary hz-font-lg hz-font-bold hz-font-color-white hz-text-center" style="margin-left:4px;">{{$t("bookingDetail.extension")}}</view>
|
||||
<view v-if="showExtendLayout() && isExtendBooker()" @click="popupCalendar()" class="hz-btn hz-bg-primary hz-font-lg hz-font-bold hz-font-color-white hz-text-center" style="margin-left:4px;">{{$t("bookingDetail.extension")}}</view>
|
||||
<view v-else-if="showExtendLayout()" @click="showExtendBookerPopup()" class="hz-cancel-disabled hz-btn hz-bg-primary hz-font-lg hz-font-bold hz-font-color-white hz-text-center" style="margin-left:4px;">{{$t("bookingDetail.extension")}}</view>
|
||||
</view>
|
||||
<!-- CHECKED_IN -->
|
||||
<view v-else-if="currentBookingStatus == 'CHECKED_IN'" class="hz-flex-row hz-spacing" style=" display: flex; justify-content: space-around;" :style="showExtendLayout() ? {width:'100%'}:{width:'34%'}">
|
||||
<view @click="popupLang()" class="hz-btn hz-bg-primary hz-font-lg hz-font-bold hz-font-color-white hz-text-center">{{$t("bookingDetail.saveImage")}}</view>
|
||||
<view v-if="bookingData.propertyCategory != 'OTHER'" @click="showMisChargeMsg = true" class="hz-btn hz-bg-primary hz-font-lg hz-font-bold hz-font-color-white hz-text-center" style="margin-left:4px;">{{$t("common.misCharge").toUpperCase()}}</view>
|
||||
<view v-if="showExtendLayout()" @click="popupCalendar()" class="hz-btn hz-bg-primary hz-font-lg hz-font-bold hz-font-color-white hz-text-center" style="margin-left:8px;">{{$t("bookingDetail.extension")}}</view>
|
||||
<view v-if="showExtendLayout() && isExtendBooker()" @click="popupCalendar()" class="hz-btn hz-bg-primary hz-font-lg hz-font-bold hz-font-color-white hz-text-center" style="margin-left:8px;">{{$t("bookingDetail.extension")}}</view>
|
||||
<view v-else-if="showExtendLayout()" @click="showExtendBookerPopup()" class="hz-cancel-disabled hz-btn hz-bg-primary hz-font-lg hz-font-bold hz-font-color-white hz-text-center" style="margin-left:8px;">{{$t("bookingDetail.extension")}}</view>
|
||||
</view>
|
||||
<!-- WAITLIST -->
|
||||
<view v-else-if="currentBookingStatus == 'WAITLIST'" class="hz-flex-row hz-spacing" style="width:100%;">
|
||||
@@ -666,6 +668,15 @@
|
||||
return false;
|
||||
}
|
||||
},
|
||||
isExtendBooker(){
|
||||
return this.userData.userId == this.bookingData.createdBy;
|
||||
},
|
||||
showExtendBookerPopup(){
|
||||
uni.showToast({
|
||||
title: this.$t("bookingDetail.onlyBookerCanExtend"),
|
||||
icon: "none"
|
||||
});
|
||||
},
|
||||
showOtherPopup(){
|
||||
uni.showToast({
|
||||
title:this.$t("bookingDetail.cannotCancel"),
|
||||
@@ -920,7 +931,7 @@
|
||||
if( ( dayjs(day.date).isAfter(startDate) || dayjs(day.date).isSame(startDate,'day')) &&
|
||||
( dayjs(day.date).isBefore(endDate) ||dayjs(day.date).isSame(endDate,'day')) ){
|
||||
// console.log(cdate)
|
||||
|
||||
|
||||
var operaStatus = this.bookingData.lastOperaStatus;
|
||||
var checkExp = (operaStatus.toUpperCase()==='CHECKED_IN')||(operaStatus.toUpperCase()==='DUE_OUT');
|
||||
if((this.bookingData.expDate==null||this.bookingData.expDate=='')&&checkExp){
|
||||
@@ -1003,7 +1014,7 @@
|
||||
const res = await changeMiscCharge(params);
|
||||
if(res.success!==null && res.success == true){
|
||||
this.iconPath = '../../static/images/ico_suc.png';
|
||||
this.popMsgStr = this.$t("bookingDetail.changeMiscChargeSuccess");
|
||||
this.popMsgStr = this.$t("bookingDetail.changeMisChargeSuccess");
|
||||
this.showMsgBox = true;
|
||||
this.showETAMsg = false;
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<view v-for="(record,index) in displayRecordList" :key="`${record.recordType}-${record.id || record.confirmationNo || index}`">
|
||||
<view class="hz-record-list">
|
||||
<view class="hz-record-item" v-for="(record,index) in displayRecordList" :key="(record.recordType || 'record') + '-' + (record.id || record.confirmationNo || index)">
|
||||
<view @click="openRecordDetail(record)" :class="getRecordCardClass(record)" class="hz-card-booking hz-record-card hz-pd-30 hz-font-bold hz-font-sm">
|
||||
<view class="hz-flex-row hz-booking-type-row">
|
||||
<view class="hz-booking-type-wrap">
|
||||
@@ -72,6 +72,9 @@
|
||||
<view class="hz-w-55">
|
||||
<view class="hz-font-md">{{$t("common.checkOutDate")}}: {{ record.checkoutDate }}</view>
|
||||
</view>
|
||||
<!-- <view class="hz-flex-row hz-sharer-wrap" v-if="canShowSharer(record)">
|
||||
<view v-if="hasSharer(record)" class="hz-btn-sharer hz-font-min hz-sharer-tag">{{$t("bookingRecord.sharer").toUpperCase()}}</view>
|
||||
</view> -->
|
||||
<view class="hz-flex-row hz-sharer-wrap" v-if="canShowSharer(record)">
|
||||
<view v-if="hasSharer(record)" class="hz-btn-sharer hz-font-min hz-sharer-tag">{{$t("bookingRecord.sharer").toUpperCase()}}</view>
|
||||
</view>
|
||||
@@ -204,11 +207,17 @@
|
||||
this.pullDownRefresh();
|
||||
},
|
||||
methods: {
|
||||
normalizeBookingList(res){
|
||||
if(Array.isArray(res)) return res;
|
||||
if(res && Array.isArray(res.data)) return res.data;
|
||||
if(res && res.data && Array.isArray(res.data.records)) return res.data.records;
|
||||
if(res && Array.isArray(res.records)) return res.records;
|
||||
return null;
|
||||
},
|
||||
updateHotelBookingList(res){
|
||||
if(Array.isArray(res) && res.length > 0){
|
||||
this.bookingList = res;
|
||||
}else{
|
||||
this.bookingList = [];
|
||||
const list = this.normalizeBookingList(res);
|
||||
if(list){
|
||||
this.bookingList = list;
|
||||
}
|
||||
},
|
||||
updateLimoBookingList(res) {
|
||||
@@ -246,39 +255,62 @@
|
||||
// 數據方法
|
||||
async getDataByPage(){
|
||||
if(this.userData.canViewBooking==false) return;
|
||||
const previousTask = this.currentTask;
|
||||
const previousRequest = this.currentTask;
|
||||
const requestId = ++this.getDataByPageRequestId;
|
||||
if(previousTask){
|
||||
try{
|
||||
previousTask.abort();
|
||||
}catch(err){
|
||||
}
|
||||
}
|
||||
|
||||
// 一次页面加载会同时发起 Hotel 和 Limo 请求,统一保存并取消它们。
|
||||
const requestTasks = [];
|
||||
let finishRequest;
|
||||
const requestFinished = new Promise(resolve => {
|
||||
finishRequest = resolve;
|
||||
});
|
||||
const requestController = {
|
||||
requestId,
|
||||
finished: requestFinished,
|
||||
isAborted: false,
|
||||
addTask: task => {
|
||||
if(!task || typeof task.abort !== 'function') return;
|
||||
if(requestController.isAborted || requestId !== this.getDataByPageRequestId){
|
||||
try{
|
||||
task.abort();
|
||||
}catch(err){
|
||||
}
|
||||
return;
|
||||
}
|
||||
requestTasks.push(task);
|
||||
},
|
||||
abort: () => {
|
||||
requestTasks.forEach(task => {
|
||||
if(task && typeof task.abort === 'function'){
|
||||
try{
|
||||
task.abort();
|
||||
}catch(err){
|
||||
}
|
||||
if(requestController.isAborted) return;
|
||||
requestController.isAborted = true;
|
||||
requestTasks.splice(0).forEach(task => {
|
||||
try{
|
||||
task.abort();
|
||||
}catch(err){
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const requestConfig = {
|
||||
getTask: task => {
|
||||
if(requestId === this.getDataByPageRequestId){
|
||||
requestTasks.push(task);
|
||||
}else if(task && typeof task.abort === 'function'){
|
||||
task.abort();
|
||||
}
|
||||
}
|
||||
},
|
||||
finish: () => finishRequest()
|
||||
};
|
||||
this.currentTask = requestController;
|
||||
|
||||
if(previousRequest && typeof previousRequest.abort === 'function'){
|
||||
previousRequest.abort();
|
||||
// 等旧请求的 abort 回调先完成,避免 App 端取消动作影响紧接着的新请求。
|
||||
if(previousRequest.finished){
|
||||
await Promise.race([
|
||||
previousRequest.finished,
|
||||
new Promise(resolve => setTimeout(resolve, 50))
|
||||
]);
|
||||
}else{
|
||||
await new Promise(resolve => setTimeout(resolve, 0));
|
||||
}
|
||||
}
|
||||
if(requestId !== this.getDataByPageRequestId){
|
||||
requestController.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
const requestConfig = {
|
||||
getTask: task => requestController.addTask(task)
|
||||
};
|
||||
let params = {};
|
||||
uni.showLoading({
|
||||
title: this.$t("common.loading")
|
||||
@@ -314,6 +346,7 @@
|
||||
uni.$u.toast(e.errMsg,5000);
|
||||
await this.writeLog(this.userData.userId,"save_booking","","[APP][bookingDetail.vue][getDataByPage][Catch Exception]"+e.errMsg,"[RequestData]" +JSON.stringify(params),"",1,false);
|
||||
}finally{
|
||||
requestController.finish();
|
||||
if(requestId === this.getDataByPageRequestId){
|
||||
if(this.currentTask === requestController){
|
||||
this.currentTask = null;
|
||||
@@ -382,10 +415,14 @@
|
||||
return bookingType+': Limo';
|
||||
},
|
||||
getRecordStatusText(record){
|
||||
if(this.isHotelRecord(record)){
|
||||
return this.getStatusText(record);
|
||||
}else{
|
||||
return record.status.replace("_"," ");
|
||||
try{
|
||||
if(this.isHotelRecord(record)){
|
||||
return this.getStatusText(record);
|
||||
}
|
||||
if(record.status == null) return '';
|
||||
return String(record.status).replace("_"," ");
|
||||
}catch(e){
|
||||
return '';
|
||||
}
|
||||
},
|
||||
getRecordStatusClass(record){
|
||||
@@ -478,8 +515,8 @@
|
||||
userId: this.userData.userId
|
||||
};
|
||||
const [resHotel, resLimo] = await Promise.all([
|
||||
getBookings(bookingParams, requestConfig),
|
||||
getLimoBookings(bookingParams, requestConfig)
|
||||
getBookings(bookingParams, requestConfig).catch(() => null),
|
||||
getLimoBookings(bookingParams, requestConfig).catch(() => null)
|
||||
]);
|
||||
if(requestId !== this.getDataByPageRequestId) return;
|
||||
this.updateHotelBookingList(resHotel);
|
||||
@@ -924,4 +961,36 @@
|
||||
.hz-book-btn-wrap--single {
|
||||
width: 95%;
|
||||
}
|
||||
.hz-page {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
.hz-record-list,
|
||||
.hz-record-item,
|
||||
.hz-record-card {
|
||||
box-sizing: border-box;
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
.hz-record-card {
|
||||
align-items: stretch;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
.hz-record-card ::v-deep .hz-flex-row,
|
||||
.hz-record-card ::v-deep .hz-w-50,
|
||||
.hz-record-card ::v-deep .hz-w-55,
|
||||
.hz-record-card ::v-deep .hz-w-100,
|
||||
.hz-record-card ::v-deep .hz-booking-type-wrap,
|
||||
.hz-record-card ::v-deep .hz-font-md {
|
||||
box-sizing: border-box;
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
.hz-record-card ::v-deep .hz-w-55 {
|
||||
flex: 1;
|
||||
width: auto;
|
||||
}
|
||||
.hz-record-card ::v-deep .hz-font-md {
|
||||
word-break: break-word;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -143,7 +143,7 @@
|
||||
</view>
|
||||
<!-- IM request -->
|
||||
<view v-show="showIMRequest">
|
||||
<view class="hz-spacing hz-font-lg hz-font-bold">{{$t("newBooking.deposit")}}</view>
|
||||
<view class="hz-spacing hz-font-lg hz-font-bold">{{$t("newBooking.deposit")}}<span class="mandatory">*</span></view>
|
||||
<view class="hz-split"></view>
|
||||
<view class="hz-spacing" style="margin-top:10px;margin-bottom:30px;">
|
||||
<u-radio-group v-model="modelBooking.depositType" placement="row" @change="changeDeposit"
|
||||
@@ -157,7 +157,7 @@
|
||||
</u-radio-group>
|
||||
</view>
|
||||
|
||||
<view class="hz-spacing hz-font-lg hz-font-bold">{{$t("newBooking.postCharge")}}</view>
|
||||
<view class="hz-spacing hz-font-lg hz-font-bold">{{$t("newBooking.postCharge")}}<span class="mandatory">*</span></view>
|
||||
<view class="hz-split"></view>
|
||||
<view class="hz-spacing" style="margin-top:10px;margin-bottom:30px;">
|
||||
<u-radio-group v-model="modelBooking.isPost" placement="row" @change="changePost"
|
||||
@@ -911,6 +911,16 @@
|
||||
uni.$u.toast(this.$t("newBooking.alertRoom"));
|
||||
return;
|
||||
}
|
||||
if (this.showIMRequest) {
|
||||
if (this.modelBooking.depositType === undefined || this.modelBooking.depositType === null || this.modelBooking.depositType === '') {
|
||||
uni.$u.toast(this.$t("newBooking.alertDeposit"));
|
||||
return;
|
||||
}
|
||||
if (this.modelBooking.isPost === undefined || this.modelBooking.isPost === null || this.modelBooking.isPost === '') {
|
||||
uni.$u.toast(this.$t("newBooking.alertPostCharge"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
/*if(this.modelBooking.roomTypeId===undefined || this.modelBooking.roomTypeId===null){
|
||||
uni.$u.toast(this.$t("newBooking.alertRoomType"));
|
||||
return;
|
||||
|
||||
@@ -1226,7 +1226,7 @@
|
||||
this.showDirBtn = true;
|
||||
this.showMsgBox = true;
|
||||
} else {
|
||||
var message = res.errorCode != "" ? res.errorCode : res.message;
|
||||
var message = res.errorCode ? res.errorCode : res.message;
|
||||
this.buttonStr = this.$t("common.ok");
|
||||
this.iconPath = '../../static/images/ico_err.png';
|
||||
this.msgStr = this.$t("common.saveFail") + ". " + this.$t("common.errorMsg") + ": " +
|
||||
|
||||
Reference in New Issue
Block a user