<template>
	<view>
		<z-navbar title="收款明细" back></z-navbar>
		<view class="totalmoney shadow-2">
			累计收款：{{totalmoney}} 元
		</view>
		<view class="ml-20" style="margin-top: 108rpx;">

			<z-timeline class="mt-24" align="top" v-if="dataList.length">
				<z-timeline-item :timestamp="item.createTime" v-for="(item,index) in dataList" :key="index">
					<z-card class="back_card mtb-20 " width="593">
						<view class="flex-n fac">
							<image class="back_card_img" :src="item.headImageSrc||'../../../static/touxiang_1.png'"></image>
							<view class="back_card_content">
								<view class="flex-n fac">
									<view class="back_card_text">{{item.roleName||'匿名'}}</view>
									<view class="back_card_text ml-49">收款金额：{{item.confirmMoney||0}}元</view>
								</view>

								<view class="back_card_text">{{item.confirmName}}</view>
							</view>
						</view>
						<view class="back_card_text2">{{item.remark}}</view>
					</z-card>
				</z-timeline-item>
			</z-timeline>
			<z-nodata  v-if="dataList.length==0"></z-nodata>
			<u-toast ref="uToast"></u-toast>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList: [],
				type: 0,
				totalmoney: 0
			};
		},
		onLoad(option) {
			this.type = option.type;
			if (option.type == 0)
				this.getData(option.id);
			else {
				this.getWedData(option.id)
			}
		},
		methods: {
			getData(orderId) {
				this.$axios.get('app/orderFinanceConfirm/financeConfirmDetail/' + orderId).then(res => {
					console.log(res)
					this.dataList = res.data.list;
					var money = 0;
					for (var i in this.dataList) {
						money += Number(this.dataList[i].confirmType == 0 ? '' : '-') + Number(this.dataList[i].confirmMoney);
					}
					this.totalmoney = money;
				}).catch(err => {
					this.$refs.uToast.error(err.msg);
				})
			},
			getWedData(orderId) {
				this.$axios.get('app/weddingFinanceConfirm/financeWeddingConfirmDetail/' + orderId).then(res => {
					console.log(res)
					this.dataList = res.data.list;
					var money = 0;
					for (var i in this.dataList) {
						money += Number(this.dataList[i].confirmType == 0 ? '' : '-') + Number(this.dataList[i].confirmMoney);
					}
					this.totalmoney = money;
				}).catch(err => {
					this.$refs.uToast.error(err.msg);
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.totalmoney {
		position: fixed;
		width: 100%;
		padding: 0 30rpx;
		line-height: 88rpx;
		top: calc(var(--status-bar-height) + 84rpx);
		z-index: 200;
		font-size: 28rpx;
		color: #555555;
	}

	.back_card {
		margin-left: 0 !important;
		font-size: 24rpx;
		padding: 26rpx;

		.back_card_img {
			width: 89rpx;
			min-width: 89rpx;
			height: 89rpx;
			border-radius: 45rpx;
			overflow: hidden;
			margin-right: 19rpx;
		}

		.back_card_text {
			color: #555555;
			line-height: 30rpx;
		}

		.back_card_text2 {
			color: #888888;
			margin-left: 108rpx;
		}
	}
</style>
