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

	.reimbursementInfor {
		height: 100vh;
	}

	.reimbursementInforHeaderBox {
		background: linear-gradient(-30deg, #4FA9FF, #4779FF);
	}

	.reimbursementInforTitle {
		position: relative;
		z-index: 3
	}

	.reimbursementInforTitle.fixed {
		position: fixed;
		left: 0;
		top: 0;
		right: 0;
		z-index: 3;
		// background: linear-gradient(-30deg, #4FA9FF, #4779FF);
	}

	.reimbursementInforTitle.fixed .reimbursementInforTsBox {
		// top: 22rpx;
	}

	.reimbursementInforTsBox {
		width: 60%;
		position: absolute;
		top: 118rpx;
		left: 80rpx;
		right: 300rpx;
		overflow: hidden;
	}

	.reimbursementInforT-text {}

	.reimbursementInforText {
		font-weight: 500;
		font-size: 32rpx;
		color: #FFFFFF;
		white-space: nowrap;
		margin-bottom: 20rpx;
		margin-left: 22rpx;
		margin-right: 22rpx;
		text-align: center;
		padding: 5rpx 30rpx;
	}

	.reimbursementInforText.active {
		color: #257BF1;
		background: #FFFFFF;
		border-radius: 6rpx;
		padding: 5rpx 30rpx;
	}

	.saveBox {
		position: fixed;
		right: 50rpx;
		bottom: 50rpx;
		z-index: 2;
	}

	.saveBox view {
		background: #257BF2;
		box-shadow: 0rpx 0rpx 10rpx #fff;
		color: #fff;
		width: 100rpx;
		height: 100rpx;
		border-radius: 50%;
	}
</style>
<template>
	<view style="height: 100vh;overflow: hidden;">
		<scroll-view class="reimbursementInforBox" scroll-y="true" :enable-back-to-top="true" :enable-flex="true"
			@scroll="scroll" style="height: 100vh;overflow: hidden;">
			<view class="reimbursementInforHeaderBox">
				<view class="reimbursementInforTitle fixed"
					:style="[{'background': old.scrollTop>20?'linear-gradient(-30deg, #4FA9FF, #4779FF)':''}]">
					<headers textAlign="left" :title="pageTitle" color="#fff"></headers>
					<scroll-view class="reimbursementInforTsBox" :scroll-x="true" :scroll-left="scrollLeft">
						<view class="reimbursementInforT-text row-aic-n">
							<view class="reimbursementInforText" :class="[params.type==item.id?'active':'']"
								v-for="(item,index) in titles" :id="`refs_${index+1}`" :key="index"
								@click="getType(item)">{{ item.name }}</view>
						</view>
					</scroll-view>
				</view>
				<view style="height: 180rpx;"></view>
				<headeDatas v-show="params.type<5" :currencyList="currencyList" :data="params" @change="getNewData">
				</headeDatas>
			</view>
			<!-- 车信息-->
			<productInfor1 v-if="params.type==1" :data="params" :dataIndex1="params.dataIndex1" @change="getNewData"
				:optionList="busTypeList">
			</productInfor1>
			<!-- 酒店信息-->
			<productInfor2 v-else-if="params.type==2" :data="params" :dataIndex2="params.dataIndex2"
				@change="getNewData" :optionList="hotelTypeList">
			</productInfor2>
			<!-- 餐食信息-->
			<productInfor3 v-else-if="params.type==3" :data="params" :dataIndex3="params.dataIndex3"
				@change="getNewData" :optionList="diningTypeList">
			</productInfor3>
			<!-- 门票信息-->
			<productInfor4 v-else-if="params.type==4" :data="params" :dataIndex4="params.dataIndex4"
				@change="getNewData" :optionList="scenicTypeList">
			</productInfor4>
			<!-- 其它信息-->
			<otherInfor1 v-else-if="params.type==5" :currencyList="currencyList" :data="params" @change="getNewData"
				:options="otherTypeList"></otherInfor1>
			<!-- 小费收入-->
			<otherInfor2 v-else-if="params.type==6" :currencyList="currencyList" :data="params" @change="getNewData">
			</otherInfor2>
			<!-- 团费小计-->
			<otherInfor3 v-else-if="params.type==7" :currencyList="currencyList" :data="params" @change="getNewData">
			</otherInfor3>
			<!-- 自费收入-->
			<otherInfor4 v-else-if="params.type==8" :currencyList="currencyList" :data="params" @change="getNewData">
			</otherInfor4>
			<!-- 自费支出-->
			<otherInfor5 v-else-if="params.type==9" :currencyList="currencyList" :data="params" @change="getNewData">
			</otherInfor5>
			<!-- 购物报账-->
			<otherInfor6 v-else-if="params.type==10" :currencyList="currencyList" :data="params" @change="getNewData"
				:options="shopTypeList"></otherInfor6>
		</scroll-view>
		<view v-if="params.IsOperation==0" class="saveBox" @click="saveData">
			<view class="row justify-center items-center">
				<text>保存</text>
			</view>
		</view>
	</view>
</template>
<script>
	import headers from "@/components/header/header";
	import headeDatas from "./components/headeDatas";
	import productInfor1 from "./components/report/productInfor1";
	import productInfor2 from "./components/report/productInfor2";
	import productInfor3 from "./components/report/productInfor3";
	import productInfor4 from "./components/report/productInfor4";
	import otherInfor1 from "./components/report/otherInfor1";
	import otherInfor2 from "./components/report/otherInfor2";
	import otherInfor3 from "./components/report/otherInfor3";
	import otherInfor4 from "./components/report/otherInfor4";
	import otherInfor5 from "./components/report/otherInfor5";
	import otherInfor6 from "./components/report/otherInfor6";
	export default {
		components: {
			headers,
			headeDatas,
			productInfor1,
			productInfor2,
			productInfor3,
			productInfor4,
			otherInfor1,
			otherInfor2,
			otherInfor3,
			otherInfor4,
			otherInfor5,
			otherInfor6,
		},
		data() {
			return {
				pageTitle: '',
				boxOption: 0,
				titleStyle: {
					opacity: 0,
				},
				scrollTop: 100,
				old: {
					scrollTop: 0
				},
				titles: [{
						name: '车辆',
						id: 1,
						val: 'refs1',
						left: 0,
					},
					{
						name: '酒店',
						id: 2,
						val: 'refs2',
						left: 0,
					},
					{
						name: '餐食',
						id: 3,
						val: 'refs3',
						left: 0,
					},
					{
						name: '门票',
						id: 4,
						val: 'refs4',
						left: 0,
					},
					{
						name: '其他费用',
						id: 5,
						val: 'refs5',
						left: 0,
					},
					{
						name: '小费收入',
						id: 6,
						val: 'refs6',
						left: 0,
					},
					{
						name: '团费小计',
						id: 7,
						val: 'refs7',
						left: 0,
					},
					{
						name: '自费收入',
						id: 8,
						val: 'refs8',
						left: 0,
					},
					{
						name: '自费支出',
						id: 9,
						val: 'refs9',
						left: 0,
					},
					{
						name: '购物店/车购',
						id: 10,
						val: 'refs10',
						left: 0,
					},
				],
				currencyVisible: false,
				oldDataIndex: 1,//选中类型
				loading: false,
				msg: {
					TCIDs: ''
				},
				datas: {},
				params: {
					IsOperation: 0, //0-可以操作，1-已制单，不能操作
					IsEditHotel: 0, //是否有修改酒店价格、付款方式权限
					IsEditHotelPeople: 0, //是否有修改酒店人数权限
					CreateBy: null, //线路负责人
					CreateByName: null, //线路负责人
					CreateByPhoto: null, //电话
					CreateByAccount: null, //联系方式
					BusOrderState: 0, //车订单信息
					Complain_Extend: null, //供应商投诉信息
					HotelOrderListReport: [], //酒店信息，合团
					BusPlanListReport: null, //车信息
					HotelList: [], //酒店列表
					PriceHotelResult: [], //酒店团情况
					ScenicList: [], //景点
					DiningList: [], //餐厅
					PriceShopList: null, //购物店列表
					HouseStatistics: {}, //房间信息
					BusList: [], //车
					OtherOrderInfo: {
						OtherList: [], //其他费用 
						TipList: [], //小费收入
						TeamList: [], //团费小计
						SelfPlayingIncomeList: [], //自费收入
						SelfPlayingExpendList: [], //自费支出
					}, //其他订单信息
					LeaderApply: {}, //领队用款
					LeaderShopList: [], //	购物店信息(领队报账的时候填写)
				},
				busTypeList: [],
				hotelTypeList: [],
				diningTypeList: [],
				scenicTypeList: [],
				otherTypeList: [{
						name: '导游津贴',
						id: 1,
					},
					{
						name: '司机津贴',
						id: 2,
					},
					{
						name: '其他支出',
						id: 0,
					},
				],
				scrollLeft: 0,
				currencyList: [],
				shopTypeList: [],
			}
		},
		onLoad(option) {
			if (option.TCIDs) {
				this.msg.TCIDs = option.TCIDs
			}
			this.b2b_user_info = uni.getStorageSync('b2b_user')
			this.init()
		},
		created() {
			this.contentHeight = this.$utils.calcContentHeight(-40) + "px";
			this.mainColor = this.$uiConfig.mainColor;
		},
		mounted() {
			const that = this
			// uni.getSystemInfo({
			// 	success(res) {
			// 		that.titleStyle = {
			// 			paddingTop: `${res.statusBarHeight}px`
			// 		};
			// 	},
			// });
			this.getOptionData()
			this.getCurrencyList()
			this.$nextTick(() => {
				this.titles.forEach((x, index) => {
					// 查询当前元素的位置
					uni.createSelectorQuery()
						.in(this) // 限定在当前组件内查询（关键！）
						.select(`#refs_${index + 1}`) // 匹配元素的 id
						.fields({
							position: true, // 获取位置信息（left/top）
							size: true // 获取尺寸（width/height）
						})
						.exec((res) => {
							if (res[0]) {
								const {
									left,
									top,
									width,
									height
								} = res[0];
								x.left = width * (index)
							} else {
								console.log(`未找到元素 refs_${index + 1}`);
							}
						});
				});
			});
		},
		methods: {
			//车验证
			VerificationBusList() {
				let msg = ''
				for (let i = 0; i < this.params.BusList.length; i++) {
					let obj = this.params.BusList[i];
					for (let j = 0; j < obj.ReimburseList.ReimburseDetailsList.length; j++) {
						let child = obj.ReimburseList.ReimburseDetailsList[j];
						if (!this.$utils.checkIsNum(child.UserNum)) {
							child.UserNum = 0;
						}
						if (!this.$utils.checkIsNum(child.UnitPrice)) {
							child.UnitPrice = 0;
						}

						if (msg == '' &&
							(obj.ReimburseList.CurrencyId == 0 || obj.ReimburseList.CurrencyId == null) &&
							(obj.ReimburseList.SettlementType > 0 || obj.ReimburseList.Remarks != '' ||
								obj.ReimburseList.VoucherPicList.length > 0 || child.StartPlace != '' ||
								child.EndPlace != '' || child.UserNum > 0 || child.UnitPrice > 0 || child.UserType)
						) {
							msg = `请选择${obj.PlanDateStr}车辆币种`;
						}
						if(msg == ''&&child.UnitPrice!=0&&child.UnitPrice!=null&&child.UnitPrice!=''&&!this.$utils.checkIsNum(child.UnitPrice)){
							msg = `请输入${obj.PlanDateStr}正确的车金额`
						}
						// if (msg == '' && child.StartPlace == '' &&
						// 	(obj.ReimburseList.SettlementType > 0 || obj.ReimburseList.Remarks != '' ||
						// 		obj.ReimburseList.VoucherPicList.length > 0 || obj.ReimburseList.CurrencyId ||
						// 		child.EndPlace != '' || child.UserNum > 0 || child.UnitPrice > 0 || child.UserType)
						// ) {
						// 	msg = `请输入[` + obj.UseTime + `]车辆出发地`
						// }
						// if (msg == '' && child.EndPlace == '' &&
						// 	(obj.ReimburseList.SettlementType > 0 || obj.ReimburseList.Remarks != '' ||
						// 		obj.ReimburseList.VoucherPicList.length > 0 || child.StartPlace != '' ||
						// 		obj.ReimburseList.CurrencyId || child.UserNum > 0 || child.UnitPrice > 0 || child.UserType)
						// ) {
						// 	msg = `请输入[` + obj.UseTime + `]车辆目的地`
						// }
					}
				}
				return msg
			},
			//酒店验证
			VerificationHotel() {
				let msg = ''
				for (let i = 0; i < this.params.HotelOrderListReport.length; i++) {
					let obj = this.params.HotelOrderListReport[i]
					for (let j = 0; j < obj.HotelOrderList.length; j++) {
						let child = obj.HotelOrderList[j]
						for (let x = 0; x < child.ReimburseList.ReimburseDetailsList.length; x++) {
							let grandson = child.ReimburseList.ReimburseDetailsList[x]
							if (msg == '' && (child.ReimburseList.CurrencyId == 0 || child.ReimburseList.CurrencyId ==
									null) &&
								(child.ReimburseList.SettlementType > 0 || child.ReimburseList.Remarks != '' ||
									child.ReimburseList.VoucherPicList.length > 0 || grandson.UserNum > 0 ||
									grandson.UnitPrice > 0 || grandson.UserType)
							) {
								msg = `请选择${obj.UseTimeStr}酒店币种`
							}
							if(msg == ''&&grandson.UnitPrice!=0&&grandson.UnitPrice!=null&&grandson.UnitPrice!=''&&!this.$utils.checkIsNum(grandson.UnitPrice)){
								msg = `请输入${obj.UseTimeStr}正确的酒店金额`
							}
						}
					}
				}
				return msg
			},
			//餐验证
			VerificationDining() {
				let msg = ''
				for (let i = 0; i < this.params.DiningList.length; i++) {
					let obj = this.params.DiningList[i]
					for (let j = 0; j < obj.DiningSummaryList.length; j++) {
						let child = obj.DiningSummaryList[j]
						for (let x = 0; x < child.ReimburseList.ReimburseDetailsList.length; x++) {
							let grandson = child.ReimburseList.ReimburseDetailsList[x]
							if (msg == '' && (child.ReimburseList.CurrencyId == 0 || child.ReimburseList.CurrencyId ==
									null) &&
								(child.ReimburseList.SettlementType > 0 || child.ReimburseList.Remarks != '' ||
									child.ReimburseList.VoucherPicList.length > 0 || grandson.UserNum > 0 ||
									grandson.UnitPrice > 0 || grandson.UserType)
							) {
								msg = `请选择${obj.UseTimeStr}餐币种`
							}
							if(msg == ''&&grandson.UnitPrice!=0&&grandson.UnitPrice!=null&&grandson.UnitPrice!=''&&!this.$utils.checkIsNum(grandson.UnitPrice)){
								msg = `请输入${obj.UseTimeStr}正确的餐金额`
							}
						}
					}
				}
				return msg
			},
			//景点验证
			VerificationScenic() {
				let msg = ''
				for (let i = 0; i < this.params.ScenicList.length; i++) {
					let obj = this.params.ScenicList[i]
					for (let j = 0; j < obj.ScenicStatisticsList.length; j++) {
						let child = obj.ScenicStatisticsList[j]
						for (let x = 0; x < child.ReimburseList.ReimburseDetailsList.length; x++) {
							let grandson = child.ReimburseList.ReimburseDetailsList[x]
							if (msg == '' && (child.ReimburseList.CurrencyId == 0 || child.ReimburseList.CurrencyId ==
									null) &&
								(child.ReimburseList.SettlementType > 0 || child.ReimburseList.Remarks != '' ||
									child.ReimburseList.VoucherPicList.length > 0 || grandson.UserNum > 0 ||
									grandson.UnitPrice > 0 || grandson.UserType)
							) {
								msg = `请选择${obj.UseTimeStr}门票币种`
							}
							if(msg == ''&&grandson.UnitPrice!=0&&grandson.UnitPrice!=null&&grandson.UnitPrice!=''&&!this.$utils.checkIsNum(grandson.UnitPrice)){
								msg = `请输入${obj.UseTimeStr}正确的门票金额`
							}
						}
					}
				}
				return msg
			},
			VerificationOther() {
				let msg = ''
				for (let i = 0; i < this.params.OtherOrderInfo.OtherList.length; i++) {
					let obj = this.params.OtherOrderInfo.OtherList[i]

					if (msg == '' && obj.UseDate == null &&
						(obj.UnitPrice > 0 || obj.Rebate > 0 || obj.VoucherPicList.length > 0 ||
							obj.Remark != '' || obj.Currency != 0)
					) {
						msg = `请选择第【${i+1}条的】其他费用使用时间`
					}
					if (msg == '' && obj.CostProjectStr == '' &&
						(obj.UnitPrice > 0 || obj.Rebate > 0 || obj.VoucherPicList.length > 0 ||
							obj.Remark != '' || obj.Currency || obj.UseDate != null)
					) {
						msg = `请选择第【${i+1}条的】其他费用费用项目`
					}
					if (msg == '' && (obj.Currency == 0 || obj.Currency == null) &&
						(obj.UnitPrice > 0 || obj.Rebate > 0 || obj.VoucherPicList.length > 0 ||
							obj.Remark != '' || obj.UseDate != null)
					) {
						msg = `请选择第【${i+1}条的】其他费用币种`
					}
					if(msg == ''&&obj.UnitPrice!=0&&obj.UnitPrice!=null&&obj.UnitPrice!=''&&!this.$utils.checkIsNum(obj.UnitPrice)){
						msg = `请输入第【${i+1}条的】正确的其他费用金额`
					}
					if(msg == ''&&obj.Rebate!=0&&obj.Rebate!=null&&obj.Rebate!=''&&!this.$utils.checkIsNum(obj.Rebate)){
						msg = `请输入第【${i+1}条的】正确的其他费用返佣金额`
					}

				}
				return msg
			},
			VerificationIncome() {
				let msg = ''
				for (let i = 0; i < this.params.OtherOrderInfo.SelfPlayingIncomeList.length; i++) {
					let obj = this.params.OtherOrderInfo.SelfPlayingIncomeList[i]
					if (msg == '' && obj.UseDate == null &&
						(obj.UnitPrice > 0 || obj.VoucherPicList.length > 0 ||
							obj.Remark != '' || obj.Currency)
					) {
						msg = `请选择第【${i+1}条的】自费收入使用时间`
					}
					if (msg == '' && (obj.Currency == 0 || obj.Currency == null) &&
						(obj.UnitPrice > 0 || obj.VoucherPicList.length > 0 ||
							obj.Remark != '' || obj.UseDate != null)
					) {
						msg = `请选择第【${i+1}条的】自费收入币种`
					}
					if(msg == ''&&obj.UnitPrice!=0&&obj.UnitPrice!=null&&obj.UnitPrice!=''&&!this.$utils.checkIsNum(obj.UnitPrice)){
						msg = `请输入第【${i+1}条的】正确的自费收入金额`
					}
					
				}
				return msg
			},
			VerificationExpend() {
				let msg = ''
				for (let i = 0; i < this.params.OtherOrderInfo.SelfPlayingExpendList.length; i++) {
					let obj = this.params.OtherOrderInfo.SelfPlayingExpendList[i]
					if (msg == '' && obj.UseDate == null &&
						(obj.UnitPrice > 0 || obj.Rebate > 0 || obj.VoucherPicList.length > 0 ||
							obj.Remark != '')
					) {
						msg = `请选择第【${i+1}条的】自费支出使用时间`
					}
					if(msg == ''&&obj.UnitPrice!=0&&!this.$utils.checkIsNum(obj.UnitPrice)){
						msg = `请输入第【${i+1}条的】正确的自费支出金额`
					}
					if(msg == ''&&obj.Rebate!=0&&obj.Rebate!=null&&obj.Rebate!=''&&!this.$utils.checkIsNum(obj.Rebate)){
						msg = `请输入第【${i+1}条的】正确的自费支出返佣金额`
					}
				}
				return msg
			},
			VerificationShop() {
				let msg = ''
				for (let i = 0; i < this.params.LeaderShopList.length; i++) {
					let obj = this.params.LeaderShopList[i]
					if (msg == '' && obj.EnterTime == null &&
						(obj.ShopMoney > 0 || obj.ShopId != null || obj.VoucherPicList.length > 0 ||
							obj.Remark != null || obj.CurrencyId)
					) {
						msg = `请选择第【${i+1}条的】购物报账进店时间`
					}
					if (msg == '' && obj.ShopId == null &&
						(obj.ShopMoney > 0 || obj.CurrencyId || obj.VoucherPicList.length > 0 ||
							obj.Remark != null || obj.EnterTime != null)&&this.params.IsSelectShop
					) {
						msg = `请选择第【${i+1}条的】购物名称`
					}
					if (msg == '' && obj.ShopName == null &&
						(obj.ShopMoney > 0 || obj.CurrencyId || obj.VoucherPicList.length > 0 ||
							obj.Remark != null || obj.EnterTime != null)&&!this.params.IsSelectShop
					) {
						msg = `请输入第【${i+1}条的】购物名称`
					}
					if (msg == '' && (obj.CurrencyId == 0 || obj.CurrencyId == null) &&
						(obj.ShopMoney > 0 || obj.ShopId != null || obj.VoucherPicList.length > 0 ||
							obj.Remark != null || obj.EnterTime != null)
					) {
						msg = `请选择第【${i+1}条的】购物报账币种`
					}
					if(msg == ''&&obj.ShopMoney!=0&&obj.ShopMoney!=null&&!this.$utils.checkIsNum(obj.ShopMoney)){
						msg = `请输入第【${i+1}条的】正确的购物金额`
					}
				}
				return msg
			},
			saveData() {
				let msg = ''
				if (msg == '') msg = this.VerificationBusList()
				if (msg == '') msg = this.VerificationHotel()
				if (msg == '') msg = this.VerificationDining()
				if (msg == '') msg = this.VerificationScenic()
				if (msg == '') msg = this.VerificationOther()
				if (msg == '') msg = this.VerificationIncome()
				if (msg == '') msg = this.VerificationExpend()
				// if (msg == '') msg = this.VerificationShop()
				if (msg) {
					return uni.showToast({
						title: msg,
						icon: "none",
					})
				}

				if (this.loading) return
				this.loading = true
				uni.showLoading({
					title: '保存中...'
				})
				this.apipost("dmcstatistics_post_SetNewLeaderApplyList_V2", this.params, (res) => {
					this.loading = false;
					if (res.resultCode == 1) {
						uni.showToast({
							title: '操作成功!',
							icon: 'success',
							duration: 2000
						});
						setTimeout(() => {
							this.init()
						}, 2000);
					}
					uni.hideLoading()
				}, (failed) => {
					this.loading = false
					uni.showToast({
						title: failed.message,
						icon: "none",
					});
				}, (error) => {
					this.loading = false
				})
			},
			getNewData(row, type) {
				let params = JSON.parse(JSON.stringify(row))
				if(type==1){
					this.params.BusList = params
				}else if (type == 2) {
					this.params.HotelOrderListReport = params
				}else if (type == 3) {
					this.params.DiningList = params
				}else if (type == 4) {
					this.params.ScenicList = params
				}else if (type == 5) {//其它费用
					this.params.OtherOrderInfo.OtherList = params;
				} else if (type == 6) {
					this.params.OtherOrderInfo.TipList = params;
				} else if (type == 7) {
					this.params.OtherOrderInfo.TeamList = params;
				} else if (type == 8) {
					this.params.OtherOrderInfo.SelfPlayingIncomeList = params;
				} else if (type == 9) {
					this.params.OtherOrderInfo.SelfPlayingExpendList = params;
				} else if (type == 10) {
					this.params.LeaderShopList = params;
				} else {
					this.params = params
				}
			},
			getType(item) {
				this.params.type = item.id
				this.oldDataIndex = item.id
				this.scrollLeft = item.left
			},
			init() {
				uni.showLoading({
					title: '数据加载中...'
				});
				this.apipost("dmcstatistics_post_GetNewLeaderPayMoneyStatics", this.msg, (res) => {
					if (res.resultCode == 1) {
						this.params = {
							...this.params,
							...res.data
						};
						
						for (let i = 1; i < 5; i++) {
							if(this.params[`dataIndex${i}`]==undefined){
								this.$set(this.params, `dataIndex${i}`, 0);
							}
						}
						this.$set(this.params, `type`, this.oldDataIndex);
						if (this.params.BusList && this.params.BusList.length > 0) {
							for (let i = 0; i < this.params.BusList.length; i++) {
								this.$set(this.params.BusList, `TotalMoney`, 0);
							}
							this.params.BusList.forEach(item => {
								var totalMoney = 0;
								if (item.ReimburseList && item.ReimburseList.ReimburseDetailsList && item
									.ReimburseList.ReimburseDetailsList.length > 0) {
									item.ReimburseList.ReimburseDetailsList.forEach(subItem => {
										totalMoney += subItem.UserNum * subItem.UnitPrice
									})
								}
								item.TotalMoney = totalMoney;
							})
						}

						if (this.params && this.params.HotelOrderListReport && this.params.HotelOrderListReport
							.length > 0) {
							for (let i = 0; i < this.params.HotelOrderListReport.length; i++) {
								this.$set(this.params.HotelOrderListReport[i], `TotalMoney`, 0);
								this.$set(this.params.HotelOrderListReport[i], `hotelIndex`, 0);
							}
							this.params.HotelOrderListReport.forEach(item => {
								if (item.HotelOrderList && item.HotelOrderList.length > 0) {
									item.HotelOrderList.forEach(subItem => {
										var totalMoney = 0;
										if (subItem.ReimburseList.ReimburseDetailsList && subItem
											.ReimburseList.ReimburseDetailsList.length > 0) {
											subItem.ReimburseList.ReimburseDetailsList.forEach(
												childItem => {
													totalMoney += childItem.UserNum * childItem
														.UnitPrice
												})
										}
										subItem.TotalMoney = totalMoney;
									});
								}
							});
						}

						if (this.params && this.params.DiningList && this.params.DiningList.length > 0) {
							for (let i = 0; i < this.params.DiningList.length; i++) {
								this.$set(this.params.DiningList[i], `TotalMoney`, 0);
								this.$set(this.params.DiningList[i], `diningIndex`, 0);
							}
							this.params.DiningList.forEach(item => {
								if (item.DiningSummaryList && item.DiningSummaryList.length > 0) {
									item.DiningSummaryList.forEach(subItem => {
										var totalMoney = 0;
										if (subItem.ReimburseList && subItem.ReimburseList
											.ReimburseDetailsList && subItem.ReimburseList
											.ReimburseDetailsList.length > 0) {
											subItem.ReimburseList.ReimburseDetailsList.forEach(
												childItem => {
													totalMoney += childItem.UserNum * childItem
														.UnitPrice
												})
										}
										subItem.TotalMoney = totalMoney;
									})
								}
							})
						}


						if (this.params && this.params.ScenicList && this.params.ScenicList.length > 0) {
							for (let i = 0; i < this.params.ScenicList.length; i++) {
								this.$set(this.params.ScenicList[i], `TotalMoney`, 0);
								this.$set(this.params.ScenicList[i], `scenicIndex`, 0);
							}
							this.params.ScenicList.forEach(item => {
								if (item.ScenicStatisticsList && item.ScenicStatisticsList.length > 0) {
									item.ScenicStatisticsList.forEach(subItem => {
										var totalMoney = 0;
										if (subItem.ReimburseList && subItem.ReimburseList
											.ReimburseDetailsList && subItem.ReimburseList
											.ReimburseDetailsList.length > 0) {
											subItem.ReimburseList.ReimburseDetailsList.forEach(
												childItem => {
													totalMoney += childItem.UserNum * childItem
														.UnitPrice
												})
										}
										subItem.TotalMoney = totalMoney;
									})
								}

							});
						}
						if (res.data.CountryIds) {
							this.getShoppingType(res.data.CountryIds)
						}
						for (let i = 0; i < this.params.OtherOrderInfo.OtherList.length; i++) {
							let obj = this.params.OtherOrderInfo.OtherList[i]
							if (obj.UseDate == null && obj.UnitPrice == 0 && obj.Rebate == 0 && obj.VoucherPic !=
								"" && obj.Remark == '' && obj.Currency == 0) {
								obj.CostProject = -1
							}
						}
						setTimeout(() => {
							uni.hideLoading()
						}, 1000)
					}
				}, (failed) => {
					uni.hideLoading()
					uni.showToast({
						title: failed.message,
						icon: "none",
					});
				}, (error) => {
					uni.hideLoading()
				})
			},
			getShoppingType(id) {
				this.apipost("Shopping_Post_GetList", {
					QCountry: id
				}, (res) => {
					if (res.resultCode == 1) {
						this.shopTypeList = []
						res.data.forEach(x => {
							this.shopTypeList.push({
								id: x.ID,
								name: x.Name,
							})
						})
					}
				})
			},
			scroll(e) {
				this.old.scrollTop = e.detail.scrollTop
				this.boxOption = Math.floor((e.detail.scrollTop - 250) / 1.5);
				this.titleStyle.opacity =
					e.detail.scrollTop - 250 < 0 ?
					0 :
					Math.floor(e.detail.scrollTop - 250) / 100 > 1 ?
					1 :
					Math.floor(e.detail.scrollTop - 250) / 100;
			},
			getOptionData() {
				this.apipost("dmcstatistics_post_GetReimburseTypeList", {
					Type: ''
				}, (res) => {
					if (res.resultCode == 1) {
						res.data.forEach(x => {
							x.name = x.TypeName
							x.id = x.ID
						});
						this.busTypeList = res.data.filter(x => {
							return x.UserTypeId == 4
						})
						this.hotelTypeList = res.data.filter(x => {
							return x.UserTypeId == 1
						})
						this.diningTypeList = res.data.filter(x => {
							return x.UserTypeId == 2
						})
						this.scenicTypeList = res.data.filter(x => {
							return x.UserTypeId == 3
						})
					}
				}, (failed) => {
					uni.showToast({
						title: failed.message,
						icon: "none",
					});
				}, (error) => {

				})
			},
			//获取币种
			getCurrencyList() {
				this.apipost("financeinfo_post_GetList", {
					Name: '',
				}, (res) => {
					if (res.resultCode == 1) {
						for (let i = 0; i < res.data.length; i++) {
							let data = res.data[i]
							this.currencyList.push({
								name: data.Name,
								id: data.ID,
							})
						}
					}
				}, (failed) => {
					uni.showToast({
						title: failed.message,
						icon: "none",
					});
				}, (error) => {

				})
			}
		}
	}
</script>