<template>
	<view class="container">
		<view class="topInfo">
			<view class="topInfo-item">
				<view class="flex info">
					<view class="logo">
						<image src="../../../static/img/reject.png" mode="" v-if="list[0].status == '已驳回'"
							style="height: 40rpx;"></image><!-- 驳回 -->
						<image src="../../../static/img/tongguo.png" mode="" v-if="list[0].status == '已通过'"
							style="height: 40rpx;"></image><!-- 通过 -->
						<image src="../../../static/img/daishenhe.png" mode="" v-if="list[0].status == '审核中'||list[0].status == '未审核'"
							style="height: 40rpx;"></image><!-- 待审核 -->
					</view>
					<view class="infoText">{{list[0].status}}</view>
				</view>
				<view class="infoData">{{list[0].warehousingDate}}</view>
			</view>
		</view>
		<view class="content">
			<view class="top content-item">
				<view>{{contractNo}}({{goodsName}})</view>
				<view>{{unitPrice}}元/吨</view>
			</view>
			<view class="content-item">
				<view class="car-container" v-for="(item,index) in list">
					<view class="car-num title">{{item.carNo}}</view>
					<view class="row">
						<view class="left car-type-item">净重</view>
						<view class="right weightInfoCss">{{item.netWeight}} 吨</view>
					</view>
					<view class="row">
						<view class="left car-type-item">结重</view>
						<view class="right weightInfoCss">{{item.settlementWeight}} 吨</view>
					</view>
					<view class="row">
						<view class="left car-type-item">扣款</view>
						<view class="right weightInfoCss">￥{{item.deductionAmountchange?item.deductionAmountchange:"0"}}/吨</view>
					</view>
					<view class="row ">
						<view class="left money">应付</view>
						<view class="right moneyInfo">￥{{item.amountIngPayable}}元</view>
					</view>
				</view>
			</view>
		</view>
		<u-toast ref="uToast" />
		<view style='padding:10px;' class='flex bottom-btn'>
			<u-button  @click='fanHui' type="success" class="btn2">返回</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: "",
				currentPage: 1,
				pageSize: 10,
				list: [
					{status:"",}
				],
				contractNo: "",
				unitPrice: "",
				goodsName:"",
			}
		},
		onLoad(options) {
			this.id = options.id
			this.getList()
		},
		methods: {
			getList(id) {
				this.$api.doRequest('get', '/stockPurchaseReceiptReport/getInfo', {
					id: this.id
				}).then(res => {
					this.contractNo = res.data.data.contractNo
					this.unitPrice = res.data.data.price
					this.goodsName = res.data.data.goodsName
					console.log(this.goodsName)
					if (res.data.code == 200) {
						this.$api.doRequest('get', '/stockPurchaseReceiptReport/selectPurchaseOrder', {
							compId: "2710b21efc1e4393930c5dc800010dc4",
							currentPage: this.currentPage,
							pageSize: this.pageSize,
							contractNo: this.contractNo,
						}).then(res => {
							if (res.data.code == 200) {
								this.list = res.data.data.records
							}
						})
					}
				})
			},
			fanHui(){
				uni.navigateBack()
			}
		}
	}
</script>

<style scoped lang="scss">
	.container {
		padding: 20rpx 20rpx 250rpx 20rpx;
	}

	.content {
		margin-top: 30rpx;
		.top {
			display: flex;
			justify-content: space-between;
		}

		.content-item {
			border-radius: 20rpx;
			background: white;
			padding: 40rpx 20rpx;
			margin-bottom: 30rpx;
		}

		.title {
			font-size: 32rpx;
			font-weight: 600;
			color: #333333;
			text-align: left;
			margin: 20rpx 0;
		}
		.car-container{
			border-bottom: 2rpx solid #EEEEEE;
		}

		.car-type-item {
			font-size: 28rpx;
			margin: 20rpx 0;
			color: #878C9C;
		}

		.weightInfoCss {
			font-size: 28rpx;
			color: #333333;
			font-weight: 500;
		}

		.row {
			display: flex;
			justify-content: space-between;
			// .right,
			// input {
			// 	font-size: 28rpx;
			// 	// color: #333333;
			// }
		}

		.money {
			font-size: 32rpx;
			font-weight: 500;
			margin-bottom: 30rpx ;
		}

		.moneyInfo {
			color: #22C572;
			font-size: 32rpx;
		}
	}
.bottom-btn {
		width: 100%;
		position: fixed;
		bottom:0;
		display: flex;
		z-index: 2;
		left: 0;
		background-color: #f8f8f8;
		flex-direction: column;
		.btn1,.btn2{
			width: 100%;
			margin-bottom: 26rpx;
			border-radius: 90rpx;
		}
		.btn1{
			background: white;
			color: #00C265;
		}
		}
		.topInfo {
			height: 210rpx;
			background: linear-gradient(270deg, #22C572 0%, #34DE8A 100%);
			padding: 30rpx;
		
			.topInfo-item {
				height: 150rpx;
				background-color: #FFFFFF;
				border-radius: 20rpx;
				padding: 40rpx;
		
				.logo {
					width: 40rpx;
					height: 40rpx;
					margin-top: 8rpx;
				}
		
				.infoText {
					font-size: 36rpx;
					font-weight: 600;
					margin-left: 20rpx;
				}
		
				.infoData {
					color: #878C9C;
					font-size: 26rpx;
					margin-top: 10rpx;
				}
			}
		}
</style>
