You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

202 lines
8.6 KiB

  1. <?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>编辑酒店信息</title>
  6. <link rel="stylesheet" type="text/css" href="/monitor/Public/css/bootstrap.min.css" />
  7. <link rel="stylesheet" type="text/css" href="/monitor/Public/css/style.css" />
  8. </head>
  9. <body onload="load()">
  10. <div class="panel panel-default" style="width: 1348px;">
  11. <div class="panel-heading">
  12. <div class="row">
  13. <div class="col-sm-10">
  14. <h2 class="panel-title">
  15. 编辑酒店信息
  16. </h2>
  17. </div>
  18. </div>
  19. </div>
  20. <div class="panel-body">
  21. <!-- <form action="/monitor/index.php/Monitor/monitorAdd" method="post">-->
  22. <input type="hidden" name="rid" id="rid" value="<?php if(!empty($edit)): echo ($edit["rid"]); else: endif; ?>">
  23. <input type="hidden" name="hid" id="hid" value="<?php if(!empty($edit)): echo ($edit["hid"]); else: endif; ?>">
  24. <div class="form-horizontal">
  25. <div class="form-group row">
  26. <label class="col-md-2 control-label">网站名称:</label>
  27. <div class="col-md-8 control-label ">
  28. <select class="form-control" id="site_name">
  29. <?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>
  30. <?php else: ?>
  31. <option value="<?php echo ($vo["id"]); ?>" selected="selected" ><?php echo ($vo["site_name"]); ?></option><?php endif; ?>
  32. <?php else: ?>
  33. <?php if(($vo["id"] == 1) OR ($vo["id"] == 12)): ?><option value="<?php echo ($vo["id"]); ?>" ><?php echo ($vo["site_name"]); ?>(开发中)</option>
  34. <?php else: ?>
  35. <option value="<?php echo ($vo["id"]); ?>" ><?php echo ($vo["site_name"]); ?></option><?php endif; endif; endforeach; endif; ?>
  36. </select>
  37. </div>
  38. </div>
  39. <div class="form-group row">
  40. <label class="col-md-2 control-label">酒店名称:</label>
  41. <div class="col-md-8">
  42. <input class="form-control" type="text" id="hotel_name" value="<?php if(!empty($edit)): echo ($edit["hotel_name"]); else: endif; ?>" required="required"/>
  43. </div>
  44. </div>
  45. <div class="form-group row">
  46. <label class="col-md-2 control-label">日期:</label>
  47. <div class="col-md-8 ">
  48. <input class="form-control" type="text" id="query_date" value="<?php if(!empty($edit)): echo ($edit["query_date"]); else: endif; ?>" required="required" readonly/>
  49. </div>
  50. </div>
  51. <div class="form-group row">
  52. <label class="col-md-2 control-label">房间类型:</label>
  53. <div class="col-md-8 ">
  54. <input class="form-control" type="text" id="room_type" value="<?php if(!empty($edit)): echo ($edit["room_type"]); else: endif; ?>" required="required" readonly/>
  55. </div>
  56. </div>
  57. <div class="form-group row">
  58. <label class="col-md-2 control-label">URL:</label>
  59. <div class="col-md-8 ">
  60. <input class="form-control" type="text" id="url_addr" value="<?php if(!empty($edit)): echo ($edit["url"]); else: endif; ?>" required="required"/>
  61. </div>
  62. </div>
  63. <div class="form-group row">
  64. <label class="col-md-2 control-label">price:</label>
  65. <div class="col-md-8 ">
  66. <input class="form-control" type="text" id="price" value="<?php if(!empty($edit)): echo ($edit["room_price"]); else: endif; ?>" required="required"/>
  67. </div>
  68. </div>
  69. <div class="form-group row">
  70. <label class="col-md-2 control-label">有无早餐:</label>
  71. <div class="col-md-4 control-label">
  72. <?php if(!empty($edit)): if($edit["breakfast"] == 0): ?><label ><input name="breakfast" type="radio" checked="checked" value="0" onclick="fn(0)"/>无早</label>
  73. <label ><input name="breakfast" type="radio" value="1" onclick="fn(1)"/>单早</label>
  74. <label ><input name="breakfast" type="radio" value="2" onclick="fn(2)"/>双早</label>
  75. <label ><input name="breakfast" type="radio" value="3" onclick="fn(3)"/>三早</label>
  76. <?php elseif($edit["breakfast"] == 1): ?>
  77. <label ><input name="breakfast" type="radio" value="0" onclick="fn(0)"/>无早</label>
  78. <label ><input name="breakfast" type="radio" checked="checked" value="1" onclick="fn(1)"/>单早</label>
  79. <label ><input name="breakfast" type="radio" value="2" onclick="fn(2)"/>双早</label>
  80. <label ><input name="breakfast" type="radio" value="3" onclick="fn(3)"/>三早</label>
  81. <?php elseif($edit["breakfast"] == 2): ?>
  82. <label ><input name="breakfast" type="radio" value="0" onclick="fn(0)"/>无早</label>
  83. <label ><input name="breakfast" type="radio" value="1" onclick="fn(1)"/>单早</label>
  84. <label ><input name="breakfast" type="radio" checked="checked" value="2" onclick="fn(2)"/>双早</label>
  85. <label ><input name="breakfast" type="radio" value="3" onclick="fn(3)"/>三早</label>
  86. <?php elseif($edit["breakfast"] == 3): ?>
  87. <label ><input name="breakfast" type="radio" value="0" onclick="fn(0)"/>无早</label>
  88. <label ><input name="breakfast" type="radio" value="1" onclick="fn(1)"/>单早</label>
  89. <label ><input name="breakfast" type="radio" value="2" onclick="fn(2)"/>双早</label>
  90. <label ><input name="breakfast" type="radio" checked="checked" value="3" onclick="fn(3)"/>三早</label>
  91. <?php else: ?>
  92. <label ><input name="breakfast" type="radio" checked="checked" value="0" onclick="fn(0)"/>无早</label>
  93. <label ><input name="breakfast" type="radio" value="1" onclick="fn(1)"/>单早</label>
  94. <label ><input name="breakfast" type="radio" value="2" onclick="fn(2)"/>双早</label>
  95. <label ><input name="breakfast" type="radio" value="3" onclick="fn(3)"/>三早</label><?php endif; ?>
  96. <?php else: ?>
  97. <label ><input name="breakfast" type="radio" checked="checked" value="0" onclick="fn(0)"/>无早</label>
  98. <label ><input name="breakfast" type="radio" value="1" onclick="fn(1)"/>单早</label>
  99. <label ><input name="breakfast" type="radio" value="2" onclick="fn(2)"/>双早</label>
  100. <label ><input name="breakfast" type="radio" value="3" onclick="fn(3)"/>三早</label><?php endif; ?>
  101. </div>
  102. </div>
  103. <div class="form-group row">
  104. <div class="col-md-5">
  105. </div>
  106. <div class="col-md-2">
  107. <input class="form-control" type="button" value="保存" onclick="save()"></input>
  108. </div>
  109. </div>
  110. </div>
  111. <!-- </form>-->
  112. </div>
  113. </div>
  114. </body>
  115. <script type="text/javascript" src="/monitor/Public/js/json2.js"></script>
  116. <script type="text/javascript" src="/monitor/Public/js/jquery.1.11.js"></script>
  117. <script type="text/javascript">
  118. var breakfast=0;
  119. function load(){
  120. var edit = '<?php echo ($edit); ?>';
  121. if(edit){
  122. breakfast='<?php echo ($edit["breakfast"]); ?>';
  123. }else{
  124. breakfast=0;
  125. }
  126. }
  127. function save(){
  128. var rid = $("#rid").val();
  129. var hid = $("#hid").val();
  130. var site_name = $("#site_name").val();
  131. site_name = site_name.replace(/(^\s*)|(\s*$)/g, "");
  132. var hotel_name = $("#hotel_name").val();
  133. hotel_name = hotel_name.replace(/(^\s*)|(\s*$)/g, "");
  134. var room_type = $("#room_type").val();
  135. room_type = room_type.replace(/(^\s*)|(\s*$)/g, "");
  136. var url_addr = $("#url_addr").val();
  137. url_addr = url_addr.replace(/(^\s*)|(\s*$)/g, "");
  138. var p = $("#price").val();
  139. if(!hotel_name || hotel_name == ''){
  140. alert("酒店名称不能为空");
  141. return;
  142. }
  143. if(!room_type || room_type == ''){
  144. alert("房间类型不能为空");
  145. return;
  146. }
  147. if(!url_addr || url_addr == ''){
  148. alert("url地址不能为空");
  149. return;
  150. }
  151. if(!p || p == ''){
  152. alert("价格不能为空");
  153. return;
  154. }
  155. var posturl='/monitor/index.php/Monitor/monitorAdd';
  156. $.ajax({
  157. type: 'POST',
  158. url: posturl,
  159. data: {
  160. id: rid,
  161. hid: hid,
  162. site_name: site_name,
  163. hotel_name: hotel_name,
  164. room_type: room_type,
  165. url_addr: url_addr,
  166. price: p,
  167. breakfast: breakfast
  168. },
  169. dataType: 'json',
  170. context: $('body'),
  171. success: function (data) {
  172. alert(data.info);
  173. },
  174. error: function (xhr, type) {
  175. var data = $.parseJSON(xhr.responseText);
  176. alert(data.message);
  177. }
  178. });
  179. }
  180. function clearNoNum(obj){
  181. //先把非数字的都替换掉,除了数字和.
  182. obj.value = obj.value.replace(/[^\d.]/g,"");
  183. //必须保证第一个为数字而不是.
  184. obj.value = obj.value.replace(/^\./g,"");
  185. //保证只有出现一个.而没有多个.
  186. obj.value = obj.value.replace(/\.{2,}/g,".");
  187. //保证.只出现一次,而不能出现两次以上
  188. obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
  189. }
  190. function fn(v){
  191. breakfast=v;
  192. }
  193. </script>
  194. </html>