<template>
	<view>
		<view class="list"  style="margin-bottom: 30rpx;">
			<u-empty v-if='dataList.length==0' mode="data">
			</u-empty>
			<view class="tab-bar-item" v-for="(item, index) in dataList" :key="index" @click="inEdit(item)">
				<view class="list-item">
					<view style="font-weight: 800;">
						{{item.insuranceNo}}
					</view>
					<view style="color: #B5B4B4;">
						{{item.claimDate}}
					</view>
				</view>
				<view class="list-item">
					<view class="">
						理赔单号:{{item.claimNo||'暂无理赔单号'}}
					</view>
				</view>
				<view class="list-item-end">
					<view class="">
						理赔原因:{{item.claimReason||'暂无原因'}}
					</view>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		itemList
	} from '@/api/home/insurance.js'
	export default {
		data() {
			return {
				dataList: [],
			}
		},
		onLoad(option) {
			console.log(option)
			if (option && option.id) {
				this.itemList(option.id)
			}
		},
		methods: {
			inEdit(row) {
				uni.navigateTo({
					url: '/pages/home/claim/details?id=' + row.claimId,
				});
			},
			itemList(id) {
				const obj = {
					insuranceId: id
				}
				this.loading = true
				uni.showLoading({
					title: '加载中',
					mask: true
				});
				itemList(obj).then(res => {
						this.dataList = res.data
					})
					.finally(() => {
						uni.hideLoading()
					});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.loading,
	.no-more {
		text-align: center;
		padding: 20px;
		color: #999;
	}

	.uni-lastmsg {
		width: 80rpx;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		display: block;
		/* 需明确设置display */
	}

	.uni-lastmsg2 {
		width: 140rpx;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		display: block;
		/* 需明确设置display */
	}

	.nav-right {
		width: 37rpx;
		height: 42rpx;
	}

	.list {
		width: 100%;

		.tab-bar-item {
			background-color: #fff;
			margin-top: 30rpx;
			padding: 0rpx 62rpx;
			font-size: 28rpx;
			line-height: 32rpx;
			color: #5F5F5F;
			font-weight: 400;

			.list-item {
				display: flex;
				justify-content: space-between;
				align-items: center;
				width: 100%;
				height: 100rpx;
				border-bottom: 2px solid #F6F6F6;
			}

			.list-item-end {
				display: flex;
				justify-content: space-between;
				align-items: center;
				width: 100%;
				height: 100rpx;
			}
		}
	}
</style>