import UserApi from '@/apis/userApi';
import Button from '@/component/button';
import Label from '@/component/label';
import Layout from '@/component/layout';
import Padding from '@/component/padding';
import UserHelper from '@/helper/userHelper';
import Taro from '@tarojs/taro';
import './index.scss'


const LogOff = () => {
    return (
        <Layout>
            <Padding>
                <Label style={{ marginBottom: 4 }} bold size="lg" >注销须知</Label>
                <Label style={{ marginBottom: 4 }} type="secondary" size="sm" >1、若账号存在风险或异常行为无法注销；</Label>
                <Label style={{ marginBottom: 4 }} type="secondary" size="sm" >2、账号内若有未完成状态订单无法注销；</Label>
                <Label style={{ marginBottom: 4 }} type="secondary" size="sm" >3、本平台仅能注销在本平台注册的账号，若通过本平台申请第三方贷款或其他服务，请联系第三方注销；</Label>
                <Label style={{ marginBottom: 24 }} type="secondary" size="sm" >4、账号注销后无法恢复，账户内信息将无法查看，请谨慎注销。</Label>
                <Button onClick={() => {
                    Taro.showModal({
                        title: "确认注销？",

                        success: (res) => {

                            res.confirm && UserApi.logOffUsingPost({
                                loading: true, errorTips: true
                            })
                                .checkSuccess()
                                .then(p => {
                                    p && UserHelper.outLogin()
                                })
                        }
                    })
                }} round={false} >熟知并同意</Button>
            </Padding>
        </Layout>
    )
}

export default LogOff;