<template>
    <view>
        <view class="OrderInfo">
        	<!-- 订单状态 -->
        	<view class="order-status">
        		<block v-if="listType == 'deliver'">
                    <view class="info">
                    	{{info.state_text}}
                    </view>
                </block>
                <block v-else>
                    <view class="info" v-if="info.state">
                    	{{info.state.text}}
                    	<span>{{info.state.remark}}</span>
                    </view>
                </block>
        		<image src="../../static/icons/fire.png" mode="widthFix"></image>
        	</view>
            
            <!-- 订单信息 -->
            <view class="goods-info1">
            	<view class="top">
            		<view class="company">
            			<view class="company-logo" v-if="info.shop">
            				<image :src="info.shop.cover" mode="aspectFill" />
            				<view class="name nowrap">{{info.shop.name}}</view>
            			</view>
            			<view class="flexrow">
                            <view class="no nowrap" v-if="listType == 'deliver'">发货单号： {{info.shipment_no}}</view>
                            <view class="no nowrap" v-else>退货单号： {{info.refund_no}}</view>
            			</view>
            		</view>
            	</view>
            	<view class="goods-info">
            		<image class="goods-img" v-if="info.goods_sku" :src="info.goods_sku.cover" mode="aspectFill" />
            		<view class="goods" v-if="info.goods_sku">
            			<view class="nowrap name">{{info.goods_sku.goods_name}}</view>
            			<view class="sku">数权个数 <span>x {{info.qty}}</span> </view>
            		</view>
            	</view>
            </view>
            <view class="goods-info1" >
            	<view class="goods-type">创建{{listType == 'deliver'?'发货':'退货'}}时间 <span>{{info.created_at}}</span></view>
            	<view class="goods-type">运费 <span>自行承担运费</span></view>
            	<view class="goods-type">{{listType === 'deliver'?'发货':'退货'}}数量 <span>{{info.qty}}个</span></view>
            </view>
            
            <view class="goods-info1" v-if="listType === 'deliver' && info.express">
            	<view class="goods-type" v-if="info.express">收件人姓名 <span>{{info.express.name || '--'}}</span></view>
            	<view class="goods-type" v-if="info.express" @click="call(info.express.mobile)">收件人电话 <span>{{info.express.mobile || '--'}}</span></view>
            	<view class="goods-type" v-if="info.express">收货地址 <span>{{info.express.full_address || '--'}}</span></view>
            	<view class="goods-type" v-if="info.express">发货快递 <span>{{info.express.express_name || '--'}}</span></view>
            	<view class="goods-type" v-if="info.express">快递单号 <span>{{info.express.express_no || '--'}}</span></view>
            </view>
			<view class="goods-info1" v-else>
				<view class="goods-type" v-if="info.express">退货单快递<span>{{info.express.company || '--'}}</span></view>
				<view class="goods-type" v-if="info.express">退货快递单号 <span>{{info.express.number || '--'}}</span></view>
			</view>
            
            <!-- 操作相关 -->
            <view class="actions">
                <view class="nowPay" @click="orderRun">返回列表</view>
                <view v-if="listType != 'deliver'" @click="$Router.push({name: 'storeJournal', params: {id: info.refund_id}})" class="nowPay">查看退货日志</view>
            </view>
        </view>
    </view>
</template>

<script>
    export default {
    	name:"storeOrderDet",
    	props:{
    		// 数据列表
    		info    : {},
            listType: ''
    	},
        created() {
        },
        methods: {
            // 返回上一页
            orderRun() {
                uni.navigateBack({
                    delta: 1
                })
            },
			call(number){
				uni.makePhoneCall({
					phoneNumber:number
				})
			}
        }
    }
</script>

<style lang="scss" scoped>
    .OrderInfo {
        width: 100%;
        min-height: 100vh;
        box-sizing: border-box;
        background-color: #F7F7F7;
        padding-bottom: 80rpx;
    }
    .order-status {
        width: 100%;
        height: 300rpx;
        background-image: linear-gradient(to bottom, $mian-color,$mian-color-light);
        color: #Fff;
        font-size: 36rpx;
        padding: 30rpx 50rpx;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        box-sizing: border-box;
        .info {
            font-size: 36rpx;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: space-between;
            box-sizing: border-box;
            span {
                font-size: 28rpx;
                padding-top: 30rpx;
            }
        }
        image {
            width: 200rpx;
        }
    }
    
    // 订单信息
    .goods-info1 {
    	padding: 20rpx 40rpx;
    	background-color: #fff;
        margin-bottom: $margin;
        .top {
        	display: flex;
        	flex-direction: row;
        	align-items: center;
        	justify-content: space-between;
        	box-sizing: border-box;
        	padding: 30rpx 0;
        	border-bottom: solid 1rpx #EFF4F2;
            .company-logo {
            	display: flex;
            	flex-direction: row;
            	align-items: center;
            	justify-content: flex-start;
            	box-sizing: border-box;
            	image {
            		width: 40rpx;
            		height: 40rpx;
            		border-radius: 50%;
            		margin-right: 20rpx;
            	}
            	.name {
            		width: 600rpx;
            		font-size: 30rpx;
            		color: #484848;
            		font-weight: bold;
            	}
                .no {
                	margin-top: 30rpx !important;
                	font-size: $title-size*0.8;
                	color: #999;
                }
            }
        }
        .goods-info {
        	display: flex;
        	flex-direction: row;
        	align-items: flex-start;
        	justify-content: flex-start;
        	box-sizing: border-box;
        	margin-top: 40rpx;
            .goods-img {
            	width: 120rpx;
            	height: 120rpx;
            	border-radius: 10rpx;
            }
            .goods {
            	width: calc(100% - 120rpx);
                padding: 0 20rpx;
                box-sizing: border-box;
                .sku {
                	flex: 1;
                	display: flex;
                	flex-direction: row;
                	align-items: center;
                	justify-content: space-between;
                	box-sizing: border-box;
                	margin-top: 20rpx;
                	font-size: 28rpx;
                	color: #999;
                }
            }
        }
        .goods-type {
        	display: flex;
        	flex-direction: row;
        	align-items: center;
        	justify-content: space-between;
        	box-sizing: border-box;
        	padding: 30rpx 0;
        	border-bottom: solid 1rpx #f7f7f7;
        }
    }
    
    // 操作按钮
    .actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        border-top: solid 1rpx #f2f2f2;
        padding-top: 18rpx;
        padding-right: 30rpx;
        padding-left: 30rpx;
        height: 110rpx;
        background: white;
        display: flex;
        flex-wrap: wrap;
        flex-direction: row-reverse;
        .nowPay {
            margin-left: 20rpx;
            height: 54rpx;
            line-height: 50rpx;
            box-sizing: border-box;
            border: solid 1rpx #747788;
            padding: 0 20rpx;
            font-size: 26rpx;
            border-radius: 40rpx;
            margin-top: 10rpx;
            &.actions-color {
                color: #e1293f;
                border-color: #ec96a0;
            }
        }
        .cancelOrder {
            padding: 10rpx 30rpx;
            border-radius: 40rpx;
            margin-left: 20rpx;
            margin-top: 20rpx;
            background-color: #DD524D;
        }
        .logistics {
            background-color: $mian-color;
            padding: 10rpx 30rpx;
            border-radius: 40rpx;
            margin-left: 20rpx;
            margin-top: 20rpx;
        }
        .sign {
            background-color: #DD524D;
            padding: 10rpx 30rpx;
            border-radius: 40rpx;
            margin-left: 20rpx;
            margin-top: 20rpx;
        }
        .evaluate {
            background-color: $mian-color;
            padding: 10rpx 30rpx;
            border-radius: 40rpx;
            margin-left: 20rpx;
            margin-top: 20rpx;
        }
    }
</style>
