Commit e0128e84 authored by youjie's avatar youjie

no message

parent f6cf3dfd
......@@ -128,6 +128,7 @@
cars: [],//购物车参数
HotelLength: 0,//购物车酒店数
editor: {},//预定订单对象
contrastCars: [],//对比缓存cars
};
},
watch: {
......@@ -146,6 +147,7 @@
},
hotelInfor: {
handler: function (val, oldVal) {
if(this.hotelInfor&&this.hotelInfor.RemainingInventory){
this.onlyNum = this.hotelInfor.RemainingInventory
}
......@@ -166,6 +168,7 @@
},
mounted() {
if(this.hotelInfor&&this.hotelInfor.RemainingInventory){
this.onlyNum = this.hotelInfor.RemainingInventory
}
......@@ -173,6 +176,7 @@
this.setList()
}
},
methods: {
changePeople(val){
......@@ -191,6 +195,8 @@
})
},
join(){
this.cars = []
this.cars = JSON.parse(localStorage.getItem('cars'))
if(!this.sumPeople) return this.Error('请加入人数');
const temp= JSON.parse(JSON.stringify(this.parameters))
temp.Money=0
......@@ -198,26 +204,26 @@
temp.SumPeople = this.sumPeople
temp.DetailList = temp.DetailList.filter(((x)=>x.PeopleNumber>0))
temp.DetailList.forEach((x) => {
temp.Money+=(x.PeopleNumber*(x.Unit_Price+x.TaxesPrice+x.PriceInTangTax))
temp.Money+=(x.PeopleNumber*(x.Unit_Price+x.TaxesPrice+x.PriceInTangTax))
});
let existsIndex = this.cars.findIndex((x)=>x.Date == temp.Date)
let exists = existsIndex==-1?null:this.cars[existsIndex]
if(exists){
let existsHotel = exists.Hotels.findIndex((h)=>h.HotelId==temp.HotelId)
if(existsHotel!=-1) exists.Hotels.splice(existsHotel,1)
let existsHotel = exists.Hotels.findIndex((h)=>h.HotelId==temp.HotelId)
if(existsHotel!=-1) exists.Hotels.splice(existsHotel,1)
}else{
exists = {
Date:temp.Date,
Hotels:[]
}
this.cars.push(exists)
exists = {
Date:temp.Date,
Hotels:[]
}
this.cars.push(exists)
}
exists.Hotels.push(temp)
this.cars.sort((x,y)=>{
return new Date(x.Date).getTime()-new Date(y.Date).getTime()
return new Date(x.Date).getTime()-new Date(y.Date).getTime()
})
this.HotelLength = this.cars.length
localStorage.setItem("cars",JSON.stringify(this.cars))
localStorage.setItem("HotelLength",this.HotelLength)
this.Success('加入购物车成功');
......
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