123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542 |
- <?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <?php $shoname_name = D('Home/Front')->get_config_by_name('shoname'); ?>
- <title><?php echo $shoname; ?></title>
- <link rel="shortcut icon" href="" />
-
- <meta name="renderer" content="webkit">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
-
- <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
- <!--[if lt IE 9]>
- <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
- <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
- <![endif]-->
- <link href="./resource/css/bootstrap.min.css?v=201903260001" rel="stylesheet">
- <link href="./resource/css/common.css?v=201903260001" rel="stylesheet">
- <script type="text/javascript">
- window.sysinfo = {
- <?php if (!empty($_W['uniacid']) ){ ?>'uniacid': '<?php echo ($_W['uniacid']); ?>',<?php } ?>
- <?php if( !empty($_W['acid']) ){ ?>'acid': '<?php echo ($_W['acid']); ?>',<?php } ?>
- <?php if (!empty($_W['openid']) ) { ?>'openid': '<?php echo ($_W['openid']); ?>',<?php } ?>
- <?php if( !empty($_W['uid']) ) { ?>'uid': '<?php echo ($_W['uid']); ?>',<?php } ?>
- 'isfounder': <?php if (!empty($_W['isfounder']) ) { ?>1<?php }else{ ?>0<?php } ?>,
- 'siteroot': '<?php echo ($_W['siteroot']); ?>',
- 'siteurl': '<?php echo ($_W['siteurl']); ?>',
- 'attachurl': '<?php echo ($_W['attachurl']); ?>',
- 'attachurl_local': '<?php echo ($_W['attachurl_local']); ?>',
- 'attachurl_remote': '<?php echo ($_W['attachurl_remote']); ?>',
- 'module' : {'url' : '<?php if( defined('MODULE_URL') ) { ?>{MODULE_URL}<?php } ?>', 'name' : '<?php if (defined('IN_MODULE') ) { ?>{IN_MODULE}<?php } ?>'},
- 'cookie' : {'pre': ''},
- 'account' : <?php echo json_encode($_W['account']);?>,
- };
- </script>
-
- <script type="text/javascript" src="./resource/js/lib/jquery-1.11.1.min.js"></script>
- <script type="text/javascript" src="./resource/js/lib/bootstrap.min.js"></script>
- <script type="text/javascript" src="./resource/js/app/util.js?v=201903260001"></script>
- <script type="text/javascript" src="./resource/js/app/common.min.js?v=201903260001"></script>
- <script type="text/javascript" src="./resource/js/require.js?v=201903260001"></script>
- <script type="text/javascript" src="./resource/js/lib/jquery.nice-select.js?v=201903260001"></script>
- <script type="text/javascript" src="/static/js/dist/area/cascade.js"></script>
- <script src="https://map.qq.com/api/js?v=2.exp&key=6R4BZ-WAB3W-JITRG-OE7GY-R2753-P3BZ2" type="text/javascript" charset="utf-8"></script>
- <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
- <link href="/static/css/snailfish.css" rel="stylesheet">
- <style>
- body.dragging, body.dragging * {
- cursor: move !important;
- }
- .dragged {
- position: absolute;
- opacity: 0.5;
- z-index: 2000;
- border: 1px solid #ccc;
- border-radius: 5px;
- background: #fff;
- }
- #sortable li {
- border-top: 1px solid #c5c5c5;
- padding-top: 20px;
- }
- #sortable li:first-child {
- border: 0;
- }
- #sortable li.placeholder {
- position: relative;
- }
- #sortable li.placeholder:before {
- position: absolute;
- }
- </style>
- </head>
- <body layadmin-themealias="default">
- <div class="layui-fluid">
- <div class="layui-card">
- <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text"><?php if( !empty($item['id'])){ ?>编辑<?php }else{ ?>新增<?php } ?>门店<?php if( !empty($item['id'])){ ?>(<?php echo ($item['title']); ?>)<?php } ?></span></div>
- <div class="layui-card-body" style="padding:15px;">
- <form action="" method="post" class="layui-form" lay-filter="component-layui-form-item" enctype="multipart/form-data" >
- <input type="hidden" name="data[id]" value="<?php echo ($item['id']); ?>"/>
- <div class="layui-form-item">
- <label class="layui-form-label"><span style="color:red;">* </span>门店名称</label>
- <div class="layui-input-block">
- <input type="text" id='room_name' name="data[room_name]" class="form-control" value="<?php echo ($item['room_name']); ?>" lay-verify="required">
- </div>
- </div>
- <?php if($supply_id == 0){ ?>
- <div class="layui-form-item">
- <label class="layui-form-label">选择供应商</label>
- <div class="layui-input-block">
- <div class="input-group " style="margin: 0;">
- <input type="text" disabled value="<?php echo ($item['supply_id']); ?>" class="form-control valid" name="data[supply_id]" placeholder="" id="member_id">
- <span class="input-group-btn">
- <span data-input="#member_id" id="chose_member_id" class="btn btn-default">选择供应商</span>
- </span>
- </div>
- <?php if( $item['supply_info']){ ?>
- <div class="input-group " style="margin: 0;">
- <div class="layadmin-text-center choose_user">
- <img style="" src="<?php echo tomedia($item['supply_info']['logo']);?>">
- <div class="layadmin-maillist-img" style=""><?php echo ($item['supply_info']['shopname']); ?></div>
- <button type="button" class="layui-btn layui-btn-sm" onclick="cancle_bind(this)"><i class="layui-icon"></i></button>
- </div>
- </div>
- <?php } ?>
- </div>
- <div class="layui-input-block">
- <span class="layui-form-mid layui-word-aux image-block">备注:新增门店是平台使用的时候不需要选择供应商</span>
- </div>
- </div>
- <?php } ?>
- <div class="layui-form-item">
- <label class="layui-form-label">门店标志图片</label>
- <div class="layui-input-block">
- <?php echo tpl_form_field_image2('data[room_logo]',$item['room_logo']);?>
- <span class="layui-form-mid layui-word-aux image-block">门店标志图片,建议尺寸:1750*1500,数量:1张,支持gif、png、jpg、jpeg格式,大小不超过1M</span>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label"><span style="color:red;">* </span>门店地址</label>
- <div class="layui-input-block">
- <select id="sel-provance" lay-ignore name="data[province_id]" onChange="selectCity();" style="width:130px;display:inline;" lay-verify="required">
- <option value="" selected="true">省/直辖市</option>
- </select>
- <select id="sel-city" lay-ignore name="data[city_id]" onChange="selectcounty(0)" style="width:135px;display:inline;" lay-verify="required">
- <option value="" selected="true">请选择</option>
- </select>
- <select id="sel-area" lay-ignore name="data[country_id]" style="width:130px;display:inline;" lay-verify="required">
- <option value="" selected="true">请选择</option>
- </select>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">门店精确位置</label>
- <div class="layui-input-block">
- <div class="dEdit_1">
- <div class="layui-inline">
- <div class="layui-input-inline" style="width: 200px;">
- <input type="text" style="width: 200px;" name="data[address]" id="address" data-val="true" data-val-required="请填写门店精确位置" class="form-control" value="<?php echo ($item['address']); ?>" data-rule-required="true" />
- </div>
- <div class="layui-input-inline" style="width: 100px;">
- <a class="btn btn-default" id="js_search_pos" onclick="getResult()">搜索地图</a>
- </div>
- <br />
- <div class="layui-form-mid layui-word-aux">地图搜索以后,请点击地图定位进行标记坐标,经纬度出来以后在进行保存,以防设置失效。</div>
- </div>
- </div>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label"><span style="color:red;">* </span>门店经纬度</label>
- <div class="layui-input-block">
- <div class="dEdit_1">
- <div class="layui-inline">
- <div class="layui-input-inline" style="width: 100px;">
- <input class="form-control input-sm" data-val="true" id="lon" name="data[lon]" readonly="readonly" type="text" value="<?php echo ($item['lon']); ?>" lay-verify="required">
- </div>
- <div class="layui-input-inline" style="width: 100px;">
- <input class="form-control input-sm" data-val="true" id="lat" name="data[lat]" readonly="readonly" type="text" value="<?php echo ($item['lat']); ?>" lay-verify="required">
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">门店地图定位</label>
- <div class="layui-input-block">
- <div class="map-box" id="container" style="width: 603px; height: 300px; float: left;"></div>
- <div class="des" id="map_des" style="display: none; float: left;">请选择一个地址并点击地图中的“导入经纬度”</div>
- <div class="info-box" id="infoDiv" style="display: none"></div>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label"><span style="color:red;">* </span>门店联系电话</label>
- <div class="layui-input-block">
- <input type="text" name="data[mobile]" class="form-control" value="<?php echo ($item['mobile']); ?>" lay-verify="required"/>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label"><span style="color:red;">* </span>门店营业时间</label>
- <div class="layui-input-block">
- <div class="input-group fixsingle-input-group">
- <div class="layui-input-inline">
- <input type="text" class="layui-input" name='data[business_hours_begin]' value='<?php echo $item[business_hours_begin];?>' id="business_hour_1" placeholder="HH:mm" lay-key="5" lay-verify="required">
- </div>
- <div class="layui-input-inline" style="width: 20px;">
- 至
- </div>
- <div class="layui-input-inline">
- <input type="text" class="layui-input" name='data[business_hours_end]' value='<?php echo $item[business_hours_end];?>' id="business_hour_2" placeholder="HH:mm" lay-key="6" lay-verify="required">
- </div>
- </div>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label"><span style="color:red;">* </span>联系人</label>
- <div class="layui-input-block">
- <input type="text" name="data[contacts]" class="form-control" value="<?php echo ($item['contacts']); ?>" lay-verify="required"/>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">门店介绍</label>
- <div class="layui-input-block">
- <textarea rows="5" cols="50" class="form-control" name="data[introduction]"><?php echo ($item['introduction']); ?></textarea>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label"><span style="color:red;">* </span>排序</label>
- <div class="layui-input-block">
- <input type="text" name="data[displayorder]" class="form-control" value="<?php echo ($item['displayorder']); ?>" lay-verify="number"/>
- <span class='help-block'>数字越大,排名越靠前</span>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">状态</label>
- <div class="layui-input-block">
- <input type='radio' name='data[state]' title="启用" value=1 <?php if( $item['state']==1 || empty($item)){ ?>checked<?php } ?> />
- <input type='radio' name='data[state]' title="禁用" value=0 <?php if( $item['state']==0 && !empty($item) ){ ?>checked<?php } ?> />
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label"> </label>
- <div class="layui-input-block">
- <input type="submit" value="提交" lay-submit lay-filter="formDemo" class="btn btn-primary" />
-
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- <script src="/layuiadmin/layui/layui.js"></script>
- <script src="/static/js/jquery-sortable.js"></script>
- <script>
- layui.config({
- base: '/layuiadmin/' //静态资源所在路径
- }).extend({
- index: 'lib/index' //主入口模块
- }).use('index');
- </script>
- <script>
- $(function () {
- initMap();//初始化门店地图
- cascdeInit("1","1","<?php echo ($item['province_id']); ?>","<?php echo ($item['city_id']); ?>","<?php echo ($item['country_id']); ?>","0");
- });
- var layer = layui.layer;
- var $;
- var cur_open_div;
- layui.use(['jquery', 'layer','form','laydate'], function(){
- $ = layui.$;
- var form = layui.form;
- var laydate = layui.laydate;
- //时间选择器
- laydate.render({
- elem: '#business_hour_1'
- ,type: 'time'
- ,format: 'HH:mm'
- });
- //时间选择器
- laydate.render({
- elem: '#business_hour_2'
- ,type: 'time'
- ,format: 'HH:mm'
- });
- form.on('radio(linktype)', function(data){
- if (data.value == 2) {
- $('#typeGroup').show();
- } else {
- $('#typeGroup').hide();
- }
- });
- $('#chose_link').click(function(){
- cur_open_div = $(this).attr('data-input');
- $.post("<?php echo U('util.selecturl', array('ok' => 1));?>", {}, function(shtml){
- layer.open({
- type: 1,
- area: '930px',
- content: shtml //注意,如果str是object,那么需要字符拼接。
- });
- });
- });
- $('#chose_member_id').click(function(){
- cur_open_div = $(this).attr('data-input');
- $.post("<?php echo U('supply/zhenquery', array('ok' => 1));?>", {}, function(shtml){
- layer.open({
- type: 1,
- area: '930px',
- content: shtml //注意,如果str是object,那么需要字符拼接。
- });
- });
- })
- var is_post = true;
- //监听提交
- form.on('submit(formDemo)', function(data){
- if(is_post){
- is_post = false;
- $.ajax({
- url: data.form.action,
- type: data.form.method,
- data: data.field,
- dataType:'json',
- success: function (info) {
- if(info.status == 0)
- {
- layer.msg(info.result.message,{icon: 1,time: 2000});
- }else if(info.status == 1){
- var go_url = location.href;
- if( info.result.hasOwnProperty("url") )
- {
- go_url = info.result.url;
- }
- layer.msg('操作成功',{time: 1000,
- end:function(){
- var backurl = "<?php echo U('salesroom/index',array('ok'=>'1'));?>";
- location.href = backurl;
- // location.href = info.result.url;
- }
- });
- }
- }
- });
- }
- return false;
- });
- })
- </script>
- <script>
- $(function () {
- var group = $("#sortable").sortable({
- group: 'limited_drop_targets',
- handle: 'i.fa-arrows-alt',
- onDrop: function ($item, container, _super) {
- console.log(group.sortable("serialize").get().join("\n"));
- $('#sortIpt').val(group.sortable("serialize").get().join("\n"));
- _super($item, container);
- },
- serialize: function (parent, children, isContainer) {
- return isContainer ? children.join() : $(parent).data('id');
- },
- tolerance: 6,
- distance: 10
- });
- });
- </script>
- <script>
- var map, searchService, marker, markers = [], infoWin = null;
- var initMap = function () {
- <?php if( !empty($item['lon']) ){ ?>
- var center = new qq.maps.LatLng(<?php echo ($item['lat']); ?>,<?php echo ($item['lon']); ?>);
- <?php }else{?>
- var center = new qq.maps.LatLng(39.916527, 116.397128);
- <?php }?>
- map = new qq.maps.Map(document.getElementById('container'), {
- center: center,
- zoom: 13
- });
- var scaleControl = new qq.maps.ScaleControl({
- align: qq.maps.ALIGN.BOTTOM_LEFT,
- margin: qq.maps.Size(85, 15),
- map: map
- });
- //调用Poi检索类
- searchService = new qq.maps.SearchService({
- //检索成功的回调函数
- complete: function (results) {
- //设置回调函数参数
- var pois = results.detail.pois;
- infoWin = new qq.maps.InfoWindow({
- map: map
- });
- var latlngBounds = new qq.maps.LatLngBounds();
- for (var i = 0, l = pois.length; i < l; i++) {
- var poi = pois[i];
- //扩展边界范围,用来包含搜索到的Poi点
- latlngBounds.extend(poi.latLng);
- (function (n) {
- var marker = new qq.maps.Marker({
- map: map
- });
- marker.setPosition(pois[n].latLng);
- markers.push(marker);
- qq.maps.event.addListener(marker, 'click', function () {
- infoWin.open();
- infoWin.setContent('<div style = "width:200px;padding:10px 0;">' + pois[n].address + '<div class="map-import-btn"><input type="button" class="btn btn-xs btn-primary" value="导入经纬度" onclick="chooseShopLoc(this);" address=' + pois[n].address + ' lat =' + pois[n].latLng.getLat() + ' lng =' + pois[n].latLng.getLng() + ' /></div></div>');
- infoWin.setPosition(pois[n].latLng);
- });
- })(i);
- }
- //调整地图视野
- map.fitBounds(latlngBounds);
- },
- //若服务请求失败,则运行以下函数
- error: function () {
- alert("很抱歉,未搜索到此地址,请重新输入!");
- }
- });
- }
- function getSelectArea() {
- var storeArr = [];
- var s_province = $('#sel-provance').val();
- var s_city = $('#sel-city').val();
- var s_area = $('#sel-area').val();
- var s_street = $('#sel-street').val();
- if('请选择省份' != s_province)
- {
- storeArr.push(s_province);
- }
- if('请选择城市' != s_city)
- {
- storeArr.push(s_city);
- }
- if('请选择区域' != s_area)
- {
- storeArr.push(s_area);
- }
- if('请选择街道/镇' != s_street && '' != s_street)
- {
- storeArr.push(s_street);
- }
- $("#area-selector select").each(function (i) {
- if ($(this).find("option:selected").text() != '请选择') {
- storeArr.push($(this).find("option:selected").text());
- }
- });
- return storeArr;
- }
- //查询社区信息
- function chooseShopLoc(t) {
- var address = $(t).attr("address");
- var storeAreaArr = getSelectArea();
- for (var i = 3; i >= 0; i--) {
- if (i == 0)
- {
- address = address.replace(storeAreaArr[0] + "市", '');
- }
- address = address.replace(storeAreaArr[i], '');
- }
- var lat = $(t).attr("lat");
- var lng = $(t).attr("lng");
- this.clearMarkers();
- var position = new qq.maps.LatLng(lat, lng);
- marker = new qq.maps.Marker({
- map: map,
- position: position,
- draggable: true
- });
- map.panTo(position);
- map.zoomTo(18);
- $("#lon").val(lng);
- $("#lat").val(lat);
- qq.maps.event.addListener(marker, 'dragend', function () {
- if (marker.getPosition()) {
- $("#lon").val(marker.getPosition().getLng());
- $("#lat").val(marker.getPosition().getLat());
- }
- });
- if (infoWin) {
- infoWin.close();
- }
- $("#map_des").hide();
- }
- ////删除所有标记
- function clearMarkers() {
- if (markers) {
- for (i = 0; i < markers.length; i++) {
- markers[i].setMap(null);
- }
- markers.length = 0;
- }
- }
- //搜索地址,这里需要判断是否选择了省市区
- function getResult() {
- if ($("#AddressId").val() <= 0) {
- // $.dialog.tips("请先选择店铺地址");
- return;
- }
- if ($.trim($("#address").val()).length == 0) {
- //tip.msgbox.err('请先输入详细地址');
- layer.msg('请先输入详细地址',{icon: 1,time: 2000});
- return;
- }
- if (marker != null) marker.setMap(null);
- clearMarkers();
- if (infoWin) {
- infoWin.close();
- }
- var storeArr = getSelectArea();
- var regions = storeArr[0] + storeArr[1] + storeArr[2];
- var regionText = storeArr.join(',');
- var poiText = regions + $.trim($("#address").val());
- //searchService.setLocation(regionText);
- searchService.setLocation(storeArr[1]);
- searchService.search(poiText);
- $("#map_des").show();
- }
- require(['bootstrap'],function(){
- $('#myTab a').click(function (e) {
- e.preventDefault();
- $('#tab').val( $(this).attr('href'));
- $(this).tab('show');
- })
- });
- function showbacktype(type){
- $('.backtype').hide();
- $('.backtype' + type).show();
- }
- function cancle_bind(obj,id)
- {
- $('#member_id').val('');
- $(obj).parent().parent().remove();
- }
- </script>
- </body>
- </html>
|