Browse Source

no message

zhejiushizhuce 2 years ago
parent
commit
7616e54e76

+ 1 - 0
src/api/config.js

@@ -45,6 +45,7 @@ export const APP_WITHDRAW_INFO=BASE_PREFIX+"withDraw/getWithDrawInfo";
 export const APP_CHANGE_PAY_PASS=BASE_PREFIX+"changePayPass";
 export const APP_WITHDRAW_RECORD=BASE_PREFIX+"withDraw/record";
 export const APP_WITHDRAW_SET_INFO=BASE_PREFIX+"withDraw/withDrawInfo";
+export const APP_WITHDRAW_PAYOUT=BASE_PREFIX+"withDraw/payout";
 //withdraw
 //userinfo
 export const APP_GAME_INFO=BASE_PREFIX+"info";

+ 19 - 1
src/features/api.js

@@ -18,7 +18,7 @@ import {
     APP_REGISTER,
     APP_ROUTES, APP_TURNPLATE_BONUS, APP_TURNPLATE_HELP, APP_TURNPLATE_INDEX, APP_TURNPLATE_KAN,
     APP_WITHDRAW_BASE_INFO,
-    APP_WITHDRAW_INFO, APP_WITHDRAW_RECORD, APP_WITHDRAW_SET_INFO,
+    APP_WITHDRAW_INFO, APP_WITHDRAW_PAYOUT, APP_WITHDRAW_RECORD, APP_WITHDRAW_SET_INFO,
     APP_WITHDRAW_TAX,
     REQ_STATUS
 } from "@api/config";
@@ -379,6 +379,24 @@ export const reqWithdrawSetInfo=createAsyncThunk(
         return response;
     }
 )
+export const reqWithdrawPayout=createAsyncThunk(
+    APP_WITHDRAW_PAYOUT,
+    async (arg,thunkAPI) => {
+        let pass=global.getWDPass();
+        let params={
+            url:APP_WITHDRAW_PAYOUT,
+            data:{
+                paypass:pass,
+                score:arg.score
+            }
+        }
+        const response=await Http.post(params);
+        if (response&&response.code===200){
+            thunkAPI.dispatch(reqWithdrawBaseInfo());
+        }
+        return response;
+    }
+)
 //withdraw
 //用户信息
 export const reqGameInfo=createAsyncThunk(

+ 33 - 3
src/features/paySlice.js

@@ -1,11 +1,19 @@
 import {createSlice} from "@reduxjs/toolkit";
 import {REQ_STATUS} from "@api/config";
 import {
-    buildReqReducer, reqChangePayPass,
+    buildReqReducer,
+    reqChangePayPass,
     reqFirstPayConfig,
     reqGetAccountsPayInfo,
-    reqPaymentOrder, reqPayOrderList,
-    reqRechargeConfig, reqWithdrawBaseInfo, reqWithdrawInfo, reqWithdrawRecord, reqWithdrawSetInfo, reqWithdrawTax
+    reqPaymentOrder,
+    reqPayOrderList,
+    reqRechargeConfig,
+    reqWithdrawBaseInfo,
+    reqWithdrawInfo,
+    reqWithdrawPayout,
+    reqWithdrawRecord,
+    reqWithdrawSetInfo,
+    reqWithdrawTax
 } from "@features/api";
 import {getHttpMsg} from "@utils/helpers";
 import {toast} from "react-toastify";
@@ -190,6 +198,23 @@ const reducerWithdrawSetInfo=(state,action,arg)=>{
 const withdrawSetInfoStatus=(state,status,arg)=>{
     state.status.WithdrawSetInfo=status;
 }
+const reducerWithdrawPayout=(state,action,arg)=>{
+    let payload=action.payload;
+    let msg=getHttpMsg(payload);
+    if (payload&&payload.code===200){
+        toast.success(msg);
+    }
+    else
+    {
+        toast.error(msg);
+    }
+    if (arg&&arg.callback!=null){
+        arg.callback(payload);
+    }
+}
+const withdrawPayoutStatus=(state,status,arg)=>{
+    state.status.WithdrawPayout=status;
+}
 export const Pay=createSlice({
     name: 'pay',
     initialState: {
@@ -204,6 +229,7 @@ export const Pay=createSlice({
             WithdrawBaseInfo:REQ_STATUS.NONE,
             WithdrawInfo:REQ_STATUS.NONE,
             WithdrawSetInfo:REQ_STATUS.NONE,
+            WithdrawPayout:REQ_STATUS.NONE,
         },
         config:[],
         payconfig:null,
@@ -241,6 +267,7 @@ export const Pay=createSlice({
         buildReqReducer(builder,reqPayOrderList,reducerPayOrderList,payOrderListStatus);
         buildReqReducer(builder,reqWithdrawRecord,reducerWithdrawRecord,withdrawRecordStatus);
         buildReqReducer(builder,reqWithdrawSetInfo,reducerWithdrawSetInfo,withdrawSetInfoStatus);
+        buildReqReducer(builder,reqWithdrawPayout,reducerWithdrawPayout,withdrawPayoutStatus);
     },
 })
 export const {updatePayFinish,setChangePayPassType} = Pay.actions;
@@ -330,6 +357,9 @@ export const getWDInfoStatus=(state)=>{
 export const getChangePayPassType=(state)=>{
     return state.pay.changePayPassType;
 }
+export const getWDPayoutStatus=(state)=>{
+    return state.pay.status.WithdrawPayout;
+}
 export default Pay.reducer;
 
 export const reqPayConfig=(dispatch,userInfo)=>{

+ 4 - 1
src/locales/languages/en_US.json

@@ -217,7 +217,10 @@
       "btn_account": "+ Bank Account",
       "btn_account_change": "Change Account",
       "btn_withdraw": "Withdraw",
-      "tip": "Tips: The expected time of receipt is within 12 hours, please refer to the bank.The minimum/maximum amount which you can withdraw every time is {0}/{1}"
+      "tip": "Tips: The expected time of receipt is within 12 hours, please refer to the bank.The minimum/maximum amount which you can withdraw every time is {0}/{1}",
+      "unbound_account": "You have not bound a bank account and cannot withdraw",
+      "account_abnormal": "The system has detected an abnormal operation in your account, and your withdrawal has been prohibited. Please contact customer service",
+      "score_null": "You didn't fill in the withdrawal amount"
     },
     "account": {
       "title": "Account Information",

+ 35 - 4
src/widgets/WWithdraw/BR/BRWithdraw.jsx

@@ -4,14 +4,16 @@ import React, {useState,useEffect} from "react";
 import {useDispatch, useSelector} from "react-redux";
 import {getUserInfo} from "@features/mainSlice";
 import {numFormatter, stringFormat} from "@utils/helpers";
-import {getWithdrawBaseInfo} from "@features/paySlice";
+import {getWDPayoutStatus, getWithdrawBaseInfo} from "@features/paySlice";
 import symbol from "@assets/symbol-defs.svg";
 import {ReactComponent as Edit} from '@assets/singlesvg/edit.svg';
 import {useNavigate} from "react-router-dom";
 import {ROUTE_PATH} from "@constants/routes";
 import WDPassBox from "@widgets/WWithdraw/PassBox/WDPassBox";
 import SmallLoading from "@components/SmallLoading";
-import {reqWithdrawBaseInfo} from "@features/api";
+import {reqWithdrawBaseInfo, reqWithdrawPayout} from "@features/api";
+import {REQ_STATUS} from "@api/config";
+import {toast} from "react-toastify";
 const i18n=global.i18n;
 const BRWithdraw=()=>{
     const user=useSelector(getUserInfo);
@@ -23,11 +25,39 @@ const BRWithdraw=()=>{
     const [wdPass,setWdPass]=useState("");
     const [openPassBox,setOpenPassBox]=useState(false);
     const dispatch = useDispatch();
+    const status=useSelector(getWDPayoutStatus);
     useEffect(()=>{
        if (info==null){
            dispatch(reqWithdrawBaseInfo())
        }
     },[])
+    const checkBank=()=>{
+        if (info!=null){
+            // data.BankUserName, data.AccountsBank, data.cbPixType
+            let name=info.BankUserName;
+            let tname=info.AccountsBank;
+            let type=info.type;
+            return ((name != "") || (tname != "")) && (type != 0);
+        }
+        return false;
+    }
+    const onClickPayout=()=>{
+        if (status===REQ_STATUS.LOADING)return;
+        if (wdValue===""){
+            toast.error(i18n.t("withdraw.main.score_null"))
+            return;
+        }
+        if (!checkBank()){
+            toast.error(i18n.t("withdraw.main.unbound_account"))
+            return;
+        }
+        let num=Number(wdValue);
+        if (num>0){
+            dispatch(reqWithdrawPayout({
+                score:num
+            }))
+        }
+    }
     const getShowCash=(value)=>{
         value=Number(value);
         return value/global.CASH_BASE;
@@ -168,8 +198,9 @@ const BRWithdraw=()=>{
         let max=getShowCash(info.MaxExchange);
         return (
             <div className={styles.content}>
-                <button className="button-green">
-                    {i18n.t("withdraw.main.btn_withdraw")+"  ("+num+")"}
+                <button className="button-green" onClick={onClickPayout}>
+                    {status===REQ_STATUS.LOADING?(<SmallLoading fill={"#fff"}></SmallLoading>):i18n.t("withdraw.main.btn_withdraw")+"  ("+num+")"}
+                    {/*{i18n.t("withdraw.main.btn_withdraw")+"  ("+num+")"}*/}
                 </button>
                 <div className={styles.tips}>
                     {stringFormat(i18n.t("withdraw.main.tip"),[min,max])}