merge limo to daylight
This commit is contained in:
@@ -18,88 +18,138 @@
|
||||
<view style="border:1rpx solid #ccc;border-radius: 14px;padding:4px 12px;" class="hz-flex-row hz-flex-vertical-mid">
|
||||
<image @click="navTo('/pages/findPlayer/findPlayer',1,false)" src="../../static/images/ico_find_player.png" class="hz-nav-btn"></image>
|
||||
<view style="height:20px;border-left:1px solid #ccc;margin-left:8px;margin-right:8px;"></view>
|
||||
<image v-if="userData && userData.canViewCalendar === true" @click="navToPlayerRoomCalendar" src="../../static/images/calendar-line.png" class="hz-nav-btn"></image>
|
||||
<image v-else @click="getDataByPage" src="../../static/images/ico_list.png" class="hz-nav-btn"></image>
|
||||
<image @click="navToPlayerRoomCalendar" src="../../static/images/calendar-line.png" class="hz-nav-btn"></image>
|
||||
</view>
|
||||
</view>
|
||||
</u-navbar>
|
||||
<view class="hz-spacing hz-bg-white" style="margin-top:8px;">
|
||||
<view class="hz-card-profile hz-mr-b-30">
|
||||
|
||||
<!-- booking record page -->
|
||||
<view class="hz-spacing hz-bg-white mt-[20]">
|
||||
<view class="hz-card-profile mb-[40]">
|
||||
<view class="hz-flex-row">
|
||||
<view style="width:60%">
|
||||
<view class="hz-w-60">
|
||||
<view class="hz-font-color-light hz-font-sm">{{$t("common.playerId")}}</view>
|
||||
<view class="hz-font-bolder hz-font-lg" >{{ playerData.playerId }}</view>
|
||||
</view>
|
||||
<view style="width:40%">
|
||||
<view class="hz-w-40">
|
||||
<view class="hz-font-color-light hz-font-sm">{{$t("common.tier")}}</view>
|
||||
<view class="hz-font-bolder hz-font-lg" >{{ playerData.tierName }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="hz-flex-row hz-mr-t-30">
|
||||
<view style="width:100%">
|
||||
<view class="hz-w-100">
|
||||
<view class="hz-font-color-light hz-font-sm">{{$t("common.name")}}</view>
|
||||
<view class="hz-font-bolder hz-font-lg" >{{playerData.salutation + " " + playerData.name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="!showEmpty">
|
||||
<!-- 'hz-card-extend' disable extend -->
|
||||
<view @click="navToDetail(booking)" v-for="(booking,index) in bookingList" :key="index"
|
||||
:class="getRecordColor(booking)" class="hz-pd-30 hz-font-bold hz-font-sm" style="margin-top:20rpx;align-items: center;">
|
||||
<view class="hz-flex-row">
|
||||
<view>
|
||||
<view class="hz-font-md">{{$t("common.confirmationNo")}}: {{ getConfirmationNo(booking)}}</view>
|
||||
|
||||
<view>
|
||||
<view v-for="(record,index) in displayRecordList" :key="`${record.recordType}-${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">
|
||||
<image :src="getBookingTypeIcon(record)" class="hz-booking-type-icon"></image>
|
||||
<view class="hz-font-md">{{ getBookingTypeLabel(record) }}</view>
|
||||
</view>
|
||||
<view class="hz-font-md hz-text-right" :class="getRecordStatusClass(record)">{{getRecordStatusText(record)}}</view>
|
||||
</view>
|
||||
<view style="margin-left:auto">
|
||||
<view class="hz-font-md" :class="getStatusTextColor(booking)">{{getStatusText(booking)}}</view>
|
||||
<view v-if="isHotelRecord(record)">
|
||||
<view class="hz-flex-row hz-row-gap">
|
||||
<view class="hz-w-50">
|
||||
<view class="hz-font-md">{{$t("common.confirmationNo")}}: {{ getConfirmationNo(record)}}</view>
|
||||
</view>
|
||||
<view class="hz-w-50">
|
||||
<view class="hz-font-md hz-text-right">{{ record.propertyName }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="hz-flex-row hz-row-gap">
|
||||
<view class="hz-w-55">
|
||||
<view class="hz-font-md">{{$t("common.checkInDate")}}: {{ record.checkinDate }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="hz-flex-row hz-row-gap">
|
||||
<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>
|
||||
<!-- <view class="hz-flex-row hz-row-gap">
|
||||
<view class="hz-w-55 hz-font-md" v-show="record.eta!==null && record.eta!=='00:00:00'">{{$t("common.etaTime")}}: {{formatEtaToHHmm(record.eta)}}</view>
|
||||
<view v-if="record.miscCharge != null" class="hz-flex-row hz-sharer-wrap">
|
||||
<view>
|
||||
<view class="hz-font-md">{{$t("common.misCharge")}}: {{ formatWithThousands(record.miscCharge) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="hz-flex-row" style="margin-top:6px;">
|
||||
<view v-show="record.eta!==null && record.eta!=='00:00:00'" class="hz-font-md">{{$t("common.etaTime")}}: {{formatEtaToHHmm(record.eta)}}</view>
|
||||
<span v-show="record.eta!==null && record.eta!=='00:00:00' && record.miscCharge!==null" class="hz-font-md" style="padding:0 6px;">|</span>
|
||||
<view v-show="record.miscCharge!==null" class="hz-font-md">{{$t("common.misCharge")}}: {{formatWithThousands(record.miscCharge)}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="hz-flex-row" style="margin-top:6px;">
|
||||
<view style="width:55%;">
|
||||
<view class="hz-font-md">{{$t("common.checkInDate")}}: {{ booking.checkinDate }}</view>
|
||||
<!-- 不然就是 limo 的 booking -->
|
||||
<view v-else>
|
||||
<view class="hz-flex-row hz-row-gap">
|
||||
<view class="hz-w-100">
|
||||
<view class="hz-font-md">Conf # : {{ getConfirmationNo(record) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="hz-flex-row hz-row-gap">
|
||||
<view class="hz-w-100">
|
||||
<view class="hz-font-md">{{$t("limoBookingRecord.pickupDatetime")}}: {{ record.pickupDatetime }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="hz-flex-row hz-row-gap">
|
||||
<view class="hz-w-100">
|
||||
<view class="hz-font-md">{{$t("limoBookingRecord.pickup")}}: {{ record.pickup }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="record.extraDropoff && record.extraDropoff.length" class="hz-flex-row hz-row-gap">
|
||||
<view class="hz-w-100">
|
||||
<view class="hz-font-md">{{$t("limoBookingRecord.extraDropoff")}}:</view>
|
||||
<view class="hz-font-md" v-for="(dropoffPoint,index) in record.extraDropoff" :key="index">
|
||||
#{{index + 1}}:{{dropoffPoint}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="hz-flex-row hz-row-gap hz-flex-vertical-mid">
|
||||
<view class="hz-w-100 hz-limo-dropoff-wrap">
|
||||
<view class="hz-font-md">
|
||||
{{$t("limoBookingRecord.dropoff")}}: {{record.dropoff}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="width:50%;">
|
||||
<view style="text-align: right;" class="hz-font-md">{{ booking.propertyName }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="hz-flex-row" style="margin-top:6px;">
|
||||
<view style="width:55%;">
|
||||
<view class="hz-font-md">{{$t("common.checkOutDate")}}: {{ booking.checkoutDate }}</view>
|
||||
</view>
|
||||
<!-- enable sharer and extend 2024-09-27 -->
|
||||
<view class="hz-flex-row" style="width:50%;text-align: right;justify-content: flex-end;" v-if="userData.canNewBooking&&booking.propertyCategory!='OTHER'">
|
||||
<view v-if="(booking.sharer!==null && booking.sharer!=='[]')||booking.isShare" class="hz-btn-sharer hz-font-min" style="width:40%;height:14px;line-height:14px;margin-right: 3px;">{{$t("bookingRecord.sharer").toUpperCase()}}</view>
|
||||
<!-- <view @click="navToDetail(booking)" v-if="((booking.lastOperaStatus==='DUE_OUT' || booking.lastOperaStatus==='CHECKED_IN') && booking.confirmationNo!=null && (booking.approveStatus!='W'&&booking.approveStatus!='PN'))" class="hz-btn-extend hz-font-min" style="width:40%;height:14px;line-height:14px;">{{$t("bookingRecord.extend").toUpperCase()}}</view> -->
|
||||
<!-- <view @click="navTo('/booking/bookingGroup/bookingGroup?groupId='+booking.groupId,0,false)" v-if="booking.groupId!==undefined && booking.groupId!==null && booking.groupId!==''" class="hz-btn-group" style="margin-left:8px;">{{$t("bookingRecord.group")}}</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="hz-flex-row" style="margin-top:6px;">
|
||||
<view v-show="booking.eta!==null && booking.eta!=='00:00:00'" class="hz-font-md">{{$t("common.etaTime")}}: {{formatEtaToHHmm(booking.eta)}}</view>
|
||||
<span v-show="booking.eta!==null && booking.eta!=='00:00:00' && booking.miscCharge!==null" class="hz-font-md" style="padding:0 6px;">|</span>
|
||||
<view v-show="booking.miscCharge!==null" class="hz-font-md">{{$t("common.misCharge")}}: {{formatWithThousands(booking.miscCharge)}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <u-loadmore :status="showLoadMore" :loadmoreText="loadMoreStr" :nomoreText="nomoreStr" :fontSize="14" color="#ccc" :line="true" /> -->
|
||||
</view>
|
||||
<u-empty
|
||||
v-if="showEmpty"
|
||||
|
||||
<!-- <u-empty
|
||||
v-if="isDisplayEmpty"
|
||||
mode="search"
|
||||
:text="dataNotFoundStr"
|
||||
>
|
||||
</u-empty>
|
||||
</u-empty> -->
|
||||
</view>
|
||||
<u-tabbar
|
||||
:fixed="true"
|
||||
:placeholder="true"
|
||||
:safeAreaInsetBottom="true"
|
||||
customStyle="z-index:100;height:58px;"
|
||||
v-if="userData.canNewBooking"
|
||||
>
|
||||
<view class="book hz-flex-row hz-spacing">
|
||||
<view class="hz-btn hz-font-color-white hz-font-lg hz-font-bold hz-text-center" @click="navToNewBooking()">
|
||||
<view v-if="userData.canNewBooking" class="book hz-flex-row hz-spacing hz-book-btn-wrap" :class="{'hz-book-btn-wrap--single': hasSingleBookingPermission}">
|
||||
<view class="hz-btn hz-font-color-white hz-font-sm hz-font-bold hz-text-center" @click="navToNewBooking()">
|
||||
{{$t("bookingRecord.newsBooking")}}
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="userData.canViewLimo" class="book hz-flex-row hz-spacing hz-book-btn-wrap" :class="{'hz-book-btn-wrap--single': hasSingleBookingPermission}">
|
||||
<view class="hz-btn hz-font-color-white hz-font-sm hz-font-bold hz-text-center" @click="navToNewLimo()">
|
||||
{{$t("bookingRecord.newLimo")}}
|
||||
</view>
|
||||
</view>
|
||||
</u-tabbar>
|
||||
<u-modal :content="msgStr" :show="showMsg" :confirmText="yesText" :showCancelButton="false" closeOnClickOverlay @confirm="showMsg=false" confirmColor="#C39A4B" @close="showMsg=false"></u-modal>
|
||||
</view>
|
||||
@@ -109,7 +159,7 @@
|
||||
<script>
|
||||
import {playerLookup} from '../../api/mgmApi.js'
|
||||
import {mapOperaStatus,mapApproveStatus} from '../../common/mapping.js'
|
||||
import {getBookingsMock,getBookings} from '../../api/bookingApi.js';
|
||||
import {getBookings, getLimoBookings} from '../../api/bookingApi.js';
|
||||
import dayjs from '../../uni_modules/uview-ui/libs/util/dayjs.js';
|
||||
export default {
|
||||
data() {
|
||||
@@ -121,15 +171,14 @@
|
||||
dataNotFoundStr:this.$t("common.dataNotFound"),
|
||||
// 界面变量
|
||||
from:'',
|
||||
showEmpty:false,
|
||||
title:'',
|
||||
footFuncHei:100,
|
||||
currentIndex:0,
|
||||
showMsg:false,
|
||||
msgStr:this.$t("bookingRecord.operaProfile"),
|
||||
yesText:this.$t("common.ok"),
|
||||
currentTask:null,
|
||||
getDataByPageRequestId:0,
|
||||
limoBookingList:[
|
||||
]
|
||||
}
|
||||
},
|
||||
onLoad(opt) {
|
||||
@@ -145,6 +194,8 @@
|
||||
// 检查是否登录
|
||||
this.isLogin();
|
||||
// 拿localstorage中的playerData
|
||||
//修改MiscCharge后 返回页面自动刷新
|
||||
// this.refreshHotelBooking();
|
||||
|
||||
this.getDataByPage();
|
||||
},
|
||||
@@ -153,49 +204,109 @@
|
||||
this.pullDownRefresh();
|
||||
},
|
||||
methods: {
|
||||
navToPlayerRoomCalendar(){
|
||||
const userData = uni.getStorageSync("userData");
|
||||
if (!userData || userData.canViewCalendar !== true) return;
|
||||
this.navTo('/booking/playerRoomCalendar/playerRoomCalendar',0,false);
|
||||
updateHotelBookingList(res){
|
||||
if(Array.isArray(res) && res.length > 0){
|
||||
this.bookingList = res;
|
||||
}else{
|
||||
this.bookingList = [];
|
||||
}
|
||||
},
|
||||
updateLimoBookingList(res) {
|
||||
if(this.userData.canViewLimo==false) return;
|
||||
if (Array.isArray(res) && res.length > 0) {
|
||||
let temp = res.map(item => {
|
||||
const pickUpDatetime = item.pickUpDatetime || item.pickUpDateTime || item.pickupDatetime || '';
|
||||
return {
|
||||
id: item.id,
|
||||
recordType: 'limo',
|
||||
confirmationNo: item.confirmationNo,
|
||||
status: item.bookingStatus,
|
||||
pickUpDatetime,
|
||||
pickupDatetime: this.formatDate(pickUpDatetime, 'YYYY-MM-DD HH:mm'),
|
||||
pickup: item.pickUpPoint,
|
||||
dropoff: item.dropOffPoint,
|
||||
extraDropoff:this.getExtraDropOff(item.extraDropOffPoint)
|
||||
// extraDropoff:item.extraDropOffPoint.split(";")
|
||||
}
|
||||
});
|
||||
|
||||
this.limoBookingList = temp;
|
||||
} else {
|
||||
this.limoBookingList = [];
|
||||
}
|
||||
},
|
||||
openBookingPage(path){
|
||||
uni.showLoading({
|
||||
title: this.$t("common.loading")
|
||||
});
|
||||
this.navTo(path,0,false);
|
||||
uni.hideLoading();
|
||||
},
|
||||
|
||||
// 數據方法
|
||||
async getDataByPage(){
|
||||
if(this.userData.canViewBooking==false) return;
|
||||
if(this.currentTask){
|
||||
const previousTask = this.currentTask;
|
||||
const requestId = ++this.getDataByPageRequestId;
|
||||
if(previousTask){
|
||||
try{
|
||||
this.currentTask.abort();
|
||||
previousTask.abort();
|
||||
}catch(err){
|
||||
}
|
||||
}
|
||||
const requestId = ++this.getDataByPageRequestId;
|
||||
|
||||
// 一次页面加载会同时发起 Hotel 和 Limo 请求,统一保存并取消它们。
|
||||
const requestTasks = [];
|
||||
const requestController = {
|
||||
abort: () => {
|
||||
requestTasks.forEach(task => {
|
||||
if(task && typeof task.abort === 'function'){
|
||||
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();
|
||||
}
|
||||
}
|
||||
};
|
||||
this.currentTask = requestController;
|
||||
let params = {};
|
||||
uni.showLoading({
|
||||
title: this.$t("common.loading")
|
||||
});
|
||||
try{
|
||||
if(this.playerData.nameIds.length==0){
|
||||
await this.getProfileByPlayerId(requestId)
|
||||
await this.getProfileByPlayerId(requestId, requestConfig)
|
||||
}else{
|
||||
params.member = this.playerData
|
||||
params.member = this.playerData;
|
||||
params.userId = this.userData.userId;
|
||||
const res = await getBookings(params, {
|
||||
getTask: (task, options) => {
|
||||
this.currentTask = task;
|
||||
}
|
||||
params.profileId = this.playerData.profileId;
|
||||
const limoPromise = getLimoBookings(params, requestConfig).catch((e) => {
|
||||
return null;
|
||||
});
|
||||
const hotelPromise = getBookings(params, requestConfig).catch((e) => {
|
||||
return null;
|
||||
});
|
||||
const [resLimo, resHotel] = await Promise.all([limoPromise, hotelPromise]);
|
||||
if(requestId !== this.getDataByPageRequestId) return;
|
||||
this.currentTask = null;
|
||||
this.bookingList = [];
|
||||
if(res.length>0){
|
||||
if(res!==undefined && res!==null){
|
||||
this.bookingList = res;
|
||||
}
|
||||
}else{
|
||||
|
||||
if (resLimo) {
|
||||
this.updateLimoBookingList(resLimo);
|
||||
}
|
||||
if (resHotel) {
|
||||
this.updateHotelBookingList(resHotel);
|
||||
}
|
||||
}
|
||||
}catch(e){
|
||||
if(e.errMsg!==undefined && e.errMsg.includes("abort")){
|
||||
if(requestId !== this.getDataByPageRequestId || (e && e.errMsg!==undefined && e.errMsg.includes("abort"))){
|
||||
return;
|
||||
}
|
||||
// console.log(e);
|
||||
@@ -204,11 +315,38 @@
|
||||
await this.writeLog(this.userData.userId,"save_booking","","[APP][bookingDetail.vue][getDataByPage][Catch Exception]"+e.errMsg,"[RequestData]" +JSON.stringify(params),"",1,false);
|
||||
}finally{
|
||||
if(requestId === this.getDataByPageRequestId){
|
||||
this.currentTask = null;
|
||||
if(this.currentTask === requestController){
|
||||
this.currentTask = null;
|
||||
}
|
||||
uni.hideLoading();
|
||||
}
|
||||
}
|
||||
},
|
||||
async refreshHotelBooking(){
|
||||
if(this.userData.canViewBooking==false) return;
|
||||
let params = {};
|
||||
uni.showLoading({
|
||||
title: this.$t("common.loading")
|
||||
});
|
||||
try{
|
||||
if(this.playerData.nameIds.length==0){
|
||||
await this.getProfileByPlayerId()
|
||||
}else{
|
||||
params.member = this.playerData;
|
||||
params.userId = this.userData.userId;
|
||||
params.profileId = this.playerData.profileId;
|
||||
const resHotel = await getBookings(params);
|
||||
this.updateHotelBookingList(resHotel);
|
||||
}
|
||||
}catch(e){
|
||||
console.log(e);
|
||||
// write log
|
||||
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{
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
pullDownRefresh(){
|
||||
try{
|
||||
this.getDataByPage('refresh');
|
||||
@@ -217,6 +355,60 @@
|
||||
}
|
||||
},
|
||||
// 界面方法
|
||||
isHotelRecord(record){
|
||||
return record.recordType === 'hotel';
|
||||
},
|
||||
getRecordCardClass(record){
|
||||
return this.getRecordColor(record);
|
||||
},
|
||||
openRecordDetail(record){
|
||||
if(this.isHotelRecord(record)){
|
||||
this.navToDetail(record);
|
||||
}else{
|
||||
this.navToLimoDetail(record);
|
||||
}
|
||||
},
|
||||
getBookingTypeIcon(record){
|
||||
if(this.isHotelRecord(record)){
|
||||
return '../../static/images/ico_hotel_active.png';
|
||||
}
|
||||
return '../../static/icon/tabbar/taxi-fill.png';
|
||||
},
|
||||
getBookingTypeLabel(record){
|
||||
let bookingType = this.$t("limoBookingRecord.bookingType");
|
||||
if(this.isHotelRecord(record)){
|
||||
return bookingType+': Hotel';
|
||||
}
|
||||
return bookingType+': Limo';
|
||||
},
|
||||
getRecordStatusText(record){
|
||||
if(this.isHotelRecord(record)){
|
||||
return this.getStatusText(record);
|
||||
}else{
|
||||
return record.status.replace("_"," ");
|
||||
}
|
||||
},
|
||||
getRecordStatusClass(record){
|
||||
return this.getStatusTextColor(record);
|
||||
},
|
||||
canShowSharer(record){
|
||||
return this.userData && this.userData.canNewBooking && record.propertyCategory!='OTHER';
|
||||
},
|
||||
hasSharer(record){
|
||||
return (record.sharer!==null && record.sharer!=='[]')||record.isShare;
|
||||
},
|
||||
hasEta(record){
|
||||
return record.eta!==undefined && record.eta!==null && record.eta!=='';
|
||||
},
|
||||
getDropOffPointLines(dropOffPoint){
|
||||
if(dropOffPoint === null || dropOffPoint === undefined || dropOffPoint === '') return [''];
|
||||
return String(dropOffPoint).split(/[;;]/).map(item => item.trim()).filter(item => item !== '');
|
||||
},
|
||||
getExtraDropOffPoint(dropOffPoint){
|
||||
if(dropOffPoint === null || dropOffPoint === undefined || dropOffPoint === '') return [''];
|
||||
|
||||
return String(dropOffPoint).split(/[;;]/).map(item => item.trim()).filter(item => item !== '');
|
||||
},
|
||||
back(){
|
||||
if(this.from==='booking'){
|
||||
this.navTo("/pages/findPlayer/findPlayer",1,false);
|
||||
@@ -227,6 +419,12 @@
|
||||
navToDetail(booking){
|
||||
this.navTo('/booking/bookingDetail/bookingDetail?id='+booking.id+"&conf="+booking.confirmationNo+"&from=list",0,false)
|
||||
},
|
||||
navToLimoDetail(limoBooking){
|
||||
this.navTo('/limo/bookingDetail/bookingDetail?id=' + limoBooking.id +'&conf='+limoBooking.confirmationNo+"&from=list",0,false)
|
||||
},
|
||||
navToPlayerRoomCalendar(){
|
||||
this.navTo('/booking/playerRoomCalendar/playerRoomCalendar',0,false)
|
||||
},
|
||||
// ETA 统一显示 HH:mm(兼容 HH:mm:ss / HH:mm)
|
||||
formatEtaToHHmm(eta) {
|
||||
if (eta === null || eta === undefined || eta === '') return '';
|
||||
@@ -259,81 +457,170 @@
|
||||
this.title = this.$t("bookingRecord.title");
|
||||
},
|
||||
navToNewBooking(){
|
||||
this.getDataByPage();
|
||||
uni.showLoading({
|
||||
title: this.$t("common.loading")
|
||||
});
|
||||
// remove no opera restrict
|
||||
// if(this.playerData.nameIds.length==0){
|
||||
// this.showMsg = true;
|
||||
// }else{
|
||||
// this.navTo('/booking/newBooking/newBooking',0,false)
|
||||
// }
|
||||
this.navTo('/booking/newBooking/newBooking',0,false)
|
||||
uni.hideLoading();
|
||||
this.openBookingPage('/booking/newBooking/newBooking');
|
||||
},
|
||||
async getProfileByPlayerId(requestId){
|
||||
navToNewLimo(){
|
||||
this.openBookingPage('/limo/newLimo/newLimo?from=bookingRecord');
|
||||
},
|
||||
async getProfileByPlayerId(requestId = this.getDataByPageRequestId, requestConfig = {}){
|
||||
try{
|
||||
let params = {playerId:this.playerData.playerId,userId:this.userData.userId};
|
||||
const res = await playerLookup(params, {
|
||||
getTask: (task, options) => {
|
||||
this.currentTask = task;
|
||||
}
|
||||
});
|
||||
const params = {playerId:this.playerData.playerId,userId:this.userData.userId};
|
||||
const res = await playerLookup(params, requestConfig);
|
||||
if(requestId !== this.getDataByPageRequestId) return;
|
||||
if(res.success == true){
|
||||
var player = res.data;
|
||||
const player = res.data;
|
||||
if(player !== null){
|
||||
if(player.codedFlag==1){
|
||||
uni.setStorageSync("playerData",player);
|
||||
this.playerData = uni.getStorageSync("playerData");
|
||||
let params = {};
|
||||
params.member = player
|
||||
params.userId = this.userData.userId;
|
||||
const res = await getBookings(params, {
|
||||
getTask: (task, options) => {
|
||||
this.currentTask = task;
|
||||
}
|
||||
});
|
||||
const bookingParams = {
|
||||
member: player,
|
||||
userId: this.userData.userId
|
||||
};
|
||||
const [resHotel, resLimo] = await Promise.all([
|
||||
getBookings(bookingParams, requestConfig),
|
||||
getLimoBookings(bookingParams, requestConfig)
|
||||
]);
|
||||
if(requestId !== this.getDataByPageRequestId) return;
|
||||
this.currentTask = null;
|
||||
this.bookingList = [];
|
||||
if(res.length>0){
|
||||
if(res!==undefined && res!==null){
|
||||
this.bookingList = res;
|
||||
}
|
||||
}else{
|
||||
}
|
||||
this.updateHotelBookingList(resHotel);
|
||||
this.updateLimoBookingList(resLimo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch(e){
|
||||
if(e.errMsg!==undefined && e.errMsg.includes("abort")){
|
||||
if(requestId !== this.getDataByPageRequestId || (e && e.errMsg!==undefined && e.errMsg.includes("abort"))){
|
||||
return;
|
||||
}
|
||||
console.error(e);
|
||||
var request = e.config!=undefined?JSON.stringify(e.config):"";
|
||||
var response = e.data!=undefined?JSON.stringify(e.data):"";
|
||||
await this.writeLog(this.userData.userId,"find_player","","[APP][findPlayer.vue][getProfileByPlayerId][Catch Exception]"+e.errMsg,request,response,1,false);
|
||||
}finally{
|
||||
}
|
||||
},
|
||||
formatDate(date, format = 'YYYY-MM-DD HH:mm:ss') {
|
||||
const d = new Date(date);
|
||||
if (Number.isNaN(d.getTime())) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const map = {
|
||||
YYYY: d.getFullYear(),
|
||||
MM: String(d.getMonth() + 1).padStart(2, '0'),
|
||||
DD: String(d.getDate()).padStart(2, '0'),
|
||||
HH: String(d.getHours()).padStart(2, '0'),
|
||||
mm: String(d.getMinutes()).padStart(2, '0'),
|
||||
ss: String(d.getSeconds()).padStart(2, '0')
|
||||
};
|
||||
return format.replace(/YYYY|MM|DD|HH|mm|ss/g, matched => map[matched]);
|
||||
},
|
||||
getExtraDropOff(extraDropOffPoint) {
|
||||
let returnExtraDropOffPoint = null;
|
||||
if(extraDropOffPoint!=undefined && extraDropOffPoint!=null && extraDropOffPoint!=''){
|
||||
returnExtraDropOffPoint = extraDropOffPoint.split(";");
|
||||
}
|
||||
console.log(returnExtraDropOffPoint);
|
||||
return returnExtraDropOffPoint;
|
||||
},
|
||||
/** 用于酒店 / limo 混合列表排序:越大表示时间越晚 */
|
||||
getRecordSortTimeMs(record) {
|
||||
if (!record) {
|
||||
return Number.POSITIVE_INFINITY;
|
||||
}
|
||||
if (record.recordType === 'limo') {
|
||||
const raw = record.pickUpDatetime || record.pickUpDateTime || record.pickupDatetime;
|
||||
if (raw != null && raw !== '') {
|
||||
const n = Number(raw);
|
||||
if (!Number.isNaN(n)) {
|
||||
return n;
|
||||
}
|
||||
const parsedRaw = dayjs(String(raw).trim());
|
||||
if (parsedRaw.isValid()) {
|
||||
return parsedRaw.valueOf();
|
||||
}
|
||||
}
|
||||
if (record.pickupDatetime) {
|
||||
const s = String(record.pickupDatetime).trim();
|
||||
const m = s.match(/^(\d{1,2})\/(\d{1,2})\/(\d{2,4})\s+(\d{1,2}):(\d{2})$/);
|
||||
if (m) {
|
||||
const year = m[3].length === 2 ? 2000 + parseInt(m[3], 10) : parseInt(m[3], 10);
|
||||
const d = new Date(
|
||||
year,
|
||||
parseInt(m[2], 10) - 1,
|
||||
parseInt(m[1], 10),
|
||||
parseInt(m[4], 10),
|
||||
parseInt(m[5], 10)
|
||||
);
|
||||
if (!Number.isNaN(d.getTime())) {
|
||||
return d.getTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Number.POSITIVE_INFINITY;
|
||||
}
|
||||
const checkInDate = record.checkinDate || record.checkInDate || record.CheckInDate;
|
||||
if (checkInDate != null && String(checkInDate).trim() !== '') {
|
||||
const parsed = dayjs(String(checkInDate).trim());
|
||||
if (parsed.isValid()) {
|
||||
return parsed.valueOf();
|
||||
}
|
||||
}
|
||||
return Number.POSITIVE_INFINITY;
|
||||
},
|
||||
getRecordSortDateMs(record) {
|
||||
const timeMs = this.getRecordSortTimeMs(record);
|
||||
if (!Number.isFinite(timeMs) || Number.isNaN(timeMs)) {
|
||||
return Number.POSITIVE_INFINITY;
|
||||
}
|
||||
const d = new Date(timeMs);
|
||||
d.setHours(0, 0, 0, 0);
|
||||
return d.getTime();
|
||||
},
|
||||
getRecordTypeSortIndex(record) {
|
||||
return record && record.recordType === 'limo' ? 1 : 0;
|
||||
},
|
||||
compareRecordForDisplay(a, b) {
|
||||
const dateA = this.getRecordSortDateMs(a);
|
||||
const dateB = this.getRecordSortDateMs(b);
|
||||
if (dateA !== dateB) {
|
||||
return dateA - dateB;
|
||||
}
|
||||
const typeDiff = this.getRecordTypeSortIndex(a) - this.getRecordTypeSortIndex(b);
|
||||
if (typeDiff !== 0) {
|
||||
return typeDiff;
|
||||
}
|
||||
if (a && b && a.recordType === 'limo' && b.recordType === 'limo') {
|
||||
const timeA = this.getRecordSortTimeMs(a);
|
||||
const timeB = this.getRecordSortTimeMs(b);
|
||||
if (timeA !== timeB) {
|
||||
return timeA - timeB;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
hasSingleBookingPermission(){
|
||||
if (!this.userData) return false;
|
||||
return Boolean(this.userData.canNewBooking) !== Boolean(this.userData.canViewLimo);
|
||||
},
|
||||
displayRecordList(){
|
||||
const hotelRecords = this.bookingList.map(item => ({...item, recordType: 'hotel'}));
|
||||
const limoRecords = this.limoBookingList.map(item => ({...item, recordType: 'limo'}));
|
||||
console.log(limoRecords);
|
||||
return hotelRecords.concat(limoRecords).sort((a, b) => this.compareRecordForDisplay(a, b));
|
||||
},
|
||||
isDisplayEmpty(){
|
||||
return this.displayRecordList.length === 0;
|
||||
},
|
||||
getConfirmationNo(){
|
||||
return function (booking) {
|
||||
if(booking!==undefined && booking!==null){
|
||||
if(booking.confirmationNo!==undefined && booking.confirmationNo!==null &&
|
||||
booking.confirmationNo!=='null' && booking.confirmationNo!=='' && booking.approveStatus!='W'){
|
||||
booking.confirmationNo!=='null' && booking.confirmationNo!=='' && booking.approveStatus!='W' && booking.approveStatus!='AP'){
|
||||
return booking.confirmationNo;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'N/A';
|
||||
}
|
||||
}else{
|
||||
return 'N/A';
|
||||
}
|
||||
return 'N/A';
|
||||
}
|
||||
},
|
||||
dateFormat() {
|
||||
@@ -439,7 +726,41 @@
|
||||
if(booking.approveStatus!=null){
|
||||
approveStatus = booking.approveStatus;
|
||||
}
|
||||
// Opera和Approve Status都不为空的情况
|
||||
if(booking.recordType === 'limo'){
|
||||
const noOpera = operaStatus==null || operaStatus==undefined || operaStatus==='' || operaStatus==='null';
|
||||
const noApprove = approveStatus==null || approveStatus==undefined || approveStatus==='' || approveStatus==='null';
|
||||
if(noOpera && noApprove && booking.status!=null && booking.status!==undefined && String(booking.status).trim()!==''){
|
||||
const s = String(booking.status).toUpperCase().replace(/\s+/g,' ');
|
||||
if(s.includes('CANCEL')){
|
||||
return 'hz-status-font-cancel';
|
||||
}
|
||||
if(s.includes('WAITLIST') || s.includes('WAIT LIST')){
|
||||
return 'hz-status-font-waitlist';
|
||||
}
|
||||
if(s.includes('NOT YET')){
|
||||
return 'hz-status-font-waitlist';
|
||||
}
|
||||
if(s.includes('PENDING')){
|
||||
return 'hz-status-font-pending';
|
||||
}
|
||||
if(s.includes('CONFIRM')){
|
||||
return 'hz-status-font-duein';
|
||||
}
|
||||
if(s.includes('DRIVER_DEPARTED')){
|
||||
return 'hz-status-font-duein';
|
||||
}
|
||||
if(s.includes('DRIVER_ASSIGNED')){
|
||||
return 'hz-status-font-duein';
|
||||
}
|
||||
if(s.includes('DRIVER_ARRIVED')){
|
||||
return 'hz-status-font-duein';
|
||||
}
|
||||
if(s.includes('GUEST_PICKED')){
|
||||
return 'hz-status-font-duein';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
if((operaStatus!=null && operaStatus!=undefined) || (approveStatus!=null && approveStatus!=undefined))
|
||||
{
|
||||
if(approveStatus.toUpperCase()==='PN'||approveStatus.toUpperCase()==='F'){
|
||||
@@ -553,12 +874,31 @@
|
||||
},
|
||||
getRecordColor(){
|
||||
return function (booking) {
|
||||
if(booking==null){
|
||||
return 'hz-card-booking';
|
||||
}
|
||||
if(booking.recordType === 'limo'){
|
||||
const noApprove = booking.approveStatus==null || booking.approveStatus===undefined || booking.approveStatus==='' || booking.approveStatus==='null';
|
||||
const noOpera = booking.lastOperaStatus==null || booking.lastOperaStatus===undefined || booking.lastOperaStatus==='' || booking.lastOperaStatus==='null';
|
||||
if(noApprove && noOpera && booking.status!=null && booking.status!==undefined && String(booking.status).trim()!==''){
|
||||
const s = String(booking.status).toUpperCase().replace(/\s+/g,' ');
|
||||
if(s.includes('NOT YET') || s.includes('CONFIRM')){
|
||||
return 'hz-card-booking';
|
||||
}
|
||||
if(s.includes('WAITLIST') || s.includes('WAIT LIST') || s.includes('PENDING')){
|
||||
return 'hz-card-waitlist';
|
||||
}
|
||||
return 'hz-card-booking';
|
||||
}
|
||||
}
|
||||
if(booking.approveStatus==='W'|| booking.approveStatus==='WA'){
|
||||
return 'hz-card-waitlist'
|
||||
}else if(booking.approveStatus==='AP'){
|
||||
return 'hz-card-approval'
|
||||
}else if((booking.lastOperaStatus==='DUE_OUT' || booking.lastOperaStatus==='CHECKED_IN') && booking.confirmationNo!=null && (booking.sharer==null || booking.sharer==='[]' || booking.sharer==='')){
|
||||
return 'hz-card-booking'
|
||||
}else if(booking.approveStatus==='AP'){
|
||||
return 'hz-card-approval'
|
||||
}else{
|
||||
return 'hz-card-booking'
|
||||
}
|
||||
@@ -581,5 +921,7 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.hz-book-btn-wrap--single {
|
||||
width: 95%;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user