|
- <?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8" />
- <title>编辑酒店信息</title>
- <link rel="stylesheet" type="text/css" href="/monitor/Public/css/bootstrap.min.css" />
- <link rel="stylesheet" type="text/css" href="/monitor/Public/css/style.css" />
- </head>
- <body onload="load()">
- <div class="panel panel-default" style="width: 1348px;">
- <div class="panel-heading">
- <div class="row">
- <div class="col-sm-10">
- <h2 class="panel-title">
- 编辑酒店信息
- </h2>
- </div>
- </div>
- </div>
- <div class="panel-body">
- <!-- <form action="/monitor/index.php/Monitor/monitorAdd" method="post">-->
-
- <input type="hidden" name="rid" id="rid" value="<?php if(!empty($edit)): echo ($edit["rid"]); else: endif; ?>">
- <input type="hidden" name="hid" id="hid" value="<?php if(!empty($edit)): echo ($edit["hid"]); else: endif; ?>">
- <div class="form-horizontal">
- <div class="form-group row">
- <label class="col-md-2 control-label">网站名称:</label>
- <div class="col-md-8 control-label ">
- <select class="form-control" id="site_name">
- <?php if(is_array($site)): foreach($site as $key=>$vo): if((!empty($edit)) AND ($vo["site_name"] == $edit['site_name'])): if(($vo["id"] == 1) OR ($vo["id"] == 12)): ?><option value="<?php echo ($vo["id"]); ?>" selected="selected" ><?php echo ($vo["site_name"]); ?>(开发中)</option>
- <?php else: ?>
- <option value="<?php echo ($vo["id"]); ?>" selected="selected" ><?php echo ($vo["site_name"]); ?></option><?php endif; ?>
- <?php else: ?>
- <?php if(($vo["id"] == 1) OR ($vo["id"] == 12)): ?><option value="<?php echo ($vo["id"]); ?>" ><?php echo ($vo["site_name"]); ?>(开发中)</option>
- <?php else: ?>
- <option value="<?php echo ($vo["id"]); ?>" ><?php echo ($vo["site_name"]); ?></option><?php endif; endif; endforeach; endif; ?>
-
-
- </select>
- </div>
- </div>
- <div class="form-group row">
- <label class="col-md-2 control-label">酒店名称:</label>
- <div class="col-md-8">
- <input class="form-control" type="text" id="hotel_name" value="<?php if(!empty($edit)): echo ($edit["hotel_name"]); else: endif; ?>" required="required"/>
- </div>
- </div>
- <div class="form-group row">
- <label class="col-md-2 control-label">日期:</label>
- <div class="col-md-8 ">
- <input class="form-control" type="text" id="query_date" value="<?php if(!empty($edit)): echo ($edit["query_date"]); else: endif; ?>" required="required" readonly/>
- </div>
- </div>
- <div class="form-group row">
- <label class="col-md-2 control-label">房间类型:</label>
- <div class="col-md-8 ">
- <input class="form-control" type="text" id="room_type" value="<?php if(!empty($edit)): echo ($edit["room_type"]); else: endif; ?>" required="required" readonly/>
- </div>
- </div>
- <div class="form-group row">
- <label class="col-md-2 control-label">URL:</label>
- <div class="col-md-8 ">
- <input class="form-control" type="text" id="url_addr" value="<?php if(!empty($edit)): echo ($edit["url"]); else: endif; ?>" required="required"/>
- </div>
- </div>
- <div class="form-group row">
- <label class="col-md-2 control-label">price:</label>
- <div class="col-md-8 ">
- <input class="form-control" type="text" id="price" value="<?php if(!empty($edit)): echo ($edit["room_price"]); else: endif; ?>" required="required"/>
- </div>
- </div>
- <div class="form-group row">
- <label class="col-md-2 control-label">有无早餐:</label>
- <div class="col-md-4 control-label">
- <?php if(!empty($edit)): if($edit["breakfast"] == 0): ?><label ><input name="breakfast" type="radio" checked="checked" value="0" onclick="fn(0)"/>无早</label>
- <label ><input name="breakfast" type="radio" value="1" onclick="fn(1)"/>单早</label>
- <label ><input name="breakfast" type="radio" value="2" onclick="fn(2)"/>双早</label>
- <label ><input name="breakfast" type="radio" value="3" onclick="fn(3)"/>三早</label>
- <?php elseif($edit["breakfast"] == 1): ?>
- <label ><input name="breakfast" type="radio" value="0" onclick="fn(0)"/>无早</label>
- <label ><input name="breakfast" type="radio" checked="checked" value="1" onclick="fn(1)"/>单早</label>
- <label ><input name="breakfast" type="radio" value="2" onclick="fn(2)"/>双早</label>
- <label ><input name="breakfast" type="radio" value="3" onclick="fn(3)"/>三早</label>
- <?php elseif($edit["breakfast"] == 2): ?>
- <label ><input name="breakfast" type="radio" value="0" onclick="fn(0)"/>无早</label>
- <label ><input name="breakfast" type="radio" value="1" onclick="fn(1)"/>单早</label>
- <label ><input name="breakfast" type="radio" checked="checked" value="2" onclick="fn(2)"/>双早</label>
- <label ><input name="breakfast" type="radio" value="3" onclick="fn(3)"/>三早</label>
- <?php elseif($edit["breakfast"] == 3): ?>
- <label ><input name="breakfast" type="radio" value="0" onclick="fn(0)"/>无早</label>
- <label ><input name="breakfast" type="radio" value="1" onclick="fn(1)"/>单早</label>
- <label ><input name="breakfast" type="radio" value="2" onclick="fn(2)"/>双早</label>
- <label ><input name="breakfast" type="radio" checked="checked" value="3" onclick="fn(3)"/>三早</label>
- <?php else: ?>
- <label ><input name="breakfast" type="radio" checked="checked" value="0" onclick="fn(0)"/>无早</label>
- <label ><input name="breakfast" type="radio" value="1" onclick="fn(1)"/>单早</label>
- <label ><input name="breakfast" type="radio" value="2" onclick="fn(2)"/>双早</label>
- <label ><input name="breakfast" type="radio" value="3" onclick="fn(3)"/>三早</label><?php endif; ?>
- <?php else: ?>
- <label ><input name="breakfast" type="radio" checked="checked" value="0" onclick="fn(0)"/>无早</label>
- <label ><input name="breakfast" type="radio" value="1" onclick="fn(1)"/>单早</label>
- <label ><input name="breakfast" type="radio" value="2" onclick="fn(2)"/>双早</label>
- <label ><input name="breakfast" type="radio" value="3" onclick="fn(3)"/>三早</label><?php endif; ?>
- </div>
- </div>
- <div class="form-group row">
- <div class="col-md-5">
- </div>
- <div class="col-md-2">
- <input class="form-control" type="button" value="保存" onclick="save()"></input>
- </div>
- </div>
- </div>
- <!-- </form>-->
-
-
-
-
- </div>
- </div>
- </body>
- <script type="text/javascript" src="/monitor/Public/js/json2.js"></script>
- <script type="text/javascript" src="/monitor/Public/js/jquery.1.11.js"></script>
- <script type="text/javascript">
- var breakfast=0;
- function load(){
- var edit = '<?php echo ($edit); ?>';
- if(edit){
- breakfast='<?php echo ($edit["breakfast"]); ?>';
- }else{
- breakfast=0;
- }
- }
- function save(){
- var rid = $("#rid").val();
- var hid = $("#hid").val();
- var site_name = $("#site_name").val();
- site_name = site_name.replace(/(^\s*)|(\s*$)/g, "");
- var hotel_name = $("#hotel_name").val();
- hotel_name = hotel_name.replace(/(^\s*)|(\s*$)/g, "");
- var room_type = $("#room_type").val();
- room_type = room_type.replace(/(^\s*)|(\s*$)/g, "");
- var url_addr = $("#url_addr").val();
- url_addr = url_addr.replace(/(^\s*)|(\s*$)/g, "");
- var p = $("#price").val();
- if(!hotel_name || hotel_name == ''){
- alert("酒店名称不能为空");
- return;
- }
- if(!room_type || room_type == ''){
- alert("房间类型不能为空");
- return;
- }
- if(!url_addr || url_addr == ''){
- alert("url地址不能为空");
- return;
- }
- if(!p || p == ''){
- alert("价格不能为空");
- return;
- }
- var posturl='/monitor/index.php/Monitor/monitorAdd';
- $.ajax({
- type: 'POST',
- url: posturl,
- data: {
- id: rid,
- hid: hid,
- site_name: site_name,
- hotel_name: hotel_name,
- room_type: room_type,
- url_addr: url_addr,
- price: p,
- breakfast: breakfast
- },
- dataType: 'json',
- context: $('body'),
- success: function (data) {
- alert(data.info);
- },
- error: function (xhr, type) {
- var data = $.parseJSON(xhr.responseText);
- alert(data.message);
- }
- });
-
- }
- function clearNoNum(obj){
- //先把非数字的都替换掉,除了数字和.
- obj.value = obj.value.replace(/[^\d.]/g,"");
- //必须保证第一个为数字而不是.
- obj.value = obj.value.replace(/^\./g,"");
- //保证只有出现一个.而没有多个.
- obj.value = obj.value.replace(/\.{2,}/g,".");
- //保证.只出现一次,而不能出现两次以上
- obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
- }
- function fn(v){
- breakfast=v;
- }
- </script>
- </html>
|