<?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>

        <variable
            name="vm"
            type="com.yidian.shenghuoquan.bgoods.ui.coupon.viewmodel.CommodityListItemViewModel" />

        <variable
            name="data"
            type="com.yidian.shenghuoquan.bgoods.dto.Goods" />

    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/shape_bg_common_card"
        android:minHeight="@dimen/dp112"
        android:padding="@dimen/dp16">

        <ImageView
            android:id="@+id/iv_commodity_pic"
            android:layout_width="@dimen/dp80"
            android:layout_height="@dimen/dp80"
            android:scaleType="centerCrop"
            app:corner="@{12}"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:url="@{data.descPicUrlList[0]}"
            tools:src="@mipmap/news_icon" />

        <TextView
            android:id="@+id/tv_commodity_name"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/dp12"
            android:ellipsize="end"
            android:maxLines="2"
            android:text="@{data.goodsName}"
            android:textColor="@color/color_333333"
            android:textSize="@dimen/sp16"
            android:textStyle="bold"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toEndOf="@id/iv_commodity_pic"
            app:layout_constraintTop_toTopOf="parent"
            tools:text="北蔡街 -0.99抢北蔡街 -0.99抢北蔡街 -0.99抢北蔡街 -0.99抢" />

        <TextView
            android:id="@+id/tv_commodity_count_sold"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@{@string/commodity_count_sold(data.totalAmountSold)}"
            android:textColor="@color/color_999999"
            android:textSize="@dimen/sp12"
            app:layout_constraintStart_toStartOf="@id/tv_commodity_name"
            app:layout_constraintTop_toBottomOf="@id/tv_commodity_name"
            tools:text="已售 100000" />

        <TextView
            android:id="@+id/tv_commodity_count_inventory"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/dp12"
            android:text="@{@string/commodity_count_inventory(data.inventoryRest)}"
            android:textColor="@color/color_999999"
            android:textSize="@dimen/sp12"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0"
            app:layout_constraintStart_toEndOf="@id/tv_commodity_count_sold"
            app:layout_constraintTop_toTopOf="@id/tv_commodity_count_sold"
            tools:text="库存 100000000000000" />

        <TextView
            android:id="@+id/tv_commodity_price_symbol"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="¥"
            android:textColor="@color/color_F26E3D"
            android:textSize="@dimen/sp12"
            app:layout_constraintBaseline_toBaselineOf="@id/tv_commodity_price"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="@id/tv_commodity_name" />

        <TextView
            android:id="@+id/tv_commodity_price"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/dp10"
            android:includeFontPadding="false"
            android:text="@{@string/commodity_price(data.price)}"
            android:textColor="@color/color_F26E3D"
            android:textSize="@dimen/sp20"
            android:textStyle="bold"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toEndOf="@id/tv_commodity_price_symbol"
            app:layout_constraintTop_toBottomOf="@id/tv_commodity_count_sold"
            tools:text="10.00" />

    </androidx.constraintlayout.widget.ConstraintLayout>

</layout>