Commit 77a7a75e authored by 罗超's avatar 罗超

Merge branch 'master' of http://gitlab.oytour.com/zk123/jz_travel

parents 9097095a 1085099b
......@@ -39,6 +39,12 @@
justify-content: space-between;
flex-wrap: nowrap;
}
.row-sbs-n{
display: flex;
align-items: center;
justify-content: space-around;
flex-wrap: nowrap;
}
.row-sbas-n{
display: flex;
justify-content: space-between;
......@@ -137,6 +143,9 @@
.width100{
width: 100rpx;
}
.width436{
width: 436rpx;
}
.width100One{
width: 100%;
}
......@@ -245,6 +254,9 @@
.MR20{
margin-right: 20rpx;
}
.MR25{
margin-right: 25rpx;
}
.MR30{
margin-right: 30rpx;
}
......@@ -347,6 +359,9 @@
.PT123{
padding-top: 123rpx;
}
.PB20{
padding-bottom: 20rpx;
}
.PB200{
padding-bottom: 200rpx;
}
......@@ -362,9 +377,18 @@
.PX4{
padding: 0 4rpx;
}
.PX10{
padding: 0 10rpx;
}
.PX20{
padding: 0 20rpx;
}
.PX50{
padding: 0 50rpx;
}
.PX53{
padding: 0 53rpx;
}
.relativeFT5{
top: -5rpx;
}
......
......@@ -4,7 +4,9 @@
<view class="column">
<view class="AirplanePassengerAddEditingC-text row-sb-n fz30">
<text class="flexS AirplanePassengerAddEditingC-textL">姓名(英文)</text>
<input class="flexG fontBold" type="text" placeholder="英文姓名,请于乘机证件相同"
<input class="flexG"
:class="[addMsg.SurName?'fontBold':'']" type="text" placeholder="请输入英文姓名,请于乘机证件相同"
:placeholder-style="placeholderStyle"
v-model="addMsg.SurName"/>
</view>
<view class="height-line1"></view>
......@@ -25,9 +27,13 @@
<view class="column">
<view class="AirplanePassengerAddEditingC-text row-sb-n fz30">
<text class="flexS AirplanePassengerAddEditingC-textL">证件号</text>
<input v-if="addMsg.GuestType==1" class="flexG fontBold" type="text" placeholder="请输入身份证号码"
<input v-if="addMsg.GuestType==1" class="flexG" type="text" placeholder="请输入身份证号码"
:class="[addMsg.IdCard?'fontBold':'']"
:placeholder-style="placeholderStyle"
v-model="addMsg.IdCard" @blur="setBirthday"/>
<input v-if="addMsg.GuestType==2" class="flexG fontBold" type="text" placeholder="请输入护照号码"
<input v-if="addMsg.GuestType==2" class="flexG" type="text" placeholder="请输入护照号码"
:class="[addMsg.PassportNo?'fontBold':'']"
:placeholder-style="placeholderStyle"
v-model="addMsg.PassportNo" @blur="setBirthday"/>
</view>
<view class="height-line1"></view>
......@@ -115,7 +121,8 @@
result:null,show: false,GuestType:1,GuestNum: 1,Id:0
},
GuestList: [],
editorIndex: null
editorIndex: null,
placeholderStyle: "color:#B8B8C0",
}
},
onLoad(options){
......@@ -147,12 +154,10 @@
}
if(this.GuestList.length>0){
uni.setStorageSync("GuestList",this.GuestList)
}
setTimeout(()=>{
uni.navigateBack({
delta: -1
})
},200)
}
},
setBirthday(){
if(this.addMsg.GuestType==1){
......
......@@ -7,23 +7,25 @@
>
<NavigationHeader :title="title" :titleStyle="titleStyle"></NavigationHeader>
<!-- :style="{top:topheight+'px'}" -->
<view class="TicketOrderDetailsC overflow PT123 PB260">
<view class="TicketOrderDetailsC overflow PT123 PB260" v-if="orderData&&orderData.model">
<view class="PY53">
<view class="row-sb-n MT20">
<view class="flexS row-aic-n">
<img class="inlineblock MR20" mode="widthFix" style="width: 44rpx;height: 44rpx;"
:src="statusImg[0]"/>
<!-- 已付款 待付款 已取消colorC6C1BC -->
<text class="fz36 fontBold">已付款</text>
:src="orderStatus.icon"/>
<!-- 已付款 待付款 已取消 -->
<text class="fz36 fontBold"
:class="[orderStatus.code==-1?'colorC6C1BC':'']">{{orderStatus.text}}</text>
</view>
<view @click="getDetail">
<text class="fz26 colorC09D4F">¥</text>
<text class="fz36 colorC09D4F fontBold ML15"> 759.9</text>
<img class="inlineblock ML10" mode="widthFix" style="width: 18rpx;height: 12rpx;"
<text class="fz36 colorC09D4F fontBold ML15"> {{dataModel.PreferPrice}}</text>
<img class="inlineblock ML10 relative" mode="widthFix" style="width: 18rpx;height: 12rpx;top:-8rpx"
:src="statusImg[3]"/>
</view>
</view>
<view class="TicketOrderDetailsCard MT45 bgFFF hidden">
<!--
<view class="row-sb-n">
<view class="row-aic-n">
<view class="fz28 color111 ML20">
......@@ -36,7 +38,6 @@
<view class="fz28 colorE1C278 row-aic-n" @click="TicketDetails(items)">
<text>详情</text>
<uni-icons class="ML10" color="#DEBF7B" :type="items.show?'arrowdown':'arrowright'" size="14"></uni-icons>
<!-- <uni-icons class="ML10" color="#DEBF7B" type="arrowright" size="14"></uni-icons> -->
</view>
</view>
<view class="MT60 PX50" style="display: none;">
......@@ -125,49 +126,68 @@
</view>
</view>
</view>
</view>
<view class="height-dashed1 DashedECF1F4 relative MT30">
<view class="TicketOrderDetailsBor-LR TicketOrderDetailsBor-L absolute z-index2 bgF2EEE5"></view>
<view class="TicketOrderDetailsBor-LR TicketOrderDetailsBor-R absolute z-index2 bgF2EEE5"></view>
</view> -->
<TicketOrderDetails :DetailsList="NewDetailsList"></TicketOrderDetails>
<view class="PX50">
<view class="height-dashed1 DashedECF1F4 relative MT30" v-if="GuestList&&GuestList.length>0">
<!-- <view class="TicketOrderDetailsBor-LR TicketOrderDetailsBor-L absolute z-index2 bgF2EEE5"></view>
<view class="TicketOrderDetailsBor-LR TicketOrderDetailsBor-R absolute z-index2 bgF2EEE5"></view> -->
</view>
<view class="MT38">
<view class="TicketOrderDetailsN-box" v-for="(item,index) in 3">
<view class="TicketOrderDetailsN-box" v-for="(item,index) in GuestList">
<view class="row-sb-n ">
<view class="TicketOrderDetails-Name MR40 fz26 color9999A5 textRight flexS">
<text>01</text>
<text>{{index+1>=10?index:'0'+(index+1)}}</text>
<text class="ML15">乘机人</text>
</view>
<view class="fz26 fontBold color1D1D20 flexG">
<text class="width100One ellipsis1">李润豪</text>
<text class="width100One ellipsis1">{{item.SurName}}</text>
</view>
<view class="fz22 color9999A5 flexS">
¥258.5
<!-- ¥{{item.Unit_Price}} -->
</view>
</view>
<view class="row-sb-n MT25">
<view class="TicketOrderDetails-Name MR40 fz26 color9999A5 textRight flexS">
<text></text>
<text class="ML15">身份证</text>
<text class="ML15">证件号</text>
</view>
<view class="fz26 fontBold color1D1D20 flexG">
514474455121454521
{{item.IdCard?item.IdCard:item.PassportNo}}
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
<view class="airTicketDetailsFooter fixedFooter bgFFF fixed row-ajc-n z-index2">
<view class="TicketOrderDetailsFooter">
<view class="airTicketDetailsFooter-order bgDEBF7B row-ajc-w fontBold">
<!-- 取消订单 立即支付 重新下单 -->
<view class="airTicketDetailsFooter fixedFooter bgFFF fixed z-index2">
<view class="TicketOrderDetailsFooter row-sbs-n"
v-if="dataModel.OrderState==1||dataModel.OrderState==2||dataModel.OrderState==3">
<view v-if="dataModel.OrderState==1||dataModel.OrderState==2||dataModel.OrderState==3"
class="airTicketDetailsFooter-order row-ajc-w fontBold ML50"
:class="[loading?'bgF5':'bgF5 colorDEBF7B']"
@click="cancelOrder(dataModel)">
<text class="fz32">取消订单</text>
</view>
<view v-if="dataModel.OrderState==1||dataModel.OrderState==2"
class="airTicketDetailsFooter-order row-ajc-w fontBold MR50"
:class="[loading?'bgF5':'bgDEBF7B']"
@click="queren(orderMsg.ID)">
<text class="fz32">立即支付</text>
</view>
</view>
<view class="TicketOrderDetailsFooter row-ajc-n" v-if="dataModel.OrderState==5||dataModel.OrderState==4">
<view
class="airTicketDetailsFooter-order row-ajc-w fontBold"
:class="[loading?'bgF5 colorDEBF7B':'bgDEBF7B']"
@click="goUndOrder(dataModel.TCID)">
<text class="fz32">重新下单</text>
</view>
</view>
</view>
<u-popup
......@@ -181,53 +201,51 @@
@click="showDetailPreviwe=false"></uni-icons>
<view class="fz30 fontBold textCenter">金额明细</view>
<view class="MT75 TicketOrderDetailsGetC">
<view class="TicketOrderDetailsGet-Num MB52">
<view class="TicketOrderDetailsGet-Num MB52" v-for="(item,index ) in NewGuestList">
<view class="row-sb-n">
<text class="flexS">人数</text>
<text class="flexS">{{item.text}}</text>
<view class="TicketOrderDetailsGet-NumA flexS ML30">
<view class="height-line1 lineC8C8CF"></view>
</view>
<view class="TicketOrderDetailsGet-NumR row-aic-n">
<view class="fz30 fontBold ML60 MR60 textRight">
¥654
</view>
<view class="fz30 fontBold textRight">
×1人
</view>
</view>
</view>
<view class="fz24 color9999A5 MT25">(2岁及2岁以上的顾客)</view>
</view>
<view class="TicketOrderDetailsGet-Num MB52">
<view class="row-sb-n">
<text class="flexS">婴儿</text>
<view class="TicketOrderDetailsGet-NumA flexS ML30">
<view class="height-line1 lineC8C8CF"></view>
<view class="fz30 fontBold ML60 MR60 textRight" v-if="item.Unit_Price&&item.Unit_Price>=0">
¥{{item.Unit_Price}}
</view>
<view class="TicketOrderDetailsGet-NumR row-aic-n">
<view class="fz30 fontBold ML60 MR60 textRight">
¥654
<view class="fz30 fontBold textRight flexS" v-if="item.Nums">
×{{item.Nums?item.Nums:''}}人
</view>
<view class="fz30 fontBold textRight">
×1人
</view>
</view>
<view class="fz24 color9999A5 MT25" v-if="index!=2">
<template v-if="index==0">(14岁及以上的顾客)</template>
<template v-if="index==1">(2岁及14岁以下的顾客)</template>
<template v-if="index==2">(2岁以下的顾客)</template>
</view>
<view class="fz24 color9999A5 MT25">(2岁以下的顾客)</view>
</view>
</view>
<view class="absolute TicketOrderDetailsGet-Footer bgFFF row-sb-n">
<view>
<view class="fontBold">
<text class="fz32 color111">¥ </text>
<text class="fz52">3,200</text>
<text class="fz52">{{dataModel.PreferPrice}}</text>
</view>
<view class="fz26 color9999A5 MT5">2</view>
<view class="fz26 color9999A5 MT5">{{dataModel.GuestNum}}</view>
</view>
<view>
<view class="airTicketDetailsFooter-order PXY2463 bgDEBF7B row-ajc-w fontBold">
<!-- 取消订单 立即支付 重新下单 -->
<text class="fz32">去支付</text>
<view class="row-aic-n">
<view v-if="dataModel.OrderState==1||dataModel.OrderState==2||dataModel.OrderState==3"
class="fz32 relative TicketOrderListCard-PrQx MR20"
:class="[loading?'color9999A5':'colorDEBF7B']"
@click="cancelOrder(dataModel)">取 消</view>
<view v-if="dataModel.OrderState==1||dataModel.OrderState==2"
class="airTicketDetailsFooter-order PXY2463 row-ajc-w fontBold"
:class="[loading?'bgF5':'bgDEBF7B']"
@click="queren(orderMsg.ID)">
<text class="fz32">立即支付</text>
</view>
<view v-if="dataModel.OrderState==5||dataModel.OrderState==4"
class="airTicketDetailsFooter-order PXY2463 row-ajc-w fontBold bgDEBF7B borderDEBF7B"
@click="goUndOrder(dataModel.TCID)">
<text class="fz32">重新下单</text>
</view>
</view>
</view>
......@@ -237,12 +255,29 @@
</template>
<script>
import NavigationHeader from "./components/NavigationHeader.vue";
import TicketOrderDetails from "./components/TicketOrderDetails.vue";
import { getDateWeek } from "./dates.js";
export default {
components: {
NavigationHeader
NavigationHeader,
TicketOrderDetails
},
data() {
return {
orderInfo: {},
loading: false,
dataModel:{},
NewGuestList: [],
GuestList: [],
NewDetailsList: [],
DetailsList: [],
orderStatus: {},
showPayBtn: '',
orderData:{},
orderMsg:{
ID: 0,
IsGetGuest: 1
},
showDetailPreviwe: false,
topheight:0,
titleStyle:{},
......@@ -257,6 +292,8 @@
}
},
onLoad(options){
this.orderMsg.ID = options.orderId
this.getOrderDetails()
let that = this;
uni.getSystemInfo({
success(res) {
......@@ -274,18 +311,348 @@
},
methods: {
goUndOrder(TCID){
uni.navigateTo({
url: `/pages/airTicket/airTicketDetails?TCID=${TCID}&Price=${this.dataModel.Unit_Price}`
});
},
TicketDetails(){
},
getDetail(){
this.showDetailPreviwe = true
},
getOrderDetails(){
uni.showLoading()
this.apipost(
"sellorder_post_GetOrderEntity",
this.orderMsg,
(res) => {
if(res.resultCode==1){
this.GuestList = []
this.NewGuestList = []
console.log(res.data,'=======')
this.orderData = res.data;
// IsChargeLossOrders 1是收损单 2否
// IsApplyForCancel 1是小程序端发起取消 2否
this.dataModel = res.data.model
this.orderData.model.GuestList.forEach(x=>{
let obj = {
SurName:x.SurName+x.Name,
PassportNo:x.PassportNo,
IdCard:x.IdCard,
MobilePhone:x.MobilePhone,
ageType: '',
Unit_Price: 0,
NewUnit_Pric: 0,
}
this.GuestList.push(obj)
})
let num = 0
let Unit_Price = 0
let Nums = 0
if(this.dataModel.ManNum>0) {
num = 1;
Unit_Price = this.dataModel.Unit_Price*this.dataModel.ManNum;
Nums = this.dataModel.ManNum
}
if(this.dataModel.BabyNum>0) {
num += 1;
Unit_Price = (this.dataModel.Unit_Price*this.dataModel.BabyNum)*(this.dataModel.BabyPrecent/100);
Nums = this.dataModel.BabyNum
}
if(this.dataModel.ChirdNum>0) {
num += 1;
Unit_Price = (this.dataModel.Unit_Price*this.dataModel.ChirdNum)*(50/100);
Nums = this.ChirdNum
}
for(let i=0;i<num;i++){
let text = '成人'
if(i==1) text = '儿童'
if(i==2) text = '婴儿'
let obj = {
text: text,
Unit_Price: Unit_Price,
Nums: Nums
}
this.NewGuestList.push(obj)
}
this.formatStatus(
this.orderData.model.OrderState,
this.orderData.model.IsChargeLossOrders,
this.orderData.model.IsApplyForCancel
);
if(this.NewDetailsList&&this.NewDetailsList.length==0){
this.getAirDetails(this.orderData.model.TCID)
}else{
uni.hideLoading()
}
}else{
uni.hideLoading()
}
})
},
getAirDetails(TCID){
this.apipost("AirTicket_get_GetTicketDetails",{
OrderId: this.orderMsg.OrderId
TCID: TCID
},
(res) => {
if(res.resultCode==1){
console.log(res,'=====')
// this.B2BSellNum = res.data.B2BSellNum //
// this.BabyPrecent = Number(res.data.BabyPrecent) //婴儿 %费用
// let that = this;
// this.title = that.orderMsg.Unit_Price>0&&that.B2BSellNum>0?'填写下单信息':'机票信息'
let arr = function(list){
list.forEach(x => {
x.time = ''
x.week = ''
x.duration = ''
x.frequency = 0
x.show = true
});
}
arr(res.data.FlightList)
this.DetailsList = res.data.FlightList
this.DetailsList.forEach(y=>{
let date = y.FlightDate.split('-')
y.time = `${date[1]}-${date[2]}`
y.week = getDateWeek(y.FlightDate)
y.duration = `${y.DepartureTime.Days>0?y.DepartureTime.Days+'d ':''}${y.DepartureTime.Hours>0?y.DepartureTime.Hours+'h ':''}${y.DepartureTime.Minutes>0?y.DepartureTime.Minutes+'m ':''}`
y.frequency = this.DetailsList.length-2>1?this.DetailsList.length-2:0
})
let FlightList = []
let NewFlightList = []
let FlightList2 = []
let NewFlightList2 = []
for(let i=0;i<this.DetailsList.length;i++){
if(this.DetailsList.length-1!=i&&this.DetailsList[i].FlightSubType!=3){
FlightList.push(this.DetailsList[i])
}else{
FlightList2.push(this.DetailsList[i])
NewFlightList2.push(this.DetailsList[i])
}
}
for(let i=0;i<FlightList2.length;i++){
let DetailsList = JSON.parse(JSON.stringify(this.DetailsList))
DetailsList.forEach((x,index)=>{
if(x.Arrival_time&&FlightList2[i].Arrival_time){
DetailsList.slice(0,index)
}
})
}
NewFlightList = [FlightList[0],FlightList[FlightList.length-1]]
if(FlightList.length>0){
let obj = {
FlightList: FlightList,
NewFlightList: NewFlightList,
...this.DetailsList[0]
}
this.NewDetailsList.push(obj)
}
if(FlightList2.length>0){
let obj = {
FlightList: FlightList2,
NewFlightList: NewFlightList2,
...this.DetailsList[this.DetailsList.length-1]
}
this.NewDetailsList.push(obj)
}
this.NewDetailsList.forEach((y,index)=>{
if(y.FlightList.length>1){
y.show = false
}
if(index){
y.duration = `${y.ArrivalTime.Days>0?y.ArrivalTime.Days+'d ':''}${y.ArrivalTime.Hours>0?y.ArrivalTime.Hours+'h ':''}${y.ArrivalTime.Minutes>0?y.ArrivalTime.Minutes+'m ':''}`
}
})
}
uni.hideLoading()
})
},
formatStatus(status, loss, isCancel) {
loss = loss ? loss : -1;
//1、已申请;!=1未申请
if (loss == 1 || status == 4) {
this.orderStatus.code = -1;
this.orderStatus.text = "已取消";
this.orderStatus.icon = this.statusImg[2];
this.showPayBtn = false;
} else if (status == 2 && isCancel != 1) {
this.orderStatus.code = 0;
this.orderStatus.text = "待付款";
this.orderStatus.icon = this.statusImg[1];
this.showPayBtn = true;
} else if (status == 2 && isCancel == 1) {
this.orderStatus.code = -2;
this.orderStatus.text = "审核中";
this.orderStatus.icon = this.statusImg[1];
this.showPayBtn = false;
} else if (status == 1) {
this.orderStatus.code = 1;
this.orderStatus.text = "待付款";
this.orderStatus.icon = this.statusImg[1];
this.showPayBtn = false;
} else if (status == 3) {
this.orderStatus.code = 3;
this.orderStatus.text = "已付款";
this.orderStatus.icon = this.statusImg[0];
this.showPayBtn = false;
}
},
cancelOrder(item){
let that = this
if(this.loading){
return
}
//未付款-调用后台取消
uni.showLoading({
title: "请稍等片刻...",
})
this.loading = true
if (
(item.PaymentTime == null || item.PaymentTime == "") &&
(item.OrderState == 1||item.OrderState == 2)
) {
this.apipost(
"sellorder_post_B2BRemoveOrder",
{
ID: item.OrderId,
},
(res) => {
if (res.resultCode == 1) {
uni.showToast({
title: "操作成功",
icon: "success",
});
that.getOrderDetails()
}
uni.hideLoading()
this.loading = false
},
(err) => {
uni.hideLoading()
this.loading = false
}
);
} else {
let msg = {
OrderId: item.OrderId,
UserId: uni.getStorageSync("mall_UserInfo").UserId,
};
//已付款取消申请
this.apipost(
"sellorder_post_AppletUserCancelOrder",
msg,
(res) => {
if (res.resultCode == 1) {
uni.showToast({
title: "操作成功",
icon: "success",
});
that.getOrderDetails()
} else {
}
uni.hideLoading()
this.loading = false
},
(err)=>{
uni.hideLoading()
this.loading = false
}
);
}
},
//微信支付
queren(OrderId) {
if(this.loading){
return
}
uni.showLoading({
title: "请稍等片刻...",
})
this.loading = true
let url = "/api/WeChatPay/GetTravlePayInfo";
let DepartureName = this.NewDetailsList[0].DepartureName
let ArrivalCityName = this.NewDetailsList[0].FlightList[this.NewDetailsList[0].FlightList.length-1].ArrivalCityName
let FlightDate = this.NewDetailsList[0].FlightDate+'/'+this.NewDetailsList[0].Departure_time
let GoodsName = `${DepartureName}-${ArrivalCityName}-${FlightDate}`;
this.request2(
{
url: url,
data: {
OrderId: OrderId,
GoodsName: GoodsName,
OrderPayType: 1,
OpenId: uni.getStorageSync("mall_UserInfo").OpenId,
},
},
(res) => {
try{
this.orderInfo = JSON.parse(res.data);
this.subscribeMsg(OrderId);
}catch(e){
uni.showToast({
title:'无法正常拉取微信支付,你可以稍后重试或联系销售人员线下转款',
icon:'none'
})
}
},
(err) => {
this.loading = false
uni.hideLoading()
console.log(err)
});
},
subscribeMsg(OrderId) {
const that = this;
let tempObj = uni.getStorageSync("basedata")?.mall?.wechatmessage ?? [];
let tmplIds = [];
if (tempObj && tempObj.length > 0) {
tempObj.forEach((x) => {
if (x.Name == "下单成功提醒" || x.Name == "订单取消提醒") {
tmplIds.push(x.MessageId);
}
});
}
uni.requestSubscribeMessage({
tmplIds: tmplIds,
complete(res) {
that.Pay(OrderId);
},
});
},
Pay(OrderId) {
let that = this;
uni.requestPayment({
provider: "wxpay",
timeStamp: this.orderInfo.timeStamp,
nonceStr: this.orderInfo.nonceStr,
package: this.orderInfo.package,
signType: this.orderInfo.signType,
paySign: this.orderInfo.sign,
success: function (res) {
that.loading = false
uni.hideLoading()
console.log("success", res);
uni.showToast({
title: "支付成功",
});
that.getOrderDetails()
},
fail: function (err) {
that.loading = false
uni.hideLoading()
console.log("fail:", err);
uni.showToast({
title: "支付失败",
icon: "none",
});
},
});
},
scroll(e) {
this.boxOption = Math.floor((e.detail.scrollTop - 50) / 1.5);
......@@ -308,7 +675,7 @@
}
.TicketOrderDetailsCard{
border-radius: 50rpx;
padding: 30rpx 50rpx 37rpx 42rpx;
padding: 30rpx 0 37rpx 0;
margin-bottom: 90rpx;
}
.TicketOrderDetailsCard-Time{
......
......@@ -4,8 +4,8 @@
<view class="TicketOrderList-header bgFFF fixed row-sb-n z-index3">
<view v-for="(item,index) in TicketOrderTyle"
class="border1 hidden fz24 bgF5 textCenter"
:class="[OrderTyle==item.Id?'borderDEBF7B':'borderF5']"
@click="research(item)">
:class="[msg.orderState==item.Id?'borderDEBF7B':'borderF5']"
@click="research(item.Id)">
{{item.Name}}
</view>
</view>
......@@ -15,9 +15,7 @@
@scrolltolower="lower" :style="{ 'height': `calc(100% - ${scrollHeight})`}">
<view class="TicketOrderListC">
<view class="TicketOrderList-box">
<template v-for="(item,index) in dataList">
<TicketOrderList></TicketOrderList>
</template>
<TicketOrderList :dataList="dataList" :msg="msg" @research="research"></TicketOrderList>
</view>
<view style="padding:10px 0;">
<u-loadmore :status="status" :load-text="loadText"
......@@ -30,6 +28,7 @@
</template>
<script>
import TicketOrderList from "./components/TicketOrderList.vue";
import { getDateWeek } from "./dates.js";
export default {
components: {
TicketOrderList
......@@ -39,23 +38,21 @@
scrollTop: 0,
status: 'loadmore',
msg:{
ageIndex:1,
pageSize:5,
OrderStaus:0,
TeacherId:0,
CourseId:0,
ID:0,
StartTime:'',
EndTime:''
pageIndex: 1,
pageSize: 15,
//MiniAppUserId: 0,
orderType:-1,
orderState: 0,
GroupType:5,//线路订单
queryDays:0,
OutBranchId:-1
},
pageCount: 0,
OrderTyle: 1,
dataList: [],
loading: false,
TicketOrderTyle:[
{Name:'全部订单',Id:1},
{Name:'已付款',Id:2},
{Name:'待付款',Id:3},
{Name:'全部订单',Id:0},
{Name:'已付款',Id:3},
{Name:'待付款',Id:1},
{Name:'已取消',Id:4},
],
loadText: {
......@@ -63,20 +60,25 @@
loading: "努力加载中",
nomore: "没有更多了",
},
scrollHeight: 0,
scrollHeight: '30px',
}
},
onLoad(options){
this.msg.orderState = options.orderState?options.orderState:0
},
created() {},
onShow() {
},
mounted() {
this.getList()
setTimeout(() => {
this.getHeadHeight();
}, 1000);
},
methods: {
getHeadHeight() {
return
let that = this;
const query = uni.createSelectorQuery().in(this);
query
......@@ -87,7 +89,7 @@
.exec();
},
research(item) {
this.OrderTyle = item.Id
this.msg.orderState = item
this.msg.pageIndex = 1;
this.getList(1);
},
......@@ -96,14 +98,58 @@
if (type == 1) {
this.dataList = [];
}
return
uni.showLoading()
this.request2({
url: "/api/Hotel/AppGetHotelPage",
data: this.msg,
},
this.apipost(
"sellorder_post_GetTravelOrderAppletList",
this.msg,
(res) => {
if (res.resultCode == 1) {
let arr = function(list){
list.forEach(x=>{
x.time = ''
x.week = ''
x.duration = ''
x.frequency = 0
x.frequencyA = 0
x.different = 0 //是否异地
x.NewFlightList = []
x.loading = false
})
}
arr(res.data.pageData)
res.data.pageData.forEach(x=>{
arr(x.flightList)
})
res.data.pageData.forEach(x=>{
if(x.flightList.length>2){
x.different = 1
}
x.frequency = 0
x.frequencyA = 0
x.flightList.forEach((y,index)=>{
if(y.flightSubType!=3&&x.flightList.length>2){
x.frequency+=1
}
if(y.flightSubType==3){
x.frequencyA+=1
}
let date = y.flightDate.split('-')
y.time = `${date[1]}-${date[2]}`
y.week = getDateWeek(y.flightDate)
if(index==0){
y.frequency = x.frequency
y.duration = `${x.departureTime.days>0?x.departureTime.days+'d ':''}${x.departureTime.hours>0?x.departureTime.hours+'h ':''}${x.departureTime.minutes>0?x.departureTime.minutes+'m ':''}`
x.NewFlightList.push(y)
}
if(x.flightList.length-1==index){
y.frequency = x.frequencyA-1
y.duration = `${x.arrivalTime.days>0?x.arrivalTime.days+'d ':''}${x.arrivalTime.hours>0?x.arrivalTime.hours+'h ':''}${x.arrivalTime.minutes>0?x.arrivalTime.minutes+'m ':''}`
x.NewFlightList.push(y)
}
// x.NewFlightList[0].frequency = y.frequency
})
})
if (this.msg.pageIndex === 1) {
this.dataList = res.data.pageData;
} else {
......
......@@ -8,20 +8,26 @@
>
<NavigationHeader :title="title" :titleStyle="titleStyle"></NavigationHeader>
<view class="PT123 PB260">
<view class="row-ajc-n MT45 MB30 fz40 fontBold">
<view class="row-ajc-n MT45 MB30 fz40 fontBold" v-if="NewDetailsList.length>0">
<view>{{NewDetailsList[0].DepartureName}}</view>
<img class="inlineblock ML50 MR50" mode="widthFix" style="width: 79rpx;height: 38rpx"
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1696990221000_663.png"/>
<view>{{NewDetailsList[0].FlightList[NewDetailsList[0].FlightList.length-1].ArrivalCityName}}</view>
<view>
{{NewDetailsList[0].FlightList[NewDetailsList[0].FlightList.length-1].ArrivalCityName}}
</view>
</view>
<AirTicketDetails v-if="NewDetailsList.length>0" :DetailsList="NewDetailsList"></AirTicketDetails>
<template v-if="orderMsg.Unit_Price>0&&B2BSellNum>0">
<view class="PX50 MT20 MB30 row-aic-n">
<img class="inlineblock MR10" mode="widthFix" style="width: 167rpx;height: 31rpx"
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1697021959000_719.png"/>
<view class="fz26 color1D1D20 ML31">
<text>已选:{{orderMsg.GuestNum}} 人数 </text>
<text class="ML30">{{orderMsg.BabyNum}} 婴儿</text>
<view class="fz26 color1D1D20 ML31" v-if="orderMsg.ManNum>0||orderMsg.BabyNum>0||orderMsg.ChirdNum>0">
<text>已选:
<!-- {{orderMsg.GuestNum}} <text class="fz22"></text> -->
</text>
<text class="ML30" v-if="orderMsg.ManNum>0">{{orderMsg.ManNum}} <text class="fz22">成人</text></text>
<text class="ML30" v-if="orderMsg.BabyNum>0">{{orderMsg.BabyNum}} <text class="fz22">婴儿</text></text>
<text class="ML30" v-if="orderMsg.ChirdNum>0">{{orderMsg.ChirdNum}} <text class="fz22">儿童</text></text>
</view>
</view>
<view class="PX50">
......@@ -76,16 +82,18 @@
<!-- {{orderMsg.Unit_Price}} -->
{{orderMsg.PreferPrice}}
</text>
<!-- <text class="airTicketDetailsFooter-text fz26 ML10 relative">
/
</text> -->
<text class="airTicketDetailsFooter-text fz26 ML10 relative" v-if="orderMsg.GuestNum>0">
共 {{orderMsg.GuestNum}}
</text>
</view>
<view class="row-acje">
<view class="airTicketDetailsFooter-order row-ajc-w bgDEBF7B fontBold"
v-if="!loading&&orderMsg.ManNum>0&&orderMsg.ContactMobile" @click="SubmitOrder">
<text class="fz32">立即下单</text>
</view>
<view v-else class="airTicketDetailsFooter-order row-ajc-w bgF5 fontBold">
<view class="airTicketDetailsFooter-order row-ajc-w fontBold" @click="SubmitOrder"
:class="[
loading
||!orderMsg.ManNum
||!orderMsg.ContactMobile
||orderMsg.ContactMobile.length>11
||11>orderMsg.ContactMobile.length?'bgF5':'bgDEBF7B']">
<text class="fz32">立即下单</text>
</view>
</view>
......@@ -110,8 +118,9 @@
OrderId: 0,
TCID: 0,
CustomerId: 0,//同行Id
ManNum: 0,
BabyNum: 0,
ManNum: 0,//成人
ChirdNum: 0,//儿童
BabyNum: 0,//婴儿
GuestNum: 0,//总人数
YSeatNum: 0,//经济舱
FSeatNum: 0,//头等舱
......@@ -191,6 +200,7 @@
watch: {
GuestList:{
handler(newVal, oldval) {
this.orderMsg.GuestList = []
newVal.forEach(x=>{
let obj = {
SurName: x.SurName,
......@@ -211,9 +221,7 @@
},
"orderMsg.GuestNum":{
handler(newVal, oldval) {
if(this.BabyPrecent>0){
this.getPrice()
}
},
deep: true,
immediate: true
......@@ -244,24 +252,31 @@
return x.GuestNum==2
})
this.orderMsg.ManNum = resultMan.length
this.orderMsg.BabyNum = resultBab.length
this.orderMsg.GuestNum = this.orderMsg.ManNum+this.orderMsg.BabyNum
let BabyNum = resultBab.length
this.orderMsg.GuestNum = this.orderMsg.ManNum+BabyNum
let ChirdNum = this.orderMsg.ManNum-BabyNum
if(ChirdNum<0){
this.orderMsg.ChirdNum = ChirdNum*-1
}else{
this.orderMsg.ChirdNum = 0
}
this.orderMsg.BabyNum = BabyNum>0?(BabyNum-this.orderMsg.ChirdNum):0
if(this.BabyPrecent>0){
this.getPrice()
}
},
// 计算金额及座位
getPrice(){
this.orderMsg.PreferPrice = 0
this.orderMsg.YSeatNum = 0
let YSeatNum = this.orderMsg.ManNum
let computeBabyNum = this.orderMsg.ManNum - this.orderMsg.BabyNum
let money = this.orderMsg.Unit_Price * this.orderMsg.ManNum;
if((computeBabyNum==0||computeBabyNum<0||computeBabyNum>0)&&this.orderMsg.BabyNum>0){
if(computeBabyNum==0) money += (this.orderMsg.Unit_Price * this.orderMsg.BabyNum)*(this.BabyPrecent/100)
if(computeBabyNum<0) {
money += (this.orderMsg.Unit_Price * this.orderMsg.ManNum)*(this.BabyPrecent/100)
money += (this.orderMsg.Unit_Price*(computeBabyNum*-1))*(50/100)
YSeatNum += (computeBabyNum*-1)
if(this.orderMsg.BabyNum>0||this.orderMsg.ChirdNum>0){
if(this.orderMsg.BabyNum>0) money += (this.orderMsg.Unit_Price * this.orderMsg.BabyNum)*(this.BabyPrecent/100)
if(this.orderMsg.ChirdNum>0) {
money += (this.orderMsg.Unit_Price*this.orderMsg.ChirdNum)*(50/100)
YSeatNum += this.orderMsg.ChirdNum
}
if(computeBabyNum>0) money += (this.orderMsg.Unit_Price * this.orderMsg.BabyNum)*(this.BabyPrecent/100)
}
this.orderMsg.PreferPrice = money
this.orderMsg.YSeatNum = YSeatNum
......@@ -288,12 +303,7 @@
this.$forceUpdate();
},
SubmitOrder(){
if(this.orderMsg.GuestList.length==0){
uni.showToast({
title: '添加乘机人',
icon: 'none',
mask: true
});
if(this.loading){
return
}
if(this.orderMsg.GuestList.length==0){
......@@ -312,13 +322,16 @@
});
return
}
uni.showLoading()
uni.showLoading({
title: "请稍等片刻...",
})
this.loading = true
this.apipost("sellorder_post_SetOrderInfoForAirTicket",this.orderMsg,
(res) => {
if(res.resultCode==1){
this.queren(res.data)
}
},(err)=>{
this.loading = false
uni.hideLoading()
})
......@@ -354,6 +367,8 @@
}
},
(err) => {
this.loading = false
uni.hideLoading()
console.log(err)
});
},
......@@ -385,28 +400,34 @@
signType: this.orderInfo.signType,
paySign: this.orderInfo.sign,
success: function (res) {
that.loading = false
uni.hideLoading()
console.log("success", res);
uni.showToast({
title: "支付成功",
});
uni.removeStorageSync("GuestList")
setTimeout(() => {
uni.redirectTo({
url:
"/pages/jiuzhai/paysuccess?PreferPrice=" +
this.orderMsg.PreferPrice +
that.orderMsg.PreferPrice +
"&isFrom=3",
});
}, 100);
},
fail: function (err) {
that.loading = false
uni.hideLoading()
console.log("fail:", err);
uni.showToast({
title: "支付失败",
icon: "none",
});
uni.removeStorageSync("GuestList")
setTimeout(() => {
uni.redirectTo({
url: "/pages/airTicket/TicketOrderList?orderId=" + OrderId,
url: "/pages/airTicket/TicketOrderList?orderState=1",
});
}, 100);
},
......@@ -434,12 +455,15 @@
}
arr(res.data.FlightList)
this.DetailsList = res.data.FlightList
this.DetailsList.forEach(y=>{
this.DetailsList.forEach((y,index)=>{
let date = y.FlightDate.split('-')
y.time = `${date[1]}-${date[2]}`
y.week = getDateWeek(y.FlightDate)
if(index){
y.duration = `${y.ArrivalTime.Days>0?y.ArrivalTime.Days+'d ':''}${y.ArrivalTime.Hours>0?y.ArrivalTime.Hours+'h ':''}${y.ArrivalTime.Minutes>0?y.ArrivalTime.Minutes+'m ':''}`
}else{
y.duration = `${y.DepartureTime.Days>0?y.DepartureTime.Days+'d ':''}${y.DepartureTime.Hours>0?y.DepartureTime.Hours+'h ':''}${y.DepartureTime.Minutes>0?y.DepartureTime.Minutes+'m ':''}`
y.frequency = this.DetailsList.length-2>1?this.DetailsList.length-2:0
}
})
let FlightList = []
let NewFlightList = []
......@@ -447,26 +471,24 @@
let NewFlightList2 = []
for(let i=0;i<this.DetailsList.length;i++){
if(this.DetailsList.length-1!=i){
if(this.DetailsList[i].FlightSubType!=3){
FlightList.push(this.DetailsList[i])
if(this.DetailsList.length-2==i||i==0){
NewFlightList.push(this.DetailsList[i])
}
}else{
FlightList2.push(this.DetailsList[i])
NewFlightList2.push(this.DetailsList[i])
}
}
if(FlightList.length==this.DetailsList.length-1){
NewFlightList = [FlightList[0],FlightList[FlightList.length-1]]
if(FlightList.length>0){
let obj = {
FlightList: FlightList,
NewFlightList: NewFlightList,
...this.DetailsList[0]
...this.DetailsList[0],
}
this.NewDetailsList.push(obj)
}
if(FlightList2.length==1){
if(FlightList2.length>0){
let obj = {
FlightList: FlightList2,
NewFlightList: NewFlightList2,
......@@ -474,8 +496,12 @@
}
this.NewDetailsList.push(obj)
}
this.NewDetailsList.forEach(x=>{
if(x.FlightList.length>1){
x.show = false
}
})
}
this.loading = false
uni.hideLoading()
})
},
......
......@@ -3,7 +3,7 @@
:class="[NewDataList.length==0||2>NewDataList.length?'height100vh':'height100']">
<view class="bgFFF">
<AirTicketHeader></AirTicketHeader>
<view class="StartStopAddress">
<view class="StartStopAddress" v-if="(AddressListAll&&AddressListAll.length>0)||(ArrivalCity&&ArrivalCity.length>0)">
<view class="row-sb-n">
<view class="StartStopAddressText-box">
<view class="column">
......@@ -40,23 +40,22 @@
<view class="height-line1 MT20" ></view>
</view>
<view class="DepartureTime column">
<text class="fz24 color9999A6">出发时间</text>
<text class="fz30 fontBold MT31 MB20"
:class="[StartDateObj.math?'':'color9999A5']">
<template v-if="StartDateObj.math">
{{StartDateObj.math}}{{StartDateObj.date}}日(周{{StartDateObj.week}})
</template>
<template v-else>
选择出发日期
</template>
</text>
<text class="fz24 color9999A6">行程类型</text>
<view class="fz30 fontBold MT31 MB20 row-aic-n">
<view v-for="(item,index) in typeList"
:class="[index?'ML60':'']"
@click="getType(item)">
<uni-icons :color="msgAddress.TicketType==item.Id?'#2EC726':'#C6C1BC'"
:type="msgAddress.TicketType==item.Id?'checkbox-filled':'circle'" size="18"></uni-icons>
<text class="ML20 fz30 fontBold">{{item.Name}}</text>
</view>
</view>
<view class="height-line1"></view>
<view class="DepartureTimeList row-sb-n">
<view style="width: 590rpx;overflow: hidden;">
<scroll-view scroll-x style="width:100%;white-space: nowrap;">
<view
:class="[NewDateList&&NewDateList.length>0?'row-aic-n':'row-w']">
<template v-if="NewDateList&&NewDateList.length>0" v-for="(item,index) in NewDateList">
<view class="row-aic-n" v-if="NewDateList&&NewDateList.length>0">
<template v-for="(item,index) in NewDateList">
<view class="DepartureTimeListC flexS column-ajc fz20"
:class="[StartDateObj.times==item.times?'bgE1C278':'active']"
@click="clickSearch(item,1)">
......@@ -68,11 +67,13 @@
</text>
</view>
</template>
<view v-if="NewDateList.length==0" class="DepartureTimeListC flexS column-ajc fz20" style="width: 100%;">
</view>
<view class="row-w" v-else>
<view class="DepartureTimeListC flexS column-ajc fz20" style="width: 100%;">
<text></text>
<text class="MT10 MB10"></text>
<text class="fz26 color9999A5">
无可选日期
暂无查询到可出发日期
</text>
</view>
</view>
......@@ -87,22 +88,15 @@
</view>
</view>
</view>
<view class="ScreeningCondition row-sb-n bgFFF">
<view class="ScreeningConditionC bgF5"
:class="[item.Id==activeId?'active':'']" v-for="(item,index) in ConditionList"
@click="clickSearch(item.Id,2)">
<text class="fz24">{{item.Name}}</text>
</view>
</view>
<scroll-view :scroll-y="true" style="background-color: #f0f4f7;"
<view class="MT40"></view>
<u-empty v-if="NewDataList.length==0" text="暂无数据" mode="data" padding-top="20"></u-empty>
<scroll-view v-else :scroll-y="true" style="background-color: #f0f4f7;"
:enable-back-to-top="true" :enable-flex="true"
@scrolltolower="lower" :style="{ 'height': `calc(100% - ${scrollHeight})`}">
<AirTicketList v-if="NewDataList.length>0" :dataList="NewDataList"></AirTicketList>
<!-- <view class="MT10 MB10">
<AirTicketList :dataList="NewDataList"></AirTicketList>
<view class="MT10 MB10">
<u-loadmore :status="status" :load-text="loadText" :font-size="24" :margin-top="0" :margin-bottom="0" bg-color="#f0f4f7" />
</view> -->
</view>
</scroll-view>
<u-popup
......@@ -112,19 +106,13 @@
length="90%"
:safe-area-inset-bottom="true"
@close="OffPopup(1)">
<!-- <canlendar
<canlendar
@finish="chosenDateResult"
:immediately="true"
:defaultDate="currentPrice.startDate"
:priceList="dataList.priceList"
:defaultDate="StartDateObj.times"
:priceList="dataList"
title="选择日期"
></canlendar> -->
<canlendar
:StartDate="msg.StartDate"
:EndDate="msg.EndDate"
@finish="chosenDateResult"
title="筛选日期">
</canlendar>
></canlendar>
</u-popup>
<u-popup
v-model="showAddressPreviwe"
......@@ -132,18 +120,19 @@
border-radius="50"
:safe-area-inset-bottom="true"
@close="OffPopup(2)">
<Address :AddressType="AddressType"
<AddressGroup
:OriginAddressObj="OriginAddress"
:dataList="AddressType==1?DepartureCityList:ArrivalCity"
@RenewalAddres="RenewalAddres"></Address>
:dataList="AddressList"
@RenewalAddres="RenewalAddres"></AddressGroup>
</u-popup>
</view>
</template>
<script>
import AirTicketHeader from "./components/airTicketHeader.vue";
import canlendar from "./components/time/index.vue";
import canlendar from "./components/sign/index.vue";
import Address from "./components/address/index.vue";
import AddressGroup from "./components/address/indexGroup.vue";
import AirTicketList from "./components/airTicketList.vue";
import { gegerateDates,getBeforeDate,getDateWeek } from "./dates.js";
export default {
......@@ -151,12 +140,17 @@
AirTicketHeader,
canlendar,
Address,
AddressGroup,
AirTicketList
},
data() {
return {
DepartureCityList:[],
ArrivalCity:[],
typeList:[
{Name:'往返',Id:2},
{Name:'单程',Id:1},
],
AddressListAll:[],
AddressList:[],
AddressType: null,//1出发 2目的地
OriginAddress:{
DepartCityName: '',
......@@ -165,12 +159,17 @@
ArriveCityId: 0,//653
},
msgAddress:{
StartDate: '',
EndDate: '',
ArriveCityId: 0,
DepartCityId: 0,
AirLineID:'',
TicketType:'',
TicketType:2,//1单程 2往返
},
StartDateObj:{},
NewDateList:[],
dateList:[],
priceList:[],
activeId: 1,
showAddressPreviwe: false,
loading: false,
......@@ -182,7 +181,7 @@
DepartCityId: 0,//343
ArriveCityId: 0,//653
AirLineID: 0,
TicketType: '',//1单程 2往返
TicketType: 2,//1单程 2往返
},
pageCount: 0,
showTimePreviwe: false,
......@@ -196,7 +195,7 @@
filterDateList: [],
NewDataList:[],
dataList:[],
status: 'loadmore',
status: 'nomore',
loadText: {
loadmore: "轻轻上拉,加载更多",
loading: "努力加载中",
......@@ -208,13 +207,10 @@
}
},
onLoad(options){
if(options.data){
let obj = JSON.parse(options.data)
// this.OriginAddress.DepartCityName = obj.DepartCityName,
this.msg.DepartCityId = this.OriginAddress.DepartCityId = obj.DepartCityId,
// this.OriginAddress.ArriveCityName = obj.ArriveCityName,
this.msg.ArriveCityId = this.OriginAddress.DepartCityId = obj.ArriveCityId
}
this.msg.DepartCityId = this.msgAddress.DepartCityId = this.OriginAddress.DepartCityId = options.DepartCityId?options.DepartCityId:0,
this.msg.ArriveCityId = this.msgAddress.ArriveCityId = this.OriginAddress.ArriveCityId = options.ArriveCityId?options.ArriveCityId:0,
this.msg.TicketType = this.msgAddress.TicketType = options.TicketType>0?options.TicketType:2,
this.U = uni.getStorageSync("mall_UserInfo")
if(this.U&&this.U.Token){
this.isToken = true
......@@ -222,18 +218,25 @@
},
created() {},
mounted() {
this.msg.StartDate = this.msgAddress.StartDate = getBeforeDate(-1, new Date()),
// this.msg.EndDate = getBeforeDate(-183, new Date()),
this.msgAddress.EndDate = getBeforeDate(-183, new Date()),
this.getDataAddressList()
this.msg.StartDate = getBeforeDate(0, new Date()),
this.msg.EndDate = getBeforeDate(-30, new Date()),
this.getDateList(31)
this.getDateList(184)
},
methods: {
getType(item){
this.msg.TicketType = this.msgAddress.TicketType = item.Id
this.getDataAddressList()
this.getDataList()
},
AddressSelection(AddressType){
// 1去程地址 2返程地址 0调换地址
if(AddressType){
this.showAddressPreviwe = true,
this.AddressType = AddressType
}else{
return
let obj = {
DepartCityName: this.OriginAddress.ArriveCityName,
DepartCityId: this.OriginAddress.ArriveCityId,
......@@ -243,16 +246,16 @@
this.OriginAddress = JSON.parse(JSON.stringify(obj))
this.msg.DepartCityId = this.OriginAddress.DepartCityId
this.msg.ArriveCityId = this.OriginAddress.ArriveCityId
if(this.msg.DepartCityId||this.msg.ArriveCityId){
this.getDataList()
}
},
RenewalAddres(SelectObj,AddressType){
if(AddressType==1){
this.OriginAddress.DepartCityName = SelectObj.Name,
this.msg.DepartCityId = this.OriginAddress.DepartCityId = SelectObj.ID
}else{
this.OriginAddress.ArriveCityName = SelectObj.Name,
this.msg.ArriveCityId = this.OriginAddress.ArriveCityId = SelectObj.ID
}
},
RenewalAddres(SelectObj){
this.OriginAddress.DepartCityName = SelectObj.DepartCityName,
this.msg.DepartCityId = this.msgAddress.DepartCityId = this.OriginAddress.DepartCityId = SelectObj.DepartCityId
this.OriginAddress.ArriveCityName = SelectObj.ArriveCityName,
this.msg.ArriveCityId = this.msgAddress.ArriveCityId = this.OriginAddress.ArriveCityId = SelectObj.ArriveCityId
this.showAddressPreviwe = false
this.getDataList()
},
......@@ -277,30 +280,69 @@
let arr = function(list){
list.forEach(x=>{
x.Price = 0
x.frequency = 0
x.frequencyA = 0
x.startDate = '',
x.remainNum = 0,
x.b2BPrice = 0,
x.b2CPrice = 0
})
}
arr(this.dataList)
this.dateList.forEach(x => {
this.dataList.forEach(y=>{
y.remainNum = y.B2BSellNum
y.startDate = y.FlightDate
y.b2BPrice = y.B2BPrice
y.b2CPrice = y.B2CPrice
y.Price = this.isToken?y.B2BPrice:y.B2CPrice
y.NewFlightList = []
if(y.FlightList.length>0&&y.FlightList.length<3){
y.FlightList.forEach(z=>{
let obj = {
y.FlightList.forEach((z,index)=>{
let obj = {}
obj = {
duration:`${y.DepartureTime.Days>0?y.DepartureTime.Days+'d ':''}${y.DepartureTime.Hours>0?y.DepartureTime.Hours+'h ':''}${y.DepartureTime.Minutes>0?y.DepartureTime.Minutes+'m ':''}`,
Days: 1,
...z
}
if(index){
obj = {
duration:`${y.ArrivalTime.Days>0?y.ArrivalTime.Days+'d ':''}${y.ArrivalTime.Hours>0?y.ArrivalTime.Hours+'h ':''}${y.ArrivalTime.Minutes>0?y.ArrivalTime.Minutes+'m ':''}`,
Days: 1,
...z
}
}
y.NewFlightList.push(obj)
})
}else if(y.FlightList.length>2){
y.frequency = 0
y.frequencyA = 0
let FlightDates = y.FlightList.map(z=>{ return z.FlightDate})
let NewFlightDates = []
let Days = []
if(FlightDates&&FlightDates.length>1){
NewFlightDates = FlightDates.slice(0,FlightDates.length-1)
Days = new Set(NewFlightDates)
}
y.FlightList.forEach((z,i)=>{
if(z.FlightType!=3&&y.FlightList.length>2&&i){
y.frequency+=1
}if(z.FlightType==3){
y.frequencyA+=1
}
})
let obj = {
duration:`${y.DepartureTime.Days>0?y.DepartureTime.Days+'d ':''}${y.DepartureTime.Hours>0?y.DepartureTime.Hours+'h ':''}${y.DepartureTime.Minutes>0?y.DepartureTime.Minutes+'m ':''}`,
frequency: y.FlightList.length-2>1?y.FlightList.length-2:1,
frequency: y.frequency-1,
FlightType: y.FlightList[1].FlightType,
Days: Array.from(Days).length>1?Array.from(Days).length:1,
...y.FlightList[0]
}
let obj2 = {
duration:`${y.ArrivalTime.Days>0?y.ArrivalTime.Days+'d ':''}${y.ArrivalTime.Hours>0?y.ArrivalTime.Hours+'h ':''}${y.ArrivalTime.Minutes>0?y.ArrivalTime.Minutes+'m ':''}`,
Days: 1,
frequency: y.frequencyA,
...y.FlightList[y.FlightList.length-1]
}
y.NewFlightList.push(obj)
......@@ -315,10 +357,7 @@
})
});
this.NewDataList = JSON.parse(JSON.stringify(this.dataList))
// this.StartDateObj = this.NewDateList[0]
// this.NewDataList = this.dataList.filter(x=> {
// return x.FlightDate==this.NewDateList[0].times
// })
this.StartDateObj = this.NewDateList.length>0&&this.NewDateList.length==1?this.NewDateList[0]:{}
}
uni.hideLoading()
});
......@@ -350,7 +389,7 @@
this.NewDataList = JSON.parse(JSON.stringify(this.dataList))
setTimeout(()=>{
uni.hideLoading()
},500)
},300)
}else{
this.StartDateObj = item
this.msg.StartDate = item.times
......@@ -359,7 +398,7 @@
})
setTimeout(()=>{
uni.hideLoading()
},500)
},300)
}
}else{
......@@ -367,10 +406,17 @@
}
},
chosenDateResult(obj) {
this.msg.startDate = obj.start;
this.msg.endDate = obj.end;
let NewDateList =this.NewDateList.filter(x=> {
return x.times==obj.start
})
this.StartDateObj = NewDateList.length>0?NewDateList[0]:{}
this.NewDataList = this.dataList.filter(x=> {
return x.FlightDate==obj.start
})
setTimeout(()=>{
uni.hideLoading()
},300)
this.showTimePreviwe = false
this.getDateList(obj.day)
},
OffPopup(){
......@@ -379,20 +425,38 @@
this.apipost("AirTicket_get_GetTicketCity",this.msgAddress,
(res) => {
if(res.resultCode==1){
this.DepartureCityList = res.data.DepartureCityList
this.ArrivalCity = res.data.ArrivalCity
this.AddressListAll = []
res.data.forEach(x=>{
let obj = {
Name: x.Name,
ID: x.ID,
}
this.AddressListAll.push(obj)
x.CityList.forEach(y=>{
let obj2 = {
Name: y.Name,
ID: y.ID,
}
this.AddressListAll.push(obj2)
if(this.msg.ArriveCityId==y.ID){
this.msg.DepartCityId = x.ID
}
})
})
this.AddressList = res.data
if(this.msg.DepartCityId){
let DepartCityName = this.DepartureCityList.filter(x=>{
let DepartCityName = this.AddressListAll.filter(x=>{
return x.ID==this.msg.DepartCityId
})
this.OriginAddress.DepartCityName = DepartCityName[0].Name
this.OriginAddress.DepartCityName = DepartCityName.length>0?DepartCityName[0].Name:''
}
if(this.msg.ArriveCityId){
let ArriveCityName = this.ArrivalCity.filter(x=>{
let ArriveCityName = this.AddressListAll.filter(x=>{
return x.ID==this.msg.ArriveCityId
})
this.OriginAddress.ArriveCityName = ArriveCityName[0].Name
this.OriginAddress.ArriveCityName = ArriveCityName.length>0?ArriveCityName[0].Name:''
}
}
});
},
......
<template>
<view class="airTicketDetailsList column">
<view v-for="(items,i) in dataList">
<view class="airTicketDetailsCard bgFFF"
:class="[dataList.length-1>i?'MB40':'']">
<view class="row-sb-n"
:class="[items.FlightList.length>1?'MR50':'']">
<view class="row-aic-n">
<view>
<view class="airTicketDetailsCard-qfc bgE1C278 fz30 color111 fontBold">
<template v-if="items.FlightSubType==1">去程</template>
<template v-if="items.FlightSubType==3">返程</template>
</view>
</view>
<view class="fz28 color111 ML20">
<text>{{items.time}}</text> <text class="ML10">周{{items.week}}</text>
</view>
<view class="fz28 color111 ML31">
总时长 {{items.duration}}
</view>
</view>
<view v-if="items.FlightList.length>1" class="fz28 colorE1C278 row-aic-n" @click="TicketDetails(items)">
<!-- <text>详情</text> -->
<uni-icons class="ML10" color="#DEBF7B" :type="items.show?'arrowdown':'arrowright'" size="14"></uni-icons>
<!-- <uni-icons class="ML10" color="#DEBF7B" type="arrowright" size="14"></uni-icons> -->
</view>
</view>
<view class="MT60 PX50" v-if="!items.show">
<view class="row relative" v-for="(item,index) in items.NewFlightList"
:class="[index==0?'MB50':'']">
<text v-if="index==1" class="fz18 fontWeight400 colorFF5858 absolute airTicketDetailsCard-timeT">
{{item.time}} 周{{item.week}}
</text>
<view class="airTicketDetailsCard-timeL column flexS MR20 textRight">
<view v-if="index==0" class="fz28 fontBold relative relativeFT10">{{item.Departure_time}} </view>
<view v-if="items.NewFlightList.length-1==index" class="MT25 fz28 fontBold">
{{item.Arrival_time}}
</view>
</view>
<view class="flexS MR30">
<view class="width-lineH49 bgE1C278 relative">
<view class="bgE1C278 absolute WH12R50 airTicketDetailsCard-LinT"></view>
<template v-if="index">
<view class="bgE1C278 absolute WH6R50 airTicketDetailsCard-LinT2"></view>
<view class="bgE1C278 absolute WH6R50 airTicketDetailsCard-LinT3"></view>
<view class="bgE1C278 absolute WH6R50 airTicketDetailsCard-LinT4"></view>
</template>
<view class="bgE1C278 absolute WH12R50 airTicketDetailsCard-LinB"></view>
<template v-if="index!=1">
<view class="bgE1C278 absolute WH6R50 airTicketDetailsCard-LinB2"></view>
</template>
</view>
</view>
<view class="flexG relative">
<view v-if="index!=0" class="airTicketDetailsCard-ZhuanNum bgE1C278 fz18 colorFFF absolute">
<template v-if="items.FlightList.length-1>1">+{{items.FlightList.length-1}}</template>
</view>
<view class="airTicketDetailsCard-title row-aic-n absolute" v-if="index==0">
<img class="inlineblock flexS" mode="widthFix" style="width: 20rpx;height: 17rpx;"
:src="item.AlImage"/>
<view class="flexG">
<text class="block width100One hidden ellipsis1 fz20 ML5 color9999A5 fontWeight400">{{item.AlName}} {{item.Flight_number}} </text>
</view>
</view>
<view class="width436 hidden">
<view class="fz28 fontBold relative relativeFT8 hidden" v-if="index==0">
<text class="block width100One hidden ellipsis1">{{item.DepartureName?item.DepartureName:''}} {{item.dName}}</text>
</view>
<view class="fz28 fontBold MT25 hidden" v-if="index==1">
<text class="block width100One hidden ellipsis1">{{item.ArrivalCityName?item.ArrivalCityName:''}} {{item.aName}}</text>
</view>
</view>
</view>
</view>
</view>
<template v-if="items.show">
<view class="MT60 PX50" v-for="(item,index) in items.FlightList"
:class="[items.FlightList.length-1!=index?'MB50':'']">
<view class="row-aic-n relative"
:class="[items.FlightList.length-1!=index?'MB70':'']">
<text v-if="items.FlightList.length-1==index" class="fz18 fontWeight400 colorFF5858 absolute airTicketDetailsCard-timeT">
{{item.time}}{{item.week}}
</text>
<view class="airTicketDetailsCard-timeL column flexS MR20 textRight">
<view :class="[index?'fz24':'fz28 fontBold']">{{item.Departure_time}} </view>
<view class="MT35" :class="[items.FlightList.length-1!=index?'fz24':'fz28 fontBold']">
{{item.Arrival_time}}
</view>
</view>
<view class="flexS MR30">
<view class="width-lineH83 bgE1C278 relative">
<view class="bgE1C278 absolute WH12R50 airTicketDetailsCard-LinT"></view>
<template v-if="index">
<view class="bgE1C278 absolute WH6R50 airTicketDetailsCard-LinT2"></view>
<view class="bgE1C278 absolute WH6R50 airTicketDetailsCard-LinT3"></view>
</template>
<view class="bgE1C278 absolute WH12R50 airTicketDetailsCard-LinB"></view>
<template v-if="items.FlightList.length-1>index">
<view class="bgE1C278 absolute WH6R50 airTicketDetailsCard-LinB2"></view>
<view class="bgE1C278 fz18 colorFFF absolute airTicketDetailsCard-LinText">
中转
</view>
</template>
</view>
</view>
<view class="column flexG relative">
<view class="airTicketDetailsCard-title row-aic-n absolute">
<img class="inlineblock flexS" mode="widthFix" style="width: 20rpx;height: 17rpx;"
:src="item.AlImage"/>
<view class="flexG">
<text class="block width100One overflow fz20 ML5 color9999A5 fontWeight400">{{item.AlName}} {{item.Flight_number}}</text>
</view>
</view>
<view class="width436 hidden">
<view class="fz28 fontBold relative relativeFT8">
<text class="block width100One hidden ellipsis1">{{item.DepartureName?item.DepartureName:''}} {{item.dName}} </text>
</view>
<view class="fz28 fontBold MT25">
<text class="block width100One hidden ellipsis1">{{item.ArrivalCityName?item.ArrivalCityName:''}} {{item.aName}} </text>
</view>
</view>
</view>
</view>
</view>
</template>
</view>
</view>
</view>
</template>
<script>
export default {
props:['DetailsList'],
components: {
},
data() {
return {
dataList:[
{
show:true
},
{
show:false
},
],
}
},
onLoad(options){
},
watch: {
DetailsList:{
handler(newVal, oldval) {
this.dataList = JSON.parse(JSON.stringify(this.DetailsList))
},
deep: true,
immediate: true
}
},
created() {},
methods: {
TicketDetails(items){
items.show=!items.show
this.$forceUpdate();
},
}
}
</script>
<style scoped>
@import url("@/asset/css/flex.css");
@import url("../style.css");
.airTicketDetailsList{
/* margin: 0 54rpx; */
}
.airTicketDetailsCard{
/* border-radius: 50rpx;
padding: 45rpx 0; */
}
</style>
\ No newline at end of file
<template>
<view class="TicketOrderListCard bgFFF relative">
<view class="TicketOrderListCard-wf absolute bg111 colorFFF fz24 z-index2">异地</view>
<view>
<view class="TicketOrderListCard bgFFF relative" v-for="(item,i) in DataLists"
@click="getDetail(item.orderId)">
<view v-if="item.different" class="TicketOrderListCard-wf absolute bg111 colorFFF fz24 z-index2">异地</view>
<template v-for="(childs,index) in item.NewFlightList">
<view class="row-sb-n">
<view class="flexG"></view>
<view class="fz24 color111 flexS">
<text>09-28</text>
<text class="ML5 MR10"></text>
<text>10:39</text>
<text>{{childs.time}}</text>
<text class="ML5 MR10"> {{childs.week}}</text>
<text>{{childs.departure_time}}</text>
</view>
</view>
<view class="MB55" v-for="(item,index) in 2">
<view
:class="[index?'':'MB10']">
<view class="row-sb-n MT10">
<view class="flexS MR20">
<view class="TicketOrderListCard-qc bgE1C278 fz24 color111 overflow textCenter relative relativeFT8">
......@@ -18,20 +22,23 @@
</view>
</view>
<view class="column flexS">
<text class="fz30 fontBold">09:00 </text>
<text class="fz22 MT5 width100 ellipsis1">天府T2</text>
<text class="fz30 fontBold">{{childs.departure_time}} </text>
<text class="fz22 MT5 width100 ellipsis1">{{childs.dName}}</text>
</view>
<view class="FlightDirection-box relative">
<view class="FlightDirection-Title column">
<!-- :style="{'height':'90rpx'}" -->
<view class="row-ajc-n">
<view class="FlightDirection-zhuan z-index2 MB10">
<text class="block bgECF1F4 fz21 nowrap">转+2</text>
<text v-if="!childs.frequency" class="fz20 color9999A5">{{childs.duration}}</text>
<text v-if="childs.frequency" class="block bgECF1F4 fz21 nowrap">
<template v-if="childs.frequency>1">+{{childs.frequency}}</template>
</text>
</view>
</view>
<view>
<text class="fz19 textCenter width100 ellipsis1 relative relativeFT8">
武汉 北京
{{childs.departureName}} {{childs.arrivalCityName}}
</text>
</view>
</view>
......@@ -44,52 +51,78 @@
</view>
</view>
<view class="column">
<text class="fz36 fontBold">11:30 </text>
<text class="fz22 MT5 width100 ellipsis1">许家坪</text>
<text class="fz36 fontBold">{{childs.arrival_time}} </text>
<text class="fz22 MT5 width100 ellipsis1">{{childs.aName}}</text>
</view>
<view class="ML20 TicketOrderListCard-Pr textRight">
<text v-if="index==1" class="color9999A5 fz32 relative TicketOrderListCard-PrQx">取消</text>
<text v-else class="fz34 fontBold">¥ 5,800</text>
<view v-if="!index" class="fz34 fontBold">
<text class="fz32">¥ </text>
{{item.preferPrice}}
</view>
<view v-if="index==1&&(item.orderState==1||item.orderState==2||item.orderState==3)"
class="fz32 relative TicketOrderListCard-PrQx"
:class="[item.loading?'color9999A5':'colorDEBF7B']"
@click.stop="cancelOrder(item,i)">取 消</view>
</view>
</view>
<view class="row-w">
<view class="aviationTitle row-aic-n">
<view class="aviationTitle row-aic-n hidden">
<img class="inlineblock flexS" mode="widthFix" style="width: 36rpx;height: 30rpx;"
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1696749257000_469.png"/>
:src="childs.alImage"/>
<view class="flexG">
<text class="fz22 ML5 color9999A5 width100One ellipsis1">东航CA1852...</text>
<text class="fz22 ML5 color9999A5 width100One ellipsis1">{{childs.alName}}</text>
</view>
</view>
</view>
</view>
</template>
<view class="row-sb-n MT30">
<view class="fz324 color9999A5 MR30 flexG">
<txet class="block TicketOrderListCard-title width100One ellipsis1">陈伟霆、郑中基等4人</txet>
<txet class="block TicketOrderListCard-title width100One ellipsis1" v-if="item.guestList&&item.guestList.length>0">
<template v-for="(n,is) in item.guestList"
v-if="2>is">
{{n.userName}}
<template v-if="is!=item.guestList.length-1"></template>
</template>
等 {{item.guestList.length}} 人</txet>
</view>
<view class="flexS">
<!-- colorDEBF7B -->
<view class="TicketOrderListCard-buttom overflow fz32 fontBold textCenter border1 bgDEBF7B borderDEBF7B"
@click="getDetail">
<view v-if="(item.orderState==1||item.orderState==2)"
class="TicketOrderListCard-buttom overflow fz32 fontBold textCenter border1"
:class="[item.loading?'bgF5 borderF5 colorDEBF7B':'bgDEBF7B borderDEBF7B']"
@click.stop="queren(item.orderId,i)">
待付款
</view>
<!-- <view class="TicketOrderListCard-buttom overflow fz32 fontBold textCenter border1 bgF5 borderF5 color9999A5">
已取消
</view>
<view class="TicketOrderListCard-buttom overflow fz32 fontBold textCenter border1 bgFFF borderDEBF7B colorDEBF7B">
已支付
<!-- <view v-if="(item.orderState==1||item.orderState==2)&&item.loading"
class="TicketOrderListCard-buttom overflow fz32 fontBold textCenter border1 bgF5 borderF5 colorDEBF7B"
@click.stop="queren(item.orderId,i)">
待付款
</view> -->
<view v-if="item.orderState==3||item.orderState==4"
class="TicketOrderListCard-buttom overflow fz32 fontBold textCenter border1"
:class="[item.orderState==3?'bgFFF borderDEBF7B colorDEBF7B':'bgF5 borderF5 color9999A5']">
{{item.orderState==3?'已支付':'已取消'}}
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
props:['dataList','msg'],
components: {
},
data() {
return {
DataLists:[],
orderData: null,
orderInfo:{},
submit: false,
submitCancel: false,
loading: false,
i: null
}
},
onLoad(options){
......@@ -98,13 +131,186 @@
created() {},
mounted() {
},
watch: {
dataList: {
handler(newVal, oldval) {
this.DataLists = JSON.parse(JSON.stringify(newVal))
},
deep: true,
immediate: true
},
msg: {
handler(newVal, oldval) {
this.dataMsg = JSON.parse(JSON.stringify(newVal))
},
deep: true,
immediate: true
},
},
methods: {
getDetail(item){
cancelOrder(item,i){
let that = this
this.i = i
if(this.DataLists[this.i].loading){
return
}
//未付款-调用后台取消
uni.showLoading({
title: "请稍等片刻...",
})
this.DataLists[this.i].loading = true
if (
(item.paymentTime == null || item.paymentTime == "") &&
(item.orderState == 1||item.orderState == 2)
) {
this.apipost(
"sellorder_post_B2BRemoveOrder",
{
ID: item.orderId,
},
(res) => {
if (res.resultCode == 1) {
uni.showToast({
title: "操作成功",
icon: "success",
});
that.$emit('research',that.dataMsg.orderState)
}
uni.hideLoading()
this.DataLists[this.i].loading = false
},
(err) => {
uni.hideLoading()
this.DataLists[this.i].loading = false
}
);
} else {
let msg = {
OrderId: item.orderId,
UserId: uni.getStorageSync("mall_UserInfo").UserId,
};
//已付款取消申请
this.apipost(
"sellorder_post_AppletUserCancelOrder",
msg,
(res) => {
if (res.resultCode == 1) {
uni.showToast({
title: "操作成功",
icon: "success",
});
that.$emit('research',that.dataMsg.orderState)
} else {
}
uni.hideLoading()
this.DataLists[this.i].loading = false
},
(err)=>{
uni.hideLoading()
this.DataLists[this.i].loading = false
}
);
}
},
getDetail(orderId){
uni.navigateTo({
url: '/pages/airTicket/TicketOrderDetails'
url: `/pages/airTicket/TicketOrderDetails?orderId=${orderId}`
});
},
//微信支付
queren(OrderId,i) {
this.i = i
if(this.DataLists[this.i].loading){
return
}
this.DataLists[this.i].loading = true
let url = "/api/WeChatPay/GetTravlePayInfo";
let DepartureName = this.DataLists[0].departureName
let ArrivalCityName = this.DataLists[0].flightList[this.DataLists[0].flightList.length-1].arrivalCityName
let FlightDate = this.DataLists[0].flightDate+'/'+this.DataLists[0].departure_time
let GoodsName = `${DepartureName}-${ArrivalCityName}-${FlightDate}`;
// GoodsName = GoodsName.slice(0, 10);
uni.showLoading({
title: "请稍等片刻...",
})
this.DataLists[this.i].loading = true
this.request2(
{
url: url,
data: {
OrderId: OrderId,
GoodsName: GoodsName,
OrderPayType: 1,
OpenId: uni.getStorageSync("mall_UserInfo").OpenId,
},
},
(res) => {
try{
this.orderInfo = JSON.parse(res.data);
this.subscribeMsg(OrderId);
}catch(e){
uni.showToast({
title:'无法正常拉取微信支付,你可以稍后重试或联系销售人员线下转款',
icon:'none'
})
}
},
(err) => {
console.log(err)
});
},
subscribeMsg(OrderId) {
const that = this;
let tempObj = uni.getStorageSync("basedata")?.mall?.wechatmessage ?? [];
let tmplIds = [];
if (tempObj && tempObj.length > 0) {
tempObj.forEach((x) => {
if (x.Name == "下单成功提醒" || x.Name == "订单取消提醒") {
tmplIds.push(x.MessageId);
}
});
}
uni.requestSubscribeMessage({
tmplIds: tmplIds,
complete(res) {
that.Pay(OrderId);
},
});
},
Pay(OrderId) {
let that = this;
uni.requestPayment({
provider: "wxpay",
timeStamp: this.orderInfo.timeStamp,
nonceStr: this.orderInfo.nonceStr,
package: this.orderInfo.package,
signType: this.orderInfo.signType,
paySign: this.orderInfo.sign,
success: function (res) {
uni.hideLoading()
that.DataLists[that.i].loading = false
console.log("success", res);
uni.showToast({
title: "支付成功",
});
that.$emit('research',that.dataMsg.orderState)
},
fail: function (err) {
uni.hideLoading()
that.DataLists[that.i].loading = false
console.log("fail:", err);
uni.showToast({
title: "支付失败",
icon: "none",
});
},
});
},
}
}
</script>
......
<template>
<view class="addressIndex-box">
<view class="fz30 fontBold textCenter MB30">选择{{AddressType==1?'出发地':'目的地'}}</view>
<view class="fz30 fontBold MB30">当前{{AddressType==1?'出发地':'目的地'}}</view>
<view class="MT30">
<view class="fz30 fontBold textCenter MB30 PX53 relative">选择{{AddressType==1?'出发地':'目的地'}}
<text v-if="SelectObj.ID" class="fz24 color9999A5 absolute PX10" style="right: 53rpx;top: 0;bottom: 0;" @click="Clear">清空</text>
</view>
<view class="fz30 fontBold MB30 PX53">当前{{AddressType==1?'出发地':'目的地'}}</view>
<view class="MT30 PX53">
<view class="addressIndex-Orientation inlineblock bgF5 row-ajc-n textCenter">
<img class="inlineblock MR10" mode="widthFix" style="width: 18rpx;height: 22rpx"
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1696743247000_254.png"/>
<text class="fz30">{{SelectObj.Name?SelectObj.Name:'--'}}</text>
</view>
</view>
<view class="fz30 fontBold MT45">地址</view>
<view class="fz30 fontBold MT45 PX53">地址</view>
<view class="hidden" style="height: calc(100vh - 60vh);">
<scroll-view :scroll-y="true" :enable-back-to-top="true" :enable-flex="true" :style="{ height: '100%' }">
<view class="addressIndex-toponym row-sb-w">
<template v-for="(item,index) in dataList">
<view class="addressIndex-toponym row-aic-w">
<view class="addressIndex-toponym-box row-ajc-n" v-for="(item,index) in dataList">
<view class="addressIndex-Orientation inlineblock textCenter MT30 fz30"
:class="[SelectObj.ID==item.ID?'bgDEBF7B':'bgF5']"
@click="getAddress(item)">{{item.Name}}</view>
</template>
</view>
</view>
</scroll-view>
</view>
......@@ -30,7 +32,7 @@
return {
SelectObj: {
Name: '',
ID: ''
ID: 0
},
}
},
......@@ -70,6 +72,13 @@
},
methods: {
Clear(){
this.SelectObj = {
Name: '',
ID: 0,
}
this.$emit('RenewalAddres',this.SelectObj ,this.AddressType)
},
getAddress(item){
if(item.ID==this.SelectObj.ID){
this.SelectObj = {
......@@ -93,7 +102,7 @@
@import url("@/asset/css/flex.css");
@import url("../../style.css");
.addressIndex-box{
padding: 46rpx 53rpx 139rpx 53rpx;
padding: 46rpx 0 139rpx 0;
}
.addressIndex-Orientation{
width: 190rpx;
......@@ -101,5 +110,9 @@
border-radius: 30rpx;
}
.addressIndex-toponym{
padding: 0 22rpx;
}
.addressIndex-toponym-box{
flex: 0 0 33.33%;
}
</style>
\ No newline at end of file
<template>
<view class="addressIndex-box">
<view class="fz30 fontBold textCenter MB30 PX53 relative">选择出发地/目的地
<text v-if="SelectObj.DepartCityId||SelectObj.ArriveCityId" class="fz24 color9999A5 absolute PX10"
style="right: 53rpx;top: 0;bottom: 0;" @click="Clear">清空</text>
</view>
<view class="fz30 fontBold MB30 PX53 row-aic-n">
<text style="width: 50%;">当前出发地</text>
<text>当前目的地</text>
</view>
<view class="MT30 PX53 row-aic-n">
<view style="width: 50%;">
<view class="addressIndex-Orientation inlineblock bgF5 row-ajc-n textCenter" style="width: auto; padding: 15rpx 50rpx;">
<img class="inlineblock MR10" mode="widthFix" style="width: 18rpx;height: 22rpx"
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1696743247000_254.png"/>
<text class="fz30">
<template v-if="SelectObj.DepartCityName">
{{SelectObj.DepartCityName}}
</template>
<template v-else>
--
</template>
</text>
</view>
</view>
<view>
<view class="addressIndex-Orientation inlineblock bgF5 row-ajc-n textCenter" style="width: auto; padding: 15rpx 50rpx;">
<img class="inlineblock MR10" mode="widthFix" style="width: 18rpx;height: 22rpx"
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1696743247000_254.png"/>
<text class="fz30">
<template v-if="SelectObj.ArriveCityName">
{{SelectObj.ArriveCityName}}
</template>
<template v-else>
--
</template>
</text>
</view>
</view>
</view>
<view class="height-line1 MT25" ></view>
<view class="fz30 fontBold MT20 PX53 MB20 row-aic-n">
<view style="width: 150rpx;">出发地</view>
<view class="flexG">目的地</view>
</view>
<view class="hidden" style="height: calc(100vh - 60vh);">
<scroll-view :scroll-y="true" :enable-back-to-top="true" :enable-flex="true" :style="{ height: '100%' }">
<template v-for="(item,index) in dataList">
<view class="addressIndex-toponym row-aic-n" :key="item.ID">
<view style="width: 150rpx;"
:class="[SelectObj.DepartCityId==item.ID?'colorDEBF7B':'']"
@click="getAddress(item)">
{{item.Name}}
</view>
<view class="flexG row-aic-w">
<view class="addressIndex-toponym-box" v-for="(items,index) in item.CityList" :key="items.ID">
<view class="addressIndex-Orientation inlineblock textCenter MT10 fz30"
:class="[SelectObj.ArriveCityId==items.ID?'bgDEBF7B':'bgF5']"
@click="getAddress(item,items)">{{items.Name}}</view>
</view>
</view>
</view>
<view class="height-line1 MT10" ></view>
</template>
</scroll-view>
</view>
<view class="AirplanePassengerList-footer fixedFooter bgFFF fixed z-index2">
<view
class="AirplanePassengerList-buttom bgDEBF7B fz32 fontBold textCenter"
@click="RenewalAddres">
确认
</view>
</view>
</view>
</template>
<script>
export default {
props:['OriginAddressObj','dataList'],
data() {
return {
SelectObj: {},
}
},
onLoad(options){
},
watch: {
OriginAddressObj: {
handler(newVal, oldval) {
this.SelectObj = JSON.parse(JSON.stringify(this.OriginAddressObj))
},
deep: true
},
},
created() {},
mounted() {
},
methods: {
RenewalAddres(){
this.$emit('RenewalAddres',this.SelectObj)
},
Clear(){
this.ClearData(null,null,1)
},
ClearData(item,items,type){
if(item||type){
this.SelectObj.DepartCityName = ''
this.SelectObj.DepartCityId = 0
}
if(items||type){
this.SelectObj.ArriveCityName = ''
this.SelectObj.ArriveCityId = 0
}
},
getAddress(item,items){
if(item&&items){
this.ClearData(item,items)
}
if(!items){
this.ClearData(item,items,1)
}
this.ClearData(item,items)
this.SelectObj.DepartCityName = item.Name
this.SelectObj.DepartCityId = item.ID
if(items){
this.SelectObj.ArriveCityName = items.Name
this.SelectObj.ArriveCityId = items.ID
}
// this.$forceUpdate()
},
}
}
</script>
<style scoped>
@import url("@/asset/css/flex.css");
@import url("../../style.css");
.addressIndex-box{
padding: 46rpx 0 139rpx 0;
}
.addressIndex-Orientation{
width: 160rpx;
padding: 15rpx 0;
border-radius: 30rpx;
}
.addressIndex-toponym{
padding: 0 0 0 53rpx;
}
.addressIndex-toponym-box{
flex: 0 0 33.33%;
}
</style>
\ No newline at end of file
......@@ -18,7 +18,7 @@
</view>
</view>
<view v-if="items.FlightList.length>1" class="fz28 colorE1C278 row-aic-n" @click="TicketDetails(items)">
<text>详情</text>
<!-- <text>详情</text> -->
<uni-icons class="ML10" color="#DEBF7B" :type="items.show?'arrowdown':'arrowright'" size="14"></uni-icons>
<!-- <uni-icons class="ML10" color="#DEBF7B" type="arrowright" size="14"></uni-icons> -->
</view>
......@@ -61,13 +61,16 @@
<text class="block width100One overflow fz20 ML5 color9999A5 fontWeight400">{{item.AlName}} {{item.Flight_number}} </text>
</view>
</view>
<view class="width436 hidden">
<view class="fz28 fontBold relative relativeFT8" v-if="index==0">
<text class="block width100One hidden">{{item.DepartureName}} {{item.dName}}</text>
<text class="block width100One hidden ellipsis1">{{item.DepartureName?item.DepartureName:''}} {{item.dName}}</text>
</view>
<view class="fz28 fontBold MT25" v-if="index==1">
<text class="block width100One hidden">{{item.ArrivalCityName}} {{item.aName}}</text>
<text class="block width100One hidden ellipsis1">{{item.ArrivalCityName?item.ArrivalCityName:''}} {{item.aName}}</text>
</view>
</view>
</view>
</view>
</view>
<template v-if="items.show">
......@@ -108,11 +111,13 @@
<text class="block width100One overflow fz20 ML5 color9999A5 fontWeight400">{{item.AlName}} {{item.Flight_number}}</text>
</view>
</view>
<view class="width436 hidden">
<view class="fz28 fontBold relative relativeFT8">
<text class="block width100One hidden">{{item.DepartureName}} {{item.dName}} </text>
<text class="block width100One hidden ellipsis1">{{item.DepartureName?item.DepartureName:''}} {{item.dName}} </text>
</view>
<view class="fz28 fontBold MT25">
<text class="block width100One hidden">{{item.ArrivalCityName}} {{item.aName}} </text>
<text class="block width100One hidden ellipsis1">{{item.ArrivalCityName?item.ArrivalCityName:''}} {{item.aName}} </text>
</view>
</view>
</view>
</view>
......
......@@ -6,7 +6,7 @@
<view v-if="item.FlightList.length>2" class="aviationCard-wf absolute bg111 colorFFF fz20 z-index2">异地往返</view>
<view class="column flexG">
<view
:class="[item.FlightList.length-1!=indexs?'MB30':'']"
:class="[indexs?'':'MB10']"
v-for="(childs,indexs) in item.NewFlightList">
<view class="row-sb-n MT25">
<view class="flexS MR20">
......@@ -27,12 +27,7 @@
<view class="FlightDirection-zhuan z-index2 ML10" v-if="childs.frequency">
<!-- childs.FlightType==2 -->
<text class="block bgECF1F4 fz21 nowrap">
<template v-if="childs.frequency&&childs.frequency>1">
转+{{childs.frequency}}
</template>
<template v-if="childs.frequency&&childs.frequency==1">
经停
</template>
<template v-if="childs.frequency>1">+{{childs.frequency}}</template>
</text>
</view>
</view>
......@@ -55,18 +50,20 @@
<text class="fz36 fontBold">{{childs.Arrival_time}} </text>
<text class="fz22 MT5 width100 ellipsis1">{{childs.aName}}</text>
</view>
<!-- <view class="FlightDirection-time absolute colorFF5858 fz20 nowrap">
<view class="FlightDirection-time absolute colorFF5858 fz20 nowrap">
<text>+</text>
<text class="ML5">1</text>
<text class="ML5">{{childs.Days}}</text>
<text class="ML5"></text>
</view> -->
</view>
</view>
</view>
<view class="row-w MT15">
<view class="aviationTitle row-aic-n">
<img class="inlineblock" mode="widthFix" style="width: 36rpx;height: 30rpx;"
<view>
<img class="inlineblock flexS" mode="widthFix" style="width: 36rpx;height: 30rpx;"
:src="item.AirlineUrl"/>
</view>
<text class="fz22 ML10 color9999A5">{{item.AirLineName}}</text>
</view>
</view>
......
//节假日信息
const day=[
{
year:2022,
month:1,
festival:[
{name:'元旦',day:1},
{name:'除夕',day:31},
]
},
{
year:2022,
month:2,
festival:[
{name:'春节',day:1},
{name:'元宵',day:15},
{name:'情人节',day:14}
]
},
{
year:2022,
month:3,
festival:[
{name:'妇女节',day:8},
]
},
{
year:2022,
month:4,
festival:[
{name:'清明',day:4},
]
},
{
year:2022,
month:5,
festival:[
{name:'劳动节',day:1},
{name:'青年节',day:4},
{name:'母亲节',day:10},
]
},
{
year:2021,
month:6,
festival:[
{name:'儿童节',day:1},
{name:'父亲节',day:21},
{name:'端午',day:14},
]
},
{
year:2021,
month:7,
festival:[
{name:'建党节',day:1}
]
},
{
year:2021,
month:8,
festival:[
{name:'建军节',day:1},
{name:'七夕',day:14},
{name:'中元节',day:22},
]
},
{
year:2021,
month:9,
festival:[
{name:'教师节',day:10},
{name:'中秋',day:21}
]
},
{
year:2021,
month:10,
festival:[
{name:'国庆',day:1},
{name:'重阳',day:14}
]
},
{
year:2021,
month:11,
festival:[
{name:'感恩节',day:26}
]
},
{
year:2021,
month:12,
festival:[
{name:'平安夜',day:24},
{name:'圣诞节',day:25}
]
}
]
export default day
\ No newline at end of file
<template>
<view class="content">
<scroll-view
:scroll-y="true"
style="height: 100%; flex: 1; box-sizing: border-box"
>
<view class="header">
<!-- <view class="bar"></view>
<view class="set text-gray">
<text @click="close" style="font-size:40upx;">返回</text>
<text @click="reset" style="font-size:35upx;color:#DDDDDD">清空</text>
</view> -->
<!-- <view class="in-and-out">
<view class="item" v-if="start.length > 0">
<view style="font-size:30upx;color:#C0C0C0">入住日期</view>
<view style="font-weight: bold;margin-top:10upx;font-size:36upx">{{ startDay }}</view>
<view style="font-size:24upx;margin-top:10upx">{{ startWeek }}</view>
</view>
<view class="item text" v-if="start.length == 0">
<view>入住日期</view>
</view>
<view class="item">
<view class="count-border" :class="day == 0 ? 'gray' : 'orange'">
<view class="count" style="font-size:26upx;line-height:26upx;">{{ day }}</view>
</view>
</view>
<view class="item text" v-if="end.length == 0">
<view>离店日期</view>
</view>
<view class="item" v-if="end.length > 0">
<view style="font-size:30upx;color:#C0C0C0">离店日期</view>
<view style="font-weight: bold;margin-top:10upx;font-size:36upx">{{ endDay }}</view>
<view style="font-size:24upx;margin-top:10upx">{{ endWeek }}</view>
</view>
</view> -->
<view
style="
font-size: 32rpx;
color: #111;
text-align: center;
padding: 30rpx 0;
"
>
<text>{{ title }}</text>
</view>
<view class="week">
<view></view>
<view></view>
<view></view>
<view></view>
<view></view>
<view></view>
<view></view>
</view>
</view>
<view class="section">
<view v-for="(res, line) in resDate" class="item" :key="line">
<view class="year">{{ res.year }}{{ res.month }}</view>
<view class="day">
<view
v-for="week in res.oneDayWeek"
class="day-list"
:style="{ width: (dayWidth - 10) / 7 + 'px' }"
></view>
<view
@tap="selectDay(line, index, (line + 1).toString() + index)"
v-for="(item, index) in res.day"
:key="index"
class="day-list"
:class="[
line == start[0] && index == start[1]
? 'bg-orange select-style'
: '',
(line >= start[0] &&
line <= end[0] &&
index > start[1] &&
index < end[1]) ||
(line >= start[0] && index > start[1] && line < end[0]) ||
(line <= end[0] && index < end[1] && line > start[0]) ||
(line < end[0] && line > start[0])
? 'bg-higlt-orange'
: '',
line == 0 && index + 1 < nowDay ? 'time-out' : '',
isNaN(item) ? 'is-festival' : '',
(isNaN(item) && line == start[0] && index == start[1]) ||
(isNaN(item) && line == end[0] && index == end[1])
? 'not-festival'
: '',
(priceStauts.length > 0 &&
priceStauts[line][index] < 0 &&
start.length > 0 &&
end.length > 0) ||
(priceStauts.length > 0 &&
priceStauts[line][index] < 0 &&
start.length == 0 &&
end.length == 0)
? 'not-sub'
: '',
priceStauts.length > 0 &&
end.length == 0 &&
start.length > 0 &&
priceStauts[line][index] < 0 &&
line + index * 2 != lastNot[0] + lastNot[1] * 2
? 'not-sub'
: '',
]"
:style="{
width: (dayWidth - 10) / 7 + 'px',
borderRadius:
line == end[0] && index == end[1] ? '0px 6px 6px 0px' : '',
backgroundColor:
line == end[0] && index == end[1] ? '#111' : '',
color: line == end[0] && index == end[1] ? '#FFFFFF' : '',
}"
>
<view style="padding-top: 2px; padding-bottom: 2px">{{
item
}}</view>
<!-- <view class="select-style" v-if="line == start[0] && index == start[1]">最早</view>
<view class="select-style" v-if="line == end[0] && index == end[1]">最晚</view> -->
<!-- userDefaultDate -->
<!-- item.start==start -->
<view
style="font-size: 12px; padding-bottom: 3px"
:style="{'color':line == start[0] && index == start[1]?'':'#DEBF7B'}"
v-if="priceStauts.length > 0"
>
<view v-if="priceStauts[line][index] > 0"
>{{ priceStauts[line][index] }}</view
>
<view v-if="priceStauts[line][index] < 0">售罄</view>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
<view class="submit" v-if="!immediately">
<button class="sub-btn" :disabled="!isSub" @click="submit">
<text v-if="isSub">确定</text>
<text v-if="!isSub">选择出行时间</text>
</button>
</view>
</view>
</template>
<script>
//引入节假日的数据,也可以用后台返回去渲染
import json from "./day.js";
export default {
props: {
priceList: {
type: Array,
default: [],
},
defaultDate: {
type: String,
default: "",
},
title: {
type: String,
default: "选择日期",
},
immediately: {
type: Boolean,
default: false,
},
},
computed: {
//房间是否能预订
isSub() {
// if (this.priceStauts.length > 0) {
// for (var i = this.start[0]; i <= this.end[0]; i++) {
// if (i == this.start[0]) {
// for (var j = this.start[1]; j < this.date[i].length; j++) {
// if (this.priceStauts[i][j] == -1) return false
// }
// } else if (this.end[0] == this.start[0]) {
// for (var j = this.start[1]; j < this.end[1]; j++) {
// if (this.priceStauts[i][j] == -1) return false
// }
// } else if (i == this.end[0]) {
// for (var j = 0; j < this.end[1]; j++) {
// if (this.priceStauts[i][j] == -1) return false
// }
// } else {
// for (var j = 0; j < this.priceStauts[i].length; j++) {
// if (this.priceStauts[i][j] == -1) return false
// }
// }
// }
// }
return this.start.length == 2;
},
//计算日历里的节假日
resDate() {
if (this.date.length == 0) return;
for (var i = 0; i < this.date.length; i++) {
for (var j = 0; j < this.festival.length; j++) {
if (
this.festival[j].year == this.date[i].year &&
this.festival[j].month == this.date[i].month
) {
for (var k = 0; k < this.festival[j].festival.length; k++) {
if (
this.date[i].day.indexOf(this.festival[j].festival[k].day) != -1
) {
this.date[i].day[
this.date[i].day.indexOf(this.festival[j].festival[k].day)
] = this.festival[j].festival[k].name;
}
}
}
}
}
return this.date;
},
},
data() {
return {
out: 0,
festival: json, //节假日
type: "-", //日期分隔符
date: [], //日期数组对象
dayWidth: 0, //日期的宽度
nowDay: 0, //当前时间的日
start: [], //入住时间
count: 6, //显示月的数量
startDay: "", //入住日期
startWeek: "", //入住时间的周几
end: [], //离开时间
endDay: "", //离开日期
endWeek: "", //离开时间的周几
day: 0, //多少晚
priceStauts: [], //价格状态
lastNot: [0, 10], //前置的无房操作
userDefaultDate: "",
};
},
mounted() {
},
watch: {
priceList:{
handler(newVal, oldval) {
this.getPriceList()
},
deep: true,
immediate: true,
},
defaultDate:{
handler(newVal, oldval) {
this.userDefaultDate = newVal?newVal:'';
if (this.userDefaultDate != "") {
this.start = this.setDefaultDate(this.userDefaultDate);
}else{
this.start = []
}
this.priceStauts = this.initPrice();
},
deep: false,
immediate: true
},
//入住日期
start(newVal) {
if (this.start.length > 0) {
this.startDay =
this.setMonth(newVal[0]) +
this.isFestival(newVal[0], newVal[1]) +
"日";
this.startWeek = this.getWeek(
this.date[newVal[0]].year +
"/" +
this.date[newVal[0]].month +
"/" +
this.isFestival(newVal[0], newVal[1])
);
}
if (this.priceStauts.length > 0) {
console.log(this.lastNot);
for (var i = newVal[0]; i < this.priceStauts.length; i++) {
if (i == newVal[0]) {
for (var j = newVal[1]; j < this.priceStauts[i].length; j++) {
if (this.priceStauts[i][j] == -1) {
this.lastNot = [i, j];
console.log(this.lastNot);
return;
}
}
} else {
for (var j = 0; j < this.priceStauts[i].length; j++) {
if (this.priceStauts[i][j] == -1) {
this.lastNot = [i, j];
console.log(this.lastNot);
return;
}
}
}
}
//清空
this.lastNot = [];
}
},
},
methods: {
getPriceList(){
this.userDefaultDate = this.defaultDate?this.defaultDate:'';
uni.getSystemInfo({
success: (res) => {
this.dayWidth = res.windowWidth;
},
});
this.setDate();
var dateTime = new Date();
dateTime = dateTime.setDate(dateTime.getDate() + 1);
this.nowDay = new Date(dateTime).getDate();
if (this.userDefaultDate != "") {
this.start = this.setDefaultDate(this.userDefaultDate);
}else{
this.start = []
}
this.priceStauts = this.initPrice();
// #ifdef MP-ALIPAY
uni.setNavigationBarTitle({
title: "",
});
// #endif
},
initPrice() {
//年份
var year = new Date().getFullYear();
let data = [];
//月份
var month = new Date().getMonth();
for (let i = 0; i < this.count; i++) {
var days = [];
var week = 0;
for (var j = 0; j < new Date(year, month + 1, 0).getDate(); j++) {
let isexsit = false;
this.priceList.forEach((x) => {
let m = month + 1 > 9 ? month + 1 : "0" + (month + 1);
let d = j + 1 > 9 ? j + 1 : "0" + (j + 1);
if (x.startDate == `${year}-${m}-${d}`) {
isexsit = true;
if (x.remainNum > 0) {
days.push(this.$utils.getretailer() ? x.b2BPrice : x.b2CPrice);
//days.push(x.b2CPrice);
} else {
days.push(-1);
}
}
});
if (!isexsit) {
days.push(0);
}
}
data.push(days);
if (month == 11) {
year += 1;
month = 0;
} else {
month++;
}
}
return data;
},
//月份补零
setMonth(dateIndex) {
let month = this.date[dateIndex].month;
if (month < 10) {
month = "0" + month;
}
return month + "月";
},
//如果是节假日名称则返回选择的日期天数
isFestival(line, index, push = false) {
var date = this.date[line].day[index];
if (isNaN(date)) {
var newIndex = this.date[line].day.indexOf(date) + 1;
if (push) return newIndex;
return newIndex < 10 ? "0" + newIndex : newIndex;
} else {
if (push) return date;
return date < 10 ? "0" + date : date;
}
},
//获取今天明天的日期
getDefaultDate(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var year = dd.getFullYear();
var mon = dd.getMonth() + 1; //获取当前月份的日期
var day = dd.getDate();
return year + "-" + mon + "-" + day;
},
//设置入住时间 如果没有传值则根据默认值设置
setDefaultDate(data) {
var arr = [0, parseInt(this.nowDay - 1)];
var start = data.indexOf("-") != -1 ? data.split("-") : data.split("/");
var year = new Date().getFullYear();
var month = new Date().getMonth() + 1;
for (var i = 0; i < this.date.length; i++) {
if (this.date[i].year == start[0] && this.date[i].month == start[1]) {
if (year == start[0] && month == start[1] && start[2] < this.nowDay) {
arr = [i, parseInt(this.nowDay - 1)];
} else {
arr = [i, parseInt(start[2] - 1)];
}
break;
}
}
return arr;
},
//清空
reset() {
this.start = [];
this.end = [];
this.day = 0;
},
//补零操作
setPull(day) {
if (day < 10) {
day = "0" + day;
}
return day;
},
//计算天数
getDay(date1, date2) {
//获得天数
//date1:开始日期,date2结束日期
var a1 = Date.parse(new Date(date1));
var a2 = Date.parse(new Date(date2));
var day = parseInt((a2 - a1) / (1000 * 60 * 60 * 24)); //核心:时间戳相减,然后除以天数
return day;
},
//计算周几
getWeek(date) {
var weekDay = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
var myDate = new Date(Date.parse(date));
return weekDay[myDate.getDay()];
},
//选择入住离开
selectDay(line, index) {
if (this.priceStauts[line][index] == 0) {
uni.showToast({
title: "抱歉,此日期没有机票哦",
icon: "none",
});
} else if (this.priceStauts[line][index] == -1) {
uni.showToast({
title: "该机票已售罄",
icon: "none",
});
} else {
this.start = [line, index];
}
if (this.immediately) {
this.submit();
}
return;
if (line == 0 && index + 1 < this.nowDay) return;
//如果有入住情况和价格则需要进行一些列的判断
if (this.priceStauts.length > 0) {
if (
(this.start.length == 0 && this.priceStauts[line][index] < 0) ||
(this.end.length > 0 && this.priceStauts[line][index] < 0)
) {
return uni.showToast({
title: "该日期已被预订",
icon: "none",
});
}
if (
(this.start.length > 0 && line < this.start[0]) ||
(line == this.start[0] && this.start[1] > index)
) {
if (this.priceStauts[line][index] < 0)
return uni.showToast({
title: "该日期已被预订",
icon: "none",
});
this.start = [line, index];
this.end = [];
return;
}
if (this.start.length > 0 && this.end.length == 0) {
if (this.start[0] - line == 0) {
for (var j = this.start[1]; j < index; j++) {
if (this.priceStauts[line][j] < 0)
return uni.showToast({
title: "很抱歉,所选入离店时间包含无房日期",
icon: "none",
mask: true,
});
}
} else {
//如果不在同一个月份有三种情况需要处理
for (var i = this.start[0]; i <= line; i++) {
//开始日期到开始日期当月的最大日期是否包含无房情况
if (i == this.start[0]) {
for (
var j = this.start[1];
j < this.priceStauts[i].length;
j++
) {
if (this.priceStauts[i][j] < 0)
return uni.showToast({
title: "很抱歉,所选入离店时间包含无房日期",
icon: "none",
mask: true,
});
}
} else if (i == line) {
//结束日期到当月结束日期之前是否包含无房情况
for (var j = 0; j < index; j++) {
if (this.priceStauts[i][j] < 0)
return uni.showToast({
title: "很抱歉,所选入离店时间包含无房日期",
icon: "none",
mask: true,
});
}
} else {
//中间间隔的月份需要检查每一天是否包含无房情况
for (var j = 0; j < this.priceStauts[i].length; j++) {
if (this.priceStauts[i][j] < 0)
return uni.showToast({
title: "很抱歉,所选入离店时间包含无房日期",
icon: "none",
mask: true,
});
}
}
}
}
}
}
//如果没有入住时间
if (this.start.length == 0) {
//填充入住时间
this.start = [line, index];
} else if (
this.start.length > 0 &&
this.start[0] == line &&
this.start[1] == index &&
this.end.length == 0
) {
return;
} else {
//如果没有离开时间
if (this.end.length == 0) {
//如果有价格和入住离开情况则需要进行判断所选的离店时间时候包含无房日期
if (
line < this.start[0] ||
(line == this.start[0] && index < this.start[1])
) {
this.end = this.start;
this.start = [line, index];
} else {
//如果离开时间比入住时间晚则填充
this.end = [line, index];
}
} else {
//如果有离开时间则清空离开时间重新填充入住时间
this.start = [line, index];
this.end = [];
}
}
},
//设置日历
setDate() {
//年份
var year = new Date().getFullYear();
//月份
var month = new Date().getMonth();
console.log("执行了...");
for (let i = 0; i < this.count; i++) {
var day = [];
var week = 0;
for (var j = 0; j < new Date(year, month + 1, 0).getDate(); j++) {
day.push(j + 1);
}
this.date.push({
year: year,
month: month + 1,
day: day,
oneDayWeek: new Date(
Date.parse(year + "/" + (month + 1) + "/" + "01")
).getDay(),
});
if (month == 11) {
year += 1;
month = 0;
} else {
month++;
}
}
return this.date;
},
//关闭
close() {
uni.navigateBack({
delta: 1,
});
},
//确定入住离店事件提交
submit() {
if(!this.start[0]) return
let m = this.date[this.start[0]].month;
m = m > 9 ? m : "0" + m;
let d = this.isFestival(this.start[0], this.start[1], true);
d = d > 9 ? d : "0" + d;
var obj = {
/* startYMD: this.date[this.start[0]].year + this.type + this.date[this.start[0]].month + this.type + this.isFestival(
this.start[0], this.start[1]),
startMD: this.date[this.start[0]].month + this.type + this.isFestival(this.start[0], this.start[1]),
startDay: this.startDay,
startWeek: this.startWeek,
endYMD: this.date[this.end[0]].year + this.type + this.date[this.end[0]].month + this.type + this.isFestival(this
.end[0], this.end[1]),
emdMD: this.date[this.end[0]].month + this.type + this.type + this.isFestival(this.end[0], this.end[1]),
endDay: this.endDay,
endWeek: this.endWeek,
day: this.day */
startWeek: this.startWeek,
start: this.date[this.start[0]].year + this.type + m + this.type + d,
startDay: m + "-" + d,
};
let tempPrice = {};
this.priceList.forEach((x, i) => {
console.log(x.startDate, obj.start);
if (obj.start == x.startDate) {
obj.priceObj = i;
}
});
this.$emit("finish", obj);
},
},
};
</script>
<style>
/**确认按钮**/
.submit {
width: 100%;
background: white;
position: fixed;
bottom: 0upx;
height: auto;
}
.sub-btn {
height: auto;
border-radius: 10upx;
background: #DEBF7B;
color: white;
}
.content {
height: 100%;
z-index: 999;
}
/**不能预订**/
/* 入住离开时间的color */
.bg-orange {
background: #DEBF7B !important;
border-radius: 6px !important;
}
.bg-higlt-orange {
background-color: #fff;
}
/* 节假日的日期样式 */
.is-festival {
font-size: 22rpx !important;
color: #000 !important;
}
/** 非节假日的日期样式**/
.not-festival {
font-size: 18upx;
color: white;
}
/***入住离开时间的日历样式*/
.not-sub {
color: #222222;
background: #dddddd;
}
.select-out-item {
background: #ffffff;
}
.select-style {
color: white !important;
font-size: 20rpx !important;
/* font-size: 20upx; */
/* padding-top: 4upx; */
}
.time-out {
/* text-decoration: line-through; */
color: #ccc !important;
}
/**
* 点击日期的样式
*/
.bg {
background: orange;
}
/**
* 日期部分
*/
.section {
width: 100%;
padding-bottom: 150upx;
height: auto;
padding-top: 176rpx;
background-color: #f1f4f6;
}
.section > .item > .year {
text-align: center;
height: 50rpx;
font-weight: bold;
/* padding-left:30upx;
padding-right: 30upx; */
font-size: 24rpx;
line-height: 50rpx;
color: #1b1d1e;
}
.section > .item > .day {
display: flex;
flex-wrap: wrap;
text-align: center;
margin-left: 5px;
margin-right: 5px;
}
.section > .item > .day > .day-list {
margin-top: 30upx;
margin-bottom: 30upx;
min-height: 100upx;
max-height: 180upx;
display: flex;
font-size: 26rpx;
flex-direction: column;
align-items: center;
justify-content: center;
/* color: #1b1d1b; */
}
/**
* 头部固定
*/
.header {
position: fixed;
top: 0;
width: 100%;
/* height: 400upx; */
background: white;
box-shadow: 0px 10rpx 30rpx 0px rgba(36, 36, 36, 0.06);
}
.bar {
width: 100%;
height: var(--status-bar-height);
background: #222222;
}
/**
* 关闭清空
*/
.set {
height: 100upx;
padding-left: 30upx;
padding-right: 30upx;
align-items: center;
display: flex;
justify-content: space-between;
}
/**
* 入住离开时间
*/
.in-and-out {
height: 210upx;
padding-left: 30upx;
padding-right: 30upx;
display: flex;
align-items: center;
justify-content: space-between;
}
/**
* 入住离开的view
*/
.in-and-out > .item {
display: flex;
flex-direction: column;
height: 100upx;
}
/**
* 未选择入离时间时的文字样式
*/
.in-and-out > .text {
margin-top: 100upx;
font-weight: bold;
font-size: 36upx;
color: #c0c0c0;
}
/**
* 一共选择了多少晚的样式
*/
.in-and-out > .item > .count-border {
width: 200upx;
font-size: 28upx;
height: 40upx;
margin-top: 48upx;
text-align: center;
}
.gray {
color: #c0c0c0;
border-bottom: 1px solid #c0c0c0;
}
.orange {
color: orange;
border-bottom: 1px solid orange;
}
/**
* 共多少晚
*/
.in-and-out > .item > .count-border > .count {
font-size: 10px;
}
/**
* 周一到周日
*/
.week {
/* height: 70upx; */
display: flex;
justify-content: space-between;
align-items: center;
padding-left: 25px;
padding-right: 25px;
font-size: 24rpx;
color: #1b1d1e;
background: white;
margin-bottom: 16rpx;
}
.isa {
color: red;
}
.isa2 {
color: red;
}
</style>
......@@ -153,6 +153,10 @@
lastNot: [0, 10] //前置的无房操作
};
},
onShow(){
this.start = this.setDefaultDate(this.StartDate);
this.end = this.setDefaultDate(this.EndDate);
},
mounted () {
console.log("进入了....")
uni.getSystemInfo({
......@@ -473,17 +477,6 @@
submit() {
var obj = {
/* startYMD: this.date[this.start[0]].year + this.type + this.date[this.start[0]].month + this.type + this.isFestival(
this.start[0], this.start[1]),
startMD: this.date[this.start[0]].month + this.type + this.isFestival(this.start[0], this.start[1]),
startDay: this.startDay,
startWeek: this.startWeek,
endYMD: this.date[this.end[0]].year + this.type + this.date[this.end[0]].month + this.type + this.isFestival(this
.end[0], this.end[1]),
emdMD: this.date[this.end[0]].month + this.type + this.type + this.isFestival(this.end[0], this.end[1]),
endDay: this.endDay,
endWeek: this.endWeek,
day: this.day */
startWeek: this.startWeek,
endWeek: this.endWeek,
start: this.date[this.start[0]].year + this.type + this.date[this.start[0]].month + this.type +
......@@ -505,72 +498,6 @@
})
this.$emit("finish",obj)
//价格清单,应该存入vuex获取缓存中
// if (this.priceStauts.length > 0) {
// var price = []
// if (this.end[0] - this.start[0] == 0) {
// for (var i = this.start[1]; i < this.end[1]; i++) {
// var day = this.date[this.start[0]].year + this.type + this.setPull(this.date[this.start[0]]
// .month) + this.type + this.isFestival(
// this.start[0], i)
// price.push({
// day_str: day,
// price: this.priceStauts[this.start[0]][i]
// })
// }
// } else {
// for (var i = this.start[0]; i <= this.end[0]; i++) {
// console.log(i)
// if (i == this.start[0]) {
// for (var j = this.start[1]; j < this.date[i].day.length; j++) {
// var day = this.date[i].year + this.type + this.setPull(this.date[i].month) + this
// .type + this.isFestival(
// i, j)
// price.push({
// day_str: day,
// price: this.priceStauts[i][j]
// })
// }
// } else if (i == this.end[0]) {
// for (var j = 0; j < this.end[1]; j++) {
// var day = this.date[i].year + this.type + this.setPull(this.date[i].month) + this
// .type + this.isFestival(
// i, j)
// price.push({
// day_str: day,
// price: this.priceStauts[i][j]
// })
// }
// } else {
// for (var j = 0; j < this.date[i].day.length; j++) {
// var day = this.date[i].year + this.type + this.setPull(this.date[i].month) + this
// .type + this.isFestival(
// i, j)
// price.push({
// day_str: day,
// price: this.priceStauts[i][j]
// })
// }
// }
// }
// }
// //加入缓存
// uni.setStorage({
// key: 'Price',
// data: JSON.stringify(price)
// })
// }
//跳转到上一页
// uni.navigateBack({
// delta: 1
// })
},
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment