|
@@ -1,12 +1,14 @@
|
|
|
import {createSlice} from "@reduxjs/toolkit";
|
|
import {createSlice} from "@reduxjs/toolkit";
|
|
|
import {REQ_STATUS} from "@api/config";
|
|
import {REQ_STATUS} from "@api/config";
|
|
|
import {
|
|
import {
|
|
|
- buildReqReducer,
|
|
|
|
|
|
|
+ buildReqReducer, reqChangePayPass,
|
|
|
reqFirstPayConfig,
|
|
reqFirstPayConfig,
|
|
|
reqGetAccountsPayInfo,
|
|
reqGetAccountsPayInfo,
|
|
|
reqPaymentOrder,
|
|
reqPaymentOrder,
|
|
|
reqRechargeConfig, reqWithdrawBaseInfo, reqWithdrawInfo, reqWithdrawTax
|
|
reqRechargeConfig, reqWithdrawBaseInfo, reqWithdrawInfo, reqWithdrawTax
|
|
|
} from "@features/api";
|
|
} from "@features/api";
|
|
|
|
|
+import {getHttpMsg} from "@utils/helpers";
|
|
|
|
|
+import {toast} from "react-toastify";
|
|
|
const reducerRechargeConfig=(state,action,arg)=>{
|
|
const reducerRechargeConfig=(state,action,arg)=>{
|
|
|
let payload=action.payload;
|
|
let payload=action.payload;
|
|
|
if (payload!=null&&payload.code===200){
|
|
if (payload!=null&&payload.code===200){
|
|
@@ -19,32 +21,31 @@ const rechargeConfigStatus=(state,status,arg)=>{
|
|
|
}
|
|
}
|
|
|
const reducerFirstPayConfig=(state,action,arg)=>{
|
|
const reducerFirstPayConfig=(state,action,arg)=>{
|
|
|
let payload=action.payload;
|
|
let payload=action.payload;
|
|
|
- payload={
|
|
|
|
|
- "data": {
|
|
|
|
|
- "first_pay": {
|
|
|
|
|
- "id": "1017",
|
|
|
|
|
- "money": "10",
|
|
|
|
|
- "gear": "[{\"id\":\"28\",\"name\":\"PIX\\u76f4\\u8fde\",\"status\":1,\"type\":3}]",
|
|
|
|
|
- "status": "1",
|
|
|
|
|
- "created_at": "2022-06-09 13:57:58.000",
|
|
|
|
|
- "favorable_price": 20,
|
|
|
|
|
- "image": "11",
|
|
|
|
|
- "give": "10",
|
|
|
|
|
- "first_pay": "1",
|
|
|
|
|
- "name": "\u9996\u5145\u6863\u4f4d\u914d\u7f6e",
|
|
|
|
|
- "gift_id": "201",
|
|
|
|
|
- "channels": "-1"
|
|
|
|
|
- },
|
|
|
|
|
- "recomendar_recharge": "7"
|
|
|
|
|
- },
|
|
|
|
|
- "result": "",
|
|
|
|
|
- "msg": "success",
|
|
|
|
|
- "code": 200
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ // payload={
|
|
|
|
|
+ // "data": {
|
|
|
|
|
+ // "first_pay": {
|
|
|
|
|
+ // "id": "1017",
|
|
|
|
|
+ // "money": "10",
|
|
|
|
|
+ // "gear": "[{\"id\":\"28\",\"name\":\"PIX\\u76f4\\u8fde\",\"status\":1,\"type\":3}]",
|
|
|
|
|
+ // "status": "1",
|
|
|
|
|
+ // "created_at": "2022-06-09 13:57:58.000",
|
|
|
|
|
+ // "favorable_price": 20,
|
|
|
|
|
+ // "image": "11",
|
|
|
|
|
+ // "give": "10",
|
|
|
|
|
+ // "first_pay": "1",
|
|
|
|
|
+ // "name": "\u9996\u5145\u6863\u4f4d\u914d\u7f6e",
|
|
|
|
|
+ // "gift_id": "201",
|
|
|
|
|
+ // "channels": "-1"
|
|
|
|
|
+ // },
|
|
|
|
|
+ // "recomendar_recharge": "7"
|
|
|
|
|
+ // },
|
|
|
|
|
+ // "result": "",
|
|
|
|
|
+ // "msg": "success",
|
|
|
|
|
+ // "code": 200
|
|
|
|
|
+ // };
|
|
|
if (payload!=null&&payload.code===200){
|
|
if (payload!=null&&payload.code===200){
|
|
|
let data=payload.data;
|
|
let data=payload.data;
|
|
|
state.firstconfig=data;
|
|
state.firstconfig=data;
|
|
|
- console.log(state.firstconfig)
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
const firstPayConfigStatus=(state,status,arg)=>{
|
|
const firstPayConfigStatus=(state,status,arg)=>{
|
|
@@ -62,16 +63,16 @@ const getAccountsPayInfoStatus=(state,status,arg)=>{
|
|
|
}
|
|
}
|
|
|
const reducerPaymentOrder=(state,action,arg)=>{
|
|
const reducerPaymentOrder=(state,action,arg)=>{
|
|
|
let payload=action.payload;
|
|
let payload=action.payload;
|
|
|
- payload={
|
|
|
|
|
- "data": {
|
|
|
|
|
- "content": "00020101021226830014br.gov.bcb.pix2561pix.delbank.com.br\/v1\/qrcode\/vcharge22e43499260b46a9a5f303ca55204000053039865802BR5907DELBANK6007ARACAJU62070503***6304F3DF",
|
|
|
|
|
- "money": 10,
|
|
|
|
|
- "prdOrdNo": "BR5050013857473344515256"
|
|
|
|
|
- },
|
|
|
|
|
- "result": "",
|
|
|
|
|
- "msg": "success",
|
|
|
|
|
- "code": 200
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ // payload={
|
|
|
|
|
+ // "data": {
|
|
|
|
|
+ // "content": "00020101021226830014br.gov.bcb.pix2561pix.delbank.com.br\/v1\/qrcode\/vcharge22e43499260b46a9a5f303ca55204000053039865802BR5907DELBANK6007ARACAJU62070503***6304F3DF",
|
|
|
|
|
+ // "money": 10,
|
|
|
|
|
+ // "prdOrdNo": "BR5050013857473344515256"
|
|
|
|
|
+ // },
|
|
|
|
|
+ // "result": "",
|
|
|
|
|
+ // "msg": "success",
|
|
|
|
|
+ // "code": 200
|
|
|
|
|
+ // };
|
|
|
if (payload!=null&&payload.code===200){
|
|
if (payload!=null&&payload.code===200){
|
|
|
let data=payload.data;
|
|
let data=payload.data;
|
|
|
data.createAt=Date.now();
|
|
data.createAt=Date.now();
|
|
@@ -79,7 +80,6 @@ const reducerPaymentOrder=(state,action,arg)=>{
|
|
|
state.currPayOrder=data;
|
|
state.currPayOrder=data;
|
|
|
if (arg.callback!=null)arg.callback();
|
|
if (arg.callback!=null)arg.callback();
|
|
|
}
|
|
}
|
|
|
- console.log(payload)
|
|
|
|
|
}
|
|
}
|
|
|
const paymentOrderStatus=(state,status,arg)=>{
|
|
const paymentOrderStatus=(state,status,arg)=>{
|
|
|
state.status.PaymentOrder=status;
|
|
state.status.PaymentOrder=status;
|
|
@@ -111,6 +111,23 @@ const reducerWithdrawInfo=(state,action,arg)=>{
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+const reducerChangePayPass=(state,action,arg)=>{
|
|
|
|
|
+ let payload=action.payload;
|
|
|
|
|
+ let msg=getHttpMsg(payload);
|
|
|
|
|
+ if (payload&&payload.code===200){
|
|
|
|
|
+ let data=payload.data;
|
|
|
|
|
+ if (data){
|
|
|
|
|
+ // state.withdrawInfo=data;
|
|
|
|
|
+ }
|
|
|
|
|
+ toast.success(msg);
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
|
|
+ toast.error(msg);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+const changePayPassStatus=(state,status,arg)=>{
|
|
|
|
|
+ state.status.ChangePayPass=status;
|
|
|
|
|
+}
|
|
|
export const Pay=createSlice({
|
|
export const Pay=createSlice({
|
|
|
name: 'pay',
|
|
name: 'pay',
|
|
|
initialState: {
|
|
initialState: {
|
|
@@ -118,7 +135,8 @@ export const Pay=createSlice({
|
|
|
RechargeConfig:REQ_STATUS.NONE,
|
|
RechargeConfig:REQ_STATUS.NONE,
|
|
|
FirstPayConfig:REQ_STATUS.NONE,
|
|
FirstPayConfig:REQ_STATUS.NONE,
|
|
|
GetAccountsPayInfo:REQ_STATUS.NONE,
|
|
GetAccountsPayInfo:REQ_STATUS.NONE,
|
|
|
- PaymentOrder:REQ_STATUS.NONE
|
|
|
|
|
|
|
+ PaymentOrder:REQ_STATUS.NONE,
|
|
|
|
|
+ ChangePayPass:REQ_STATUS.NONE
|
|
|
},
|
|
},
|
|
|
config:[],
|
|
config:[],
|
|
|
payconfig:null,
|
|
payconfig:null,
|
|
@@ -127,26 +145,7 @@ export const Pay=createSlice({
|
|
|
currPayOrder:null,
|
|
currPayOrder:null,
|
|
|
WithDrawTax:4,
|
|
WithDrawTax:4,
|
|
|
withdrawBaseInfo:null,
|
|
withdrawBaseInfo:null,
|
|
|
- withdrawInfo:null,
|
|
|
|
|
- // withdrawBaseInfo:{
|
|
|
|
|
- // // "Achieves": null,
|
|
|
|
|
- // // "SumCanExchange": "3482",
|
|
|
|
|
- // // "AccountsBank": "",
|
|
|
|
|
- // // "BranchBank": "",
|
|
|
|
|
- // // "BankNO": "",
|
|
|
|
|
- // // "MinExchange": "6000",
|
|
|
|
|
- // // "MaxExchange": "3000000",
|
|
|
|
|
- // // "OrderLimit": "3",
|
|
|
|
|
- // // "OrderCount": "0",
|
|
|
|
|
- // // "BankUserName": "",
|
|
|
|
|
- // // "PhoneNumber": "",
|
|
|
|
|
- // // "IFSCNumber": "",
|
|
|
|
|
- // // "EmailAddress": "",
|
|
|
|
|
- // // "PANNumber": "",
|
|
|
|
|
- // // "AdhaarNumber": "",
|
|
|
|
|
- // // "PixNum": "",
|
|
|
|
|
- // // "PixType": "0"
|
|
|
|
|
- // }
|
|
|
|
|
|
|
+ withdrawInfo:null
|
|
|
},
|
|
},
|
|
|
reducers: {
|
|
reducers: {
|
|
|
|
|
|
|
@@ -159,6 +158,7 @@ export const Pay=createSlice({
|
|
|
buildReqReducer(builder,reqWithdrawTax,reducerWithdrawTax,null);
|
|
buildReqReducer(builder,reqWithdrawTax,reducerWithdrawTax,null);
|
|
|
buildReqReducer(builder,reqWithdrawBaseInfo,reducerWithdrawBaseInfo,null);
|
|
buildReqReducer(builder,reqWithdrawBaseInfo,reducerWithdrawBaseInfo,null);
|
|
|
buildReqReducer(builder,reqWithdrawInfo,reducerWithdrawInfo,null);
|
|
buildReqReducer(builder,reqWithdrawInfo,reducerWithdrawInfo,null);
|
|
|
|
|
+ buildReqReducer(builder,reqChangePayPass,reducerChangePayPass,changePayPassStatus);
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
|
export const {} = Pay.actions;
|
|
export const {} = Pay.actions;
|
|
@@ -173,13 +173,15 @@ export const getFirstPay=(state)=>{
|
|
|
let first_pay=firstconfig.first_pay;
|
|
let first_pay=firstconfig.first_pay;
|
|
|
let recomendar_recharge=firstconfig.recomendar_recharge;
|
|
let recomendar_recharge=firstconfig.recomendar_recharge;
|
|
|
if (first_pay!=null){
|
|
if (first_pay!=null){
|
|
|
|
|
+ let gear=JSON.parse(first_pay.gear);
|
|
|
|
|
+ if (gear)gear=gear[0];
|
|
|
order={
|
|
order={
|
|
|
goodsName:"firstpay",
|
|
goodsName:"firstpay",
|
|
|
goodsPrice:first_pay.money,
|
|
goodsPrice:first_pay.money,
|
|
|
GiftsID: 201,
|
|
GiftsID: 201,
|
|
|
cpf_first:0,
|
|
cpf_first:0,
|
|
|
give:first_pay.give,
|
|
give:first_pay.give,
|
|
|
- gear:JSON.parse(first_pay.gear)
|
|
|
|
|
|
|
+ gear:gear
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
@@ -187,13 +189,15 @@ export const getFirstPay=(state)=>{
|
|
|
for (let i = 0; i <config.length ; i++) {
|
|
for (let i = 0; i <config.length ; i++) {
|
|
|
const elem = config[i];
|
|
const elem = config[i];
|
|
|
if (elem.id===recomendar_recharge){
|
|
if (elem.id===recomendar_recharge){
|
|
|
|
|
+ let gear=JSON.parse(elem.gear);
|
|
|
|
|
+ if (gear)gear=gear[0];
|
|
|
order={
|
|
order={
|
|
|
goodsName: "chip",
|
|
goodsName: "chip",
|
|
|
goodsPrice: elem.money,
|
|
goodsPrice: elem.money,
|
|
|
GiftsID:elem.gift_id,
|
|
GiftsID:elem.gift_id,
|
|
|
cpf_first:0,
|
|
cpf_first:0,
|
|
|
give:elem.give,
|
|
give:elem.give,
|
|
|
- gear:JSON.parse(elem.gear)
|
|
|
|
|
|
|
+ gear:gear
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
@@ -214,6 +218,9 @@ export const getWithdrawBaseInfo=(state)=>{
|
|
|
export const getWithdrawInfo=(state)=>{
|
|
export const getWithdrawInfo=(state)=>{
|
|
|
return state.pay.withdrawInfo;
|
|
return state.pay.withdrawInfo;
|
|
|
}
|
|
}
|
|
|
|
|
+export const getChangePayPassStatus=(state)=>{
|
|
|
|
|
+ return state.pay.status.ChangePayPass;
|
|
|
|
|
+}
|
|
|
export default Pay.reducer;
|
|
export default Pay.reducer;
|
|
|
|
|
|
|
|
export const reqPayConfig=(dispatch,userInfo)=>{
|
|
export const reqPayConfig=(dispatch,userInfo)=>{
|