1.修复套餐过期续费计算价格错误的bug
2.优化套餐时间显示,亚马逊服务器时间转换当前时区时间
This commit is contained in:
@@ -65,7 +65,7 @@ class MySubscriptionAdapter(
|
||||
}
|
||||
holder.setText(
|
||||
R.id.tv_my_subscription_active_time,
|
||||
Utils.stringToDate(item.updateTime, resultFormat = Utils.DATE_FORMAT_PATTERN_EN6)
|
||||
Utils.formatTime(item.payTime, Utils.DATE_FORMAT_PATTERN_EN6)
|
||||
)
|
||||
|
||||
holder.getTextView(R.id.tv_my_subscription_annual_care).apply {
|
||||
@@ -74,13 +74,17 @@ class MySubscriptionAdapter(
|
||||
else mContext.getString(R.string.txt_no)
|
||||
}
|
||||
|
||||
// val timestamp = getAfterHowTimestamp(
|
||||
// Utils.stringToTimestamp(item.currentTime), item.surplusDays
|
||||
// )
|
||||
holder.setText(
|
||||
R.id.tv_my_subscription_expires_on,
|
||||
Utils.formatTime(item.endTime, Utils.DATE_FORMAT_PATTERN_EN7)
|
||||
)
|
||||
holder.getTextView(R.id.tv_my_subscription_expires_on).apply {
|
||||
if (item.orderStatus == 6 && item.refundTime > 0L) {
|
||||
text = Utils.formatTime(item.refundTime, Utils.DATE_FORMAT_PATTERN_EN6)
|
||||
} else {
|
||||
text = Utils.formatTime(
|
||||
Utils.timestampAddHowTimestamp(
|
||||
item.payTime, item.mealPeriod, item.mealUnit
|
||||
), Utils.DATE_FORMAT_PATTERN_EN7
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (item.subscriptionStatus == ConstantInt.Close) {
|
||||
holder.setText(
|
||||
|
||||
@@ -51,24 +51,27 @@ class NotificationV2Adapter(
|
||||
setTextColor(ContextCompat.getColor(mContext, textColor))
|
||||
}
|
||||
holder.getTextView(R.id.tv_home_route_notification_date).apply {
|
||||
text = getRelativeTimeString(Utils.stringToTimestamp(item.sendTime))
|
||||
text = getRelativeTimeString(item.sendTime)
|
||||
setTextColor(ContextCompat.getColor(mContext, textColor))
|
||||
}
|
||||
}
|
||||
|
||||
private fun getRelativeTimeString(time: Long): String {
|
||||
private fun getRelativeTimeString(sendTime: String): String {
|
||||
var formatDateStr = ""
|
||||
val time = Utils.stringToTimestamp(sendTime)
|
||||
val now = System.currentTimeMillis()
|
||||
formatDateStr = if (DateUtils.isToday(time)) {
|
||||
mContext.getString(R.string.txt_today) + " " + Utils.formatTime(
|
||||
time, Utils.DATE_FORMAT_PATTERN_EN8
|
||||
)
|
||||
} else if (now - time < (48 * 60 * 60 * 1000)) {
|
||||
mContext.getString(R.string.txt_yesterday)+ " " + Utils.formatTime(
|
||||
mContext.getString(R.string.txt_yesterday) + " " + Utils.formatTime(
|
||||
time, Utils.DATE_FORMAT_PATTERN_EN8
|
||||
)
|
||||
} else {
|
||||
Utils.formatTime(time, Utils.DATE_FORMAT_PATTERN_EN9)
|
||||
Utils.formatTime(
|
||||
Utils.stringToTimestamp(sendTime, isUtc = true), Utils.DATE_FORMAT_PATTERN_EN9
|
||||
)
|
||||
}
|
||||
return formatDateStr
|
||||
}
|
||||
|
||||
@@ -59,16 +59,17 @@ class SubscriptionHistoryAdapter(
|
||||
}
|
||||
holder.setText(R.id.tv_subscription_annual_care_state, state)
|
||||
holder.setText(
|
||||
R.id.tv_subscription_annual_care_active_time,
|
||||
Utils.stringToDate(item.createTime, resultFormat = Utils.DATE_FORMAT_PATTERN_EN7)
|
||||
R.id.tv_subscription_annual_care_active_time, Utils.formatTime(
|
||||
item.payTime, Utils.DATE_FORMAT_PATTERN_EN7
|
||||
)
|
||||
)
|
||||
//保险时长,不足一年按12个月算
|
||||
val insuranceTime =
|
||||
if (item.mealUnit == ConstantString.PackageUnitYear) item.mealPeriod else 1
|
||||
holder.setText(
|
||||
R.id.tv_subscription_annual_care_expiry_time, Utils.formatTime(
|
||||
Utils.getAfterHowTimestamp(
|
||||
Utils.stringToTimestamp(item.createTime), insuranceTime * 365L
|
||||
Utils.timestampAddHowTimestamp(
|
||||
item.payTime, insuranceTime, ConstantString.PackageUnitYear
|
||||
), Utils.DATE_FORMAT_PATTERN_EN7
|
||||
)
|
||||
)
|
||||
@@ -89,7 +90,7 @@ class SubscriptionHistoryAdapter(
|
||||
)
|
||||
holder.setText(
|
||||
R.id.tv_subscription_history_order_time,
|
||||
Utils.stringToDate(item.createTime, resultFormat = Utils.DATE_FORMAT_PATTERN_EN10)
|
||||
Utils.formatTime(item.payTime, Utils.DATE_FORMAT_PATTERN_EN10)
|
||||
)
|
||||
holder.setText(R.id.tv_subscription_history_package_name, item.mealName)
|
||||
holder.setText(
|
||||
@@ -109,8 +110,14 @@ class SubscriptionHistoryAdapter(
|
||||
1 -> {
|
||||
val updateTimestamp = Utils.stringToTimestamp(item.updateTime)
|
||||
val nowTimestamp = System.currentTimeMillis()
|
||||
// val nowTimestamp = Utils.stringToTimestamp(item.currentTime)
|
||||
if (item.mealUnit == ConstantString.PackageUnitMonth) {
|
||||
if (item.mealUnit == ConstantString.PackageUnitDay) {
|
||||
if (item.enabled == ConstantInt.Type0 || (item.surplusDays == 0L && item.subscriptionStatus == ConstantInt.Close)) {
|
||||
visibility = View.GONE
|
||||
} else {
|
||||
visibility = View.VISIBLE
|
||||
setText(R.string.txt_refund)
|
||||
}
|
||||
} else if (item.mealUnit == ConstantString.PackageUnitMonth) {
|
||||
val day7Timestamp = 7 * 24 * 60 * 60 * 1000L
|
||||
//套餐超出7天不能退款
|
||||
if (nowTimestamp - updateTimestamp <= day7Timestamp) {
|
||||
|
||||
@@ -31,7 +31,7 @@ data class SubscriptionsOrderBean(
|
||||
var mealDiscountPrice: Double,
|
||||
var orderNum: String,
|
||||
var orderStatus: Int,//0支付取消 1支付成功 2支付失败 3待支付 4申请审核中 5退款中 6退款成功 7退款失败 8审核失败
|
||||
var payTime: String,
|
||||
var payTime: Long,
|
||||
var payType: Int,
|
||||
var planCategory: String,
|
||||
var planId: String,
|
||||
@@ -53,6 +53,7 @@ data class SubscriptionsOrderBean(
|
||||
var username: String,
|
||||
var iccid: String,
|
||||
var endTime: Long,
|
||||
var refundTime: Long,
|
||||
var planTimeMonthsCount: Int,
|
||||
@MultipleEntity var menuType: Int,
|
||||
var isUpdateOrder: Int = 0//是否是升级订单 1:是 0:否
|
||||
@@ -76,7 +77,7 @@ data class SubscriptionsOrderBean(
|
||||
0.0,
|
||||
"",
|
||||
0,
|
||||
"",
|
||||
0L,
|
||||
0,
|
||||
"",
|
||||
"",
|
||||
@@ -98,6 +99,7 @@ data class SubscriptionsOrderBean(
|
||||
"",
|
||||
"",
|
||||
0L,
|
||||
0L,
|
||||
0,
|
||||
menuType,
|
||||
0
|
||||
@@ -122,7 +124,7 @@ data class SubscriptionsOrderBean(
|
||||
0.0,
|
||||
"",
|
||||
0,
|
||||
"",
|
||||
0L,
|
||||
0,
|
||||
"",
|
||||
"",
|
||||
@@ -144,6 +146,7 @@ data class SubscriptionsOrderBean(
|
||||
"",
|
||||
"",
|
||||
0L,
|
||||
0L,
|
||||
0,
|
||||
MultipleEntity.TEXT,
|
||||
0
|
||||
|
||||
@@ -63,13 +63,12 @@ class PaymentSuccessActivity :
|
||||
ivPaymentSuccessAnim.load(R.drawable.pwd_reset_successful_done)
|
||||
mPayResult?.let {
|
||||
LogUtil.e("充值类型rechargeType=${it.rechargeType}")
|
||||
// if (it.rechargeType == ConstantInt.Type0) {
|
||||
// btnPaymentSuccessContinue.setText(R.string.txt_continue)
|
||||
// }
|
||||
|
||||
tvPaymentSuccessDeviceId.text = it.deviceOutId
|
||||
tvPaymentSuccessExpiresOnDate.text = Utils.stringToDate(
|
||||
it.expirationTime, resultFormat = Utils.DATE_FORMAT_PATTERN_EN7
|
||||
tvPaymentSuccessExpiresOnDate.text = Utils.formatTime(
|
||||
Utils.stringToTimestamp(
|
||||
it.expirationTime, isUtc = true
|
||||
), Utils.DATE_FORMAT_PATTERN_EN6
|
||||
)
|
||||
val times = Utils.differYear(
|
||||
System.currentTimeMillis(), Utils.stringToTimestamp(it.expirationTime)
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.abbidot.tracker.ui.activity.subscribe
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Paint
|
||||
import android.text.TextUtils
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import androidx.activity.viewModels
|
||||
@@ -294,20 +293,23 @@ class SureSubscriptionPlanActivity :
|
||||
}
|
||||
|
||||
//判断套餐是否过期 或者套餐没退款
|
||||
if (!TextUtils.isEmpty(it.orderNum) && it.orderStatus != 6 && it.surplusDays == 0L && it.subscriptionStatus == ConstantInt.Close) {
|
||||
// mOrderBean?.reactivation = 1
|
||||
mSubscriptionViewModel.getReactivationFee(it.orderNum)
|
||||
} else {
|
||||
if (isUpgrade) mSubscriptionViewModel.getReactivationFee(it.orderNum)
|
||||
else {
|
||||
mOrderBean?.reactivation = 0
|
||||
mOrderBean?.reactivatePrice = 0.0
|
||||
updateMoney()
|
||||
}
|
||||
}
|
||||
// if (!TextUtils.isEmpty(it.orderNum) && it.orderStatus != 6 && it.surplusDays == 0L && it.subscriptionStatus == ConstantInt.Close) {
|
||||
//// mOrderBean?.reactivation = 1
|
||||
// mSubscriptionViewModel.getReactivationFee(it.orderNum)
|
||||
// } else {
|
||||
// if (isUpgrade) mSubscriptionViewModel.getReactivationFee(it.orderNum)
|
||||
// else {
|
||||
// mOrderBean?.reactivation = 0
|
||||
// mOrderBean?.reactivatePrice = 0.0
|
||||
// updateMoney()
|
||||
// }
|
||||
// }
|
||||
|
||||
mOrderBean?.reactivation = 0
|
||||
mOrderBean?.reactivatePrice = 0.0
|
||||
updateMoney()
|
||||
//隐藏保险
|
||||
mViewBinding.ilSubscribePlanInsurance.cbSureSubscribeInsureSwitch.isChecked=false
|
||||
mViewBinding.ilSubscribePlanInsurance.cbSureSubscribeInsureSwitch.isChecked = false
|
||||
|
||||
}
|
||||
}
|
||||
@@ -327,16 +329,6 @@ class SureSubscriptionPlanActivity :
|
||||
mReactivationFeeLiveData.observe(this@SureSubscriptionPlanActivity) {
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
// it.getOrNull()?.apply {
|
||||
// mOrderBean?.reactivatePrice = this
|
||||
// mSummaryAdapter.getData().add(
|
||||
// 2, MenuTxtBean(
|
||||
// getString(R.string.txt_reactivation), Utils.formatDecimal(this, 1)
|
||||
// ).apply {
|
||||
// colorRedId = R.color.data_black_color
|
||||
// })
|
||||
// mTotalMoney += this
|
||||
// }
|
||||
it.getOrNull()?.apply {
|
||||
mPackageBean?.let { p ->
|
||||
mTotalMoney -= mSumInsuranceMoney
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
style="@style/my_TextView_style_v2"
|
||||
android:layout_below="@id/tv_subscription_history_order_time"
|
||||
android:text="@string/txt_annual_care_text1"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:textSize="@dimen/textSize14"
|
||||
android:textStyle="bold" />
|
||||
@@ -49,13 +50,14 @@
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:layout_toEndOf="@id/tv_subscription_history_annual_care_title"
|
||||
android:text="@string/app_name"
|
||||
android:visibility="gone"
|
||||
android:textSize="@dimen/textSize14"
|
||||
app:typeface="@string/roboto_regular_font" />
|
||||
|
||||
<com.abbidot.tracker.widget.TypefaceTextView
|
||||
android:id="@+id/tv_subscription_history_package_name"
|
||||
style="@style/my_TextView_style_v2"
|
||||
android:layout_below="@id/tv_subscription_history_annual_care_title"
|
||||
android:layout_below="@id/tv_subscription_history_order_time"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
android:text="@string/txt_order_id"
|
||||
android:textSize="@dimen/textSize14"
|
||||
|
||||
Reference in New Issue
Block a user