<style lang="scss" scoped>
	@import url("@/asset/css/flex.css");

	.headeDatasTime {
		padding-top: 25rpx;
		font-weight: 500;
		font-size: 32rpx;
		color: #FFFFFF;
	}

	.headeDatasTime img {
		display: inline-block;
	}

	.headeDatasTime text {
		padding: 0 20rpx;
	}

	.headeDatasTimeImg1 {
		width: 30rpx;
		height: 30rpx;
	}

	.headeDatasTimeImg2 {
		width: 12rpx;
		height: 7rpx;
	}

	.headeDatasTitle {
		font-weight: 500;
		font-size: 36rpx;
		color: #FFFFFF;
		padding: 30rpx 0 49rpx 0;
	}

	.headeDatasText {
		color: #CDDCFF;
		font-size: 24rpx;
	}

	.headeDatasNumText {
		font-size: 28rpx;
		color: #fff;
	}

	.headeDatasNumText text:first-child {
		margin-right: 10rpx;
	}

	.headeDatasNumText text:last-child {
		font-size: 58rpx;
		font-family: PingFang SC;
		font-weight: bold;
	}

	.headeDatasCenterBox {
		font-weight: 400;
		font-size: 28rpx;
		color: #FFFFFF;
	}

	.headeDatasCenter {
		margin-top: 1px;
	}

	.headeDatasCenter view {
		background: #3A7DF5;
	}

	.headeDatasCenter view {
		padding: 22rpx 30rpx;
	}

	.headeDatasCenter view:first-child {
		min-width: 150rpx;
		white-space: nowrap;
		background: rgba(41, 94, 235, .2);
	}

	.headeDatasCenter view:nth-child(2) {
		min-width: 170rpx;
		padding: 22rpx 0rpx 22rpx 30rpx;
	}

	.headeDatasCenterBox.car .headeDatasCenter view:first-child {
		width: 175rpx;
	}

	.triangle {
		width: 0;
		height: 0;
		border-left: 8rpx solid transparent;
		border-right: 8rpx solid transparent;
		border-top: 8rpx solid #fff;
	}

	.headeDatasCurrency {
		background: #EBA429;
		font-weight: 500;
		font-size: 28rpx;
		color: #FFFFFF;
		padding: 15rpx 30rpx;
	}

	.nameTitle {
		max-width: 500rpx;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
</style>
<template>
	<view class="headeDatasBox">
		<view class="PX40 PB40">
			<view class="row justify-center">
				<view class="headeDatasTime row items-center" @click="showOptionVisible(1)">
					<img class="headeDatasTimeImg1"
						src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638869669341003114.png" />
					<text>{{ dateObj.name }}</text>
					<img class="headeDatasTimeImg2"
						src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638869669873781692.png" />
				</view>
			</view>
			<view class="headeDatasTitle row justify-center">
				<view class="text-center nameTitle" v-if="params.type==1">
					<template v-if="datas.DriverName">{{ datas.DriverName }}({{ datas.DriverTel }})</template>
					<template v-else>暂无司机信息</template>
				</view>
				<view v-if="params.type>1&&params.type<5" class="row justify-center items-center">
					<view v-if="params.type==2" class="row justify-center items-center">
						<view class="row items-center" v-if="datas.HotelOrderList[datas.hotelIndex].ReimburseList.ActualUseInfo||datas.HotelOrderList[datas.hotelIndex].NewHotelName"
						 @click="showOptionVisible(3)">
							<view class="nameTitle">
								{{ datas.HotelOrderList[datas.hotelIndex].ReimburseList.ActualUseInfo?datas.HotelOrderList[datas.hotelIndex].ReimburseList.ActualUseInfo:datas.HotelOrderList[datas.hotelIndex].NewHotelName }}
							</view>
							<img class="headeDatasTimeImg2 PL20"
							src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638869669873781692.png" />
						</view>
						<view v-else class="nameTitle">
							暂无酒店信息
						</view>
					</view>
					<view v-if="params.type==3" class="row justify-center items-center">
						<view class="row items-center" v-if="datas.DiningSummaryList[datas.diningIndex].ReimburseList.ActualUseInfo||datas.DiningSummaryList[datas.diningIndex].NewDiningName"
						@click="showOptionVisible(4)">
							<view class="nameTitle">
								{{ datas.DiningSummaryList[datas.diningIndex].ReimburseList.ActualUseInfo?datas.DiningSummaryList[datas.diningIndex].ReimburseList.ActualUseInfo:datas.DiningSummaryList[datas.diningIndex].NewDiningName }}
								({{ datas.DiningSummaryList[datas.diningIndex].UseDinnerTypeStr }})
							</view>
							<img class="headeDatasTimeImg2 PL20"
								src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638869669873781692.png" />
						</view>
						<view v-else class="nameTitle">
							暂无餐食信息
						</view>
					</view>
					<view v-if="params.type==4" class="row justify-center items-center">
						<view class="row items-center" v-if="datas.ScenicStatisticsList[datas.scenicIndex].ReimburseList.ActualUseInfo||datas.ScenicStatisticsList[datas.scenicIndex].ScenicName"
						@click="showOptionVisible(5)">
							<view class="nameTitle">
								{{ datas.ScenicStatisticsList[datas.scenicIndex].ReimburseList.ActualUseInfo?datas.ScenicStatisticsList[datas.scenicIndex].ReimburseList.ActualUseInfo:datas.ScenicStatisticsList[datas.scenicIndex].ScenicName }}
							</view>
							<img class="headeDatasTimeImg2 PL20"
								src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638869669873781692.png" />
						</view>
						<view v-else class="nameTitle">
							暂无门票信息
						</view>
					</view>
					<img v-if="(params.type==2&&(datas.HotelOrderList[datas.hotelIndex].ReimburseList.ActualUseInfo||datas.HotelOrderList[datas.hotelIndex].NewHotelName))
					||(params.type==3&&(datas.DiningSummaryList[datas.diningIndex].ReimburseList.ActualUseInfo||datas.DiningSummaryList[datas.diningIndex].NewDiningName))
					||(params.type==4&&(datas.ScenicStatisticsList[datas.scenicIndex].ReimburseList.ActualUseInfo||datas.ScenicStatisticsList[datas.scenicIndex].ScenicName))" @click="showEditorVisible" class="PL40"
						style="width: 30rpx;height: 30rpx;display: inline-block;"
						src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638870767566609082.png" />
				</view>
			</view>
			<view class="headeDatasText text-center">计划金额</view>
			<view class="headeDatasNumText text-center">
				<text>¥</text>
				<text v-if="params.type==1">{{ datas.TotalPrice?datas.TotalPrice:0 }}</text>
				<text
					v-else-if="params.type==2">{{ datas.HotelOrderList[datas.hotelIndex].TradingTotalPrice?datas.HotelOrderList[datas.hotelIndex].TradingTotalPrice:0 }}</text>
				<text
					v-else-if="params.type==3">{{ datas.DiningSummaryList[datas.diningIndex].TradingTotalPrice?datas.DiningSummaryList[datas.diningIndex].TradingTotalPrice:0 }}</text>
				<text
					v-else-if="params.type==4">{{ datas.ScenicStatisticsList[datas.scenicIndex].TradingTotalPrice?datas.ScenicStatisticsList[datas.scenicIndex].TradingTotalPrice:0 }}</text>
			</view>
		</view>
		<view v-if="params.type==1" class="headeDatasCenterBox car">
			<view class="headeDatasCenter row">
				<view>车牌号</view>
				<view class="flex1">{{ datas.BusCode?datas.BusCode:'暂无' }}</view>
			</view>
			<view class="headeDatasCenter row">
				<view>车辆号</view>
				<view class="flex1">{{ datas.BusNum?datas.BusNum:'暂无' }}</view>
			</view>
			<view class="headeDatasCenter row">
				<view>用车方式</view>
				<view class="flex1">{{ datas.AirportPickUpStr?datas.AirportPickUpStr:'暂无' }}</view>
			</view>
		</view>
		<view v-if="params.type==2" class="headeDatasCenterBox">
			<view class="headeDatasCenter row">
				<view>床位</view>
				<view>占床：{{ datas.HotelOrderList[datas.hotelIndex].HouseStatistics.NeedBed?datas.HotelOrderList[datas.hotelIndex].HouseStatistics.NeedBed:'暂无' }}</view>
				<view class="flex1">不占床：{{ datas.HotelOrderList[datas.hotelIndex].HouseStatistics.NoNeedBed?datas.HotelOrderList[datas.hotelIndex].HouseStatistics.NoNeedBed:'暂无' }}</view>
			</view>
			<template v-if="datas&&datas.HotelOrderList&&datas.HotelOrderList[datas.hotelIndex]&&datas.HotelOrderList[datas.hotelIndex].OrderDetailsList">
				<template v-for="item in datas.HotelOrderList[datas.hotelIndex].OrderDetailsList">
					<view class="headeDatasCenter row" v-if="item.HouseTypeCount>0">
						<view>{{ getHotelName(item.HouseType) }}</view>
						<view>数量：{{ item.HouseTypeCount }}</view>
						<view class="flex1">
							<template v-if="datas.HotelOrderList[datas.hotelIndex].PayStyle==1">
								单价：¥{{ item.UnitPrice }}
							</template>	
						</view>
					</view>
				</template>
			</template>
		</view>
		<view v-if="params.type==3" class="headeDatasCenterBox din">
			<template v-if="datas&&datas.DiningSummaryList&&datas.DiningSummaryList[datas.diningIndex]">
				<template v-for="item in datas.DiningSummaryList[datas.diningIndex].DiningPriceList">
					<view class="headeDatasCenter row" v-if="item.UsePeopleNum>0">
						<view>{{ getPeopleName(item.PeopleType) }}</view>
						<view>人数：{{ item.UsePeopleNum }}</view>
						<view class="flex1">
							<template v-if="datas.DiningSummaryList[datas.diningIndex].PayStyle==1">
								单价：¥{{ item.PeoplePrice }}	
							</template>
						</view>
					</view>
				</template>
			</template>
		</view>
		<view v-if="params.type==4" class="headeDatasCenterBox">
			<template v-if="datas&&datas.ScenicStatisticsList&&datas.ScenicStatisticsList[datas.scenicIndex]">
				<template v-for="item in datas.ScenicStatisticsList[datas.scenicIndex].TicketPriceList">
					<view class="headeDatasCenter row" v-if="item.PeopleNum>0">
						<view>{{ getPeopleName(item.PeopleType) }}</view>
						<view>人数：{{ item.PeopleNum }}</view>
						<view class="flex1">
							<template v-if="datas.ScenicStatisticsList[datas.scenicIndex].PayStyle==1">
								单价：¥{{ item.PeoplePrice }}
							</template>
						</view>
					</view>
				</template>
			</template>
		</view>
		<view class="headeDatasCurrency row justify-between" @click="showOptionVisible(2)">
			<view v-if="params.type==1">
				实际金额：¥{{ datas&&datas.TotalMoney!=0?datas.TotalMoney.toFixed(2):0.0 }}
			</view>
			<view v-else-if="params.type==2">
				实际金额：¥{{ datas&&datas.HotelOrderList&&datas.HotelOrderList[datas.hotelIndex].TotalMoney!=0?datas.HotelOrderList[datas.hotelIndex].TotalMoney.toFixed(2):0.0 }}
			</view>
			<view v-else-if="params.type==3">
				实际金额：¥{{ datas&&datas.DiningSummaryList&&datas.DiningSummaryList[datas.diningIndex].TotalMoney!=0?datas.DiningSummaryList[datas.diningIndex].TotalMoney.toFixed(2):0.0 }}
			</view>
			<view v-else="params.type==4">
				实际金额：¥{{ datas&&datas.ScenicStatisticsList&&datas.ScenicStatisticsList[datas.scenicIndex].TotalMoney!=0?datas.ScenicStatisticsList[datas.scenicIndex].TotalMoney.toFixed(2):0.0 }}
			</view>
			<view class="row items-center">
				<text style="color: red;">*</text>
				<text class="ML10">币种：{{ currencyObj.name }}</text>
				<view class="triangle ML10"></view>
			</view>
		</view>
		<!-- 单选 -->
		<singleChoice v-if="optionVisible" :current="optionObj.id" :list="optionList" @close="close"
			@change="popupOption"></singleChoice>
		<!-- 编辑 -->
		<editor v-if="editorVisible" :title="editorObj.name" @close="close" @change="popupEditor"></editor>
	</view>
</template>
<script>
	import singleChoice from "./singleChoice";
	import editor from "./editor";
	export default {
		props: ['data', 'currencyList'],
		components: {
			singleChoice,
			editor,
		},
		data() {
			return {
				editorObj: {
					name: '酒店',
					type: 2
				},
				editorVisible: false,
				optionVisible: false,
				optionType: 0,
				optionList: [], //下拉list
				dateList: [], //日期下拉
				BusList: [], //车信息
				HotelOrderListReport: [], //酒店信息，合团
				DiningList: [], //餐厅
				ScenicList: [], //景点
				OtherList: [], //其他订单信息
				TipList: [], //小费收入
				TeamList: [], //团费小计
				SelfPlayingIncomeList: [], //自费收入
				SelfPlayingExpendList: [], //自费支出
				LeaderShopList: [], //购物报账
				optionObj: {
					id: 0,
					name: '',
				},
				currentIndex: 0,
				currencyObj: {
					id: 0,
					name: '选择币种',
				}, //币种id
				dateObj: {}, //日期id
				hotelObj: {}, //酒店id
				hotelList: [],
				diningObj: {}, //餐id
				diningList: [],
				scenicObj: {}, //门票
				scenicsList: [],
				params: {},
				datas: null, //展示数据
				dataIndex: 0,
				houseTypeList: [{
						name: '单间',
						id: 1
					},
					{
						name: '大床房',
						id: 2
					},
					{
						name: '标准间',
						id: 3
					},
					{
						name: '三人间',
						id: 4
					},
					{
						name: '双人间',
						id: 5
					},
					{
						name: '不占床',
						id: 6
					},
				],
				peopleTypeList: [{
						name: '大人',
						id: 1
					},
					{
						name: '中人',
						id: 2
					},
					{
						name: '小人',
						id: 3
					}
				]
			}
		},
		watch: {
			data: {
				handler(newVal, oldVal) {
					this.params = JSON.parse(JSON.stringify(newVal))
					this.BusList = this.params.BusList //车信息
					this.HotelOrderListReport = this.params.HotelOrderListReport //酒店信息，合团
					this.DiningList = this.params.DiningList //餐厅
					this.ScenicList = this.params.ScenicList //景点
					this.OtherList = this.params.OtherOrderInfo.OtherList //其他订单信息
					this.TipList = this.params.OtherOrderInfo.TipList //小费收入
					this.TeamList = this.params.OtherOrderInfo.TeamList //团费小计
					this.SelfPlayingIncomeList = this.params.OtherOrderInfo.SelfPlayingIncomeList //自费收入
					this.SelfPlayingExpendList = this.params.OtherOrderInfo.SelfPlayingExpendList //自费支出
					this.LeaderShopList = this.params.OtherOrderInfo.LeaderShopList //购物报账

					if (this.params.type == 1) {
						this.dataIndex = this.params.dataIndex1
						this.getRenderingDataBus(0)
					} else if (this.params.type == 2) {
						this.dataIndex = this.params.dataIndex2
						this.getRenderingDataHotel(0)
					} else if (this.params.type == 3) {
						this.dataIndex = this.params.dataIndex3
						this.getRenderingDataDining(0)
					} else if (this.params.type == 4) {
						this.dataIndex = this.params.dataIndex4
						this.getRenderingDataScenic(0)
					}
				},
				deep: true,
				immediate: true,
			},
		},
		mounted() {

		},
		methods: {
			getPeopleName(type) {
				let findIndex = this.peopleTypeList.findIndex(x => x.id == type)
				if (findIndex != -1) return this.peopleTypeList[findIndex].name
				else return ''
			},
			getHotelName(type) {
				let findIndex = this.houseTypeList.findIndex(x => x.id == type)
				if (findIndex != -1) return this.houseTypeList[findIndex].name
				else return ''
			},
			popupEditor(value) {
				let text = value.detail.__args__
				if (this.editorObj.type == 2) {
					this.datas.HotelOrderList[this.datas.hotelIndex].ReimburseList.ActualUseInfo = text[0]
					this.HotelOrderListReport[this.dataIndex] = JSON.parse(JSON.stringify(this.datas))
					this.params.HotelOrderListReport = this.HotelOrderListReport
				} else if (this.params.type == 3) {
					this.datas.DiningSummaryList[this.datas.diningIndex].ReimburseList.ActualUseInfo = text[0]
					this.DiningList[this.dataIndex] = JSON.parse(JSON.stringify(this.datas))
					this.params.DiningList = this.DiningList
				} else if (this.params.type == 4) {
					this.datas.ScenicStatisticsList[this.datas.scenicIndex].ReimburseList.ActualUseInfo = text[0]
					this.ScenicList[this.dataIndex] = JSON.parse(JSON.stringify(this.datas))
					this.params.ScenicList = this.ScenicList
				}
				this.$emit('change', this.params)
			},
			showEditorVisible() {
				let name = ''
				if (this.params.type == 2) name = '酒店'
				else if (this.params.type == 3) name = '餐食'
				else if (this.params.type == 4) name = '门票'
				this.editorObj = {
					name: name,
					type: this.params.type
				}
				this.editorVisible = true
			},
			// 门票
			getRenderingDataScenic(type) {
				if (type == 0) {
					this.dateList = []
					for (let i = 0; i < this.ScenicList.length; i++) {
						let data = this.ScenicList[i]
						if (data.Id == undefined) {
							this.$set(this.ScenicList[i], `Id`, i + 1);
						}
						this.dateList.push({
							name: data.UseTimeStr,
							id: i + 1,
							newName: data.ActualUseInfo
						})
					}
					this.datas = this.ScenicList[this.dataIndex]
					this.scenicsList = []
					if(this.datas&&this.datas.ScenicStatisticsList){
						this.datas.ScenicStatisticsList.forEach(x => {
							this.scenicsList.push({
								name: x.ScenicName,
								id: x.ID
							})
						})
						this.scenicObj = JSON.parse(JSON.stringify(this.scenicsList[this.datas.scenicIndex]))
					}
					
				}
				let dates = this.dateList.filter(x => {
					return x.id == this.ScenicList[this.dataIndex].Id
				})
				if (dates.length == 0) dates = [this.dateList[0]]
				if(dates&&dates[0]){
					this.dateObj = JSON.parse(JSON.stringify(dates[0]))

					let list = this.currencyList.filter(x => {
						return x.id == this.ScenicList[this.dataIndex].ScenicStatisticsList[this.datas.scenicIndex]
							.ReimburseList.CurrencyId
					})
					if (list.length == 1) list = this.currencyObj = JSON.parse(JSON.stringify(list[0]))
					else this.currencyObj = {
						id: 0,
						name: '选择币种'
					}
					for (let i = 0; i < this.datas.ScenicStatisticsList.length; i++) {
						//只替换当前景点下面的币种
						if (this.datas.scenicIndex == i) {
							this.datas.ScenicStatisticsList[i].CurrencyId = this.currencyObj.id
							this.datas.ScenicStatisticsList[i].CurrencyStr = this.currencyObj.id ? this.currencyObj.name : ''
							this.datas.ScenicStatisticsList[i].ReimburseList.CurrencyId = this.currencyObj.id
							for (let j = 0; j < this.datas.ScenicStatisticsList[i].ReimburseList.ReimburseDetailsList
								.length; j++) {
								this.datas.ScenicStatisticsList[i].ReimburseList.ReimburseDetailsList[j].CurrencyId = this
									.currencyObj.id
							}
						}
					}
				}
				
			},
			// 餐食
			getRenderingDataDining(type) {
				if (type == 0) {
					this.dateList = []
					for (let i = 0; i < this.DiningList.length; i++) {
						let data = this.DiningList[i]
						if (data.Id == undefined) {
							this.$set(this.DiningList[i], `Id`, i + 1);
						}
						this.dateList.push({
							name: data.UseTimeStr,
							id: i + 1,
							newName: data.ActualUseInfo
						})
					}
					this.datas = this.DiningList[this.dataIndex]
					this.diningList = []
					if(this.datas&&this.datas.DiningSummaryList){
						this.datas.DiningSummaryList.forEach(x => {
							this.diningList.push({
								name: x.DiningName,
								id: x.DiningID
							})
						})
						this.diningObj = JSON.parse(JSON.stringify(this.diningList[this.datas.diningIndex]))
					}
				}
				let dates = this.dateList.filter(x => {
					return x.id == this.DiningList[this.dataIndex].Id
				})
				if (dates.length == 0) dates = [this.dateList[0]]
				if(dates&&dates[0]){
					this.dateObj = JSON.parse(JSON.stringify(dates[0]))
					let list = this.currencyList.filter(x => {
						return x.id == this.DiningList[this.dataIndex].DiningSummaryList[this.datas.diningIndex]
							.ReimburseList.CurrencyId
					})
					if (list.length == 1) list = this.currencyObj = JSON.parse(JSON.stringify(list[0]))
					else this.currencyObj = {
						id: 0,
						name: '选择币种'
					}
					for (let i = 0; i < this.datas.DiningSummaryList.length; i++) {
						//只替换当前餐下面的币种
						if (i == this.datas.diningIndex) {
							this.datas.DiningSummaryList[i].CurrencyId = this.currencyObj.id
							this.datas.DiningSummaryList[i].CurrencyStr = this.currencyObj.id ? this.currencyObj.name : ''
							this.datas.DiningSummaryList[i].ReimburseList.CurrencyId = this.currencyObj.id
							for (let j = 0; j < this.datas.DiningSummaryList[i].ReimburseList.ReimburseDetailsList
								.length; j++) {
								this.datas.DiningSummaryList[i].ReimburseList.ReimburseDetailsList[j].CurrencyId = this
									.currencyObj
									.id
							}
						}
					}
				}
				
			},
			// 酒店
			getRenderingDataHotel(type) {
				if (type == 0) {
					this.dateList = []
					for (let i = 0; i < this.HotelOrderListReport.length; i++) {
						let data = this.HotelOrderListReport[i]
						if (data.Id == undefined) {
							this.$set(this.HotelOrderListReport[i], `Id`, i + 1);
						}
						this.dateList.push({
							name: data.UseTimeStr,
							id: i + 1,
						})
					}
					this.datas = this.HotelOrderListReport[this.dataIndex]
					this.hotelList = []
					if(this.datas&&this.datas.HotelOrderList){
						this.datas.HotelOrderList.forEach(x => {
							this.hotelList.push({
								name: x.HotelName,
								id: x.HotelId,
								newName: x.ReimburseList.ActualUseInfo
							})
						})
						this.hotelObj = JSON.parse(JSON.stringify(this.hotelList[this.datas.hotelIndex]))
					}
				}
				let dates = this.dateList.filter(x => {
					return x.id == this.HotelOrderListReport[this.dataIndex].Id
				})
				if (dates.length == 0) dates = [this.dateList[0]]
				if(dates&&dates[0]){
					this.dateObj = JSON.parse(JSON.stringify(dates[0]))
				}
				
				if(this.HotelOrderListReport&&this.HotelOrderListReport[this.dataIndex]&&this.HotelOrderListReport[this.dataIndex].HotelOrderList[this.datas.hotelIndex]){
					let list = this.currencyList.filter(x => {
						return x.id == this.HotelOrderListReport[this.dataIndex].HotelOrderList[this.datas.hotelIndex]
							.ReimburseList.CurrencyId
					})
					if (list.length == 1) list = this.currencyObj = JSON.parse(JSON.stringify(list[0]))
					else this.currencyObj = {
						id: 0,
						name: '选择币种'
					}
					for (let i = 0; i < this.datas.HotelOrderList.length; i++) {
						//只替换当前酒店下的币种
						if (this.datas.hotelIndex == i) {
							this.datas.HotelOrderList[i].CurrencyId = this.currencyObj.id
							this.datas.HotelOrderList[i].CurrencyStr = this.currencyObj.id ? this.currencyObj.name : ''
							this.datas.HotelOrderList[i].ReimburseList.CurrencyId = this.currencyObj.id
							for (let j = 0; j < this.datas.HotelOrderList[i].ReimburseList.ReimburseDetailsList.length; j++) {
								this.datas.HotelOrderList[i].ReimburseList.ReimburseDetailsList[j].CurrencyId = this
									.currencyObj.id
							}
						}
					}
				}
			},
			// 车
			getRenderingDataBus(type) {
				if (type == 0) {
					this.dateList = []
					for (let i = 0; i < this.BusList.length; i++) {
						let data = this.BusList[i]
						if (data.TotalMoney == undefined) {
							this.$set(this.BusList[i], `TotalMoney`, 0);
						}
						if (data.CheckDateId == undefined) {
							this.$set(this.BusList[i], `CheckDateId`, i + 1);
						}
						this.dateList.push({
							name: data.PlanDateStr,
							id: i + 1,
						})
					}
				}
				this.datas = this.BusList[this.dataIndex]
				let dates = this.dateList.filter(x => {
					return x.id == this.BusList[this.dataIndex].CheckDateId
				})
				if (dates.length == 0) dates = [this.dateList[0]]
				this.dateObj = JSON.parse(JSON.stringify(dates[0]))

				let list = this.currencyList.filter(x => {
					return x.id == this.BusList[this.dataIndex].ReimburseList.CurrencyId
				})
				if (list.length == 1) list = this.currencyObj = JSON.parse(JSON.stringify(list[0]))
				else this.currencyObj = {
					id: 0,
					name: '选择币种'
				}
				this.datas.ReimburseList.CurrencyId = this.currencyObj.id
			},
			showOptionVisible(type) {
				this.optionType = type
				if (this.optionType == 1) { //时间
					this.optionList = JSON.parse(JSON.stringify(this.dateList))
					this.optionObj = JSON.parse(JSON.stringify(this.dateObj))
				} else if (this.optionType == 2) { //币种
					this.optionList = JSON.parse(JSON.stringify(this.currencyList))
					this.optionObj = JSON.parse(JSON.stringify(this.currencyObj))
				} else if (this.optionType == 3) { //酒店
					this.optionList = JSON.parse(JSON.stringify(this.hotelList))
					this.optionObj = JSON.parse(JSON.stringify(this.hotelObj))
				} else if (this.optionType == 4) { //餐食
					this.optionList = JSON.parse(JSON.stringify(this.diningList))
					this.optionObj = JSON.parse(JSON.stringify(this.diningObj))
				} else if (this.optionType == 5) { //门票
					this.optionList = JSON.parse(JSON.stringify(this.scenicsList))
					this.optionObj = JSON.parse(JSON.stringify(this.scenicObj))
				}
				this.optionVisible = true
			},
			close() {
				this.optionVisible = false
				this.editorVisible = false
			},
			// 获取选中时间及币种
			popupOption(value) {
				this.optionVisible = false
				if (this.optionType == 1) { //日期
					this.getDate(value)
				} else if (this.optionType == 2) { //币种
					this.getCurrency(value)
				} else if (this.optionType == 3) { //酒店
					let newDataIndex = this.optionList.findIndex(item => item.id == value)
					if (this.dataIndex != -1) {
						this.datas.hotelIndex = newDataIndex
						this.HotelOrderListReport[this.dataIndex] = JSON.parse(JSON.stringify(this.datas))
						this.params.HotelOrderListReport = JSON.parse(JSON.stringify(this.HotelOrderListReport))
					}
					this.hotelObj = JSON.parse(JSON.stringify(this.optionObj))
				} else if (this.optionType == 4) { //餐食
					let newDataIndex = this.optionList.findIndex(item => item.id == value)
					if (this.dataIndex != -1) {
						this.datas.diningIndex = newDataIndex
						this.DiningList[this.dataIndex] = JSON.parse(JSON.stringify(this.datas))
						this.params.DiningList = JSON.parse(JSON.stringify(this.DiningList))
					}
					this.diningObj = JSON.parse(JSON.stringify(this.optionObj))
				} else if (this.optionType == 5) { //门票
					let newDataIndex = this.optionList.findIndex(item => item.id == value)
					if (this.dataIndex != -1) {
						this.datas.scenicIndex = newDataIndex
						this.ScenicList[this.dataIndex] = JSON.parse(JSON.stringify(this.datas))
						this.params.ScenicList = JSON.parse(JSON.stringify(this.ScenicList))
					}
					this.scenicgObj = JSON.parse(JSON.stringify(this.optionObj))
				}
				this.$emit('change', this.params)
			},
			getDate(value) {
				this.dateObj.id = value;
				let newDataIndex = this.optionList.findIndex(item => item.id == value);
				if (this.dataIndex != -1) {
					if (this.params.type == 1) {
						this.BusList[this.dataIndex] = JSON.parse(JSON.stringify(this.datas))
						this.params.BusList = JSON.parse(JSON.stringify(this.BusList))
					}
					this.optionObj = this.optionList[this.dataIndex]
					this.dataIndex = newDataIndex;
				}
				this.dateObj = JSON.parse(JSON.stringify(this.optionObj));

				if (this.params.type == 1) {
					this.params.dataIndex1 = this.dataIndex
				} else if (this.params.type == 2) {
					this.params.dataIndex2 = this.dataIndex
				} else if (this.params.type == 3) {
					this.params.dataIndex3 = this.dataIndex
				} else if (this.params.type == 4) {
					this.params.dataIndex4 = this.dataIndex
				} else if (this.params.type == 5) {
					this.params.dataIndex5 = this.dataIndex
				} else if (this.params.type == 6) {
					this.params.dataIndex6 = this.dataIndex
				} else if (this.params.type == 7) {
					this.params.dataIndex7 = this.dataIndex
				} else if (this.params.type == 8) {
					this.params.dataIndex8 = this.dataIndex
				} else if (this.params.type == 9) {
					this.params.dataIndex9 = this.dataIndex
				} else if (this.params.type == 10) {
					this.params.dataIndex10 = this.dataIndex
				}
			},
			getCurrency(value) {
				let list = this.optionList.filter(item => {
					return item.id == value
				})
				this.optionObj = list[0]
				this.currencyObj = JSON.parse(JSON.stringify(this.optionObj))
				if (this.params.type == 1) {
					this.datas.CurrencyStr = this.currencyObj.name
					this.datas.ReimburseList.CurrencyId = this.currencyObj.id
					this.datas.ReimburseList.ReimburseDetailsList.forEach(x => {
						x.CurrencyId = this.currencyObj.id
					});
					this.BusList[this.dataIndex] = JSON.parse(JSON.stringify(this.datas))
					this.params.BusList = JSON.parse(JSON.stringify(this.BusList))
				} else if (this.params.type == 2) {
					this.datas.HotelOrderList[this.datas.hotelIndex].CurrencyId = this.currencyObj.id
					this.datas.HotelOrderList[this.datas.hotelIndex].CurrencyStr = this.currencyObj.name
					this.datas.HotelOrderList[this.datas.hotelIndex].ReimburseList.CurrencyId = this.currencyObj.id
					this.datas.HotelOrderList[this.datas.hotelIndex].ReimburseList.ReimburseDetailsList.forEach(x => {
						x.CurrencyId = this.currencyObj.id
					})
					this.HotelOrderListReport[this.dataIndex] = JSON.parse(JSON.stringify(this.datas))
					this.params.HotelOrderListReport = JSON.parse(JSON.stringify(this.HotelOrderListReport))
				} else if (this.params.type == 3) {
					this.datas.DiningSummaryList[this.datas.diningIndex].CurrencyId = this.currencyObj.id
					this.datas.DiningSummaryList[this.datas.diningIndex].CurrencyStr = this.currencyObj.name
					this.datas.DiningSummaryList[this.datas.diningIndex].ReimburseList.CurrencyId = this.currencyObj.id
					this.datas.DiningSummaryList[this.datas.diningIndex].ReimburseList.ReimburseDetailsList.forEach(x => {
						x.CurrencyId = this.currencyObj.id
					})
					this.DiningList[this.dataIndex] = JSON.parse(JSON.stringify(this.datas))
					this.params.DiningList = JSON.parse(JSON.stringify(this.DiningList))
				} else if (this.params.type == 4) {
					this.datas.ScenicStatisticsList[this.datas.scenicIndex].CurrencyId = this.currencyObj.id
					this.datas.ScenicStatisticsList[this.datas.scenicIndex].CurrencyStr = this.currencyObj.name
					this.datas.ScenicStatisticsList[this.datas.scenicIndex].ReimburseList.CurrencyId = this.currencyObj.id
					this.datas.ScenicStatisticsList[this.datas.scenicIndex].ReimburseList.ReimburseDetailsList.forEach(
						x => {
							x.CurrencyId = this.currencyObj.id
						})
					this.ScenicList[this.dataIndex] = JSON.parse(JSON.stringify(this.datas))
					this.params.ScenicList = JSON.parse(JSON.stringify(this.ScenicList))
				}
			},
		}
	}
</script>