Commit 4153109f authored by 王雪伟's avatar 王雪伟

[提交人]:王雪伟

[提交简述] :小象省钱
[实现方案] :调整订单列表
parent 1643e604
......@@ -19,8 +19,10 @@ class ShopOrderEntity {
var totalPrice: String? = ""
var discount: String = "0"//优惠价格
var userAddressId: String? = ""
var orderStatus: Int? = 0//订单状态:0待发货;1已发货;2已签收;3其他
var orderStatus: String? = ""//订单状态:0待发货;1已发货;2已签收;3其他
var orderType: String? = ""
var buyMethod: String? = ""
var phone: String? = ""
var goodsList: List<GoodList>? = null
var equitCard: RightsDetailEntity? = null
var equitCard: List<RightsDetailEntity>? = null
}
\ No newline at end of file
package com.zxbw.modulemain.adapter
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.zxbw.modulemain.R
import com.zxhl.cms.AppContext
import com.zxhl.cms.common.base.BaseRecyclerAdapter
import com.zxhl.cms.net.model.box.GoodList
import com.zxhl.cms.net.model.qy.RightsDetailEntity
import com.zxhl.cms.utils.JumpUtils
import com.zxhl.cms.utils.Utils
import com.zxhl.cms.widget.RecycleImageView
class ItemVipOrderAdapter : BaseRecyclerAdapter<RightsDetailEntity, ItemVipOrderAdapter.ViewHolder> {
private var mContext: Context? = null
constructor(
content: Context?
) : super() {
mContext = content
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
var bean = mList[position]
// holder.id_tv_vip_goods_name.text = bean.goodsName
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(
LayoutInflater.from(AppContext.get())
.inflate(R.layout.items_item_vip_rights_order, parent, false)
)
}
class ViewHolder : RecyclerView.ViewHolder {
var id_img_rights_icon: RecycleImageView?
var id_tv_vip_goods_name: TextView?
var id_tv_vip_goods_price: TextView?
var id_tv_vip_goods_num: TextView?
constructor(
itemView: View
) : super(itemView) {
id_img_rights_icon = itemView.findViewById<RecycleImageView>(R.id.id_img_rights_icon)
id_tv_vip_goods_name = itemView.findViewById<TextView>(R.id.id_tv_vip_goods_name)
id_tv_vip_goods_price = itemView.findViewById<TextView>(R.id.id_tv_vip_goods_price)
id_tv_vip_goods_num = itemView.findViewById<TextView>(R.id.id_tv_vip_goods_num)
}
}
}
\ No newline at end of file
......@@ -3,7 +3,6 @@ package com.zxbw.modulemain.adapter
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
......@@ -17,27 +16,47 @@ import com.zxhl.cms.common.base.BaseRecyclerAdapter
import com.zxhl.cms.net.model.box.ShopOrderEntity
import com.zxhl.cms.utils.Utils
//魔盒订单adapter
class BoxOrderAdapter : BaseRecyclerAdapter<ShopOrderEntity, BoxOrderAdapter.ViewHolder> {
//我的订单
class MyOrderAdapter : BaseRecyclerAdapter<ShopOrderEntity, RecyclerView.ViewHolder> {
private var mContext: Context? = null
private val VIEW_TYPE_GOODS_VIEW = 101
private val VIEW_TYPE_CARD_VIEW = 201
private val VIEW_TYPE_VIP_VIEW = 301
constructor(
content: Context?
) : super() {
mContext = content
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
override fun getItemViewType(position: Int): Int {
if (mList[position].orderType == "50") {
return VIEW_TYPE_VIP_VIEW
} else if (mList[position].orderType == "51") {
return VIEW_TYPE_CARD_VIEW
} else if (mList[position].orderType == "99") {
return VIEW_TYPE_GOODS_VIEW
} else {
return VIEW_TYPE_CARD_VIEW
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
var bean = mList[position]
if(!bean.goodsList.isNullOrEmpty()){
//实物订单
if (holder is GoodsOrderViewHolder) {
holder.img_order_no_copy?.setOnClickListener {
copy(holder.id_tv_order_no?.text.toString())
}
holder.id_tv_total_price?.text = "¥${bean.cash}"
// var mPrice = bean.cash?.toDouble()?.plus(bean.discount?.toDouble())
holder.id_tv_pricedesc?.text = "总价:¥${bean.totalPrice}|优惠:¥${bean.discount}|运费:¥${bean.freight}|"
holder.id_tv_pricedesc?.text =
"总价:¥${bean.totalPrice}|优惠:¥${bean.discount}|运费:¥${bean.freight}|"
holder.id_tv_order_no?.text = bean.orderNo
holder.id_tv_pay_time?.text = bean.payTime
if (!bean.goodsList.isNullOrEmpty()) {
var mAdapter: ItemOrderAdapter? = ItemOrderAdapter(mContext)
holder.id_rl_order_item?.layoutManager =
LinearLayoutManager(mContext)
......@@ -45,23 +64,61 @@ class BoxOrderAdapter : BaseRecyclerAdapter<ShopOrderEntity, BoxOrderAdapter.Vie
mAdapter?.clear()
mAdapter?.appendToList(bean.goodsList)
mAdapter?.notifyDataSetChanged()
}else{
}
} else if (holder is VipRightsOrderViewHolder) {
holder.img_vip_order_no_copy?.setOnClickListener {
copy(holder.id_tv_vip_order_no?.text.toString())
}
holder.id_tv_vip_order_no?.text = bean.orderNo
holder.id_tv_vip_pay_time?.text = "付款时间:${bean.payTime}"
holder.id_tv_vip_phone_number?.text = "会员手机号:${bean.phone}"
if (!bean.equitCard.isNullOrEmpty()) {
// var mAdapter: ItemOrderAdapter? = ItemOrderAdapter(mContext)
// holder.id_rl_order_item?.layoutManager =
// LinearLayoutManager(mContext)
// holder.id_rl_order_item?.adapter = mAdapter
// mAdapter?.clear()
// mAdapter?.appendToList(bean.goodsList)
// mAdapter?.notifyDataSetChanged()
}
} else {
}
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
if (viewType == VIEW_TYPE_VIP_VIEW) {
return VipRightsOrderViewHolder(
LayoutInflater.from(AppContext.get())
.inflate(R.layout.items_layout_vip_rights_order, parent, false)
)
} else if (viewType == VIEW_TYPE_CARD_VIEW) {
return CardRightsOrderViewHolder(
LayoutInflater.from(AppContext.get())
.inflate(R.layout.items_layout_card_rights_order, parent, false)
)
} else if (viewType == VIEW_TYPE_GOODS_VIEW) {
return CardRightsOrderViewHolder(
LayoutInflater.from(AppContext.get())
.inflate(R.layout.items_layout_card_rights_order, parent, false)
)
} else {
return CardRightsOrderViewHolder(
LayoutInflater.from(AppContext.get())
.inflate(R.layout.items_layout_box_order, parent, false)
.inflate(R.layout.items_layout_card_rights_order, parent, false)
)
}
class ViewHolder : RecyclerView.ViewHolder {
}
//实物商品类型
class GoodsOrderViewHolder : RecyclerView.ViewHolder {
var id_tv_total_price: TextView?
var id_tv_pricedesc: TextView?
var id_tv_order_no: TextView?
......@@ -73,7 +130,6 @@ class BoxOrderAdapter : BaseRecyclerAdapter<ShopOrderEntity, BoxOrderAdapter.Vie
itemView: View
) : super(itemView) {
id_tv_total_price = itemView.findViewById<TextView>(R.id.id_tv_total_price)
id_tv_pricedesc = itemView.findViewById<TextView>(R.id.id_tv_pricedesc)
id_tv_order_no = itemView.findViewById<TextView>(R.id.id_tv_order_no)
......@@ -84,6 +140,35 @@ class BoxOrderAdapter : BaseRecyclerAdapter<ShopOrderEntity, BoxOrderAdapter.Vie
}
}
//权益卡类型
class VipRightsOrderViewHolder : RecyclerView.ViewHolder {
var id_tv_vip_phone_number: TextView?
var id_tv_vip_order_no: TextView?
var id_tv_vip_pay_time: TextView?
var img_vip_order_no_copy: ImageView?
var id_rl_vip_order_item: RecyclerView?
constructor(
itemView: View
) : super(itemView) {
id_tv_vip_phone_number = itemView.findViewById<TextView>(R.id.id_tv_vip_phone_number)
id_tv_vip_order_no = itemView.findViewById<TextView>(R.id.id_tv_vip_order_no)
id_tv_vip_pay_time = itemView.findViewById<TextView>(R.id.id_tv_vip_pay_time)
img_vip_order_no_copy = itemView.findViewById<ImageView>(R.id.img_vip_order_no_copy)
id_rl_vip_order_item = itemView.findViewById<RecyclerView>(R.id.id_rl_vip_order_item)
}
}
//卡券类类型
class CardRightsOrderViewHolder : RecyclerView.ViewHolder {
constructor(
itemView: View
) : super(itemView) {
}
}
fun copy(string: String) {
//获取剪贴板管理器:
val cm: ClipboardManager =
......
......@@ -5,7 +5,7 @@ import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.zxbw.modulemain.R
import com.zxbw.modulemain.adapter.BoxOrderAdapter
import com.zxbw.modulemain.adapter.MyOrderAdapter
import com.zxbw.modulemain.contract.BoxOrderContract
import com.zxbw.modulemain.presenter.BoxOrderPresenter
import com.zxhl.cms.common.base.BaseFragment
......@@ -17,14 +17,14 @@ import kotlinx.android.synthetic.main.fragment_layout_magic_box_order.*
class MagicBoxOrderFragment:BaseFragment(), BoxOrderContract.View {
private var mPresenter: BoxOrderPresenter? = null
private var mAdapter: BoxOrderAdapter?=null
private var mAdapter: MyOrderAdapter?=null
override fun layoutID(): Int {
return R.layout.fragment_layout_magic_box_order
}
override fun init(view: View?) {
mPresenter = BoxOrderPresenter(this)
mAdapter= BoxOrderAdapter(mActivity)
mAdapter= MyOrderAdapter(mActivity)
box_order_recyclerView.layoutManager= LinearLayoutManager(mActivity)
box_order_recyclerView.adapter=mAdapter
mPresenter?.getOrderList(true)
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="52dp"
android:orientation="horizontal">
<com.zxhl.cms.widget.RecycleImageView
android:id="@+id/id_img_rights_icon"
android:layout_width="70dp"
android:layout_height="52dp"
android:layout_marginRight="10dp" />
<TextView
android:id="@+id/id_tv_vip_goods_name"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="30dp"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="2"
android:text="ssss"
android:textColor="@color/color_333333"
android:textSize="14sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="right"
android:orientation="vertical">
<TextView
android:id="@+id/id_tv_vip_goods_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="¥199"
android:textColor="@color/color_333333"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/id_tv_vip_goods_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="x 1"
android:textColor="@color/color_333333"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:background="#EDEDED" />
</LinearLayout>
......@@ -11,7 +11,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -93,4 +92,6 @@
android:textColor="@color/color_999999"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@drawable/shape_ffffff_r5"
android:orientation="vertical">
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@drawable/shape_ffffff_r5"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<LinearLayout
android:layout_width="match_parent"
android:gravity="center_vertical"
android:layout_height="wrap_content">
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:text="订单编号:"
android:textColor="@color/color_999999"
android:textSize="12sp" />
<TextView
android:id="@+id/id_tv_vip_order_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:text=""
android:textColor="@color/color_999999"
android:textSize="12sp" />
<ImageView
android:id="@+id/img_vip_order_no_copy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:src="@drawable/icon_copy" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/id_rl_vip_order_item"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/id_tv_vip_phone_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="会员手机号:15632195693"
android:textColor="@color/color_999999"
android:textSize="12sp" />
<TextView
android:id="@+id/id_tv_vip_pay_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="付款时间:2020-11-23 11:11"
android:textColor="@color/color_999999"
android:textSize="12sp" />
</LinearLayout>
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