<template>
    <view class="orderVerifica">
        <capsule :showBorder="true">
            <template v-slot:top>
                <view class="shop-top">
                    <view class="back-icon" @click="backClick">
                        <tui-icon name="arrowleft" :size="36" color="#000"></tui-icon>
                    </view>
                    <view class="shop-name">订单核销</view>
                </view>
            </template>
        </capsule>
        <view class="order-number">订单编号:139529738377368</view>
        <view class="verifica-container">
            <view class="verifica-info">
                <view class="info-state">订单状态：(待核销已付款)</view>
                <view class="info-state">商户:麦乐鸡烤肉店 </view>
                <view class="info-price">
                    <view class="all-price">
                        商品总价:￥<text>199.99</text>
                    </view>
                    <view class="all-price">
                        实付款:￥<text>198.99</text>
                    </view>
                </view>
            </view>
            <view class="verifica-product">
                <view class="verifica-time">
                    <text>创建时间</text>
                    <text>2024-06-01 11:29:42</text>
                </view>
                <view class="commodity-list">
                    <view class="commodity-item">
                        <view class="item-left">
                            <view class="left-image">
                                <image
                                    src="https://img2.baidu.com/it/u=1700149007,2105278410&fm=253&fmt=auto&app=138&f=JPEG?w=400&h=400" />
                            </view>
                            <view class="left-text">
                                <view class="text-title">嘿嘿嘿</view>
                                <!-- <template v-if="item2.productName == '扫码付款商品'">
                                    <view class="text-price">扫码付款商品</view>
                                </template> -->
                                <template>
                                    <view class="text-price">小份</view>
                                    <view class="text-price">x1</view>
                                </template>
                            </view>
                        </view>
                        <view class="item-right">￥99.00</view>
                    </view>
                </view>
                <view class="gifts">
                    <view class="gifs-left">赠送代金券</view>
                    <view class="gifs-right">￥1 x 1</view>
                </view>
                <view class="verifica-code">
                    <text>核销码</text>
                    <text>4561-JFHXDKHGM8</text>
                </view>
            </view>
            <view class="verifica-btn">
                <view class="btn">确认核销</view>
            </view>
        </view>
    </view>
</template>

<script>
import { orderGetById } from '@/config/index.js'
export default {
    onLoad(props){
        console.log(props);
        this.orderId = props.orderId
        this.getOrderDetail()
    },
    data() {
        return {
            //  订单详情
            orderDetail:{},
            orderId:null
        }
    },
    methods: {
        // 获取订单详情
        async getOrderDetail(){
            try {
                let res = await orderGetById({orderId:this.orderId})
                console.log(res);
            } catch (error) {
                
            }
        },
        backClick() {
            uni.navigateBack()
        }
    },
}
</script>

<style lang="scss" scoped>
.orderVerifica {
    .shop-top {
        width: 100%;
        height: 100%;
        position: relative;
        z-index: 999;
        @include flex(center);

        .back-icon {
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
        }

        .shop-name {
            color: #000;
        }
    }

    .order-number {
        margin: 32rpx 0;
        color: #999999;
        font-size: 28rpx;
        padding-left: 32rpx;
    }

    .verifica-container {
        padding: 0 60rpx;

        .verifica-info {
            display: flex;
            flex-direction: column;
            gap: 12rpx;
            color: #3D3D3D;
            font-size: 28rpx;
            font-weight: 600;
            padding-bottom: 20rpx;
            border-bottom: 2rpx solid #D8D8D8;

            text {
                color: #EA1717;
            }

            .info-price {
                @include flex(space-between);
            }
        }

        .verifica-product {
            padding: 12rpx 0 20rpx;
            border-bottom: 2rpx solid #D8D8D8;

            .verifica-time {
                @include flex(space-between);
                color: #999999;
                font-size: 24rpx;
            }

            .commodity-list {
                width: 100%;
                display: flex;
                justify-content: center;
                gap: 12rpx;
                flex-direction: column;
                margin: 20rpx 0 36rpx;

                .commodity-item {
                    display: flex;
                    justify-content: space-between;

                    .item-left {
                        display: flex;
                        gap: 12rpx;

                        .left-image {
                            width: 124rpx;
                            height: 124rpx;

                            image {
                                width: 100%;
                                height: 100%;
                                border-radius: 12rpx;
                            }
                        }

                        .left-text {
                            display: flex;
                            flex-direction: column;
                            gap: 6rpx;

                            .text-title {
                                color: #333333;
                                font-size: 28rpx;
                            }

                            .text-price {
                                font-size: 24rpx;
                                color: #999999;
                            }
                        }
                    }

                    .item-right {
                        color: #333333;
                        font-size: 28rpx;
                    }
                }
            }

            .gifts {
                @include flex(space-between);
                font-size: 28rpx;
                color: #333333;

                .gifs-right {
                    color: #ea1717;
                }
            }

            .verifica-code {
                color: #3D3D3D;
                font-size: 28rpx;
                @include flex(space-between);
                margin-top: 32rpx;
            }
        }
        .verifica-btn{
            padding-top: 72rpx;
            display: flex;
            justify-content: flex-end;
            .btn{
                width: 246rpx;
                height: 88rpx;
                text-align: center;
                line-height: 88rpx;
                color: #FFFFFF;
                font-size: 28rpx;
                border-radius: 50rpx;
                background: linear-gradient(180deg, #FE4B1E 0%, #FB8857 100%);
            }
        }
    }
}
</style>