<!doctype html>
<html class="no-js">
<head>

<include file="Common/head" />

    <style type="text/css">
        a.am-text-secondary:visited{color:#3bb4f2;}
        a.am-text-danger:visited{color:#dd514c;}
        .am-btn-default {background-color: #fff;}
        th {text-align:center;}
        tr td{text-align:center;}
        select{padding: 4px;border: 1px solid #ccc;}
        .am-popup-bd {background:#fff;}
        .am-popup-bd img {max-width: 100%}
        .am-u-sm-2 {border-top: 1px solid #ddd;margin-top: 10px;}
        .am-u-sm-10 {border-left: 1px solid #ddd;margin-top: 10px;}
    </style>
</head>
<body>

<include file="Common/header" />

<div class="am-cf admin">

    <!-- sidebar start -->
    <include file="Common/sidebar" nav="$nav"/>
    <!-- sidebar end -->

    <!-- Start right Content here -->
        <div class="content-page" style="background: white;">
            <!-- Start content -->
            <div class="content">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf">
                    <strong class="am-text-primary am-text-lg">设置</strong> / <small>修改个人信息</small>
                </div>
            </div>
            <div class="am-g">
                <div class="am-u-sm-12">
                    <form class="am-form" action="" method="POST" enctype="multipart/form-data">
                        <input type="hidden" name="id" value="{$info.id}"/>
                        <fieldset>
                            <legend>{$legend}</legend>

                        <?php if ($info['is_business'] == 1) : ?>
                            <div class="am-form-group">
                                <label for="business_name">商户名</label>
                                <input type="text" name="business_name" class="" id="business_name" value="{$info.business_name}" required/>
                            </div>
                        <?php endif;?>

                        <?php if ($info['is_business'] == 1) : ?>
                            <div class="am-form-group">
                                <h3>是否禁用外卖</h3>
                                <label class="am-radio-inline">
                                  <input type="radio" name="is_on_waimai" value="1" data-am-ucheck <?php if ($info['is_on_waimai'] == 1) : ?>checked<?php endif;?>>
                                  启用
                                </label>
                                <label class="am-radio-inline">
                                  <input type="radio" name="is_on_waimai" value="2" data-am-ucheck <?php if ($info['is_on_waimai'] == 2) : ?>checked<?php endif;?>>
                                  禁用
                                </label>
                            </div>
                        <?php endif;?>

                            <div class="am-form-group">
                                <label for="username"><?php if ($info['is_business'] == 1) : ?>联系人<?php else : ?>用户名<?php endif;?></label>
                                <input type="text" name="username" class="" id="username" value="{$info.username}" required <?php if ($info['is_business'] == 1) : ?>readonly<?php endif;?>/>
                            </div>

                            <div class="am-form-group">
                                <label for="picture"><?php if ($info['is_business'] == 1) : ?>商户LOGO(100 * 100)<?php else : ?>用户头像<?php endif;?></label>
                                <input type="file" name="picture" class="" id="picture"/>
                                <?php if (!empty($info['picture'])) : ?>
                                <img src="__UPLOADS__/{$info.picture}" alt="" style="width:100px;height:100px" />
                                <?php endif;?>
                            </div>

                        <?php if ($info['is_business'] == 1) : ?>
                            <div class="am-form-group">
                                <label for="picture_environment">店面环境图片(750 * 480)</label>
                                <input type="file" name="picture_environment" class="" id="picture_environment"/>
                                <?php if (!empty($info['picture_environment'])) : ?>
                                <img src="__UPLOADS__/{$info.picture_environment}" alt="" style="width:200px;height:125px" />
                                <?php endif;?>
                            </div>

                            <div class="am-form-group">
                                <label for="business_phone">联系方式</label>
                                <input type="text" id="business_phone" name="business_phone" value="{$info.business_phone}" required/>
                            </div>

                            <div class="am-form-group">
                                <label for="delivery">配送费</label>
                                <input type="text" id="delivery" name="delivery" value="{$info.delivery}" required/>
                            </div>

                            <div class="am-form-group">
                                <label for="up_to_send">起送费</label>
                                <input type="text" id="up_to_send" name="up_to_send" value="{$info.up_to_send}" required/>
                            </div>

                            <div class="am-form-group">
                                <label for="boxes">餐盒费</label>
                                <input type="text" id="boxes" name="boxes" value="{$info.boxes}" required/>
                            </div>

                            <div class="am-form-group">
                                <label for="business_des">商户介绍</label>
                                <textarea id="business_des" name="business_des" minlength="10" maxlength="100">{$info.business_des}</textarea>
                            </div>

                            <div class="am-form-group">
                                <label for="business_address">商户地址</label>
                                <input type="text" id="business_address" name="business_address" value="{$info.business_address}" required/>
                            </div>

                            <div class="am-form-group">
                                <label for="business_address">经纬度（PS:','为英文的逗号，无空格）</label>
                                <input type="text" name="lnglat" id="lnglat" value="{$info.lnglat}" placeholder="经度,纬度，例：116.440719,23.252995" required="required">
                            </div>
                            <!-- <div id="l_map" style="width: 100%; height: 600px;"></div> -->

                            <div class="am-form-group">
                                <label for="service_time">营业时间</label>
                                <input type="text" name="service_time" id="service_time" value="{$info.service_time}" placeholder="例：9:00~23:00">
                            </div>

                        <?php endif;?>

                            <p>
                                <button type="submit" class="am-btn am-btn-success">提交</button>
                                <input type="reset" class="am-btn am-btn-info" value="重置" style="margin-left:20px" />
                                <a href="javascript:location.href=history.back();">
                                    <input type="button" class="am-btn am-btn-default" value="返回" style="margin-left:20px" />
                                </a>
                            </p>
                        </fieldset>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <!-- content end -->
</div>

<include file="Common/footer" />
</body>
<script type="text/javascript">
    // function loadJScript() {
    //     var script = document.createElement("script");
    //     script.type = "text/javascript";
    //     script.src = "https://api.map.baidu.com/api?v=2.0&ak=gTnpZGuGVTorsYAyIOhwehhRIRj3cKCM&callback=init";
    //     document.body.appendChild(script);
    // }

    // function init() {
    //     var map = new BMap.Map("l_map");
    //     var point = new BMap.Point(116.404, 39.915);
    //     map.centerAndZoom(point,15);
    //     map.enableScrollWheelZoom();//启用滚轮放大缩小
    //     // 创建地址解析器实例
    //     var myGeo = new BMap.Geocoder();

    //     var business_address = $('#business_address').val();
            
    //     // 将地址解析结果显示在地图上,并调整地图视野
    //     myGeo.getPoint(business_address, function(point){
    //         if (point) {
    //             map.centerAndZoom(point, 16);
    //             map.addOverlay(new BMap.Marker(point)); 
    //         }
    //     });

    //     $("#business_address").change('input propertychange', function() {
    //         console.log(1);
    //         var business_address = $(this).val();
    //         console.log(business_address);
    //         // 将地址解析结果显示在地图上,并调整地图视野
    //         myGeo.getPoint(business_address, function(point){
    //             if (point) {
    //                 map.centerAndZoom(point, 16);
    //                 map.addOverlay(new BMap.Marker(point)); 
    //                 $('#lnglat').val(point.lng+','+point.lat)
    //             } else{
    //                 alert("您选择地址没有解析到结果!");
    //             }
    //         });
    //         console.log(2)
    //     });
    // }  

    // window.onload = loadJScript;  //异步加载地图
</script>
</html>