<!DOCTYPE html>
<html>
<head lang="en">
    <include file="./Application/M/View/Common/head_include.html"/>
    <title>幻速-招募城市合伙人,赛车竞速馆、体验店加盟介绍-厦门欣富地智能科技</title>
    <link rel="stylesheet" type="text/css" href="/Public/static/home/m/css/join.css"/>
</head>
<body>
<include file="./Application/M/View/Common/head.html"/>
<div class="content">
    <div class="img_content">
        <div class="img_content col">
            <p><img src="https://img.x-motion.cn/home/m/image/join/join_01.jpg" alt="" /></p>
            <p><img src="https://img.x-motion.cn/home/m/image/join/join_12.jpg" alt="" /></p>
            <p><img src="https://img.x-motion.cn/home/m/image/join/join_03.jpg" alt="" /></p>
            <p><img src="https://img.x-motion.cn/home/m/image/join/join_04.jpg" alt="" /></p>
            <p><img src="https://img.x-motion.cn/home/m/image/join/join_05.jpg" alt="" /></p>
            <p><img src="https://img.x-motion.cn/home/m/image/join/join_07.jpg" alt="" /></p>
            <p><img src="https://img.x-motion.cn/home/m/image/join/join_08.jpg" alt="" /></p>
            <p><img src="https://img.x-motion.cn/home/m/image/join/join_09.jpg" alt="" /></p>
            <p><img src="https://img.x-motion.cn/home/m/image/join/join_10.jpg" alt="" /></p>
            <p><img src="https://img.x-motion.cn/home/m/image/join/join_11.jpg" alt="" /></p>
        </div>
    </div>
    <div class="message">
        <h2>咨询留言</h2>
        <h3>请填写以下信息,我们将安排专业的客服与您联系</h3>

        <form action="javascript:void(0);" method="post">
            <p><label for="name">*<span>姓&emsp;&emsp;名:</span></label><input type="text" name="name" id="name" value="" placeholder="请输入您的姓名"/><span class="error"></span></p>

            <p><label for="tel">*<span>电&emsp;&emsp;话:</span></label><input type="text" name="tel" id="tel" value="" placeholder="请输入您的真实电话号码"/><span class="error"></span></p>

            <p><label for="intention"><span>意向方式:</span></label><input type="text" name="intention" id="intention" value="" placeholder="请输入合作意向"/><span class="error"></span></p>

            <p><label for="city"><span>所在城市:</span></label><input type="text" name="city" id="city" value="" placeholder="请输入您所在的城市"/><span class="error"></span></p>

            <p class="content1"><label for="content">*<span>留&emsp;&emsp;言:</span></label><textarea id="content" name="content" rows="" cols=""
                                                                                   placeholder="您有什么想告诉我们的?"></textarea><span class="error"></span></p>
            <input id="submit" type="submit" value="确定"/>
        </form>
    </div>
    <include file="./Application/M/View/Common/footer.html"/>
</div>
<include file="./Application/M/View/Common/footer_include.html"/>

<script type="text/javascript">
    $(document).ready(function() {

        $('form input,form textarea').on('input', function(){
            $(this).siblings('span.error').html('');
        });
        $('#submit').on('click', function(){
            $("#submit").attr('disabled', true);
            var check_key = {
                name:'',
                tel:'',
                content:''
            };
            var data = {
                name: $('#name').val(),
                tel: $('#tel').val(),
                intention: $('#intention').val(),
                city: $('#city').val(),
                content: $('#content').val()
            };
            var status = true;
            if(!isPoneAvailable(data["tel"])){
                error = $('#tel').siblings('.error');
                $(error).html('号码错误');
                status = false;
            }
            for (var Key in check_key){
                if(data[Key] == ''){
                    error = $('#' + Key).siblings('.error');
                    $(error).html('请填写');
                    status = false;
                }
            }
            if(status == false){
                $("#submit").removeAttr('disabled');
                return false;
            }
            $.ajax({
                type: "post",
                url: "{:U(CONTROLLER_NAME . '/' . ACTION_NAME)}",
                data: {data: data},
                success: function (data) {
                    if (data.status == '1') {
                        layer.msg('提交成功!');
                        setTimeout( function(){
                            window.location.href = location.href;
                        }, 2 * 1000 );
                    } else if (data.status == '0') {
                        parent.layer.msg(data.info, {icon: 5});
                    }
                    $("#submit").removeAttr('disabled');
                    <if condition="!empty($tt_code)">
                    _taq.push({convert_id:"{$tt_code}", event_type:"form"});
                    </if>
                }
            });

        });
        $('.message_input input').on('focus', function(){
            $(this).siblings('.error').html('');
        });
        $('.message_input textarea').on('focus', function(){
            $(this).siblings('.error').html('');
        });
    });
    function isPoneAvailable(phone) {
        var myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
        if (!myreg.test(phone)) {
            return false;
        } else {
            return true;
        }
    }
</script>
</body>
</html>