Commit 9ca4e8b2 authored by chengkun's avatar chengkun

隐藏优惠券tip

parent 725a64c9
package com.yidian.shenghuoquan.buserorder.app.adapter
import android.graphics.Typeface
import android.view.View
import android.widget.LinearLayout
import android.widget.RelativeLayout
import android.widget.TextView
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.yidian.shenghuoquan.buserorder.R
import com.yidian.shenghuoquan.buserorder.app.bean.OrderWebData
import com.yidian.shenghuoquan.buserorder.utils.Utils
import com.yidian.shenghuoquan.buserorder.view.RoundImageView
class OrderListAdapter : BaseQuickAdapter<OrderWebData, BaseViewHolder>(R.layout.border_recycle_order_item){
override fun convert(holder: BaseViewHolder, item: OrderWebData) {
......@@ -17,20 +22,40 @@ class OrderListAdapter : BaseQuickAdapter<OrderWebData, BaseViewHolder>(R.layout
holder.itemView.findViewById<TextView>(R.id.tv_market_name).text = data.marketing_name
holder.itemView.findViewById<TextView>(R.id.tv_pay_status).text = data.online_status
when(data.order_item_list.size) {
0 -> {
holder.itemView.findViewById<LinearLayout>(R.id.ll_order_image1).visibility = View.GONE
holder.itemView.findViewById<LinearLayout>(R.id.ll_order_image2).visibility = View.GONE
holder.itemView.findViewById<LinearLayout>(R.id.ll_order_image3).visibility = View.GONE
}
1 -> {
holder.itemView.findViewById<TextView>(R.id.tv_goog1_name).text = data.order_item_list[0].goods_name
holder.itemView.findViewById<LinearLayout>(R.id.ll_order_image2).visibility = View.GONE
holder.itemView.findViewById<LinearLayout>(R.id.ll_order_image3).visibility = View.GONE
/*if (Utils.isWebUrl(data.order_item_list[0].desc_pic_url)) {
Glide.with(context).load(data.order_item_list[0].desc_pic_url).into(holder.itemView.findViewById(R.id.round_image1))
}*/
}
2 -> {
holder.itemView.findViewById<TextView>(R.id.tv_goog1_name).text = data.order_item_list[0].goods_name
holder.itemView.findViewById<TextView>(R.id.tv_goog2_name).text = data.order_item_list[1].goods_name
holder.itemView.findViewById<LinearLayout>(R.id.ll_order_image3).visibility = View.GONE
/*if (Utils.isWebUrl(data.order_item_list[0].desc_pic_url) && Utils.isWebUrl(data.order_item_list[1].desc_pic_url)) {
Glide.with(context).load(data.order_item_list[0].desc_pic_url).into(holder.itemView.findViewById(R.id.round_image1))
Glide.with(context).load(data.order_item_list[1].desc_pic_url).into(holder.itemView.findViewById(R.id.round_image2))
}*/
}
3 -> {
else -> {
holder.itemView.findViewById<TextView>(R.id.tv_goog1_name).text = data.order_item_list[0].goods_name
holder.itemView.findViewById<TextView>(R.id.tv_goog2_name).text = data.order_item_list[1].goods_name
holder.itemView.findViewById<TextView>(R.id.tv_good3_name).text = data.order_item_list[2].goods_name
/*if (Utils.isWebUrl(data.order_item_list[0].desc_pic_url) && Utils.isWebUrl(data.order_item_list[1].desc_pic_url) && Utils.isWebUrl(data.order_item_list[2].desc_pic_url)) {
Glide.with(context).load(data.order_item_list[0].desc_pic_url).into(holder.itemView.findViewById(R.id.round_image1))
Glide.with(context).load(data.order_item_list[1].desc_pic_url).into(holder.itemView.findViewById(R.id.round_image2))
Glide.with(context).load(data.order_item_list[2].desc_pic_url).into(holder.itemView.findViewById(R.id.round_image3))
}*/
}
}
holder.itemView.findViewById<TextView>(R.id.tv_order_goods_count).text = data.goods_num.toString()
holder.itemView.findViewById<TextView>(R.id.tv_order_goods_count).text = "共${data.goods_num}件"
holder.itemView.findViewById<TextView>(R.id.tv_pay_time).text = data.pay_time
var money:TextView = holder.itemView.findViewById<TextView>(R.id.tv_pay_money_count)
money.setTypeface(Typeface.DEFAULT_BOLD)
......@@ -40,8 +65,10 @@ class OrderListAdapter : BaseQuickAdapter<OrderWebData, BaseViewHolder>(R.layout
}
if (data.online_status.equals("4")) {
holder.itemView.findViewById<TextView>(R.id.tv_pay_money_status).text = "已退款:"
holder.itemView.findViewById<TextView>(R.id.tv_pay_status).text = "已退款"
} else {
holder.itemView.findViewById<TextView>(R.id.tv_pay_money_status).text = "已支付:"
holder.itemView.findViewById<TextView>(R.id.tv_pay_status).text = "已支付"
}
}
}
package com.yidian.shenghuoquan.buserorder.app.bean
import com.google.gson.annotations.SerializedName
data class OrderWebData(
@SerializedName(value = "create_time_text")
val create_time_text: String,
@SerializedName(value = "desc_pic_url")
val desc_pic_url: String,
@SerializedName(value = "discount_fee")
val discount_fee: Int,
@SerializedName(value = "goods_desc")
val goods_desc: String,
@SerializedName(value = "goods_introduce")
val goods_introduce: String,
@SerializedName(value = "goods_name")
val goods_name: String,
@SerializedName(value = "goods_num")
val goods_num: Int,
@SerializedName(value = "goods_price")
val goods_price: String,
@SerializedName(value = "life_account_icon")
val life_account_icon: String,
@SerializedName(value = "life_account_id")
val life_account_id: String,
@SerializedName(value = "life_account_name")
val life_account_name: String,
@SerializedName(value = "marketing_id")
val marketing_id: Int,
@SerializedName(value = "marketing_name")
val marketing_name: String,
@SerializedName(value = "merge_order_item_list")
val merge_order_item_list: List<MergeOrderItem>,
@SerializedName(value = "online_status")
val online_status: String,
@SerializedName(value = "order_id")
val order_id: String,
@SerializedName(value = "order_item_list")
val order_item_list: List<OrderItem>,
@SerializedName(value = "order_price")
val order_price: String,
@SerializedName(value = "order_status")
val order_status: Int,
@SerializedName(value = "order_status_text")
val order_status_text: String,
@SerializedName(value = "original_price")
val original_price: String,
@SerializedName(value = "pay_time")
val pay_time: String,
@SerializedName(value = "payment")
val payment: Double,
@SerializedName(value = "place_list")
val place_list: PlaceList,
@SerializedName(value = "refund_amount")
val refund_amount: Double,
@SerializedName(value = "refund_apply_time")
val refund_apply_time: String,
@SerializedName(value = "refund_finish_time")
val refund_finish_time: String,
@SerializedName(value = "shipping_list")
val shipping_list: ShippingList,
@SerializedName(value = "total_amount_sold")
val total_amount_sold: String,
@SerializedName(value = "total_price")
val total_price: Double
)
data class MergeOrderItem(
@SerializedName(value = "goods_name")
val goods_name: String,
@SerializedName(value = "goods_num")
val goods_num: Int,
@SerializedName(value = "price")
val price: Double
)
data class OrderItem(
@SerializedName(value = "goods_name")
val goods_name: String,
@SerializedName(value = "goods_num")
val goods_num: Int,
@SerializedName(value = "goods_sku_id")
val goods_sku_id: String,
@SerializedName(value = "price")
val price: Double
)
data class PlaceList(
@SerializedName(value = "address")
val address: String,
@SerializedName(value = "area")
val area: String,
@SerializedName(value = "city")
val city: String,
@SerializedName(value = "contact_name")
val contact_name: String,
@SerializedName(value = "create_time")
val create_time: String,
@SerializedName(value = "is_delete")
val is_delete: Int,
@SerializedName(value = "latitude")
val latitude: String,
@SerializedName(value = "life_account_id")
val life_account_id: String,
@SerializedName(value = "location")
val location: String,
@SerializedName(value = "longitude")
val longitude: String,
@SerializedName(value = "phone")
val phone: String,
@SerializedName(value = "province")
val province: String,
@SerializedName(value = "take_place_id")
val take_place_id: Int,
@SerializedName(value = "take_place_name")
val take_place_name: String,
@SerializedName(value = "update_time")
val update_time: String
)
data class ShippingList(
@SerializedName(value = "receiver_address")
val receiver_address: String,
@SerializedName(value = "receiver_mobile")
val receiver_mobile: String,
@SerializedName(value = "receiver_name")
val receiver_name: String
)
......
......@@ -3,6 +3,7 @@ package com.yidian.shenghuoquan.buserorder.http
import com.yidian.bcommon.http.HttpResult
import io.reactivex.rxjava3.core.Observable
import retrofit2.http.Body
import retrofit2.http.Headers
import retrofit2.http.POST
import retrofit2.http.QueryMap
......@@ -15,6 +16,7 @@ interface UserOrderListService {
/**
* 获取用户订单列表
*/
@Headers("Content-Type: application/json")
@POST(userOrderList)
fun userOrderList(@QueryMap commonParams: Map<String, String>, @Body params: Map<String, String?>): Observable<HttpResult<Any?>>
}
......@@ -29,10 +29,9 @@ class OrderListActivity : BaseMvvmActivity<BorderActivityOrderListBinding, Order
override fun initView() {
initTitleBar(binding.orderListToolbar, binding.tvTitle, "参与的")
SystemBarUtils.setStatusBarTextColorWhite(this)
binding.orderListToolbar.setNavigationIcon(R.drawable.icon_arrow_white)
binding.orderListToolbar.setNavigationIcon(R.drawable.icon_back)
initRecycleView()
initClickEvent()
}
private fun initRecycleView() {
......@@ -81,7 +80,9 @@ class OrderListActivity : BaseMvvmActivity<BorderActivityOrderListBinding, Order
}
override fun onRefresh(refreshLayout: RefreshLayout) {
vm.requestUserOrder(HashMap<String, String?>())
var param = HashMap<String, String?>()
param["business_from"] = "2"
vm.requestUserOrder(param)
binding.smartRefresh.finishRefresh()
}
......
package com.yidian.shenghuoquan.buserorder.utils
class Utils {
import java.lang.StringBuilder
import java.util.regex.Pattern
object Utils {
//域名后缀,需要可以添加
private val come = arrayOf(
"top", "com.cn", "com", "net", "cn", "cc", "gov", "cn", "hk"
)
fun isWebUrl(url: String?): Boolean {
val sb = StringBuilder()
sb.append("(")
for (anExt in come) {
sb.append(anExt)
sb.append("|")
}
sb.deleteCharAt(sb.length - 1)
sb.append(")")
val pattern =
"((https?|s?ftp|irc[6s]?|git|afp|telnet|smb)://)?((\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|((www\\.|[a-zA-Z\\.\\-]+\\.)?[a-zA-Z0-9\\-]+\\.$sb(:[0-9]{1,5})?))((/[a-zA-Z0-9\\./,;\\?'\\+&%\\$#=~_\\-]*)|([^\\u4e00-\\u9fa5\\s0-9a-zA-Z\\./,;\\?'\\+&%\\$#=~_\\-]*))"
return Pattern.compile(pattern).matcher(url).matches()
}
}
......@@ -21,14 +21,14 @@
android:paddingStart="@dimen/dp15"
android:paddingEnd="@dimen/dp15"
app:layout_scrollFlags="scroll|enterAlways"
app:navigationIcon="@drawable/icon_arrow_white"
android:background="#F6775B">
app:navigationIcon="@drawable/icon_back"
android:background="#FFFFFF">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="#FFFFFF"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold"
tools:text="标题" />
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/dp265"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/shape_rond_react"
android:paddingLeft="@dimen/dp16"
......@@ -33,28 +33,29 @@
android:layout_centerVertical="true"
android:src="@drawable/icon_arrow_right">
</ImageView>
<TextView
android:id="@+id/tv_pay_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/dp16"
android:layout_gravity="center_vertical"
android:text="已支付"
android:textSize="14sp">
</TextView>
android:textSize="14sp"></TextView>
</RelativeLayout>
<TextView
android:id="@+id/tv_youhui_detail"
android:layout_width="wrap_content"
android:layout_height="18dp"
android:layout_marginStart="@dimen/dp16"
android:layout_below="@+id/ll_you_hui_and_pay"
android:layout_marginStart="@dimen/dp16"
android:layout_marginTop="@dimen/dp11"
android:textSize="12sp"
android:gravity="center"
android:text="新人首单立减十元"
android:textColor="#D66948"
android:text="新人首单立减十元">
android:textSize="12sp"
android:visibility="gone">
</TextView>
<RelativeLayout
......@@ -68,11 +69,12 @@
android:layout_centerHorizontal="true">
<LinearLayout
android:id="@+id/ll_order_image1"
android:layout_width="82dp"
android:layout_width="70dp"
android:layout_height="match_parent"
android:orientation="vertical">
<com.yidian.shenghuoquan.buserorder.view.RoundImageView
android:layout_width="@dimen/dp82"
android:id="@+id/round_image1"
android:layout_width="match_parent"
android:layout_height="@dimen/dp60"
android:scaleType="centerInside"
app:radius="@dimen/dp12"
......@@ -84,7 +86,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:textSize="12sp"
android:text="肉末茄子+蔬菜"
android:text=""
android:gravity="center"
android:textColor="#999999"
android:ellipsize="end"
......@@ -93,12 +95,13 @@
</LinearLayout>
<LinearLayout
android:id="@+id/ll_order_image2"
android:layout_width="82dp"
android:layout_width="70dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_toRightOf="@+id/ll_order_image1"
android:layout_marginStart="@dimen/dp8">
<com.yidian.shenghuoquan.buserorder.view.RoundImageView
android:id="@+id/round_image2"
android:layout_width="match_parent"
android:layout_height="@dimen/dp60"
android:scaleType="centerCrop"
......@@ -112,7 +115,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:gravity="center"
android:text="肉末茄子+蔬菜"
android:text=""
android:textColor="#999999"
android:textSize="12sp"
android:ellipsize="end"
......@@ -121,12 +124,13 @@
</LinearLayout>
<LinearLayout
android:id="@+id/ll_order_image3"
android:layout_width="@dimen/dp82"
android:layout_width="@dimen/dp70"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginLeft="@dimen/dp8"
android:layout_toRightOf="@+id/ll_order_image2">
<com.yidian.shenghuoquan.buserorder.view.RoundImageView
android:id="@+id/round_image3"
android:layout_width="match_parent"
android:layout_height="60dp"
android:scaleType="centerCrop"
......@@ -139,24 +143,24 @@
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:textSize="12sp"
android:text="肉末茄子+蔬菜"
android:text=""
android:gravity="center"
android:textColor="#999999"
android:maxLines="1"
android:ellipsize="end">
</TextView>
</LinearLayout>
<TextView
android:id="@+id/tv_order_goods_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:textSize="13sp"
android:layout_marginRight="@dimen/dp17"
android:text="共2件"
android:layout_centerVertical="true"
android:gravity="center"
android:textColor="#999999">
android:text=""
android:textColor="#999999"
android:textSize="13sp">
</TextView>
</RelativeLayout>
<RelativeLayout
......
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