Commit e0128e84 authored by youjie's avatar youjie

no message

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