<template>
	<view class="page-css">
		<view class="order-box">
			<view class="order-title">订单详情</view>
			<view class="order-item">
				<text class="item_left_txt">订单编号</text>
				<text class="item_right_txt">{{detailObj.code}}</text>
			</view>
			<view class="order-item">
				<text class="item_left_txt">交货日期：</text>
				<text class="item_right_txt">{{detailObj.deliveryDate}}</text>
			</view>
			<view class="order-item">
				<text class="item_left_txt">运输地址：</text>
				<text class="item_right_txt">{{detailObj.transportationAddress}}</text>
			</view>
			<view class="order-item">
				<text class="item_left_txt">商品信息：</text>
				<view class="item_right_table">
					<view class="table_box">
					    <view class="table_txt left">商品名称</view>
					    <view class="table_txt right">数量</view>
					</view>
					<view class="table_box table_item" v-for="item in detailObj.detailList" :key="item.id">
						<view class="table_txt left">{{item.commodityName}}</view>
						<view class="table_txt right">{{item.commodityCount}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				id:'',
				detailObj:{}
			}
		},
		onLoad(option) {
			console.log('option--------------------',option)
			this.id = option.id ? option.id : ''
		},
		mounted() {
			this.getDetail()
		},
		methods:{
			getDetail(){
				this.$u.api.getOrderDetail({id:this.id}).then(res =>{
					console.log('res------------------------',res)
					this.detailObj = res.data
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page-css{
		padding: 20rpx 0;
		
		.order-box{
			width: 95%;
			background: #fff;
			border-radius: 10rpx;
			margin: 0 auto;
			padding: 6rpx;
			padding-bottom: 30rpx;
			
			.order-title{
				line-height: 60rpx;
				color: rgba(0, 0, 0, 1);
				font-size: 32rpx;
				text-align: left;
				font-family: SourceHanSansSC-bold;
				margin: 18rpx 0 0rpx 20rpx;
				font-weight: bold;
			}
			
			.order-item{
				padding: 4rpx 20rpx 0;
				display: flex;
				align-items: center;
				justify-content: space-between;
				
				.item_left_txt {
				    color: rgba(108, 108, 108, 1);
				    font-size: 28rpx;
				    text-align: left;
				    font-family: SourceHanSansSC-regular;
				    width: 210rpx;
				    margin-right: 20rpx;
				    line-height: 60rpx;
				}
				
				.item_right_txt {
				    max-width: calc(100% - 200rpx);
				    color: rgba(0, 0, 0, 1);
				    font-size: 28rpx;
				    // text-align: left;
				    text-align: justify;
				    font-family: SourceHanSansSC-regular;
				    image{
				        width: 100rpx;
				        height: 100rpx;
				    }
				}
				
				.item_right_table {
				    width: calc(100% - 220rpx);
				    margin-top: 10rpx;
				
				    .table_box {
				        width: 100%;
				        height: 60rpx;
				        background-color: #e8e8e8;
				        border: 1px solid #bbbbbb;
				        font-size: 14px;
				        color: #101010;
				        line-height: 60rpx;
				        display: flex;
				
				        .left {
				            width: 72%;
				            height: 100%;
				            text-align: center;
				            border-right: 2rpx solid #bbbbbb;
				        }
				
				        .right {
				            width: 28%;
				            height: 100%;
				            text-align: center;
				        }
				    }
				
				    .table_item {
				        background-color: #fff;
				        border-top: none;
				    }
				
				    .table_sub {
				        border-top: none;
				        background-color: #fff;
				    }
				}
			}
		}
	}
</style>