新增转账cash,积分手续费,详情列表新增提示

This commit is contained in:
guozhen
2024-11-13 17:11:11 +08:00
committed by xuhuixiang
parent 1616e14446
commit edecacff74
19 changed files with 313 additions and 23 deletions

View File

@@ -24,6 +24,15 @@ public class BillBean {
private OauthAppBean oauthApp;
private TaskBean dailyTask;
private String coinModifyRemark;
private TransferMoneyBean transferMoneyRecord;
public TransferMoneyBean getTransferMoneyRecord() {
return transferMoneyRecord;
}
public void setTransferMoneyRecord(TransferMoneyBean transferMoneyRecord) {
this.transferMoneyRecord = transferMoneyRecord;
}
public String getCoinModifyRemark() {
return coinModifyRemark;

View File

@@ -31,6 +31,24 @@ public class LoginBean extends RosterElementEntity {
private Integer isFollow;
private Integer allowGiftCoin;
private Integer isBiz = 0;
private float cashFeeRate; //cash费率
private float silverFeeRate;//积分费率
public float getCashFeeRate() {
return cashFeeRate;
}
public void setCashFeeRate(float cashFeeRate) {
this.cashFeeRate = cashFeeRate;
}
public float getSilverFeeRate() {
return silverFeeRate;
}
public void setSilverFeeRate(float silverFeeRate) {
this.silverFeeRate = silverFeeRate;
}
public Integer getAllowGiftCoin() {
return allowGiftCoin;

View File

@@ -0,0 +1,44 @@
package com.dskj.rbchat.model;
/**
* 转账记录
*/
public class TransferMoneyBean {
private long feeAmount;
private int coinType;
private int payVerifyType;
private int receiptType;
public long getFeeAmount() {
return feeAmount;
}
public void setFeeAmount(long feeAmount) {
this.feeAmount = feeAmount;
}
public int getCoinType() {
return coinType;
}
public void setCoinType(int coinType) {
this.coinType = coinType;
}
public int getPayVerifyType() {
return payVerifyType;
}
public void setPayVerifyType(int payVerifyType) {
this.payVerifyType = payVerifyType;
}
public int getReceiptType() {
return receiptType;
}
public void setReceiptType(int receiptType) {
this.receiptType = receiptType;
}
}

View File

@@ -55,6 +55,7 @@ import com.netease.yunxin.kit.contactkit.ui.utils.ColorUtils;
import com.netease.yunxin.kit.corekit.im.IMKitClient;
import com.netease.yunxin.kit.corekit.im.provider.FetchCallback;
import java.text.DecimalFormat;
import java.util.HashMap;
import io.reactivex.android.schedulers.AndroidSchedulers;
@@ -64,10 +65,11 @@ public class TransferAccountsActivity extends BaseActivity {
LoginBean u;
WalletBean walletBean;
int number = 0;
int number = 0; //总金额
PayCashFingerDialog payCashFingerDialog;
PayCashDialog payDialog;
private boolean isJinBi = false;
private float feeRate;//费率
private ActivityTransferAccountsBinding viewBinding;
@@ -79,6 +81,7 @@ public class TransferAccountsActivity extends BaseActivity {
viewBinding = ActivityTransferAccountsBinding.inflate(getLayoutInflater());
setContentView(viewBinding.getRoot());
isJinBi = getIntent().getBooleanExtra("type", isJinBi);
feeRate = isJinBi ? DataUtils.getLocUserInfo().getCashFeeRate() : DataUtils.getLocUserInfo().getSilverFeeRate();
initView();
initListeners();
}
@@ -89,9 +92,8 @@ public class TransferAccountsActivity extends BaseActivity {
protected void initView() {
viewBinding.contactListActivityTitleBar.getBackImageView().setImageResource(R.mipmap.dialog_colose_img);
viewBinding.contactListActivityTitleBar.getBackImageView().setOnClickListener(v -> finish());
viewBinding.ivJinbiType.setImageResource(isJinBi?R.mipmap.wallet_jinbi_img:R.mipmap.wallet_yinbi_img);
viewBinding.ivJinbiType.setImageResource(isJinBi ? R.mipmap.wallet_jinbi_img : R.mipmap.wallet_yinbi_img);
// u = lu1();
// 设置标题自定义标题栏后的title文本设置是不同的哦见CustomeTitleBar中的说明
this.setTitle(getString(R.string.zhuanzhang_txt));
viewBinding.tvLogin.setOnClickListener(new View.OnClickListener() {
@@ -146,7 +148,7 @@ public class TransferAccountsActivity extends BaseActivity {
return;
}
number = Integer.parseInt(viewBinding.numberHintEt.getText().toString().trim());
number = Integer.parseInt(viewBinding.totaljineTv.getText().toString().trim());
// if(DataUtils.get(TransferAccountsActivity.this, "hasMianMi", false)){
// toChange(null, number,2);
@@ -335,7 +337,7 @@ public class TransferAccountsActivity extends BaseActivity {
private void toChange(String password, long number, int type) {
hideSoftInput(this);
HashMap<String, Object> maps = new HashMap<>();
maps.put("amount", (int) (number * 100));
maps.put("amount", (Integer.parseInt(viewBinding.numberHintEt.getText().toString())) * 100);
maps.put("senderUid", Integer.parseInt(IMKitClient.account()));
maps.put("receiverUid", Integer.parseInt(getIntent().getStringExtra("receiverUid")));
if (!TextUtils.isEmpty(password)) {
@@ -348,6 +350,8 @@ public class TransferAccountsActivity extends BaseActivity {
maps.put("substationId", IMUIKitConfig.SUBSTATIONID);
maps.put("payVerifyCode", type);
maps.put("receiptType", 1);
maps.put("feeAmount", (Integer.parseInt(viewBinding.shouxufeiTv.getText().toString())) * 100); //手续费金额
maps.put("feeRate", feeRate); //费率
Api.getInstance().transferMoney(maps)
.subscribeOn(Schedulers.io())
@@ -488,9 +492,10 @@ public class TransferAccountsActivity extends BaseActivity {
@Override
public void afterTextChanged(Editable s) {
changeInfo();
changeStatus();
changeShouxuFei(s.toString());
}
});
@@ -506,6 +511,28 @@ public class TransferAccountsActivity extends BaseActivity {
}
private void changeShouxuFei(String inputStr) {
if (TextUtils.isEmpty(inputStr)) {
viewBinding.shouxufeiTv.setText("");
viewBinding.totaljineTv.setText("");
viewBinding.layoutTips.setVisibility(View.GONE);
return;
}
int inputAmount = Integer.parseInt(inputStr);
int shouxufei = (int)(Math.ceil(inputAmount * feeRate));
int rateAmount = inputAmount+shouxufei;
viewBinding.shouxufeiTv.setText(String.valueOf(shouxufei));
viewBinding.totaljineTv.setText(String.valueOf(rateAmount));
int currentYue = (int) (Math.floor(isJinBi ? (walletBean.getGoldCoin() / 100f) : (walletBean.getSilverCoin() / 100f)));
if (rateAmount > currentYue) {
viewBinding.layoutTips.setVisibility(View.VISIBLE);
viewBinding.totaljineTipsTv.setText(isJinBi ? getString(R.string.cashbuzu_txt) : getString(R.string.lipinjifenbuzu_txt));
} else {
viewBinding.layoutTips.setVisibility(View.GONE);
}
}
private void changeTop() {
if (isJinBi) {
viewBinding.jinbiLy.setBackgroundResource(R.drawable.logout_btn_main1);

View File

@@ -1,17 +1,27 @@
package com.dskj.rbchat.wallet;
import static android.widget.RelativeLayout.END_OF;
import static android.widget.RelativeLayout.START_OF;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -47,6 +57,7 @@ import com.netease.nimlib.sdk.uinfo.UserService;
import com.netease.nimlib.sdk.uinfo.model.NimUserInfo;
import com.netease.yunxin.kit.common.ui.fragments.BaseFragment;
import com.netease.yunxin.kit.common.ui.utils.TimeFormatUtils;
import com.netease.yunxin.kit.common.utils.SizeUtils;
import com.netease.yunxin.kit.corekit.im.IMKitClient;
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
@@ -261,15 +272,24 @@ public class WalletInfoFragment extends BaseFragment {
commonAdapter = new CommonAdapter<BillBean>(getContext(), R.layout.item_bill_list, titles) {
@Override
public void convert(ViewHolder holder, BillBean s, int index) {
boolean isShowRate;
// holder.setText(R.id.price_tv, AppUtils.getQian(s.getAmount()) + (status == 0 ? getString(R.string.species_txt) :
// getString(R.string.silver_coins_txt)));
holder.setText(R.id.price_tv, AppUtils.getQian(s.getAmount()));
TextView textView = holder.getView(R.id.price_tv);
textView.setText(AppUtils.getQian(s.getAmount()));
RelativeLayout layoutroot = holder.getView(R.id.big_bg);
if (s.getAmount() < 0) {
textView.setTextColor(getResources().getColor(R.color.black));
} else {
textView.setTextColor(getResources().getColor(R.color.black));
}
if (s.getTransferMoneyRecord() != null && s.getTransferMoneyRecord().getFeeAmount() != 0) {
isShowRate = true;
textView.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.mipmap.ic_transfer_tips), null, null, null);
} else {
isShowRate = false;
textView.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
}
TextView statusTv = holder.getView(R.id.status_tv);
statusTv.setVisibility(View.GONE);
if (status == 0) {
@@ -289,8 +309,11 @@ public class WalletInfoFragment extends BaseFragment {
holder.setText(R.id.time_tv, TimeFormatUtils.formatMillisecond(getActivity(), Long.parseLong(s.getCreateTimestamp())));
}
holder.getView(R.id.big_bg).setOnClickListener(v -> {
layoutroot.setOnClickListener(v -> {
//弹窗
if (isShowRate) {
showPopWindow(textView, s.getTransferMoneyRecord().getFeeAmount(), s.getTransferMoneyRecord().getCoinType());
}
});
((ImageView) holder.getView(R.id.logo_iv)).setImageResource(getTypeRes(s));
@@ -299,6 +322,40 @@ public class WalletInfoFragment extends BaseFragment {
binding.recyclerview.setAdapter(commonAdapter);
}
private void showPopWindow(TextView itemView, long feeamount, int type) {
View popView = LayoutInflater.from(getContext()).inflate(R.layout.layout_popwindow_feerate, null);
PopupWindow popupWindow = new PopupWindow(popView,
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT,
true);
TextView tvValue = popView.findViewById(R.id.tv_transfer_txt);
ImageView ivTop = popView.findViewById(R.id.iv_poptop);
if (type == 0) {
tvValue.setText(HtmlCompat.fromHtml(String.format(getString(R.string.shouxufeitips_jinbi_txt), feeamount / 100), HtmlCompat.FROM_HTML_MODE_LEGACY));
} else {
tvValue.setText(HtmlCompat.fromHtml(String.format(getString(R.string.shouxufeitips_yinbi_txt), feeamount / 100), HtmlCompat.FROM_HTML_MODE_LEGACY));
}
RelativeLayout.LayoutParams paramsiv = (RelativeLayout.LayoutParams) ivTop.getLayoutParams();
paramsiv.setMargins(0, 0, itemView.getWidth(), 0);
ivTop.setLayoutParams(paramsiv);
// 设置背景来实现阴影效果
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
// 设置阴影的透明度
WindowManager.LayoutParams layoutParams = getActivity().getWindow().getAttributes();
layoutParams.alpha = 0.7f; // 设置背景透明度0.0到1.01.0是完全不透明)
getActivity().getWindow().setAttributes(layoutParams);
// 添加弹窗关闭时恢复透明度的监听器
popupWindow.setOnDismissListener(() -> {
WindowManager.LayoutParams params = getActivity().getWindow().getAttributes();
params.alpha = 1.0f; // 恢复为不透明
getActivity().getWindow().setAttributes(params);
});
popupWindow.setOutsideTouchable(true);
popupWindow.showAsDropDown(itemView, 0, 0);
}
private String getStatusTxt(WithdrawCashBean withdrawCashRecord) {
//0 未处理1 客服审核通过2 已打款3 拒绝
switch (withdrawCashRecord.getStatus()) {

View File

@@ -317,6 +317,8 @@ public class WelcomeActivity extends BaseActivity {
loginBean.setAccessToken(feedbackResp.data.getAccessToken());
loginBean.setAllowGiftCoin(feedbackResp.data.getUser().getAllowGiftCoin());
loginBean.setIsBiz(feedbackResp.data.getUser().getIsBiz());
loginBean.setCashFeeRate(feedbackResp.data.getCashFeeRate());
loginBean.setSilverFeeRate(feedbackResp.data.getSilverFeeRate());
DataUtils.set(WelcomeActivity.this, "login_bean", GsonUtils.beanToJSONString(loginBean));
new Handler().postDelayed(() -> loginIM(account, token), 3000);