From b13afc751dbbce24753d008f1f87d2c5e133a4ad Mon Sep 17 00:00:00 2001
From: lmw <125975490@qq.com>
Date: 星期二, 09 七月 2024 15:19:26 +0800
Subject: [PATCH] fix bug

---
 app/src/main/java/com/dollearn/student/ui/welfare/GoodsDetailActivity.kt |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/app/src/main/java/com/dollearn/student/ui/welfare/GoodsDetailActivity.kt b/app/src/main/java/com/dollearn/student/ui/welfare/GoodsDetailActivity.kt
index 6164ef5..77a5825 100644
--- a/app/src/main/java/com/dollearn/student/ui/welfare/GoodsDetailActivity.kt
+++ b/app/src/main/java/com/dollearn/student/ui/welfare/GoodsDetailActivity.kt
@@ -39,6 +39,12 @@
 
     override fun initClick() {
         tv_action.setOnClickListener {
+            if (score<goods?.good?.integral?:0){
+                val tipDialog = TipDialog()
+                tipDialog.arguments = bundleOf("isAlert" to true,"msg" to "兑换失败,当前剩余积分不足!","ok" to "关闭")
+                tipDialog.show(supportFragmentManager,"tip")
+                return@setOnClickListener
+            }
             tv_action.isEnabled = false
             showDialog()
             HttpManager.redeemNow(id).request(this,false, {_,data->
@@ -88,7 +94,7 @@
                 tv_value.paintFlags = tv_value.paintFlags or Paint.STRIKE_THRU_TEXT_FLAG
                 tv_name.text = good.name
                 tv_category.text = goodTypes?.joinToString ("|"){ it.name }
-                tv_sold.text = "剩余数量:%d|可换数量:%d|%d人已换".format(good.surplus,good.userCount,good.inventory?:0)
+                tv_sold.text = "%s%s%d人已换".format(if (residueNumber == null) "" else "剩余数量:${residueNumber}|",if (good.userCount == null) "" else "可换数量:${good.userCount}|", exchangeNumber)
                 val sHead =
                     "<html><head><meta name=\"viewport\" content=\"width=device-width, " + "initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=yes\" />" + "<style>img{max-width:100% !important;height:auto !important;}</style>" + "<style>body{max-width:100% !important;}</style>" + "</head><body>"
                 webView!!.loadDataWithBaseURL(null, sHead + good.detail, "text/html", "utf-8", null)

--
Gitblit v1.7.1