<template>
    <div class="page" :class="{ 'page--iphoneX': iphoneX }">
        <div class="form-card">
            <section class="form-item">
                <div class="label">
                    <span class="required">*</span>
                    企业名：
                </div>
                <div class="box">
                    <input type="text" v-model="form.name" />
                </div>
            </section>
            <section class="form-item">
                <div class="label">
                    <span class="required">*</span>
                    法人微信：
                </div>
                <div class="box">
                    <input
                        type="text"
                        v-model="form.legalPersonaWechat"
                    />
                </div>
            </section>
            <section class="form-item">
                <div class="label">
                    <span class="required">*</span>
                    法人姓名：
                </div>
                <div class="box">
                    <input
                        type="text"
                        v-model="form.legalPersonaName"
                    />
                </div>
            </section>
        </div>
        <div class="btns">
            <div class="btn layout" @click="layout">退出登录</div>
            <div class="btn" @click="saveOk">保存</div>
        </div>
    </div>
</template>

<script>
import MyImage from "../../../components/image/index";
import DateTimePicker from "../../../components/biaofun-datetime-picker/biaofun-datetime-picker";

export default {
    name: "",
    components: { MyImage, DateTimePicker },
    // 数据
    data() {
        return {
            form: {
                name: "",
                legalPersonaWechat: "",
                legalPersonaName: "",
            },
        };
    },

    onLoad(opts) {},

    onShow() {},

    // 函数
    methods: {
        saveOk() {
            if (!this.form.name) {
                return this.fn.showToast("请输入企业名");
            }
            if (!this.form.legalPersonaWechat) {
                return this.fn.showToast("请输入法人微信");
            }
            if (!this.form.legalPersonaName) {
                return this.fn.showToast("请输入法人姓名");
            }
            let data = { ...this.form };
            this.api
                .post("/Mina/CheckRegister", data, { pass: true })
                .then((res) => {
                    this.submitLoading = false;
                    uni.hideLoading();
                    if (res.success) {
                        let obj = {
                            0: "成功",
                            "-1": "非法 action 参数",
                            89249: "该主体已有任务执行中，距上次任务 24h 后再试",
                            89247: "内部错误",
                            86004: "无效微信号",
                            61070: "法人姓名与微信号不一致",
                            89248: "企业代码类型无效，请选择正确类型填写",
                            89250: "未找到该任务",
                            89251: "待法人人脸核身校验",
                            89252: "法人&企业信息一致性校验中",
                            89253: "缺少参数",
                            89254: "第三方权限集不全，请补充权限集后重试",
                            89255: "code参数无效，请检查code长度以及内容是否正确 ；注意code_type的值不同需要传的code长度不一样",
                        };
                        if (res.data == "0") {
                            this.fn.showToast("查询成功,");
                            this.router.back();
                        } else {
                            let msg =
                                obj[res.data] ||
                                "未知错误,错误代码:" + res.data;
                            this.fn.showModal({
                                content: msg,
                                showCancel: false,
                            });
                        }
                    } else {
                        this.fn.showModal({
                            content:
                                "错误码:" +
                                res.code +
                                ",错误信息:" +
                                res.message,
                            showCancel: false,
                        });
                    }
                });
        },
        layout() {
            this.$store.commit("user/logout", null);
            this.router.push({
                path: "/pages/index/login",
                isTabBar: true,
            });
        },
    },

    // 数据计算
    computed: {},

    // 数据监听
    watch: {},
};
</script>


<style lang="scss" scoped>
.page {
    padding-bottom: px(120);
    min-height: 100vh;
    background-color: #fff;
}
.page--iphoneX {
    padding-bottom: px(150);
    .btn {
        padding-bottom: px(30);
        background-color: rgb(0, 188, 38);
    }
}
.form-card {
    background-color: #fff;
    padding: 0 px(30);
    & ~ .form-card {
        margin-top: px(25);
    }
    .head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: px(140);
        background-color: #fbfbfb;
        border-bottom: 1px solid #f1f1f1;
        border-top: 1px solid #f1f1f1;
        font-size: px(44);
    }
}
.form-item {
    display: flex;
    min-height: px(140);
    padding: px(30) 0;
    box-sizing: border-box;
    align-items: center;
    font-size: px(44);
    &.dis-item {
        color: #999;
        background: #f9f9f9;
    }
    & ~ .form-item {
        border-top: 1px solid #f1f1f1;
    }
    .label {
        width: px(240);
        flex-shrink: 0;
        color: #999;
        margin-right: px(10);
    }
    .box {
        width: 100%;
        position: relative;
        input {
            width: 100%;
        }
    }
    .tool {
        flex-shrink: 0;
        color: #999;
        margin-left: px(10);
    }
    textarea,
    input {
        max-width: 100%;
        width: 100%;
    }
}
.list {
    // min-height: 100vh;
    // background-color: #fff;
    // border-bottom: 1px solid #f1f1f1;
    li {
        padding: px(0) px(35);
        height: px(140);
        line-height: px(140);
        font-size: px(44);
        border-top: 1px solid #f1f1f1;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .tools {
        display: flex;
        align-items: center;
        flex-shrink: 0;
        span {
            display: inline-block;
            border: 1px solid #f1f1f1;
            font-size: px(36);
            height: px(80);
            width: px(120);
            display: flex;
            justify-content: center;
            align-items: center;
            & ~ span {
                margin-left: px(30);
            }
        }
        .remove {
            color: #f00;
        }
    }
}
.btn {
    width: 100%;
    height: px(120);
    background-color: rgb(0, 188, 38);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btns {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
}
.layout{
    background-color: #eee;
    color: #666;
}
.add-btn {
    height: px(120);
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: px(50) px(35) 0;
    border: 1px solid #ccc;
    border-radius: px(10);
}
.code-tool {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    .scan-img {
        flex-shrink: 0;
        width: px(80);
        height: px(80);
        /deep/ img {
            width: px(80);
            height: px(80);
        }
    }
    .generate {
        color: #0097d1;
        margin-right: px(30);
        flex-shrink: 0;
    }
}
.required {
    color: #f00;
    font-size: px(44);
    &.hide {
        visibility: hidden;
    }
}
.inp-dis {
    color: #999;
}

.img-card {
    padding-top: px(30);
    padding-bottom: px(30);
}
.form-img-item {
    .tit {
        padding: px(30);
        font-size: px(44);
    }
}

.spec-list {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    li {
        width: 33.333333%;
        font-size: px(40);
        height: px(100);
        border: 1px solid #f1f1f1;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #999;
        & ~ li {
            // border-left: none;
        }
        &.on {
            color: rgb(0, 188, 38);
            border-color: rgb(0, 188, 38);
        }
    }
}
.mo-date {
    margin-top: px(20);
    border-bottom: 1px solid #f1f1f1;
    background: #fbfbfb;
    font-size: px(40);
    padding: px(10);
}
.n-date-box {
    margin-top: px(20);
    font-size: px(40);
}
.n-date {
    border-bottom: 1px solid #f1f1f1;
    background: #fbfbfb;
    padding: 0 px(20);
    display: inline-block;
    width: px(200);
    font-size: px(44);
    vertical-align: bottom;
}
</style>