|
|
|
@ -146,21 +146,25 @@ export default { |
|
|
|
|
this.ticketSumPrice = 0; |
|
|
|
|
if (Array.isArray(val) && val.length > 0) { |
|
|
|
|
val.forEach((i) => { |
|
|
|
|
const priceInCents = Math.round(Number(i.settlementPrice) * 100); |
|
|
|
|
const quantity = Number(i.num); |
|
|
|
|
this.ticketSumNum += i.num; |
|
|
|
|
this.ticketSumPrice += i.num * i.settlementPrice; |
|
|
|
|
this.ticketSumPrice += quantity * priceInCents/100; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onShow() { |
|
|
|
|
debugger |
|
|
|
|
//debugger |
|
|
|
|
const allTicket = uni.getStorageSync('ALL_TICKET'); |
|
|
|
|
|
|
|
|
|
if (allTicket && Array.isArray(allTicket) && allTicket.length > 0) { |
|
|
|
|
this.car = allTicket |
|
|
|
|
}else{ |
|
|
|
|
this.car = [] |
|
|
|
|
this.ticketSumNum = 0; |
|
|
|
|
this.ticketSumPrice = 0; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onReady() { |
|
|
|
@ -243,7 +247,7 @@ export default { |
|
|
|
|
calendarConfirm(e) { |
|
|
|
|
let that = this; |
|
|
|
|
console.log(e); |
|
|
|
|
debugger; |
|
|
|
|
//debugger; |
|
|
|
|
|
|
|
|
|
//不限库存 |
|
|
|
|
if (that.selectItem.inventorySettings == 1) { |
|
|
|
@ -302,12 +306,12 @@ export default { |
|
|
|
|
if (that.selectItem.touristInformation == 1) { |
|
|
|
|
|
|
|
|
|
if (that.car.length > 0) { |
|
|
|
|
debugger; |
|
|
|
|
//debugger; |
|
|
|
|
|
|
|
|
|
console.log(that.car, 'car里的数据'); |
|
|
|
|
index = that.car.findIndex((items) => Number(items.id) == Number(that.selectItem.id) && items.date == e.fulldate); |
|
|
|
|
if (index != -1) { |
|
|
|
|
debugger; |
|
|
|
|
//debugger; |
|
|
|
|
|
|
|
|
|
const currentNum = that.car[index].num; |
|
|
|
|
if (Number(that.selectItem.currentinventory) - currentNum >= 1) { |
|
|
|
@ -334,7 +338,7 @@ export default { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
debugger; |
|
|
|
|
//debugger; |
|
|
|
|
const newItem = { ...that.selectItem, num: 1, date: e.fulldate, zkc: that.selectItem.currentinventory }; |
|
|
|
|
// that.$set(that.car, that.car.length, that.selectItem); |
|
|
|
|
that.car.push(newItem); |
|
|
|
@ -346,7 +350,7 @@ export default { |
|
|
|
|
//需要一个游客信息/需要全部游客信息 |
|
|
|
|
if (that.selectItem.touristInformation == 2 || that.selectItem.touristInformation == 3) { |
|
|
|
|
if (that.car.length > 0) { |
|
|
|
|
debugger; |
|
|
|
|
//debugger; |
|
|
|
|
console.log('that.selectItem.id:', that.selectItem.id); |
|
|
|
|
console.log('e.fulldate:', e.fulldate); |
|
|
|
|
console.log('that.car:', that.car); |
|
|
|
@ -398,7 +402,7 @@ export default { |
|
|
|
|
//日库存 |
|
|
|
|
if (that.selectItem.inventorySettings == 3) { |
|
|
|
|
let index; |
|
|
|
|
debugger |
|
|
|
|
//debugger |
|
|
|
|
const cartItem = that.car.find((item) => Number(item.id) == Number(that.selectItem.id) && item.date == e.fulldate); |
|
|
|
|
const cartQuantity = cartItem ? cartItem.num : 0; |
|
|
|
|
|
|
|
|
@ -421,7 +425,7 @@ export default { |
|
|
|
|
index = that.car.findIndex((items) => Number(items.id) == Number(that.selectItem.id) && items.date == e.fulldate); |
|
|
|
|
console.log('index:', index); |
|
|
|
|
if (index != -1) { |
|
|
|
|
debugger; |
|
|
|
|
//debugger; |
|
|
|
|
|
|
|
|
|
const currentNum = that.car[index].num; |
|
|
|
|
// 创建一个新的对象,并设置num为当前值加1 |
|
|
|
@ -430,7 +434,7 @@ export default { |
|
|
|
|
that.$set(that.car, index, newItem); |
|
|
|
|
uni.setStorageSync('ALL_TICKET', that.car) |
|
|
|
|
} else { |
|
|
|
|
debugger; |
|
|
|
|
//debugger; |
|
|
|
|
const newItem = { ...that.selectItem, num: 1, date: e.fulldate, rkc: inventory }; |
|
|
|
|
// that.$set(that.car, that.car.length, that.selectItem); |
|
|
|
|
that.car.push(newItem); |
|
|
|
@ -443,7 +447,7 @@ export default { |
|
|
|
|
index = that.car.findIndex((items) => Number(items.id) == Number(that.selectItem.id) && items.date == e.fulldate); |
|
|
|
|
console.log('index:', index); |
|
|
|
|
if (index != -1) { |
|
|
|
|
debugger; |
|
|
|
|
//debugger; |
|
|
|
|
|
|
|
|
|
const currentNum = that.car[index].num; |
|
|
|
|
// 创建一个新的对象,并设置num为当前值加1 |
|
|
|
@ -455,7 +459,7 @@ export default { |
|
|
|
|
url: '/pages/addUserinfo/addUserinfo?needInfoItem=' + data + '&event=' + eve |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
debugger; |
|
|
|
|
//debugger; |
|
|
|
|
const newItem = { ...that.selectItem, num: 1, date: e.fulldate, rkc: inventory }; |
|
|
|
|
const data = JSON.stringify(newItem) |
|
|
|
|
const eve = JSON.stringify(that.event) |
|
|
|
@ -538,7 +542,7 @@ export default { |
|
|
|
|
item.btnLoading = true; |
|
|
|
|
let that = this; |
|
|
|
|
//有效期模式, |
|
|
|
|
debugger; |
|
|
|
|
//debugger; |
|
|
|
|
if (item.datesettings == 1) { |
|
|
|
|
const date = this.parseTime(new Date(),'{y}-{m}-{d}') |
|
|
|
|
item.date = date |
|
|
|
@ -546,10 +550,11 @@ export default { |
|
|
|
|
if (item.inventorySettings == 1) { |
|
|
|
|
//无需游客信息 |
|
|
|
|
if (item.touristInformation == 1) { |
|
|
|
|
item.num += 1; |
|
|
|
|
if (that.car.length > 0) { |
|
|
|
|
const index = that.car.findIndex((items) => Number(items.id) == Number(item.id)); |
|
|
|
|
if (index !== -1) { |
|
|
|
|
that.car[index].num+=1 |
|
|
|
|
item.num = that.car[index].num |
|
|
|
|
// 使用 Vue.set 或 that.$set 来保证响应式 |
|
|
|
|
that.$set(that.car, index, item); |
|
|
|
|
uni.setStorageSync('ALL_TICKET', that.car) |
|
|
|
@ -612,11 +617,11 @@ export default { |
|
|
|
|
if (item.touristInformation == 1) { |
|
|
|
|
if (Number(item.currentinventory) > item.num) { |
|
|
|
|
//没超过总库存 |
|
|
|
|
item.num += 1; |
|
|
|
|
|
|
|
|
|
if (that.car.length > 0) { |
|
|
|
|
const index = that.car.findIndex((items) => Number(items.id) == Number(item.id)); |
|
|
|
|
if (index !== -1) { |
|
|
|
|
that.car[index].num+=1 |
|
|
|
|
item.num = that.car[index].num |
|
|
|
|
// 使用 Vue.set 或 that.$set 来保证响应式 |
|
|
|
|
that.$set(that.car, index, item); |
|
|
|
|
uni.setStorageSync('ALL_TICKET', that.car) |
|
|
|
|