import * as React from "react"; import { Radio, Form, Select, Input, Button, Tooltip, Icon, message } from "antd"; import { FormComponentProps } from "antd/lib/form"; import ContentView from "@/layout/ContentView"; import MainLayout from "@/layout"; import FormItemDecorator from "@/components/FormItemDecorator"; import { VIP_INFO, DEVICE_TYPE } from "../constants"; import CustomUpload from "./customUpload"; import API from "@/api"; import ConfirmInfo from "../confirmInfo"; import { CheckRes, APPList } from "@/api/service/RechargeService"; import { getOpenCreateAPPUrl } from "@/shared/common/utils"; import "./index.scss"; // 充值信息 type P = FormComponentProps & {}; type S = { type: string; accountType: number; appList: object[]; isConfirm: Boolean; isLoading: Boolean; chargeInfoData: CheckRes; }; class ChargeInfo extends React.Component
{
state = {
type: "VIP",
accountType: 1,
appList: [],
isConfirm: false,
isLoading: false,
chargeInfoData: null
};
componentDidMount() {
API.recharge.APPList().then(res => {
// console.log(res);
if (res.code === 0) {
this.setState({
appList: res.data as APPList[]
});
}
});
}
onTypeChange = e => {
this.setState({
type: e.target.value
});
};
onAccountTypeChange = e => {
this.setState({
accountType: e.target.value
});
};
handleUploadSuccess = url => {
console.log(url);
};
handleSubmit = e => {
e.preventDefault();
this.props.form.validateFields((err, values) => {
console.log("values=>", values);
if (!err) {
console.log("Received values of form: ", values);
values.mobileList = values.mobileList.split(/,|↵|\\n/);
values.xiDianNum = +values.xiDianNum;
this.setState({
isLoading: true
});
API.recharge
.applyRecharge(values)
.then(res => {
if (res.code === 0) {
this.toRecharge(true);
this.setState({
chargeInfoData: res.data as CheckRes
});
} else {
message.error(res.message);
}
})
.finally(() => {
this.setState({
isLoading: false
});
});
}
});
};
verifyAlbum = async (rule, value, callback) => {
// console.log(rule, value);
if (value) {
const res = await API.recharge.getAlbumInfo(value);
if (res.code === 0) {
callback();
} else {
callback(`${value}专辑,未查询到`);
}
} else {
callback("请填写专辑ID");
}
};
toRecharge = (bool: Boolean) => {
this.setState({
isConfirm: bool
});
};
render() {
const {
type,
accountType,
appList,
isConfirm,
isLoading,
chargeInfoData
} = this.state;
const { form } = this.props;
return (
如果第一次权益充值,请先创建一个名为权益充值的应用。
创建应用时,名称为:公司名称+权益充值。例如:喜马拉雅权益充值;
网址为:权益充值的网址。例如:www.ximalaya.com;
创建成功后,请与商务联系,及时走审核流程。商务反馈审核通过后,刷新该页面,选择项会增加“公司名称+权益充值”的应用。
创建完成后,每次选择该权益充值应用进行权益充值。
()(ChargeInfo);