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"
) )
} }
//试玩 //试玩
......
...@@ -10,6 +10,7 @@ import android.view.View ...@@ -10,6 +10,7 @@ import android.view.View
import android.webkit.* 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.zxbw.modulemain.activity.OpenMemberOrderActivity
import com.zxbw.modulemain.box.adapter.OrderAdapter import com.zxbw.modulemain.box.adapter.OrderAdapter
import com.zxbw.modulemain.box.contract.OrderDetailContract import com.zxbw.modulemain.box.contract.OrderDetailContract
import com.zxbw.modulemain.box.presenter.OrderDetailPresenter import com.zxbw.modulemain.box.presenter.OrderDetailPresenter
...@@ -22,17 +23,18 @@ import com.zxhl.cms.net.model.box.AddressEntity ...@@ -22,17 +23,18 @@ import com.zxhl.cms.net.model.box.AddressEntity
import com.zxhl.cms.net.model.box.AppInEntity import com.zxhl.cms.net.model.box.AppInEntity
import com.zxhl.cms.net.model.box.OrderEntity import com.zxhl.cms.net.model.box.OrderEntity
import com.zxhl.cms.net.model.video.MemberEntity import com.zxhl.cms.net.model.video.MemberEntity
import com.zxhl.cms.pay.PayActivity
import com.zxhl.cms.pay.PayContract
import com.zxhl.cms.pay.PayPresenter
import com.zxhl.cms.utils.* import com.zxhl.cms.utils.*
import com.zxhl.cms.widget.LoadingDialog import com.zxhl.cms.widget.LoadingDialog
import com.zxhl.cms.net.model.uc.PayResultEntity import com.zxhl.cms.net.model.uc.PayResultEntity
import com.zxhl.cms.pay.PaymentFunAdapter import com.zxhl.cms.pay.*
import io.reactivex.Observable import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer import io.reactivex.functions.Consumer
import kotlinx.android.synthetic.main.activity_layout_member_order.*
import kotlinx.android.synthetic.main.activity_layout_order_detail.* import kotlinx.android.synthetic.main.activity_layout_order_detail.*
import kotlinx.android.synthetic.main.activity_layout_order_detail.id_img_back
import kotlinx.android.synthetic.main.activity_layout_order_detail.id_img_close_pay_web
import kotlinx.android.synthetic.main.activity_layout_order_detail.id_rl_h5_pay_view
class OrderDetailActivity : BaseActivity(), OrderDetailContract.View, PayContract.View { class OrderDetailActivity : BaseActivity(), OrderDetailContract.View, PayContract.View {
private var mPresenter: OrderDetailPresenter? = null private var mPresenter: OrderDetailPresenter? = null
...@@ -56,7 +58,7 @@ class OrderDetailActivity : BaseActivity(), OrderDetailContract.View, PayContrac ...@@ -56,7 +58,7 @@ class OrderDetailActivity : BaseActivity(), OrderDetailContract.View, PayContrac
const val H5_PAY = 21 //h5支付 const val H5_PAY = 21 //h5支付
} }
private var pay_type = 0 private var pay_type: Int? = H5_PAY
override fun onClick(v: View?) { override fun onClick(v: View?) {
} }
...@@ -116,6 +118,9 @@ class OrderDetailActivity : BaseActivity(), OrderDetailContract.View, PayContrac ...@@ -116,6 +118,9 @@ class OrderDetailActivity : BaseActivity(), OrderDetailContract.View, PayContrac
// id_img_ali?.setImageResource(com.zxhl.cms.R.drawable.icon_xuanzhong) // id_img_ali?.setImageResource(com.zxhl.cms.R.drawable.icon_xuanzhong)
// } // }
id_img_close_pay_web?.setOnClickListener {
id_rl_h5_pay_view?.visibility = View.GONE
}
id_tv_to_pay?.setOnClickListener { id_tv_to_pay?.setOnClickListener {
EventUtils.onEvent("pick_up_btn_click") EventUtils.onEvent("pick_up_btn_click")
...@@ -293,6 +298,7 @@ class OrderDetailActivity : BaseActivity(), OrderDetailContract.View, PayContrac ...@@ -293,6 +298,7 @@ class OrderDetailActivity : BaseActivity(), OrderDetailContract.View, PayContrac
pay_type.toString() pay_type.toString()
) )
} else { } else {
Log.d("wxw","goodsID"+payGoodsId)
mPayresenter?.requestMiniProgrom( mPayresenter?.requestMiniProgrom(
payGoodsId ?: "", payGoodsId ?: "",
pay_type.toString(), pay_type.toString(),
...@@ -380,7 +386,32 @@ class OrderDetailActivity : BaseActivity(), OrderDetailContract.View, PayContrac ...@@ -380,7 +386,32 @@ class OrderDetailActivity : BaseActivity(), OrderDetailContract.View, PayContrac
EventUtils.onEvent("h5_pay_error") EventUtils.onEvent("h5_pay_error")
showResultLoading(false) showResultLoading(false)
} else { } else {
loadH5Pay(form) mHandler.sendEmptyMessageDelayed(1, 8000)
H5PayUtil().loadH5PayWeb(
this,
id_pay_web_view,
form,
object : H5PayUtil.H5PayCallBack {
override fun jumpZfbAppSuc() {
id_rl_h5_pay_view?.visibility = View.GONE
EventUtils.onEvent("h5_open_zfb_suc")
mHandler.removeMessages(1)
}
override fun jumpZfbAppException(e: Exception) {
EventUtils.onEvent("h5_open_zfb_error", e.toString())
mHandler.removeMessages(1)
mHandler.sendEmptyMessage(2)
}
override fun loadH5Error1(errorStr: String) {
EventUtils.onEvent("h5_pay_error1", errorStr)
}
override fun loadH5Error2(errorStr: String) {
EventUtils.onEvent("h5_pay_error2", errorStr)
}
})
} }
} }
...@@ -418,34 +449,6 @@ class OrderDetailActivity : BaseActivity(), OrderDetailContract.View, PayContrac ...@@ -418,34 +449,6 @@ class OrderDetailActivity : BaseActivity(), OrderDetailContract.View, PayContrac
} }
} }
} }
// if (result != null) {
//
// if (result.pay_ali.equals("1") && result.pay_wx.equals("0")) {
// pay_type = PayActivity.ALI_PAY
// id_rl_wechat_pay.visibility = View.GONE
// id_rl_zfb_pay.visibility = View.VISIBLE
// id_img_ali?.setImageResource(com.zxhl.cms.R.drawable.icon_xuanzhong)
// } else {
// if (result?.pay_ali.equals("0")) {
// id_rl_zfb_pay.visibility = View.GONE
// } else {
// id_rl_zfb_pay.visibility = View.VISIBLE
//// pay_type = PayActivity.ALI_PAY
//// id_img_wechat?.setImageResource(com.zxhl.cms.R.drawable.icon_xuanzhong_default)
//// id_img_ali?.setImageResource(com.zxhl.cms.R.drawable.icon_xuanzhong)
// }
// if (result?.pay_wx.equals("0")) {
// id_rl_wechat_pay.visibility = View.GONE
// } else {
// id_rl_wechat_pay.visibility = View.VISIBLE
// pay_type = PayActivity.MINI_PROGRAM
// id_img_wechat?.setImageResource(com.zxhl.cms.R.drawable.icon_xuanzhong)
// id_img_ali?.setImageResource(com.zxhl.cms.R.drawable.icon_xuanzhong_default)
// }
// }
// }
} }
private var isPause = false private var isPause = false
...@@ -477,112 +480,20 @@ class OrderDetailActivity : BaseActivity(), OrderDetailContract.View, PayContrac ...@@ -477,112 +480,20 @@ class OrderDetailActivity : BaseActivity(), OrderDetailContract.View, PayContrac
mLoading?.setResult(false, "取消支付", 1000) mLoading?.setResult(false, "取消支付", 1000)
} }
} }
} 1 -> {
false if (mLoading != null) {
} mLoading?.setResult(false, "支付异常", 0)
private fun loadH5Pay(form: String) {
val webSettings = id_pay_web_view.settings
//如果访问的页面中要与Javascript交互,则webview必须设置支持Javascript
webSettings.javaScriptEnabled = true
//设置自适应屏幕,两者合用
webSettings.useWideViewPort = true //将图片调整到适合webview的大小
webSettings.loadWithOverviewMode = true // 缩放至屏幕的大小
//其他细节操作
webSettings.cacheMode = WebSettings.LOAD_NO_CACHE //关闭webview中缓存
webSettings.allowFileAccess = true //设置可以访问文件
webSettings.javaScriptCanOpenWindowsAutomatically = true //支持通过JS打开新窗口
webSettings.loadsImagesAutomatically = true //支持自动加载图片
webSettings.defaultTextEncodingName = "utf-8" //设置编码格式
webSettings.domStorageEnabled = true
webSettings.allowFileAccessFromFileURLs = true;
webSettings.allowUniversalAccessFromFileURLs = true;
id_pay_web_view?.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
Log.e("WXW", "dURL" + url.toString())
if (url == null) return false
try {
if (url.startsWith("alipays://") //支付宝
) {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
startActivity(intent)
EventUtils.onEvent("h5_open_zfb_suc")
return true
}
} catch (e: Exception) { //防止crash (如果手机上没有安装处理某个scheme开头的url的APP, 会导致crash)
EventUtils.onEvent("h5_open_zfb_error", e.toString())
showResultLoading(false)
return true //没有安装该app时,返回true,表示拦截自定义链接,但不跳转,避免弹出上面的错误页面
}
return false
}
override fun onPageFinished(view: WebView?, url: String?) {
Log.e("WXW", "cURL" + url.toString())
Log.d("wxw", "EndTime" + System.currentTimeMillis())
super.onPageFinished(view, url)
if (url?.contains(NetConfig.H5.WEB_URL_H5_PAY) == true) {
id_pay_web_view?.loadUrl("javascript:loadPayHtml('$form')");
}
}
override fun onReceivedSslError(
view: WebView?,
handler: SslErrorHandler?,
error: SslError?
) {
// 接受所有网站的证书,忽略SSL错误,执行访问网页
handler?.proceed();
}
override fun onReceivedError(
view: WebView?,
request: WebResourceRequest?,
error: WebResourceError?
) {
super.onReceivedError(view, request, error)
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
Log.d("wxw", "1error${error?.errorCode}")
Log.d("wxw", "2error${error?.description}")
Log.d("wxw", "3error${error?.toString()}")
EventUtils.onEvent(
"h5_pay_error1",
"code: ${error?.errorCode} desc: ${error?.description}"
)
} else {
EventUtils.onEvent("h5_pay_error1", error.toString())
} }
showResultLoading(false) id_rl_h5_pay_view.visibility = View.VISIBLE
EventUtils.onEvent("h5_pay_end")
} }
2 -> {
override fun onReceivedHttpError( if (mLoading != null) {
view: WebView?, mLoading?.setResult(false, "支付异常", 0)
request: WebResourceRequest?,
errorResponse: WebResourceResponse?
) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
if (request?.url?.path?.endsWith("/favicon.ico") == true) {
} else {
Log.d("wxw", "1errorResponse?.statusCode${request?.url}")
Log.d("wxw", "2errorResponse?.statusCode${errorResponse?.statusCode}")
EventUtils.onEvent(
"h5_pay_error2",
errorResponse?.statusCode.toString() + " url:${request?.url}"
)
showResultLoading(false)
}
} else {
EventUtils.onEvent("h5_pay_error2", errorResponse.toString())
showResultLoading(false)
} }
super.onReceivedHttpError(view, request, errorResponse) id_rl_h5_pay_view.visibility = View.VISIBLE
} }
} }
id_pay_web_view.loadUrl(NetConfig.H5.WEB_URL_H5_PAY) false
} }
} }
\ No newline at end of file
...@@ -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