完成提现页面

This commit is contained in:
yezian 2024-06-28 23:14:36 +08:00
parent 3c9b6c76e3
commit f03b870d62
3 changed files with 22 additions and 17 deletions

View File

@ -3,7 +3,7 @@ import React, { useState, useEffect } from "react";
import { getCookie } from "cookies-next";
import { useRouter } from "next/navigation";
import baseRequest from "@/utils/baseRequest";
import { Toast } from "antd-mobile";
import { Toast, Modal } from "antd-mobile";
import { generateSignature } from "@/utils/crypto";
import { JSEncrypt } from "jsencrypt";
@ -138,17 +138,16 @@ export default function Checkout() {
const handleConfirm = async () => {
try {
setIsSubmitting(true);
//RSA
//RSA
const encrypt = new JSEncrypt();
encrypt.setPublicKey(process.env.NEXT_PUBLIC_WITHDRAW_RSA_KEY);
// const auth_alipay_id = encrypt.encrypt(alipayAccount);
// const auth_alipay_name = encrypt.encrypt(payee);
encrypt.setPublicKey(process.env.NEXT_PUBLIC_RSA_KEY);
const encryptedAlipayAccount = encrypt.encrypt(alipayAccount);
const base = baseRequest();
const body =
receiptChannel === 20
? {
receipt_channel: receiptChannel,
worker_account: alipayAccount,
worker_account: encryptedAlipayAccount,
distribute_amount: (withdrawalNum * 10).toString(),
...base,
}
@ -168,8 +167,6 @@ export default function Checkout() {
}
);
const applyData = await applyResponse.json();
console.log(JSON.stringify(body));
console.log(applyData);
if (applyData.ret === -1) {
setErrorMessage(applyData.msg);
setIsSubmitting(false);
@ -187,10 +184,17 @@ export default function Checkout() {
const handleEditBankCardNo = async () => {
try {
setIsSubmitting(true);
//rsa
const encrypt = new JSEncrypt();
encrypt.setPublicKey(process.env.NEXT_PUBLIC_RSA_KEY);
const encryptedWorkerMobile = encrypt.encrypt(
data?.detail?.worker_mobile
);
const encryptedBankCard = encrypt.encrypt(newBankCardNo);
const base = baseRequest();
const body = {
worker_mobile: data?.detail?.worker_mobile,
bank_card: newBankCardNo,
worker_mobile: encryptedWorkerMobile,
bank_card: encryptedBankCard,
receipt_channel: 10,
...base,
};
@ -206,7 +210,6 @@ export default function Checkout() {
}
);
const _data = await _response.json();
console.log(_data);
if (_data.ret === -1) {
setIsSubmitting(false);
return;
@ -267,7 +270,7 @@ export default function Checkout() {
onClick={() => setReceiptChannel(10)}
className={`${
receiptChannel === 10 ? "border-primary" : "border-[#FFFFFF1A]"
} border flex flex-row items-center justify-between cursor-pointer bg-[#FFFFFF1A] rounded-xl px-4 py-2`}
} border flex flex-row items-center justify-between cursor-pointer bg-[#FFFFFF1A] rounded-lg px-4 py-2`}
>
<div className="flex flex-row items-center">
<svg viewBox="0 0 1024 1024" width="24" height="24">
@ -303,7 +306,7 @@ export default function Checkout() {
onClick={() => setReceiptChannel(20)}
className={`${
receiptChannel === 20 ? "border-primary" : "border-[#FFFFFF1A]"
} border flex flex-row items-center cursor-pointer bg-[#FFFFFF1A] rounded-xl px-4 py-2`}
} border flex flex-row items-center cursor-pointer bg-[#FFFFFF1A] rounded-lg px-4 py-2`}
>
<svg viewBox="0 0 1024 1024" width="24" height="24">
<path

View File

@ -47,7 +47,6 @@ export default function WithDrawal() {
}
);
const verificationData = await verificationResponse.json();
console.log(verificationData);
if (verificationData.ret === -1) {
Toast.show({
content: verificationData.msg,
@ -78,6 +77,7 @@ export default function WithDrawal() {
setData({
verificationStatus: verificationData.data?.agree_state,
withdrawal_diamond: withdrawalData.data.withdraw_diamonds,
diamonds: withdrawalData.data.diamonds,
});
} catch (error) {
console.error(error);
@ -89,7 +89,7 @@ export default function WithDrawal() {
//
const handleVerify = () => {
const token = getCookie("token");
const huiYongGongUrl = `http://bh5-channel.hvyogo.com/?channel=CDLX&token=${token}`;
const huiYongGongUrl = `https://h5-channel.hvyogo.com/?channel=CDLX&token=${token}`;
router.push(huiYongGongUrl);
};
@ -121,7 +121,9 @@ export default function WithDrawal() {
<div className="flex flex-row justify-between items-center bg-[#FFFFFF1A] rounded-2xl p-4 my-4">
<p className="text-secondary text-base font-medium">
钻石总额
<span className="text-white text-xl font-medium">20000</span>
<span className="text-white text-xl font-medium">
{data?.diamonds}
</span>
</p>
</div>
<p className="text-secondary text-base mt-2">注意事项</p>

View File

@ -18,7 +18,7 @@ export default function Success() {
></path>
</svg>
<p className="text-center text-white text-base font-medium mx-4 mt-4">
已为您提交提现申请提现款项将在24内到账若未及时到账请联系客服处理
已为您提交提现申请提现款项将在24小时内到账若未及时到账请联系客服处理
</p>
<button
onClick={() => router.push("/withdrawal")}