<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <data>

        <import type="android.view.View" />

        <import type="com.yidian.shenghuoquan.buserorder.manager.OrderStatus" />

        <variable
            name="vm"
            type="com.yidian.shenghuoquan.buserorder.viewmodel.OrderInfoViewModel" />

        <variable
            name="data"
            type="com.yidian.shenghuoquan.buserorder.dto.OrderDetailDto" />

        <variable
            name="status"
            type="com.yidian.shenghuoquan.buserorder.manager.OrderStatus" />
    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/shape_solid_ffffff_corner_20"
        android:paddingStart="@dimen/dp16"
        android:paddingTop="@dimen/dp20"
        android:paddingEnd="@dimen/dp16"
        android:paddingBottom="@dimen/dp20">

        <TextView
            android:id="@+id/tv_order_info"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/order_info"
            android:textColor="@color/color_333333"
            android:textSize="@dimen/sp16"
            android:textStyle="bold"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/tv_order_no_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/dp28"
            android:text="@string/order_no"
            android:textColor="@color/color_999999"
            android:textSize="@dimen/sp14"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/tv_order_info" />

        <TextView
            android:id="@+id/tv_order_no"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="@dimen/dp8"
            android:text="@{data.orderId}"
            android:textColor="@color/color_333333"
            android:textSize="@dimen/sp14"
            app:layout_constraintEnd_toStartOf="@id/tv_copy"
            app:layout_constraintTop_toTopOf="@id/tv_order_no_text"
            tools:text="98567572479254325580" />

        <TextView
            android:id="@+id/tv_copy"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/shape_stroke_e5e5e5_corner_14"
            android:onClick="@{() -> vm.copyOrderId(data.orderId)}"
            android:paddingStart="@dimen/dp12"
            android:paddingTop="@dimen/dp5"
            android:paddingEnd="@dimen/dp12"
            android:paddingBottom="@dimen/dp5"
            android:text="@string/copy"
            android:textColor="@color/color_333333"
            android:textSize="@dimen/sp12"
            app:layout_constraintBottom_toBottomOf="@id/tv_order_no_text"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="@id/tv_order_no_text" />

        <TextView
            android:id="@+id/tv_order_payment_time_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/dp20"
            android:text="@string/payment_time"
            android:textColor="@color/color_999999"
            android:textSize="@dimen/sp14"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/tv_order_no_text" />

        <TextView
            android:id="@+id/tv_order_payment_time"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@{data.payTime}"
            android:textColor="@color/color_333333"
            android:textSize="@dimen/sp14"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="@id/tv_order_payment_time_text"
            tools:text="2021-5-10 10:23" />

        <TextView
            android:id="@+id/tv_order_refund_apply_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/dp20"
            android:text="@string/refund_apply"
            android:textColor="@color/color_999999"
            android:textSize="@dimen/sp14"
            android:visibility="@{status == OrderStatus.ORDER_STATUS_WAIT_REFUND || status == OrderStatus.ORDER_STATUS_REFUNDED || status == OrderStatus.ORDER_STATUS_ON_REFUND || status == OrderStatus.ORDER_STATUS_REFUSE_REFUND || status == OrderStatus.ORDER_STATUS_PART_REFUND ? View.VISIBLE : View.GONE}"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/tv_order_payment_time_text" />

        <TextView
            android:id="@+id/tv_order_refund_apply"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@{data.refundApplyTime}"
            android:textColor="@color/color_333333"
            android:textSize="@dimen/sp14"
            android:visibility="@{status == OrderStatus.ORDER_STATUS_WAIT_REFUND || status == OrderStatus.ORDER_STATUS_REFUNDED || status == OrderStatus.ORDER_STATUS_ON_REFUND || status == OrderStatus.ORDER_STATUS_REFUSE_REFUND || status == OrderStatus.ORDER_STATUS_PART_REFUND? View.VISIBLE : View.GONE}"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="@id/tv_order_refund_apply_text"
            tools:text="2021-5-10 10:23" />

        <TextView
            android:id="@+id/tv_order_refund_time_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/dp20"
            android:text="@{status == OrderStatus.ORDER_STATUS_REFUNDED || status == OrderStatus.ORDER_STATUS_PART_REFUND ? @string/refund_time : @string/refuse_time}"
            android:textColor="@color/color_999999"
            android:textSize="@dimen/sp14"
            android:visibility="@{status == OrderStatus.ORDER_STATUS_REFUNDED || status == OrderStatus.ORDER_STATUS_REFUSE_REFUND || status == OrderStatus.ORDER_STATUS_PART_REFUND ? View.VISIBLE : View.GONE}"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/tv_order_refund_apply_text" />

        <TextView
            android:id="@+id/tv_order_refund_time"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@{status == OrderStatus.ORDER_STATUS_REFUNDED || status == OrderStatus.ORDER_STATUS_PART_REFUND ? data.refundFinishTime : data.auditTime}"
            android:textColor="@color/color_333333"
            android:textSize="@dimen/sp14"
            android:visibility="@{status == OrderStatus.ORDER_STATUS_REFUNDED || status == OrderStatus.ORDER_STATUS_REFUSE_REFUND || status == OrderStatus.ORDER_STATUS_PART_REFUND ? View.VISIBLE : View.GONE}"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="@id/tv_order_refund_time_text"
            tools:text="2021-5-10 10:23" />

        <TextView
            android:id="@+id/tv_order_remark_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/dp20"
            android:text="@string/order_remark"
            android:textColor="@color/color_999999"
            android:textSize="@dimen/sp14"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/tv_order_refund_time_text" />

        <TextView
            android:id="@+id/tv_order_remark"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/dp14"
            android:text="@{data.comment}"
            android:textColor="@color/color_333333"
            android:textSize="@dimen/sp14"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toEndOf="@id/tv_order_remark_text"
            app:layout_constraintTop_toTopOf="@id/tv_order_remark_text"
            tools:text="不喜欢吃辣，希望少放点辣椒不喜欢吃辣，希望少放点辣椒不喜欢吃辣" />

    </androidx.constraintlayout.widget.ConstraintLayout>
</layout>