Commit 420711c4 authored by maxiaoliang's avatar maxiaoliang

修改话费券bug

parent c6d250a0
...@@ -531,53 +531,70 @@ class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<MemberEntity ...@@ -531,53 +531,70 @@ class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<MemberEntity
mAdapter?.notifyDataSetChanged() mAdapter?.notifyDataSetChanged()
if (!result.goodsList.isNullOrEmpty()) { if (!result.goodsList.isNullOrEmpty()) {
if (result.goodsList!!.size >= 0) { if (result.goodsList!!.size >= 0) {
useCoupn(0, 0) useCoupn(0,0, 0)
} }
} }
} }
fun useCoupn(default: Int, price: Int) { fun useCoupn(position: Int, default: Int, price: Int) {
if (!mCouponsResult.isNullOrEmpty()) { if (!mCouponsResult.isNullOrEmpty()) {
for (i in mCouponsResult!!) { for (i in mCouponsResult!!) {
if (price == 200) { if (price == 200) {
if (TextUtils.equals(i.amount, "10.0")) { if (TextUtils.equals(i.amount, "10.0")) {
//判断当有5元券时 帮他选择100元档位且使用当前5元的券 //判断当有5元券时 帮他选择100元档位且使用当前5元的券
Log.e("MXL", "优先使用10元优惠券") Log.e("MXL", "优先使用10元优惠券")
if (position == 2 || position == 0) {
couponsentity = i couponsentity = i
setCouponInfo(couponsentity) setCouponInfo(couponsentity)
} else {
couponsentity = null
setCouponInfo(null)
}
break break
}else{
couponsentity = null
setCouponInfo(null)
} }
} else { } else {
if (TextUtils.equals(i.amount, "5.0")) {
//判断当有5元券时 帮他选择100元档位且使用当前5元的券
Log.e("MXL", "使用5元优惠券")
if (default == 0) { if (default == 0) {
mAdapter?.setPosition(1) mAdapter?.setPosition(1)
selectPrice = mAdapter?.getItem(1)?.originalPrice selectPrice = mAdapter?.getItem(1)?.originalPrice
goodsID = mAdapter?.getItem(1)?.goodsId goodsID = mAdapter?.getItem(1)?.goodsId
memberentity = mAdapter?.getItem(1) memberentity = mAdapter?.getItem(1)
} }
if (TextUtils.equals(i.amount, "5.0")) {
//判断当有5元券时 帮他选择100元档位且使用当前5元的券
Log.e("MXL", "使用5元优惠券")
if (position == 1 || position == 0) {
couponsentity = i couponsentity = i
setCouponInfo(couponsentity) setCouponInfo(couponsentity)
break } else {
} couponsentity = null
setCouponInfo(null)
} }
break
}else{
couponsentity = null
setCouponInfo(null)
break
} }
Log.e("MXL", "循环结束取到优惠券信息")
if (couponsentity == null) {
Log.e("MXL", "没有5元的 使用10元券")
if (default == 0) {
mAdapter?.setPosition(2)
selectPrice = mAdapter?.getItem(2)?.originalPrice
goodsID = mAdapter?.getItem(2)?.goodsId
memberentity = mAdapter?.getItem(2)
} }
couponsentity = mCouponsResult!!.get(0)
setCouponInfo(couponsentity)
} }
// Log.e("MXL", "循环结束取到优惠券信息" + couponsentity?.amount)
// if (couponsentity == null) {
// Log.e("MXL", "没有5元的 使用10元券")
// if (default == 0 || default == 1) {
// mAdapter?.setPosition(2)
// selectPrice = mAdapter?.getItem(2)?.originalPrice
// goodsID = mAdapter?.getItem(2)?.goodsId
// memberentity = mAdapter?.getItem(2)
// }
// couponsentity = mCouponsResult!!.get(0)
//
// setCouponInfo(couponsentity)
// }
Log.e("MXL", "price:" + price + "default:" + default) Log.e("MXL", "price:" + price + "default:" + default)
// mAdapter?.updateData( couponsentity?.amount.toString()) // mAdapter?.updateData( couponsentity?.amount.toString())
...@@ -620,13 +637,13 @@ class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<MemberEntity ...@@ -620,13 +637,13 @@ class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<MemberEntity
} }
1 -> { 1 -> {
Log.e("MXL", "选1") Log.e("MXL", "选1")
useCoupn(1, 100) useCoupn(position,1, 100)
setBootomPrice(data) setBootomPrice(data)
return return
} }
2 -> { 2 -> {
Log.e("MXL", "选2") Log.e("MXL", "选2")
useCoupn(1, 200) useCoupn(position,1, 200)
setBootomPrice(data) setBootomPrice(data)
return return
} }
......
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