first commit
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,195 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="hz-page">
|
||||
<u-navbar
|
||||
:safeAreaInsetTop="true"
|
||||
:placeholder="true"
|
||||
:title="title"
|
||||
:fixed="true"
|
||||
:autoBack="true"
|
||||
leftIconColor="#000000"
|
||||
titleStyle="font-weight:bold;"
|
||||
>
|
||||
<view
|
||||
style="margin-top:2px;margin-right:3px;"
|
||||
slot="right"
|
||||
>
|
||||
<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 @click="navTo('/booking/bookingRecord/bookingRecord',0,false)" src="../../static/images/ico_list.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">
|
||||
<view class="hz-flex-row">
|
||||
<view style="width: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-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-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">
|
||||
<view v-for="(booking,index) in bookingList" :key="index" :class="(booking.lastOperaStatus==='DUE_OUT' || booking.lastOperaStatus==='CHECKED_IN') && booking.confirmationNo!=null? 'hz-card-extend':'hz-card-booking'" class="hz-pd-30 hz-font-bold hz-font-sm" style="margin-top:20rpx;align-items: center;">
|
||||
<view @click="navToDetail(booking)" class="hz-flex-row">
|
||||
<view style="width:60%;">
|
||||
<view>{{$t("common.property")}}: {{ booking.propertyName }}</view>
|
||||
</view>
|
||||
<view style="width:40%;">
|
||||
<view>{{$t("common.roomType")}}: {{ booking.roomTypeCode }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view @click="navToDetail(booking)" class="hz-flex-row" style="margin-top:8px;">
|
||||
<view style="width:60%;">
|
||||
<view>{{$t("common.checkInDate")}}: {{ dateFormat(booking.checkinDate) }}</view>
|
||||
</view>
|
||||
<view style="width:40%;">
|
||||
<view>{{$t("common.confirmationNo")}}: {{ getConfirmationNo(booking) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="hz-flex-row" style="margin-top:8px;">
|
||||
<view @click="navToDetail(booking)" style="width:60%;">
|
||||
<view>{{$t("common.checkOutDate")}}: {{ dateFormat(booking.checkoutDate) }}</view>
|
||||
</view>
|
||||
<view class="hz-flex-row" style="width:40%;justify-content: flex-end;">
|
||||
<view @click="navToDetail(booking)" v-if="(booking.sharer===null || booking.sharer==='[]') && ((booking.lastOperaStatus==='DUE_OUT' || booking.lastOperaStatus==='CHECKED_IN') && booking.confirmationNo!=null)" class="hz-btn-extend">{{$t("bookingRecord.extend")}}</view>
|
||||
<view @click="navTo('/booking/bookingGroup/bookingGroup?groupId='+booking.groupId,0,false)" v-if="booking.groupId!==undefined && booking.groupId!==''" class="hz-btn-group" style="margin-left:8px;">{{$t("bookingRecord.group")}}</view>
|
||||
<view v-if="booking.sharer!==null && booking.sharer!=='[]'" class="hz-btn-sharer" style="margin-left:8px;">{{$t("bookingRecord.sharer")}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view :style="'height:'+footFuncHei+'rpx;'"></view>
|
||||
</view>
|
||||
<u-empty
|
||||
v-if="showEmpty"
|
||||
mode="search"
|
||||
:text="dataNotFoundStr"
|
||||
>
|
||||
</u-empty>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import dayjs from '../../uni_modules/uview-ui/libs/util/dayjs.js';
|
||||
import {getBookingsByGroupId} from '../../api/bookingApi.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
//数据变量
|
||||
playerData:null,
|
||||
bookingList:[],
|
||||
userData:null,
|
||||
groupId:'',
|
||||
// 界面变量
|
||||
dataNotFoundStr:this.$t("common.dataNotFound"),
|
||||
showEmpty:false,
|
||||
title:'',
|
||||
footFuncHei:100,
|
||||
}
|
||||
},
|
||||
onLoad(opt) {
|
||||
// 初始化界面
|
||||
this.initUI();
|
||||
this.playerData = uni.getStorageSync("playerData");
|
||||
this.userData = uni.getStorageSync("userData");
|
||||
this.groupId = opt.groupId;
|
||||
this.getBookings();
|
||||
},
|
||||
onShow() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
// 數據方法
|
||||
async getBookings(){
|
||||
uni.showLoading({
|
||||
title: this.$t("common.loading")
|
||||
});
|
||||
try{
|
||||
let params = {};
|
||||
params.groupId = this.groupId;
|
||||
const res = await getBookingsByGroupId(params);
|
||||
|
||||
if(res.success == true){
|
||||
this.bookingList = [];
|
||||
this.bookingList = res.data;
|
||||
this.showEmpty = false;
|
||||
}else{
|
||||
// 出错
|
||||
this.showEmpty = true;
|
||||
}
|
||||
}catch(e){
|
||||
console.error(e);
|
||||
this.showEmpty = true;
|
||||
}finally{
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
//下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.pullDownRefresh();
|
||||
},
|
||||
pullDownRefresh(){
|
||||
try{
|
||||
this.getBookings();
|
||||
}finally{
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
},
|
||||
// 界面方法
|
||||
navToDetail(booking){
|
||||
this.navTo('/booking/bookingDetail/bookingDetail?id='+booking.id+"&conf="+booking.confirmationNo+"&from=list",0,false)
|
||||
},
|
||||
initUI() {
|
||||
this.deviceData = uni.getStorageSync("deviceData");
|
||||
this.title = this.$t("bookingRecord.title");
|
||||
// 判斷iphone下方安全區域
|
||||
const area = this.deviceData.saveArea;
|
||||
if(area){
|
||||
this.footFuncHei = 160;
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
computed:{
|
||||
getConfirmationNo(){
|
||||
return function (booking) {
|
||||
if(booking!==undefined && booking!==null){
|
||||
if(booking.confirmationNo!==undefined && booking.confirmationNo!==null && booking.confirmationNo!=='null' && booking.confirmationNo!==''){
|
||||
return booking.confirmationNo;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'N/A';
|
||||
}
|
||||
}else{
|
||||
return 'N/A';
|
||||
}
|
||||
}
|
||||
},
|
||||
dateFormat() {
|
||||
return function (date) {
|
||||
if (date != undefined) {
|
||||
return dayjs(date).format("DD/MM/YY");
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,579 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="hz-page">
|
||||
<u-navbar
|
||||
:safeAreaInsetTop="true"
|
||||
:placeholder="true"
|
||||
:title="title"
|
||||
:fixed="true"
|
||||
:autoBack="false"
|
||||
leftIconColor="#000000"
|
||||
titleStyle="font-weight:bold;"
|
||||
@leftClick="back()"
|
||||
>
|
||||
<view
|
||||
style="margin-top:2px;margin-right:3px;"
|
||||
slot="right"
|
||||
>
|
||||
<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 @click="getDataByPage" src="../../static/images/ico_list.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">
|
||||
<view class="hz-flex-row">
|
||||
<view style="width: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-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-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 style="margin-left:auto">
|
||||
<view class="hz-font-md" :class="getStatusTextColor(booking)">{{getStatusText(booking)}}</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>
|
||||
</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"
|
||||
mode="search"
|
||||
:text="dataNotFoundStr"
|
||||
>
|
||||
</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()">
|
||||
{{$t("bookingRecord.newsBooking")}}
|
||||
</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>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {playerLookup} from '../../api/mgmApi.js'
|
||||
import {mapOperaStatus,mapApproveStatus} from '../../common/mapping.js'
|
||||
import {getBookingsMock,getBookings} from '../../api/bookingApi.js';
|
||||
import dayjs from '../../uni_modules/uview-ui/libs/util/dayjs.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
//数据变量
|
||||
playerData:null,
|
||||
userData:null,
|
||||
bookingList:[],
|
||||
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,
|
||||
}
|
||||
},
|
||||
onLoad(opt) {
|
||||
// 初始化界面
|
||||
this.initUI();
|
||||
this.playerData = uni.getStorageSync("playerData");
|
||||
this.userData = uni.getStorageSync("userData");
|
||||
if(opt.from!==undefined && opt.from!='') this.from = opt.from;
|
||||
// this.getDataByPage();
|
||||
},
|
||||
onShow() {
|
||||
this.$i18n.locale = uni.getLocale();
|
||||
// 检查是否登录
|
||||
this.isLogin();
|
||||
// 拿localstorage中的playerData
|
||||
|
||||
this.getDataByPage();
|
||||
},
|
||||
// 下拉刷新(页面生命周期,需与 onLoad/onShow 同级)
|
||||
onPullDownRefresh() {
|
||||
this.pullDownRefresh();
|
||||
},
|
||||
methods: {
|
||||
// 數據方法
|
||||
async getDataByPage(){
|
||||
if(this.userData.canViewBooking==false) return;
|
||||
if(this.currentTask){
|
||||
try{
|
||||
this.currentTask.abort();
|
||||
}catch(err){
|
||||
}
|
||||
}
|
||||
const requestId = ++this.getDataByPageRequestId;
|
||||
let params = {};
|
||||
uni.showLoading({
|
||||
title: this.$t("common.loading")
|
||||
});
|
||||
try{
|
||||
if(this.playerData.nameIds.length==0){
|
||||
await this.getProfileByPlayerId(requestId)
|
||||
}else{
|
||||
params.member = this.playerData
|
||||
params.userId = this.userData.userId;
|
||||
const res = await getBookings(params, {
|
||||
getTask: (task, options) => {
|
||||
this.currentTask = task;
|
||||
}
|
||||
});
|
||||
if(requestId !== this.getDataByPageRequestId) return;
|
||||
this.currentTask = null;
|
||||
this.bookingList = [];
|
||||
if(res.length>0){
|
||||
if(res!==undefined && res!==null){
|
||||
this.bookingList = res;
|
||||
}
|
||||
}else{
|
||||
|
||||
}
|
||||
}
|
||||
}catch(e){
|
||||
if(e.errMsg!==undefined && e.errMsg.includes("abort")){
|
||||
return;
|
||||
}
|
||||
// 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{
|
||||
if(requestId === this.getDataByPageRequestId){
|
||||
this.currentTask = null;
|
||||
uni.hideLoading();
|
||||
}
|
||||
}
|
||||
},
|
||||
pullDownRefresh(){
|
||||
try{
|
||||
this.getDataByPage('refresh');
|
||||
}finally{
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
},
|
||||
// 界面方法
|
||||
back(){
|
||||
if(this.from==='booking'){
|
||||
this.navTo("/pages/findPlayer/findPlayer",1,false);
|
||||
}else{
|
||||
this.navBack();
|
||||
}
|
||||
},
|
||||
navToDetail(booking){
|
||||
this.navTo('/booking/bookingDetail/bookingDetail?id='+booking.id+"&conf="+booking.confirmationNo+"&from=list",0,false)
|
||||
},
|
||||
// ETA 统一显示 HH:mm(兼容 HH:mm:ss / HH:mm)
|
||||
formatEtaToHHmm(eta) {
|
||||
if (eta === null || eta === undefined || eta === '') return '';
|
||||
const str = String(eta).trim();
|
||||
const m = str.match(/^(\d{1,2}):(\d{2})(?::\d{2})?$/);
|
||||
if (m) {
|
||||
const hh = m[1].padStart(2, '0');
|
||||
return `${hh}:${m[2]}`;
|
||||
}
|
||||
// 兜底:如果有冒号,取前两段
|
||||
const parts = str.split(':');
|
||||
if (parts.length >= 2) {
|
||||
return `${parts[0].padStart(2, '0')}:${parts[1]}`;
|
||||
}
|
||||
return str;
|
||||
},
|
||||
formatWithThousands(value) {
|
||||
if (value === null || value === undefined || value === '') return '-';
|
||||
const str = String(value).trim();
|
||||
if (/^-?\d{1,3}(,\d{3})*(\.\d+)?$/.test(str)) return str;
|
||||
const normalized = str.replace(/,/g, '');
|
||||
if (/^-?\d+(\.\d+)?$/.test(normalized)) {
|
||||
const n = Number(normalized);
|
||||
return n.toLocaleString('en-US');
|
||||
}
|
||||
return value;
|
||||
},
|
||||
initUI() {
|
||||
this.deviceData = uni.getStorageSync("deviceData");
|
||||
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();
|
||||
},
|
||||
async getProfileByPlayerId(requestId){
|
||||
try{
|
||||
let params = {playerId:this.playerData.playerId,userId:this.userData.userId};
|
||||
const res = await playerLookup(params, {
|
||||
getTask: (task, options) => {
|
||||
this.currentTask = task;
|
||||
}
|
||||
});
|
||||
if(requestId !== this.getDataByPageRequestId) return;
|
||||
if(res.success == true){
|
||||
var 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;
|
||||
}
|
||||
});
|
||||
if(requestId !== this.getDataByPageRequestId) return;
|
||||
this.currentTask = null;
|
||||
this.bookingList = [];
|
||||
if(res.length>0){
|
||||
if(res!==undefined && res!==null){
|
||||
this.bookingList = res;
|
||||
}
|
||||
}else{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch(e){
|
||||
if(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{
|
||||
}
|
||||
},
|
||||
},
|
||||
computed:{
|
||||
getConfirmationNo(){
|
||||
return function (booking) {
|
||||
if(booking!==undefined && booking!==null){
|
||||
if(booking.confirmationNo!==undefined && booking.confirmationNo!==null &&
|
||||
booking.confirmationNo!=='null' && booking.confirmationNo!=='' && booking.approveStatus!='W'){
|
||||
return booking.confirmationNo;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'N/A';
|
||||
}
|
||||
}else{
|
||||
return 'N/A';
|
||||
}
|
||||
}
|
||||
},
|
||||
dateFormat() {
|
||||
return function (date) {
|
||||
if (date != undefined) {
|
||||
return dayjs(date).format("DD/MM/YY");
|
||||
}
|
||||
}
|
||||
},
|
||||
getStatusColor(){
|
||||
return function (booking) {
|
||||
let operaStatus = null;
|
||||
if(booking==null){
|
||||
return '';
|
||||
}
|
||||
if(booking.lastOperaStatus!=null){
|
||||
operaStatus = booking.lastOperaStatus;
|
||||
}
|
||||
let approveStatus = null;
|
||||
if(booking.approveStatus!=null){
|
||||
approveStatus = booking.approveStatus;
|
||||
}
|
||||
// Opera和Approve Status都不为空的情况
|
||||
if((operaStatus!=null && operaStatus!=undefined) || (approveStatus!=null && approveStatus!=undefined))
|
||||
{
|
||||
if(approveStatus.toUpperCase()==='PN'){
|
||||
return 'hz-status-pending';
|
||||
}else if(approveStatus.toUpperCase()==='N'){
|
||||
if(operaStatus!==null && operaStatus!==undefined && operaStatus!=='' && operaStatus!=='null'){
|
||||
if(operaStatus.toUpperCase()==='DUE_IN'){
|
||||
return 'hz-status-duein';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='CHECKED_IN'){
|
||||
return 'hz-status-checkedin';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='CHECKED_OUT'){
|
||||
return 'hz-status-waitlist';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='DUE_OUT'){
|
||||
return 'hz-status-dueout';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='RESERVED'){
|
||||
return 'hz-status-reserved';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}else if(approveStatus.toUpperCase()==='W' ||approveStatus.toUpperCase()==='WA'){
|
||||
return 'hz-status-waitlist';
|
||||
}
|
||||
else
|
||||
{
|
||||
if(operaStatus==null) return '';
|
||||
if(operaStatus.toUpperCase()==='DUE_IN'){
|
||||
return 'hz-status-duein';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='CHECKED_IN'){
|
||||
return 'hz-status-checkedin';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='CHECKED_OUT'){
|
||||
return 'hz-status-waitlist';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='DUE_OUT'){
|
||||
return 'hz-status-dueout';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='RESERVED'){
|
||||
return 'hz-status-reserved';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Opera status为空,Approve Status不为空的情况
|
||||
else if((operaStatus==null || operaStatus==undefined) && (approveStatus!=null && approveStatus!=undefined))
|
||||
{
|
||||
if(approveStatus.toUpperCase()==='PN'){
|
||||
return 'hz-status-font-pending';
|
||||
}else if(approveStatus.toUpperCase()==='W' || approveStatus.toUpperCase()==='WA'){
|
||||
return 'hz-status-font-waitlist';
|
||||
}else if(approveStatus.toUpperCase()==='AP'){
|
||||
console.log(111);
|
||||
return 'hz-status-font-approval'
|
||||
}else{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
getStatusTextColor(){
|
||||
return function (booking) {
|
||||
let operaStatus = null;
|
||||
if(booking==null){
|
||||
return '';
|
||||
}
|
||||
if(booking.lastOperaStatus!=null){
|
||||
operaStatus = booking.lastOperaStatus;
|
||||
}
|
||||
let approveStatus = null;
|
||||
if(booking.approveStatus!=null){
|
||||
approveStatus = booking.approveStatus;
|
||||
}
|
||||
// Opera和Approve Status都不为空的情况
|
||||
if((operaStatus!=null && operaStatus!=undefined) || (approveStatus!=null && approveStatus!=undefined))
|
||||
{
|
||||
if(approveStatus.toUpperCase()==='PN'||approveStatus.toUpperCase()==='F'){
|
||||
return 'hz-status-font-pending';
|
||||
}else if(approveStatus.toUpperCase()==='N' || approveStatus.toUpperCase()==="FC"){
|
||||
if(operaStatus!==null && operaStatus!==undefined && operaStatus!=='' && operaStatus!=='null'){
|
||||
if(operaStatus.toUpperCase()==='DUE_IN'){
|
||||
return 'hz-status-font-duein';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='CHECKED_IN'){
|
||||
return 'hz-status-font-checkedin';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='CHECKED_OUT'){
|
||||
return 'hz-status-font-waitlist';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='DUE_OUT'){
|
||||
return 'hz-status-font-dueout';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='RESERVED'){
|
||||
return 'hz-status-font-reserved';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='PENDING CANCEL'){
|
||||
return 'hz-status-font-cancel';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}else if(approveStatus.toUpperCase()==='W'|| approveStatus.toUpperCase()==='WA'){
|
||||
return 'hz-status-font-waitlist';
|
||||
}else if(approveStatus.toUpperCase()==='AP'){
|
||||
return 'hz-status-font-approval';
|
||||
}
|
||||
else
|
||||
{
|
||||
if(operaStatus==null) return '';
|
||||
if(operaStatus.toUpperCase()==='DUE_IN'){
|
||||
return 'hz-status-font-duein';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='CHECKED_IN'){
|
||||
return 'hz-status-font-checkedin';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='CHECKED_OUT'){
|
||||
return 'hz-status-font-waitlist';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='DUE_OUT'){
|
||||
return 'hz-status-font-dueout';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='RESERVED'){
|
||||
return 'hz-status-font-reserved';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Opera status为空,Approve Status不为空的情况
|
||||
else if((operaStatus==null || operaStatus==undefined) && (approveStatus!=null && approveStatus!=undefined))
|
||||
{
|
||||
if(approveStatus.toUpperCase()==='PN'||approveStatus.toUpperCase()==='F'){
|
||||
return 'hz-status-font-pending';
|
||||
}else if(approveStatus.toUpperCase()==='W' || approveStatus.toUpperCase()==='WA'){
|
||||
return 'hz-status-font-waitlist';
|
||||
}
|
||||
else{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
getStatusText(){
|
||||
return function (booking) {
|
||||
let operaStatus = null;
|
||||
if(booking==null){
|
||||
return;
|
||||
}
|
||||
if(booking.lastOperaStatus!=null){
|
||||
operaStatus = booking.lastOperaStatus;
|
||||
}
|
||||
let approveStatus = null;
|
||||
if(booking.approveStatus!=null){
|
||||
approveStatus = booking.approveStatus;
|
||||
}
|
||||
if((operaStatus!=null && operaStatus!=undefined) || (approveStatus!=null && approveStatus!=undefined))
|
||||
{
|
||||
if(approveStatus.toUpperCase()==='PN' || approveStatus.toUpperCase()==='W' || approveStatus.toUpperCase()==='WA'
|
||||
|| approveStatus.toUpperCase()==='F' || approveStatus.toUpperCase()==='AP'){
|
||||
if(approveStatus!==null && approveStatus!==undefined && approveStatus!=='' && approveStatus!=='null'){
|
||||
if(approveStatus.toUpperCase()==='F'&&booking.tryTime<5){
|
||||
return "PENDING";
|
||||
}else{
|
||||
return mapApproveStatus(approveStatus.toUpperCase());
|
||||
}
|
||||
}
|
||||
}else if( approveStatus.toUpperCase()==='N' || approveStatus.toUpperCase()==='FC'){
|
||||
if(operaStatus!==null && operaStatus!==undefined && operaStatus!=='' && operaStatus!=='null')
|
||||
return mapOperaStatus(operaStatus.toUpperCase());
|
||||
}
|
||||
}
|
||||
else if((operaStatus==null || operaStatus==undefined) && (approveStatus!=null && approveStatus!=undefined))
|
||||
{
|
||||
if(approveStatus.toUpperCase()==='F'&&booking.tryTime<5){
|
||||
return "PENDING";
|
||||
}else{
|
||||
return mapApproveStatus(approveStatus.toUpperCase());
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
getRecordColor(){
|
||||
return function (booking) {
|
||||
if(booking.approveStatus==='W'|| booking.approveStatus==='WA'){
|
||||
return 'hz-card-waitlist'
|
||||
}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'
|
||||
}
|
||||
}
|
||||
},
|
||||
getETA(){
|
||||
return function(ETA){
|
||||
let returnStr = [];
|
||||
if(ETA !== null && ETA !== undefined){
|
||||
returnStr = ETA.split(":");
|
||||
return returnStr[0] + ":" +returnStr[1];
|
||||
}
|
||||
return null;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,389 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="hz-page">
|
||||
<u-navbar
|
||||
:safeAreaInsetTop="true"
|
||||
:placeholder="true"
|
||||
:title="title"
|
||||
:fixed="true"
|
||||
:autoBack="true"
|
||||
leftIconColor="#000000"
|
||||
titleStyle="font-weight:bold;"
|
||||
>
|
||||
<view
|
||||
style="margin-top:2px;margin-right:3px;"
|
||||
slot="right"
|
||||
>
|
||||
<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 @click="navTo('/booking/bookingRecord/bookingRecord',0,false)" src="../../static/images/ico_list.png" class="hz-nav-btn"></image>
|
||||
</view>
|
||||
</view>
|
||||
</u-navbar>
|
||||
<view v-for="(item,index) in bookingData.dateList" :key="'date'+index" class="hz-spacing hz-bg-white" style="margin-top:10px;">
|
||||
<view class="hz-pd-30 hz-font-bold hz-font-sm hz-card-extend hz-flex-row" style="margin-top:20rpx;align-items: center;">
|
||||
<view class="hz-flex-row" style="align-items: center;width:90%;">
|
||||
<image src="../../static/images/ico_calendar.png" style="width:16px;height:16px;"></image>
|
||||
<span class="hz-font-sm hz-font-bolder" style="margin-left:4px;">{{dateFormat(item.date[0])}} - {{dateFormat(item.date[item.date.length-1])}}</span>
|
||||
</view>
|
||||
<view @click="delDate(index)" class="hz-flex-row" style="width:10%;justify-content: flex-end;">
|
||||
<u-icon name="trash" size="20" color="#c04b41"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-tabbar
|
||||
:fixed="true"
|
||||
:placeholder="true"
|
||||
:safeAreaInsetBottom="true"
|
||||
customStyle="z-index:100;height:58px;"
|
||||
>
|
||||
<view class="hz-btn-leftRight hz-flex-row hz-spacing">
|
||||
<view @click="popupCalendar()" class="hz-btn-left hz-bg-light hz-font-lg hz-font-bold hz-font-color-primary" >{{$t("multipleDate.addDate")}}</view>
|
||||
<view @click="navToConfirm()" class="hz-btn-right hz-bg-primary hz-font-lg hz-font-bold hz-font-color-white" >{{$t("common.confirm").toUpperCase()}}</view>
|
||||
</view>
|
||||
</u-tabbar>
|
||||
</view>
|
||||
<u-modal :content="msgStr" :show="showMsg" :cancelText="cancelText" :confirmText="yesText" showCancelButton closeOnClickOverlay @confirm="confirmDel" confirmColor="#C39A4B" @cancel="cancelMsg" @close="cancelMsg"></u-modal>
|
||||
<u-calendar
|
||||
closeOnClickOverlay
|
||||
:confirmText="confirmText"
|
||||
:confirmDisabledText="confirmText"
|
||||
color="#C39A4B"
|
||||
title=""
|
||||
:startText="inText"
|
||||
:endText="outText"
|
||||
:show="showCalendar"
|
||||
:defaultDate="bookingData.dateList.at(-1)!=null?[bookingData.dateList.at(-1).date.at(-1)]:[]"
|
||||
:formatter="formatter"
|
||||
mode="range"
|
||||
:monthNum="monthNum"
|
||||
:maxRange="maxRange"
|
||||
:footerInfo="footerInfo"
|
||||
@close="cancelDate"
|
||||
@confirm="confirmDate"
|
||||
@rangeSelected="rangeSelected">
|
||||
</u-calendar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import dayjs from '../../uni_modules/uview-ui/libs/util/dayjs.js';
|
||||
import {getSetting,getCriterias,getAvailableRoom} from '../../api/configApi.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
//数据变量
|
||||
playerData:null,
|
||||
userData:null,
|
||||
bookingData:null,
|
||||
criteriaList:[],
|
||||
maxDate:'',
|
||||
defaultDate:[],
|
||||
// 界面变量
|
||||
title:'',
|
||||
msgStr:this.$t("common.removeConfirm"),
|
||||
cancelText:this.$t("common.cancel"),
|
||||
confirmText:this.$t("common.confirm").toUpperCase(),
|
||||
inText:this.$t("common.in"),
|
||||
outText:this.$t("common.out"),
|
||||
yesText:this.$t("common.yes"),
|
||||
showCalendar:false,
|
||||
showMsg:false,
|
||||
footFuncHei:100,
|
||||
footerInfo:"",
|
||||
bookNum:1,
|
||||
maxRange:0,
|
||||
monthNum:0,
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// 初始化界面
|
||||
this.initUI();
|
||||
|
||||
this.playerData = uni.getStorageSync("playerData");
|
||||
this.userData = uni.getStorageSync("userData");
|
||||
this.bookingData = uni.getStorageSync("bookingData");
|
||||
},
|
||||
onShow() {
|
||||
// 检查是否登录
|
||||
// this.isLogin();
|
||||
this.getSetting();
|
||||
},
|
||||
methods: {
|
||||
// 數據方法
|
||||
async buildCalendar(){
|
||||
uni.showLoading({
|
||||
title: this.$t("common.loading")
|
||||
});
|
||||
try{
|
||||
let params = {
|
||||
roomId:this.bookingData.roomId,
|
||||
propertyId:this.bookingData.propertyId,
|
||||
blockId:this.bookingData.blockId,
|
||||
coded:this.playerData.coded,
|
||||
userId:this.userData.userId,
|
||||
playerId:this.playerData.playerId,
|
||||
};
|
||||
const res = await getCriterias(params);
|
||||
if(res.success === true){
|
||||
this.criteriaList = [];
|
||||
if(res.data!==undefined && res.data!==null){
|
||||
this.criteriaList = res.data;
|
||||
}
|
||||
}else{
|
||||
|
||||
}
|
||||
}catch(e){
|
||||
|
||||
}finally{
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
// 界面方法
|
||||
navToConfirm(){
|
||||
// 數據檢查,臨時保存,跳轉到確認頁
|
||||
if(this.bookingData.dateList.length==0){
|
||||
uni.$u.toast(this.$t("multipleDate.pleaseAddDate"));
|
||||
return;
|
||||
}
|
||||
this.navTo("/booking/bookingConfirm/bookingConfirm",0,false);
|
||||
},
|
||||
async popupCalendar(){
|
||||
if(this.bookingData.dateList.length==this.bookNum){
|
||||
uni.$u.toast(this.$t("multipleDate.reachMaxBookNum"));
|
||||
return;
|
||||
}
|
||||
await this.buildCalendar();
|
||||
this.showCalendar = true;
|
||||
},
|
||||
confirmDate(e){
|
||||
let checkDate =JSON.parse(JSON.stringify(e));
|
||||
checkDate.pop();
|
||||
if(!this.checkDate(checkDate)) return false;
|
||||
let objDate ={
|
||||
date:e,
|
||||
status:null,
|
||||
checked:false,
|
||||
remark:'',
|
||||
numOfNight:dayjs(e[e.length-1]).diff(dayjs(e[0]),'day'),
|
||||
numOfRoom:1,
|
||||
};
|
||||
// 把對應的criteria也放到booking裡面後面用
|
||||
for(let i=0;i<e.length;i++){
|
||||
const date = e[i];
|
||||
const criterias = this.criteriaList;
|
||||
if(criterias[date]!==undefined && criterias[date]!=null)
|
||||
this.bookingData.criteriaList.push(criterias[date]);
|
||||
}
|
||||
this.bookingData.dateList.push(objDate);
|
||||
uni.setStorageSync("bookingData",this.bookingData);
|
||||
this.showCalendar = false;
|
||||
},
|
||||
confirmDel(){
|
||||
// 從dateList中刪除
|
||||
if(this.bookingData.dateList!=undefined && this.bookingData.dateList!=null){
|
||||
for(let i=0;i<this.bookingData.dateList[this.deleteIndex].date.length;i++){
|
||||
const date1 = this.bookingData.dateList[this.deleteIndex].date[i];
|
||||
if(this.bookingData.criteriaList!=null && this.bookingData.criteriaList.length>0){
|
||||
for(let a=0;a<this.bookingData.criteriaList.length;a++){
|
||||
let date2 = this.bookingData.criteriaList[a].bookDate;
|
||||
if(date1 == date2){
|
||||
this.bookingData.criteriaList.splice(a,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.bookingData.dateList.splice(this.deleteIndex,1);
|
||||
|
||||
uni.setStorageSync("bookingData",this.bookingData);
|
||||
}
|
||||
this.showMsg = false;
|
||||
},
|
||||
delDate(index){
|
||||
this.showMsg = true;
|
||||
this.deleteIndex = index;
|
||||
},
|
||||
cancelMsg(){
|
||||
this.showMsg = false;
|
||||
},
|
||||
cancelDate(){
|
||||
this.showCalendar = false;
|
||||
},
|
||||
formatter(day) {
|
||||
if(this.criteriaList!=null){
|
||||
let cdate = dayjs(day.date).format("YYYY-MM-DD");
|
||||
for(let i=0;i<this.bookingData.dateList.length;i++){
|
||||
let dates = this.bookingData.dateList[i].date;
|
||||
for(let j=0;j<dates.length;j++){
|
||||
let date = dates[j];
|
||||
if(cdate == date){
|
||||
day.picked = true
|
||||
if(j!=dates.length-1) // 可以连接上日期的处理
|
||||
day.disabled = true
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.criteriaList[cdate]!=undefined){
|
||||
let criteria =this.criteriaList[cdate];
|
||||
if(criteria.isWaitlist==1){
|
||||
day.bottomInfo = 'Waitlist'
|
||||
day.dot = true
|
||||
}
|
||||
if(criteria.protection==1){
|
||||
day.bottomInfo = 'Protect'
|
||||
day.dot = true
|
||||
}
|
||||
if(criteria.available==0){
|
||||
day.bottomInfo = 'Full'
|
||||
day.dot = true
|
||||
}
|
||||
}else{
|
||||
day.bottomInfo = 'Full'
|
||||
day.dot = true
|
||||
}
|
||||
}
|
||||
return day
|
||||
},
|
||||
initUI() {
|
||||
this.deviceData = uni.getStorageSync("deviceData");
|
||||
this.title = this.$t("multipleDate.title");
|
||||
// 判斷iphone下方安全區域
|
||||
const area = this.deviceData.saveArea;
|
||||
if(area){
|
||||
this.footFuncHei = 160;
|
||||
}
|
||||
},
|
||||
async getSetting(){
|
||||
uni.showLoading({
|
||||
title: this.$t("common.loading")
|
||||
});
|
||||
var that = this;
|
||||
try{
|
||||
let params = {};
|
||||
const res = await getSetting(params);
|
||||
if(res!=null && res.success==true){
|
||||
for(let i of res.data){
|
||||
if(i.keys=="MAX_BOOKING_STAY_DAYS"){
|
||||
let stay = i.keyValues;
|
||||
that.maxRange = stay;
|
||||
}else if(i.keys=="NUM_OF_MULTIPLE_DATE_RANGE"){
|
||||
that.bookNum = i.keyValues;
|
||||
}else if(i.keys=="MAX_ADVANCE_BOOKING_DAYS"){
|
||||
var monthNum = i.keyValues/30;
|
||||
that.monthNum = Math.ceil(monthNum)+1;
|
||||
let mDate = dayjs().add(i.keyValues,'day').format("YYYY-MM-DD");
|
||||
that.maxDate = mDate
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// write log
|
||||
}
|
||||
}catch(e){
|
||||
// write log
|
||||
}finally{
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
async rangeSelected(e){
|
||||
var isWaitlist = false;
|
||||
for(let d of e){
|
||||
if(this.criteriaList[d]!=undefined){
|
||||
if(this.criteriaList[d].isWaitlist==1)isWaitlist = true;
|
||||
}
|
||||
}
|
||||
if(isWaitlist){
|
||||
try{
|
||||
let params = {
|
||||
roomId:this.modelBooking.roomId,
|
||||
propertyId:this.modelBooking.propertyId,
|
||||
blockId:this.modelBooking.blockId,
|
||||
selectDate: [e[0],e[e.length-1]],
|
||||
};
|
||||
const res = await getAvailableRoom(params);
|
||||
if(res.success === true){
|
||||
if(res.data.length>0) {
|
||||
this.footerInfo = "Available Room:"+res.data.join(',');
|
||||
}else{
|
||||
this.footerInfo = "";
|
||||
}
|
||||
}
|
||||
}catch(e){
|
||||
|
||||
}
|
||||
}else{
|
||||
this.footerInfo = "";
|
||||
}
|
||||
},
|
||||
checkDate(date){
|
||||
var protectList = [];
|
||||
var fullList = [];
|
||||
for(let d of date){
|
||||
if(this.criteriaList[d]!=undefined){
|
||||
if(this.criteriaList[d].available==0) fullList.push(d);
|
||||
if(this.criteriaList[d].protection==1) protectList.push(d);
|
||||
}else{
|
||||
fullList.push(d);
|
||||
}
|
||||
}
|
||||
if(fullList.length>0){
|
||||
let msg = this.$t("newBooking.appFull");
|
||||
msg += " "+fullList.join(',')
|
||||
uni.$u.toast(msg,3000);
|
||||
return false;
|
||||
}
|
||||
if(protectList.length>0){
|
||||
let msg = this.$t("newBooking.protectionPeriod");
|
||||
msg += " "+protectList.join(',')
|
||||
uni.$u.toast(msg,3000);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
dateFormat() {
|
||||
return function (date) {
|
||||
if (date != undefined) {
|
||||
let weekNum = dayjs(date).day();
|
||||
let week = '';
|
||||
switch(weekNum){
|
||||
case 1:
|
||||
week='Mon'
|
||||
break;
|
||||
case 2:
|
||||
week='Tue';
|
||||
break;
|
||||
case 3:
|
||||
week='Wed';
|
||||
break;
|
||||
case 4:
|
||||
week='Thu';
|
||||
break;
|
||||
case 5:
|
||||
week='Fri';
|
||||
break;
|
||||
case 6:
|
||||
week='Sat';
|
||||
break;
|
||||
case 0:
|
||||
week='Sun';
|
||||
break;
|
||||
}
|
||||
return week + ', ' + dayjs(date).format("MMM D/YYYY");
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,655 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="hz-page">
|
||||
<u-navbar
|
||||
:safeAreaInsetTop="true"
|
||||
:placeholder="true"
|
||||
:title="title"
|
||||
:fixed="true"
|
||||
:autoBack="false"
|
||||
leftIconColor="#ffffff"
|
||||
titleStyle="font-weight:bold;"
|
||||
>
|
||||
<view
|
||||
style="margin-top:2px;margin-right:3px;"
|
||||
slot="right"
|
||||
>
|
||||
<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 @click="navTo('/booking/bookingRecord/bookingRecord',0,false)" src="../../static/images/ico_list.png" class="hz-nav-btn"></image>
|
||||
</view>
|
||||
</view>
|
||||
</u-navbar>
|
||||
<view class="hz-spacing hz-bg-white">
|
||||
<view class="hz-card-profile" style="margin-bottom:6px;">
|
||||
<view class="hz-flex-row">
|
||||
<view style="width: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-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-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-for="(item,index) in pendingList" :key="index" class="hz-flex-row hz-pd-30 hz-font-bold hz-font-sm hz-card-booking" style="margin-top:10px;align-items: center;">
|
||||
<view style="width:100%;">
|
||||
<view class="hz-flex-row" style="align-items: center;">
|
||||
<image src="../../static/images/ico_calendar_grey.png" style="width:16px;height:16px;"></image>
|
||||
<span class="hz-font-md hz-font-bolder" style="margin-left:4px;">{{dateFormat(item.date[0])}} {{$t("common.to")}} {{dateFormat(item.date[item.date.length-1]) }}</span>
|
||||
</view>
|
||||
<view class="hz-flex-row" style="margin-top:8px;">
|
||||
<view class="hz-flex-row" style="width:33%;align-items: center;">
|
||||
<image src="../../static/images/ico_night_grey.png" style="width:16px;height:16px;"></image>
|
||||
<span class="hz-font-md hz-font-bolder" style="margin-left:4px;">{{getNight(item.numOfNight)}}</span>
|
||||
</view>
|
||||
<view class="hz-flex-row" style="width:33%;align-items: center;">
|
||||
<image src="../../static/images/ico_room_grey.png" style="width:16px;height:16px;"></image>
|
||||
<span class="hz-font-md hz-font-bolder" style="margin-left:4px;">{{getRoom(item.numOfRoom)}}</span>
|
||||
</view>
|
||||
<view class="hz-flex-row" style="width:34%;justify-content: right;">
|
||||
<view class="hz-status-pending hz-btn-status hz-font-min hz-text-center" style="width:70%;height:14px;line-height:14px;">{{item.bookingStatus!==undefined && item.bookingStatus!='PN'? 'DUE IN':'PENDING'}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="waitlist!=null && waitlist.length>1" class="hz-flex-row" style="align-items: center;margin-top:20px;">
|
||||
<view @click="changeRoom('prev')" style="width:8%;" :class="currentRoomIndex===0? 'hz-disabled':''">
|
||||
<u-icon name="arrow-left" color="#C39A4B" size="28"></u-icon>
|
||||
</view>
|
||||
<view class="hz-text-center hz-font-md hz-font-bolder" style="width:84%;">Waitlist {{currentRoomIndex+1}}</view>
|
||||
<view @click="changeRoom('next')" style="width:8%;":class="currentRoomIndex===numOfWatilist-1? 'hz-disabled':''">
|
||||
<u-icon name="arrow-right" color="#C39A4B" size="28"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="showDateRange" class="hz-flex-row hz-pd-30 hz-font-bold hz-font-md hz-card-extend" style="margin-top:30rpx;align-items: center;">
|
||||
<view style="width:100%;">
|
||||
<view class="hz-flex-row" style="align-items: center;">
|
||||
<image src="../../static/images/ico_calendar.png" style="width:16px;height:16px;"></image>
|
||||
<span class="hz-font-md hz-font-bolder" style="margin-left:4px;">{{(waitlist[currentRoomIndex].date[0]) +" - " + (waitlist[currentRoomIndex].date[waitlist[currentRoomIndex].date.length-1]) }}</span>
|
||||
</view>
|
||||
<view class="hz-flex-row" style="margin-top:8px;">
|
||||
<view class="hz-flex-row" style="width:33%;align-items: center;">
|
||||
<image src="../../static/images/ico_night.png" style="width:16px;height:16px;"></image>
|
||||
<span class="hz-font-md hz-font-bolder" style="margin-left:4px;">{{getNight(waitlist[currentRoomIndex].numOfNight)}}</span>
|
||||
</view>
|
||||
<view class="hz-flex-row" style="width:33%;align-items: center;">
|
||||
<image src="../../static/images/ico_room.png" style="width:16px;height:16px;"></image>
|
||||
<span class="hz-font-md hz-font-bolder" style="margin-left:4px;">{{getRoom(waitlist[currentRoomIndex].numOfRoom)}}</span>
|
||||
</view>
|
||||
<view class="hz-flex-row" style="width:34%;justify-content: right;">
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="hz-spacing hz-mr-t-30" style="margin-bottom:30px;">
|
||||
<view class="hz-flex-row">
|
||||
<view style="width:65%">
|
||||
<view class="hz-font-color-black hz-font-sm">{{$t("common.property")}}</view>
|
||||
<view class="hz-font-bolder hz-font-lg" >{{bookingData.propertyName}}</view>
|
||||
</view>
|
||||
<view style="width:35%">
|
||||
<view class="hz-font-color-black hz-font-sm">{{$t("newBooking.roomType")}}</view>
|
||||
<view class="hz-font-bolder hz-font-lg" >{{bookingData.room}}</view>
|
||||
<!--<view class="hz-font-color-black hz-font-sm">{{$t("common.block")}}</view>
|
||||
<view class="hz-font-bolder hz-font-lg" >{{bookingData.block}}</view>-->
|
||||
</view>
|
||||
</view>
|
||||
<!--<<view class="hz-flex-row hz-mr-t-30">
|
||||
<view style="width:65%">
|
||||
<view class="hz-font-color-black hz-font-sm">{{$t("newBooking.roomType")}}</view>
|
||||
<view class="hz-font-bolder hz-font-lg" >{{bookingData.room}}</view>
|
||||
</view>
|
||||
<view style="width:35%">
|
||||
view class="hz-font-color-black hz-font-sm">{{$t("newBooking.roomType")}}</view>
|
||||
<view class="hz-font-bolder hz-font-lg" >{{bookingData.roomTypeCode}}</view>
|
||||
</view>
|
||||
</view>-->
|
||||
<view v-if="(bookingData.specialName!=null && bookingData.specialName!='') || (bookingData.bedTypeName!=null && bookingData.bedTypeName!='')" class="hz-flex-row hz-mr-t-30">
|
||||
<view style="width:100%">
|
||||
<view class="hz-font-color-black hz-font-sm">{{$t("newBooking.specialPreference")}}</view>
|
||||
<view class="hz-font-bolder hz-font-lg" >{{getSpecial(bookingData.specialName,bookingData.bedTypeName)}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="bookingData.sharerList!=null && bookingData.sharerList.length>0" class="hz-flex-row hz-mr-t-30">
|
||||
<view style="width:100%">
|
||||
<view class="hz-font-color-black hz-font-sm">{{$t("bookingRecord.sharer")}}</view>
|
||||
<view v-for="(item,index) in bookingData.sharerList" :key="'sharer'+index" class="hz-font-bolder hz-font-lg" >{{getSharer(item.playerId,item.name)}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="hz-flex-row hz-mr-t-30">
|
||||
<view style="width:65%">
|
||||
<view class="hz-font-color-black hz-font-sm">{{$t("bookingConfirm.createdOn")}}</view>
|
||||
<view class="hz-font-bolder hz-font-lg" >{{bookingData.createdOn}}</view>
|
||||
</view>
|
||||
<view style="width:35%">
|
||||
<view class="hz-font-color-black hz-font-sm">{{$t("bookingConfirm.createdBy")}}</view>
|
||||
<view class="hz-font-bolder hz-font-lg">
|
||||
{{bookingData.createdByName!=null?bookingData.createdByName:userData.userName}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="hz-flex-row hz-mr-t-30">
|
||||
<view style="width:100%">
|
||||
<view class="hz-font-color-black hz-font-sm">{{$t("newWaitlist.remark")}}</view>
|
||||
<view class="hz-font-bolder hz-font-md" style="margin-top:4px;">
|
||||
<u--textarea v-model="remarkList[currentRoomIndex]" :count="true" :maxlength="255" ></u--textarea>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view :style="'height:'+footFuncHei+'rpx;'"></view>
|
||||
</view>
|
||||
<u-tabbar
|
||||
:fixed="true"
|
||||
:placeholder="true"
|
||||
:safeAreaInsetBottom="true"
|
||||
customStyle="z-index:100;height:58px;"
|
||||
>
|
||||
<view class="book hz-spacing">
|
||||
<view @click="submitWaitlist" class="hz-btn-danger hz-font-color-white hz-font-lg hz-font-bold hz-text-center">
|
||||
{{$t("newWaitlist.submitWaitlist")}}
|
||||
</view>
|
||||
</view>
|
||||
</u-tabbar>
|
||||
</view>
|
||||
<u-popup
|
||||
:safeAreaInsetBottom="true"
|
||||
:safeAreaInsetTop="true"
|
||||
:mode="'center'"
|
||||
:round="12"
|
||||
:show="showMsgBox"
|
||||
>
|
||||
<view
|
||||
:style="'width:'+ windowWidth + 'px;'"
|
||||
style="padding:30px;"
|
||||
>
|
||||
<view class="hz-flex-row" style="justify-content: center;">
|
||||
<image :src="iconPath" style="width:64px;height:64px;"></image>
|
||||
</view>
|
||||
<view class="hz-font-md hz-font-bold hz-text-center" style="margin-top:20px;">
|
||||
<rich-text v-html="msgStr" style="line-height:26px;"></rich-text>
|
||||
</view>
|
||||
<view @click="navToDetail(url)" class="hz-btn hz-font-color-white hz-font-lg hz-font-bold hz-text-center" style="margin-top:20px;">
|
||||
{{buttonStr}}
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import dayjs from '../../uni_modules/uview-ui/libs/util/dayjs.js';
|
||||
import {formatDate} from '../../common/stringUtils.js';
|
||||
import {saveBooking,editBooking} from '../../api/bookingApi.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
//数据变量
|
||||
playerData:null,
|
||||
bookingData:null,
|
||||
userData:null,
|
||||
remarkList:[],
|
||||
pendingList:[],
|
||||
waitlist:[],
|
||||
// 界面变量
|
||||
title:'',
|
||||
type:'',
|
||||
iconPath:'',
|
||||
msgStr:'',
|
||||
url:'',
|
||||
buttonStr:'',
|
||||
showMsgBox:false,
|
||||
showList:false,
|
||||
showDateRange:false,
|
||||
currentRoomIndex:0,
|
||||
numOfWatilist:0,
|
||||
putInWaitlistText:this.$t("bookingConfirm.putInWaitlist"),
|
||||
windowWidth:0,
|
||||
footFuncHei:100,
|
||||
}
|
||||
},
|
||||
onLoad(opt) {
|
||||
// 初始化界面
|
||||
this.initUI();
|
||||
this.playerData = uni.getStorageSync("playerData");
|
||||
this.userData = uni.getStorageSync("userData");
|
||||
this.getBooking();
|
||||
},
|
||||
async onShow() {
|
||||
// 检查是否登录
|
||||
// this.isLogin();
|
||||
},
|
||||
methods: {
|
||||
// 數據方法
|
||||
getBooking(){
|
||||
this.bookingData = uni.getStorageSync("bookingData");
|
||||
if(this.bookingData!==null && this.bookingData!==undefined && this.bookingData!==''){
|
||||
if(this.bookingData.bookType==1){
|
||||
for(let i=0;i<this.bookingData.extendDate.length;i++){
|
||||
let dateObj = this.bookingData.extendDate[i];
|
||||
if(dateObj.checked===true && dateObj.status===1) {
|
||||
this.numOfWatilist++;
|
||||
this.waitlist.push(dateObj);
|
||||
}
|
||||
if(dateObj.checked===true && dateObj.status===0) {
|
||||
this.pendingList.push(dateObj);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for(let i=0;i<this.bookingData.dateList.length;i++){
|
||||
let dateObj = this.bookingData.dateList[i];
|
||||
if(dateObj.checked===true && dateObj.status===1) {
|
||||
this.numOfWatilist++;
|
||||
this.waitlist.push(dateObj);
|
||||
}
|
||||
if(dateObj.checked===true && dateObj.status===0) {
|
||||
this.pendingList.push(dateObj);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
this.showDateRange = true;
|
||||
|
||||
}else{
|
||||
// 报错
|
||||
}
|
||||
},
|
||||
async submitWaitlist(){
|
||||
uni.showLoading({
|
||||
title: this.$t("common.loading")
|
||||
});
|
||||
try{
|
||||
if(this.bookingData.bookType==1){
|
||||
for(let i=0;i<this.bookingData.extendDate.length;i++){
|
||||
if(this.bookingData.extendDate[i].checked===true && this.bookingData.extendDate[i].status===1){
|
||||
this.bookingData.extendDate[i].remark = this.remarkList[0];
|
||||
this.bookingData.extendDate[i].submit = true;
|
||||
this.remarkList.splice(0,1);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for(let i=0;i<this.bookingData.dateList.length;i++){
|
||||
if(this.bookingData.dateList[i].checked===true && this.bookingData.dateList[i].status===1){
|
||||
this.bookingData.dateList[i].remark = this.remarkList[0];
|
||||
this.bookingData.dateList[i].submit = true;
|
||||
this.remarkList.splice(0,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uni.setStorageSync("bookingData",this.bookingData);
|
||||
|
||||
// 保存waitlist
|
||||
var res = null;
|
||||
if(this.bookingData.bookType=='1'){
|
||||
res = await editBooking(this.bookingData);
|
||||
}else{
|
||||
res = await saveBooking(this.bookingData);
|
||||
}
|
||||
// 如果成功
|
||||
if(res.success === true){
|
||||
const resultBookings = res.data;
|
||||
if(this.numOfWatilist>1){
|
||||
//this.url = '/booking/bookingGroup/bookingGroup?groupId='+resultBookings[0].groupId;
|
||||
this.url = '/booking/bookingRecord/bookingRecord';
|
||||
this.buttonStr = this.$t("bookingConfirm.backToRecords");
|
||||
}else if(this.numOfWatilist==1){
|
||||
this.url = '/booking/bookingDetail/bookingDetail?id='+resultBookings[0].id+'&conf=&from=booking';
|
||||
this.buttonStr = this.$t("newWailist.viewSubmitedWaitlist");
|
||||
}else{
|
||||
// 出错
|
||||
}
|
||||
this.msgStr = this.$t("newWaitlist.savesuccessful");
|
||||
this.iconPath = '../../static/images/ico_suc.png';
|
||||
|
||||
this.showMsgBox = true;
|
||||
}else{
|
||||
this.msgStr = this.$t("common.saveFail"); // 或者其他錯誤信息
|
||||
this.buttonStr = this.$t("common.ok");
|
||||
this.iconPath = '../../static/images/ico_err.png';
|
||||
this.url = '';
|
||||
this.showMsgBox = true;
|
||||
}
|
||||
|
||||
}catch(e){
|
||||
console.error(e);
|
||||
await this.writeLog(this.userData.userId,"save_booking","","[APP][newWaitlist.vue][submitWaitlist][Catch Exception]"+e.errMsg,"","",1,false);
|
||||
}finally{
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
// 界面方法
|
||||
navToDetail(url){
|
||||
if(url!=null && url!==undefined && url!==''){
|
||||
this.navTo(url,0,false);
|
||||
}else{
|
||||
this.showMsgBox = false;
|
||||
}
|
||||
},
|
||||
changeRoom(type){
|
||||
if(type==='prev' && this.currentRoomIndex>0){
|
||||
this.currentRoomIndex = this.currentRoomIndex-1;
|
||||
}
|
||||
else if(type==='next' && this.currentRoomIndex<this.numOfWatilist-1){
|
||||
this.currentRoomIndex = this.currentRoomIndex+1;
|
||||
}
|
||||
},
|
||||
initUI() {
|
||||
this.deviceData = uni.getStorageSync("deviceData");
|
||||
this.title = this.$t("newWaitlist.title");
|
||||
this.windowWidth = this.deviceData.windowWidth-130;
|
||||
// 判斷iphone下方安全區域
|
||||
const area = this.deviceData.saveArea;
|
||||
if(area){
|
||||
this.footFuncHei = 160;
|
||||
}
|
||||
},
|
||||
},
|
||||
computed:{
|
||||
getStatusColor(){
|
||||
return function (booking) {
|
||||
let operaStatus = null;
|
||||
if(booking==null){
|
||||
return '';
|
||||
}
|
||||
if(booking.lastOperaStatus!=null){
|
||||
operaStatus = booking.lastOperaStatus;
|
||||
}
|
||||
let approveStatus = null;
|
||||
if(booking.approveStatus!=null){
|
||||
approveStatus = booking.approveStatus;
|
||||
}
|
||||
// Opera和Approve Status都不为空的情况
|
||||
if((operaStatus!=null && operaStatus!=undefined) || (approveStatus!=null && approveStatus!=undefined))
|
||||
{
|
||||
if(approveStatus.toUpperCase()==='PN'){
|
||||
return 'hz-status-pending';
|
||||
}else if(approveStatus.toUpperCase()==='N'){
|
||||
if(operaStatus!==null && operaStatus!==undefined && operaStatus!=='' && operaStatus!=='null'){
|
||||
if(operaStatus.toUpperCase()==='DUE_IN'){
|
||||
return 'hz-status-duein';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='CHECKED_IN'){
|
||||
return 'hz-status-checkedin';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='CHECKED_OUT'){
|
||||
return 'hz-status-waitlist';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='DUE_OUT'){
|
||||
return 'hz-status-dueout';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='RESERVED'){
|
||||
return 'hz-status-reserved';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}else if(approveStatus.toUpperCase()==='W'){
|
||||
return 'hz-status-waitlist';
|
||||
}
|
||||
else
|
||||
{
|
||||
if(operaStatus==null) return '';
|
||||
if(operaStatus.toUpperCase()==='DUE_IN'){
|
||||
return 'hz-status-duein';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='CHECKED_IN'){
|
||||
return 'hz-status-checkedin';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='CHECKED_OUT'){
|
||||
return 'hz-status-waitlist';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='DUE_OUT'){
|
||||
return 'hz-status-dueout';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='RESERVED'){
|
||||
return 'hz-status-reserved';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Opera status为空,Approve Status不为空的情况
|
||||
else if((operaStatus==null || operaStatus==undefined) && (approveStatus!=null && approveStatus!=undefined))
|
||||
{
|
||||
if(approveStatus.toUpperCase()==='PN'){
|
||||
return 'hz-status-font-pending';
|
||||
}else if(approveStatus.toUpperCase()==='W'){
|
||||
return 'hz-status-font-waitlist';
|
||||
}else{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
getStatusTextColor(){
|
||||
return function (booking) {
|
||||
let operaStatus = null;
|
||||
if(booking==null){
|
||||
return '';
|
||||
}
|
||||
if(booking.lastOperaStatus!=null){
|
||||
operaStatus = booking.lastOperaStatus;
|
||||
}
|
||||
let approveStatus = null;
|
||||
if(booking.approveStatus!=null){
|
||||
approveStatus = booking.approveStatus;
|
||||
}
|
||||
// Opera和Approve Status都不为空的情况
|
||||
if((operaStatus!=null && operaStatus!=undefined) || (approveStatus!=null && approveStatus!=undefined))
|
||||
{
|
||||
if(approveStatus.toUpperCase()==='PN'){
|
||||
return 'hz-status-font-pending';
|
||||
}else if(approveStatus.toUpperCase()==='N'){
|
||||
if(operaStatus!==null && operaStatus!==undefined && operaStatus!=='' && operaStatus!=='null'){
|
||||
if(operaStatus.toUpperCase()==='DUE_IN'){
|
||||
return 'hz-status-font-duein';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='CHECKED_IN'){
|
||||
return 'hz-status-font-checkedin';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='CHECKED_OUT'){
|
||||
return 'hz-status-font-waitlist';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='DUE_OUT'){
|
||||
return 'hz-status-font-dueout';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='RESERVED'){
|
||||
return 'hz-status-font-reserved';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}else if(approveStatus.toUpperCase()==='W'){
|
||||
return 'hz-status-font-waitlist';
|
||||
}
|
||||
else
|
||||
{
|
||||
if(operaStatus==null) return '';
|
||||
if(operaStatus.toUpperCase()==='DUE_IN'){
|
||||
return 'hz-status-font-duein';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='CHECKED_IN'){
|
||||
return 'hz-status-font-checkedin';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='CHECKED_OUT'){
|
||||
return 'hz-status-font-waitlist';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='DUE_OUT'){
|
||||
return 'hz-status-font-dueout';
|
||||
}
|
||||
else if(operaStatus.toUpperCase()==='RESERVED'){
|
||||
return 'hz-status-font-reserved';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Opera status为空,Approve Status不为空的情况
|
||||
else if((operaStatus==null || operaStatus==undefined) && (approveStatus!=null && approveStatus!=undefined))
|
||||
{
|
||||
if(approveStatus.toUpperCase()==='PN'){
|
||||
return 'hz-status-font-pending';
|
||||
}else if(approveStatus.toUpperCase()==='W'){
|
||||
return 'hz-status-font-waitlist';
|
||||
}
|
||||
else{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
getStatusText(){
|
||||
return function (booking) {
|
||||
let operaStatus = null;
|
||||
if(booking==null){
|
||||
return;
|
||||
}
|
||||
if(booking.lastOperaStatus!=null){
|
||||
operaStatus = booking.lastOperaStatus;
|
||||
}
|
||||
let approveStatus = null;
|
||||
if(booking.approveStatus!=null){
|
||||
approveStatus = booking.approveStatus;
|
||||
}
|
||||
if((operaStatus!=null && operaStatus!=undefined) || (approveStatus!=null && approveStatus!=undefined))
|
||||
{
|
||||
if(approveStatus.toUpperCase()==='PN' || approveStatus.toUpperCase()==='W'){
|
||||
if(approveStatus!==null && approveStatus!==undefined && approveStatus!=='' && approveStatus!=='null')
|
||||
return mapApproveStatus(approveStatus.toUpperCase());
|
||||
}else if( approveStatus.toUpperCase()==='N'){
|
||||
if(operaStatus!==null && operaStatus!==undefined && operaStatus!=='' && operaStatus!=='null')
|
||||
return mapOperaStatus(operaStatus.toUpperCase());
|
||||
}
|
||||
}
|
||||
else if((operaStatus==null || operaStatus==undefined) && (approveStatus!=null && approveStatus!=undefined))
|
||||
{
|
||||
return mapApproveStatus(approveStatus.toUpperCase());
|
||||
}
|
||||
}
|
||||
},
|
||||
getSpecial(){
|
||||
return function (specialName,bedTypeName) {
|
||||
let str = ''
|
||||
if(bedTypeName!=null && bedTypeName!=''){
|
||||
str = bedTypeName;
|
||||
}
|
||||
if(specialName!=null && specialName!=''){
|
||||
if(str == ''){
|
||||
str = specialName;
|
||||
}else{
|
||||
str = str+", "+ specialName;
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
},
|
||||
getSharer(){
|
||||
return function (playerId,name) {
|
||||
let id = null;
|
||||
if(playerId!==null && playerId!==undefined && playerId!=='' && playerId!=='null'){
|
||||
id = playerId;
|
||||
}
|
||||
let na = null;
|
||||
if(name!==null && name!==undefined && name!=='' && name!=='null'){
|
||||
na = name;
|
||||
}
|
||||
let res = '';
|
||||
if(id!=null){
|
||||
res = id;
|
||||
}
|
||||
if(na!=null){
|
||||
if(res!==''){
|
||||
res = res + ', ' + na;
|
||||
}else{
|
||||
res = na;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
},
|
||||
dateFormat() {
|
||||
return function (date) {
|
||||
if (date != undefined) {
|
||||
let weekNum = dayjs(date).day();
|
||||
let week = '';
|
||||
switch(weekNum){
|
||||
case 1:
|
||||
week='Mon'
|
||||
break;
|
||||
case 2:
|
||||
week='Tue';
|
||||
break;
|
||||
case 3:
|
||||
week='Wed';
|
||||
break;
|
||||
case 4:
|
||||
week='Thu';
|
||||
break;
|
||||
case 5:
|
||||
week='Fri';
|
||||
break;
|
||||
case 6:
|
||||
week='Sat';
|
||||
break;
|
||||
case 0:
|
||||
week='Sun';
|
||||
break;
|
||||
}
|
||||
return '('+week+') ' + dayjs(date).format("YYYY-MM-DD");
|
||||
}
|
||||
}
|
||||
},
|
||||
getNight(){
|
||||
return function (num) {
|
||||
if(num!==null && num!==undefined && num!=='null')
|
||||
{
|
||||
if(num>1){
|
||||
return num + " " + this.$t("common.nights");
|
||||
}else{
|
||||
return num + " " + this.$t("common.night");
|
||||
}
|
||||
}
|
||||
else
|
||||
return '';
|
||||
}
|
||||
},
|
||||
getRoom(){
|
||||
return function (num) {
|
||||
if(num!==null && num!==undefined && num!=='null')
|
||||
{
|
||||
if(num>1){
|
||||
return num + " " + this.$t("common.rooms");
|
||||
}else{
|
||||
return num + " " + this.$t("common.room");
|
||||
}
|
||||
}
|
||||
else
|
||||
return '';
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user