Commit ab18a99d authored by 王雪伟's avatar 王雪伟

[提交人]:王雪伟

[提交简述] :小象省钱
[实现方案] :调整订单
parent 75262c44
package com.zxbw.modulemain.activity package com.zxbw.modulemain.activity
import android.content.Intent
import android.net.Uri
import android.net.http.SslError
import android.os.Handler import android.os.Handler
import android.util.Log import android.util.Log
import android.view.View import android.view.View
import android.webkit.*
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.zxbw.modulemain.R import com.zxbw.modulemain.R
import com.zxhl.cms.AppContext import com.zxhl.cms.AppContext
import com.zxhl.cms.common.Constant import com.zxhl.cms.common.Constant
import com.zxhl.cms.common.NetConfig
import com.zxhl.cms.common.base.BaseActivity import com.zxhl.cms.common.base.BaseActivity
import com.zxhl.cms.net.ApiClient import com.zxhl.cms.net.ApiClient
import com.zxhl.cms.net.RxSchedulers import com.zxhl.cms.net.RxSchedulers
......
...@@ -25,7 +25,7 @@ class ItemVipOrderAdapter : ...@@ -25,7 +25,7 @@ class ItemVipOrderAdapter :
override fun onBindViewHolder(holder: ViewHolder, position: Int) { override fun onBindViewHolder(holder: ViewHolder, position: Int) {
var bean = mList[position] var bean = mList[position]
holder.id_img_rights_icon?.setLoadImageUrl(bean.icon,0, 4) holder.id_img_rights_icon?.setLoadImageUrl(bean.icon,false)
holder.id_tv_vip_goods_name?.text = "${bean.brand} ${bean.category} ${bean.goodsName}" holder.id_tv_vip_goods_name?.text = "${bean.brand} ${bean.category} ${bean.goodsName}"
holder.id_tv_vip_goods_price?.text = "¥${bean.salePrice}" holder.id_tv_vip_goods_price?.text = "¥${bean.salePrice}"
// holder.id_tv_vip_goods_num?.text = "${bean.salePrice}" // holder.id_tv_vip_goods_num?.text = "${bean.salePrice}"
......
...@@ -41,7 +41,12 @@ class JgqQyAdapter : BaseRecyclerAdapter<JgqQyEntity, JgqQyAdapter.ViewHolder> { ...@@ -41,7 +41,12 @@ class JgqQyAdapter : BaseRecyclerAdapter<JgqQyEntity, JgqQyAdapter.ViewHolder> {
.apply(RequestOptions.bitmapTransform(CircleCrop())) .apply(RequestOptions.bitmapTransform(CircleCrop()))
.into(holder?.id_icon!!) .into(holder?.id_icon!!)
holder.id_name?.text = bean.brand holder.id_name?.text = bean.brand
holder.id_tv_discount_value?.text = "${bean.maxDiscount}折" if(bean.maxDiscount.isNullOrEmpty()||bean.maxDiscount.equals("0")){
holder.id_tv_discount_value?.visibility = View.INVISIBLE
}else{
holder.id_tv_discount_value?.visibility = View.VISIBLE
holder.id_tv_discount_value?.text = "${bean.maxDiscount}折"
}
holder.id_rl_qy_item_view?.setOnClickListener { holder.id_rl_qy_item_view?.setOnClickListener {
listener.onItemClick(it, position, bean) listener.onItemClick(it, position, bean)
} }
......
...@@ -51,7 +51,6 @@ class MyOrderAdapter : BaseRecyclerAdapter<ShopOrderEntity, RecyclerView.ViewHol ...@@ -51,7 +51,6 @@ class MyOrderAdapter : BaseRecyclerAdapter<ShopOrderEntity, RecyclerView.ViewHol
copy(holder.id_tv_order_no?.text.toString()) copy(holder.id_tv_order_no?.text.toString())
} }
holder.id_tv_total_price?.text = "¥${bean.cash}" holder.id_tv_total_price?.text = "¥${bean.cash}"
// var mPrice = bean.cash?.toDouble()?.plus(bean.discount?.toDouble())
holder.id_tv_pricedesc?.text = holder.id_tv_pricedesc?.text =
"总价:¥${bean.totalPrice}|优惠:¥${bean.discount}|运费:¥${bean.freight}|" "总价:¥${bean.totalPrice}|优惠:¥${bean.discount}|运费:¥${bean.freight}|"
holder.id_tv_order_no?.text = bean.orderNo holder.id_tv_order_no?.text = bean.orderNo
...@@ -63,7 +62,6 @@ class MyOrderAdapter : BaseRecyclerAdapter<ShopOrderEntity, RecyclerView.ViewHol ...@@ -63,7 +62,6 @@ class MyOrderAdapter : BaseRecyclerAdapter<ShopOrderEntity, RecyclerView.ViewHol
holder.id_rl_order_item?.adapter = mAdapter holder.id_rl_order_item?.adapter = mAdapter
mAdapter?.clear() mAdapter?.clear()
mAdapter?.appendToList(bean.goodsList) mAdapter?.appendToList(bean.goodsList)
mAdapter?.notifyDataSetChanged()
} }
} else if (holder is VipRightsOrderViewHolder) { } else if (holder is VipRightsOrderViewHolder) {
holder.img_vip_order_no_copy?.setOnClickListener { holder.img_vip_order_no_copy?.setOnClickListener {
...@@ -102,9 +100,9 @@ class MyOrderAdapter : BaseRecyclerAdapter<ShopOrderEntity, RecyclerView.ViewHol ...@@ -102,9 +100,9 @@ class MyOrderAdapter : BaseRecyclerAdapter<ShopOrderEntity, RecyclerView.ViewHol
.inflate(R.layout.items_layout_card_rights_order, parent, false) .inflate(R.layout.items_layout_card_rights_order, parent, false)
) )
} else if (viewType == VIEW_TYPE_GOODS_VIEW) { } else if (viewType == VIEW_TYPE_GOODS_VIEW) {
return CardRightsOrderViewHolder( return GoodsOrderViewHolder(
LayoutInflater.from(AppContext.get()) LayoutInflater.from(AppContext.get())
.inflate(R.layout.items_layout_card_rights_order, parent, false) .inflate(R.layout.items_layout_box_order, parent, false)
) )
} else { } else {
return CardRightsOrderViewHolder( return CardRightsOrderViewHolder(
......
...@@ -102,7 +102,7 @@ class NewBoxGoodsDetailActivity : BaseActivity(), GoodsDetailContract.View, ...@@ -102,7 +102,7 @@ class NewBoxGoodsDetailActivity : BaseActivity(), GoodsDetailContract.View,
id_detail_rule?.setOnClickListener { id_detail_rule?.setOnClickListener {
JumpUtils.webJump( JumpUtils.webJump(
"规则", "规则",
"https://newspool.zhangxinhulian.com/sspapiNovel/su/custom/xingyunmohe/ios/use_introduce.html" "https://newspool.zhangxinhulian.com/sspapiNovel/su/custom/xiaoxiangSaveMoney/privacy_app1.html"
) )
} }
//试玩 //试玩
......
...@@ -4,6 +4,8 @@ import android.text.TextUtils ...@@ -4,6 +4,8 @@ import android.text.TextUtils
import android.view.View import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.scwang.smart.refresh.footer.ClassicsFooter
import com.scwang.smart.refresh.header.ClassicsHeader
import com.zxbw.modulemain.R import com.zxbw.modulemain.R
import com.zxbw.modulemain.adapter.MyOrderAdapter import com.zxbw.modulemain.adapter.MyOrderAdapter
import com.zxbw.modulemain.contract.BoxOrderContract import com.zxbw.modulemain.contract.BoxOrderContract
...@@ -13,66 +15,57 @@ import com.zxhl.cms.net.model.box.NoticeEntity ...@@ -13,66 +15,57 @@ import com.zxhl.cms.net.model.box.NoticeEntity
import com.zxhl.cms.net.model.box.ShopOrderEntity import com.zxhl.cms.net.model.box.ShopOrderEntity
import com.zxhl.cms.utils.Utils import com.zxhl.cms.utils.Utils
import kotlinx.android.synthetic.main.fragment_layout_magic_box_order.* import kotlinx.android.synthetic.main.fragment_layout_magic_box_order.*
import kotlinx.android.synthetic.main.fragment_layout_magic_box_order.id_refresh_view
import kotlinx.android.synthetic.main.fragment_layout_recommend.*
class MagicBoxOrderFragment:BaseFragment(), BoxOrderContract.View { class MagicBoxOrderFragment : BaseFragment(), BoxOrderContract.View {
private var mPresenter: BoxOrderPresenter? = null private var mPresenter: BoxOrderPresenter? = null
private var mAdapter: MyOrderAdapter?=null private var mAdapter: MyOrderAdapter? = null
override fun layoutID(): Int { override fun layoutID(): Int {
return R.layout.fragment_layout_magic_box_order return R.layout.fragment_layout_magic_box_order
} }
override fun init(view: View?) { override fun init(view: View?) {
mPresenter = BoxOrderPresenter(this) mPresenter = BoxOrderPresenter(this)
mAdapter= MyOrderAdapter(mActivity) mAdapter = MyOrderAdapter(mActivity)
box_order_recyclerView.layoutManager= LinearLayoutManager(mActivity) box_order_recyclerView.layoutManager = LinearLayoutManager(mActivity)
box_order_recyclerView.adapter=mAdapter box_order_recyclerView.adapter = mAdapter
mPresenter?.getOrderList(true) mPresenter?.getOrderList(true)
mPresenter?.getNotice() mPresenter?.getNotice()
refreshLayout.setColorSchemeColors(resources.getColor(R.color.color_3A95FD))
refreshLayout?.setOnRefreshListener {
mPresenter?.getOrderList(true)
}
box_order_recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState)
} id_refresh_view.setRefreshHeader(ClassicsHeader(activity))
id_refresh_view.setRefreshFooter(ClassicsFooter(activity))
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (Utils.isSlideToBottom(recyclerView)) {
if ((mAdapter?.list?.size ?: 0) > 0) {
mPresenter?.getOrderList(false)
}
}
}
})
id_refresh_view.setOnRefreshListener {
mPresenter?.getOrderList(true)
}
id_refresh_view.setOnLoadMoreListener {
mPresenter?.getOrderList(false)
}
} }
companion object { companion object {
fun newInstance() = MagicBoxOrderFragment() fun newInstance() = MagicBoxOrderFragment()
} }
override fun setOrderListData(isRefresh: Boolean, reslut: List<ShopOrderEntity>?) { override fun setOrderListData(isRefresh: Boolean, reslut: List<ShopOrderEntity>?) {
if (isRefresh) { if (isRefresh) {
id_refresh_view.finishRefresh(!reslut.isNullOrEmpty());//传入false表示加载失败
} else {
id_refresh_view.finishLoadMore(!reslut.isNullOrEmpty());//传入false表示加载失败
}
if (isRefresh && !reslut.isNullOrEmpty()) {
mAdapter?.clear() mAdapter?.clear()
} }
setEmptyView(false) if (!reslut.isNullOrEmpty()) {
val start = mAdapter?.getItemCount() ?: 0 mAdapter?.appendToList(reslut)
mAdapter?.appendToList(reslut)
if (isRefresh) {
mAdapter?.notifyDataSetChanged()
} else {
val end = mAdapter?.getItemCount() ?: 0
mAdapter?.notifyItemRangeChanged(start, end)
} }
setEmptyView(mAdapter?.list?.size ?: 0 == 0)
} }
override fun setEmptyView(isEmpty: Boolean) { override fun setEmptyView(isEmpty: Boolean) {
refreshLayout?.isRefreshing = false
if (isEmpty) { if (isEmpty) {
id_order_empty.visibility = View.VISIBLE id_order_empty.visibility = View.VISIBLE
} else { } else {
...@@ -81,11 +74,11 @@ class MagicBoxOrderFragment:BaseFragment(), BoxOrderContract.View { ...@@ -81,11 +74,11 @@ class MagicBoxOrderFragment:BaseFragment(), BoxOrderContract.View {
} }
override fun setNotice(reslut: NoticeEntity?) { override fun setNotice(reslut: NoticeEntity?) {
if(!TextUtils.isEmpty(reslut?.orderNotice)){ if (!TextUtils.isEmpty(reslut?.orderNotice)) {
id_ll_notice?.visibility=View.VISIBLE id_ll_notice?.visibility = View.VISIBLE
id_tv_order_notice?.text=reslut?.orderNotice id_tv_order_notice?.text = reslut?.orderNotice
}else{ } else {
id_ll_notice?.visibility=View.GONE id_ll_notice?.visibility = View.GONE
} }
} }
......
...@@ -18,43 +18,25 @@ class BoxOrderPresenter : BoxOrderContract.Presenter { ...@@ -18,43 +18,25 @@ class BoxOrderPresenter : BoxOrderContract.Presenter {
private var page: Int = 1 private var page: Int = 1
private val size: Int = 10 private val size: Int = 10
private var isMore = false
override fun getOrderList(ifRefresh: Boolean) { override fun getOrderList(ifRefresh: Boolean) {
if (ifRefresh) { if (ifRefresh) {
page = 1 page = 1
isMore = false
} else if (isMore) {
return
} }
isMore = true
ApiClient.homeApi.getOrder(page, size) ApiClient.homeApi.getOrder(page, size)
.compose(RxSchedulers.observableIO2Main()) .compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<List<ShopOrderEntity>>() { .subscribe(object : BaseObserver<List<ShopOrderEntity>>() {
override fun onSuccess(result: List<ShopOrderEntity>?) { override fun onSuccess(result: List<ShopOrderEntity>?) {
if (result != null) { if (result != null) {
if (!result.isNullOrEmpty()) { page++;
if (result.size <= size) { mView.setOrderListData(ifRefresh, result)
page++
isMore = false
} else {
isMore = true
}
mView.setOrderListData(ifRefresh, result)
} else {
if (page == 1) {
mView.setEmptyView(true)
}
}
} else { } else {
mView.setEmptyView(true) mView.setOrderListData(ifRefresh, null)
} }
} }
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) { override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.d("wxw", "goodsListError " + code + " errorMsg " + errorMsg) Log.d("wxw", "goodsListError " + code + " errorMsg " + errorMsg)
// mView.setEmptyView(true) mView.setOrderListData(ifRefresh, null)
mView.setEmptyView(true)
} }
}) })
......
...@@ -409,7 +409,7 @@ ...@@ -409,7 +409,7 @@
android:id="@+id/id_img_close_pay_web" android:id="@+id/id_img_close_pay_web"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignRight="@+id/id_member_pay_web_view" android:layout_alignRight="@id/id_rights_pay_web_view"
android:padding="10dp" android:padding="10dp"
android:src="@drawable/icon_guanbi" /> android:src="@drawable/icon_guanbi" />
......
...@@ -342,7 +342,7 @@ ...@@ -342,7 +342,7 @@
android:id="@+id/id_img_close_pay_web" android:id="@+id/id_img_close_pay_web"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignRight="@+id/id_member_pay_web_view" android:layout_alignRight="@id/id_member_pay_web_view"
android:padding="10dp" android:padding="10dp"
android:src="@drawable/icon_guanbi" /> android:src="@drawable/icon_guanbi" />
......
...@@ -450,9 +450,25 @@ ...@@ -450,9 +450,25 @@
<!-- android:textSize="15sp" />--> <!-- android:textSize="15sp" />-->
<!-- </RelativeLayout>--> <!-- </RelativeLayout>-->
<WebView <RelativeLayout
android:id="@+id/id_pay_web_view" android:id="@+id/id_rl_h5_pay_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:visibility="gone" /> android:layout_below="@id/id_rl_order_title"
android:visibility="gone">
<WebView
android:id="@+id/id_pay_web_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/id_img_close_pay_web"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@id/id_pay_web_view"
android:padding="10dp"
android:src="@drawable/icon_guanbi" />
</RelativeLayout>
</RelativeLayout> </RelativeLayout>
...@@ -322,7 +322,7 @@ ...@@ -322,7 +322,7 @@
android:id="@+id/id_img_close_pay_web" android:id="@+id/id_img_close_pay_web"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignRight="@+id/id_member_pay_web_view" android:layout_alignRight="@id/id_rights_pay_web_view"
android:padding="10dp" android:padding="10dp"
android:src="@drawable/icon_guanbi" /> android:src="@drawable/icon_guanbi" />
......
...@@ -343,7 +343,7 @@ ...@@ -343,7 +343,7 @@
android:id="@+id/id_img_close_pay_web" android:id="@+id/id_img_close_pay_web"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignRight="@+id/id_member_pay_web_view" android:layout_alignRight="@id/id_rights_pay_web_view"
android:padding="10dp" android:padding="10dp"
android:src="@drawable/icon_guanbi" /> android:src="@drawable/icon_guanbi" />
......
...@@ -344,7 +344,7 @@ ...@@ -344,7 +344,7 @@
android:id="@+id/id_img_close_pay_web" android:id="@+id/id_img_close_pay_web"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignRight="@+id/id_member_pay_web_view" android:layout_alignRight="@id/id_rights_pay_web_view"
android:padding="10dp" android:padding="10dp"
android:src="@drawable/icon_guanbi" /> android:src="@drawable/icon_guanbi" />
......
...@@ -31,18 +31,19 @@ ...@@ -31,18 +31,19 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout <com.scwang.smart.refresh.layout.SmartRefreshLayout
android:id="@+id/refreshLayout" android:id="@+id/id_refresh_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/box_order_recyclerView" android:id="@+id/box_order_recyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="5dp" /> android:padding="5dp" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </com.scwang.smart.refresh.layout.SmartRefreshLayout>
<LinearLayout <LinearLayout
android:id="@+id/id_order_empty" android:id="@+id/id_order_empty"
......
...@@ -9,11 +9,18 @@ ...@@ -9,11 +9,18 @@
android:layout_height="52dp" android:layout_height="52dp"
android:orientation="horizontal"> android:orientation="horizontal">
<com.zxhl.cms.widget.RecycleImageView <RelativeLayout
android:id="@+id/id_img_rights_icon"
android:layout_width="70dp" android:layout_width="70dp"
android:layout_height="52dp" android:layout_height="52dp"
android:layout_marginRight="10dp" /> android:layout_marginRight="10dp"
android:background="@drawable/img_vip_rights_bg">
<com.zxhl.cms.widget.RecycleImageView
android:id="@+id/id_img_rights_icon"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_margin="5dp" />
</RelativeLayout>
<TextView <TextView
android:id="@+id/id_tv_vip_goods_name" android:id="@+id/id_tv_vip_goods_name"
......
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