Commit a0a7f777 authored by yinjiacheng's avatar yinjiacheng

update 订单详情优惠券数据结构

parent f5d2397d
......@@ -8,7 +8,7 @@ import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.RecyclerView
import com.yidian.shenghuoquan.border.R
import com.yidian.shenghuoquan.border.databinding.BorderItemOrderDetailCommodityListBinding
import com.yidian.shenghuoquan.border.dto.OrderItem
import com.yidian.shenghuoquan.border.dto.MergeOrderItem
import com.yidian.shenghuoquan.border.viewmodel.OrderDetailCommodityListItemViewModel
import com.yidian.utils.DensityUtil
......@@ -17,10 +17,10 @@ import com.yidian.utils.DensityUtil
* date: 2021/8/23 16:18
* description: 订单详情商品列表
*/
class OrderDetailCommodityListAdapter(data: List<OrderItem>?) :
class OrderDetailCommodityListAdapter(data: List<MergeOrderItem>?) :
RecyclerView.Adapter<OrderDetailCommodityListAdapter.OrderDetailCommodityListViewHolder>() {
private val data by lazy { ArrayList<OrderItem>() }
private val data by lazy { ArrayList<MergeOrderItem>() }
init {
data?.let {
......@@ -31,7 +31,7 @@ class OrderDetailCommodityListAdapter(data: List<OrderItem>?) :
/**
* 更新数据
*/
fun updateData(data: List<OrderItem>?) {
fun updateData(data: List<MergeOrderItem>?) {
data?.let {
notifyItemRangeRemoved(0, this.data.size)
this.data.clear()
......
......@@ -69,11 +69,11 @@ data class OrderDetailDto(
val refundAmount: Double,
@SerializedName("refund_apply_time") // 退款申请时间
val refundApplyTime: String,
@SerializedName("refund_finish_time") // 退款时间
@SerializedName("refund_finish_time") // 退款完成时间
val refundFinishTime: String,
@SerializedName("shop_id")
val shopId: String,
@SerializedName("total_price") // 合计金额
@SerializedName("total_price") // 合计金额 = 优惠金额 + 支付金额
val totalPrice: Double,
@SerializedName("update_time")
val updateTime: String,
......@@ -86,28 +86,38 @@ data class OrderDetailDto(
)
data class Coupon(
@SerializedName("amount")
val amount: String,
@SerializedName("coupon_amount")
val couponAmount: Double,
val couponAmount: Int,
@SerializedName("coupon_id")
val couponId: String,
@SerializedName("create_time")
val createTime: String,
@SerializedName("goods_sku_id")
val goodsSkuId: String,
@SerializedName("order_id")
val orderId: String,
@SerializedName("order_item_id")
val orderItemId: String,
@SerializedName("recover_coupon_amount")
val recoverCouponAmount: Double,
@SerializedName("share_coupon_amount")
val shareCouponAmount: Double,
@SerializedName("share_coupon_id")
val shareCouponId: Long,
@SerializedName("update_time")
val updateTime: String,
@SerializedName("user_id")
val userId: Long
@SerializedName("desc") // 优惠券描述
val desc: String,
@SerializedName("end_time")
val endTime: String,
@SerializedName("id")
val id: String,
@SerializedName("jump_url")
val jumpUrl: String,
@SerializedName("name") // 优惠券名称
val name: String,
@SerializedName("start_time")
val startTime: String,
@SerializedName("status")
val status: Int,
@SerializedName("thumbnail")
val thumbnail: String,
@SerializedName("type")
val type: Int,
@SerializedName("use_activity_type")
val useActivityType: Int,
@SerializedName("use_amount_min")
val useAmountMin: Int,
@SerializedName("use_amount_type")
val useAmountType: Int,
@SerializedName("use_shop_type")
val useShopType: Int
)
data class MergeOrderItem(
......@@ -160,7 +170,7 @@ data class OrderItem(
val orderItemId: String,
@SerializedName("payment")
val payment: Double,
@SerializedName("price") // 商品价格
@SerializedName("price") // 商品单价
val price: Double,
@SerializedName("refund_amount")
val refundAmount: Double,
......@@ -175,7 +185,7 @@ data class OrderItem(
@SerializedName("settle_code")
val settleCode: Long,
@SerializedName("share_coupon")
val shareCoupon: Double,
val shareCoupon: Int,
@SerializedName("shop_id")
val shopId: String,
@SerializedName("sub_shop_id")
......
......@@ -66,7 +66,7 @@ class OrderCommodityInfoView @JvmOverloads constructor(context: Context, attrs:
vm.requestApplyRefund(it)
}
}, null, R.color.color_FD7823)
}, null, R.color.color_FD7823).show()
})
// 监听申请退款接口请求结果
vm.applyRefundResult.observe(context as LifecycleOwner, {
......@@ -98,6 +98,6 @@ class OrderCommodityInfoView @JvmOverloads constructor(context: Context, attrs:
binding.vm = vm
binding.status = status
binding.data = info
adapter.updateData(info.orderItemList)
adapter.updateData(info.mergeOrderItemList)
}
}
......@@ -11,7 +11,7 @@
<variable
name="data"
type="com.yidian.shenghuoquan.border.dto.OrderItem" />
type="com.yidian.shenghuoquan.border.dto.MergeOrderItem" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
......@@ -22,7 +22,7 @@
android:id="@+id/iv_commodity_pic"
android:layout_width="@dimen/dp82"
android:layout_height="@dimen/dp60"
app:commodityImageUrl="@{data.descPicUrl.get(0)}"
app:commodityImageUrl='@{data.descPicUrl.size() > 0 ? data.descPicUrl.get(0) : ""}'
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/img_order_commodity_placeholder" />
......
......@@ -113,7 +113,7 @@
android:layout_marginStart="@dimen/dp3"
android:ellipsize="end"
android:maxLines="1"
android:text='@{data.couponList.size() > 0 ? data.couponList.get(0).couponId : @string/red_packet_or_coupon}'
android:text='@{data.couponList.size() > 0 ? data.couponList.get(0).name : @string/red_packet_or_coupon}'
android:textColor="@color/color_333333"
android:textSize="@dimen/sp14"
android:visibility="@{data.couponList.size() > 0 ? View.VISIBLE : View.GONE}"
......@@ -127,7 +127,7 @@
android:id="@+id/tv_coupon_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text='@{data.couponList.size() > 0 ? "-¥" + String.valueOf(data.couponList.get(0).shareCouponAmount) : ""}'
android:text='@{"- ¥" + String.valueOf(data.discountFee)}'
android:textColor="@color/color_FB4653"
android:textSize="@dimen/sp14"
android:visibility="@{data.couponList.size() > 0 ? View.VISIBLE : View.GONE}"
......@@ -185,7 +185,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp24"
android:text='@{"¥" + String.valueOf(data.totalPrice)}'
android:text='@{String.format("¥%.2f", data.payment)}'
android:textColor="@color/black"
android:textSize="@dimen/sp18"
android:textStyle="bold"
......
......@@ -67,7 +67,7 @@
android:layout_marginTop="@dimen/dp8"
android:ellipsize="end"
android:maxLines="2"
android:text="@{data.address}"
android:text="@{data.location}"
android:textColor="@color/color_999999"
android:textSize="@dimen/sp14"
android:visibility="@{data != null ? View.VISIBLE : View.GONE}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment