|
- <?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" />
- <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">
- function saveAll(){
- var str = '<?php echo ($json); ?>';
- var list = eval(str);
- var p='';
- for (var i=0; i<list.length; i++){
- var id = list[i].id;
- var price1 = list[i].room_price;
- var price2 = $("#price_"+id).val();
- if(Math.abs(price1 - price2) > 1e-6 || Math.abs(price2 - price1) > 1e-6){
- if(!p || p == ''){
- p += price2 +"P"+id;
- }else{
- p += "|"+price2 +"P"+id;
- }
- }
- }
- if(!p || p == ''){
- return;
- }
- var r=confirm("确认批量保存!")
- if (r==true){
- var geturl='/monitor/index.php/Monitor/monitorSaveAll';
- $.ajax({
- type: 'GET',
- url: geturl,
- data: {
- price: p
- },
- dataType: 'json',
- context: $('body'),
- success: function (data) {
- alert(data.info);
- },
- error: function (xhr, type) {
- var data = $.parseJSON(xhr.responseText);
- alert(data.message);
- }
- });
- }else{
-
- }
- }
- function priceAll(){
- var str = '<?php echo ($json); ?>';
- var list = eval(str);
- var arr = new Array();
- var items = document.getElementsByName("Fruit");
- for (i = 0; i < items.length; i++) {
- if (items[i].checked) {
- arr.push(items[i].value);
- }
- }
- if(arr.length <= 0){
- alert("请选择星期");
- return;
- }
- var price = $("#priceAll").val();
- if(!price || price == ''){
- alert("价格不能为空");
- return;
- }
- var p='';
- for (var i=0; i<list.length; i++){
- var id = list[i].id;
- for(var j=0; j<arr.length; j++){
- if(parseInt(arr[j]) == parseInt(list[i].dwk)){
- if(!p || p == ''){
- p += price +"P"+id;
- }else{
- p += "|"+price +"P"+id;
- }
- }
- }
- }
- if(!p || p == ''){
- alert("价格不能为空");
- return;
- }
- var r=confirm("确认批量保存!")
- if (r==true){
- var geturl='/monitor/index.php/Monitor/monitorSaveAll';
- $.ajax({
- type: 'GET',
- url: geturl,
- data: {
- price: p
- },
- dataType: 'json',
- context: $('body'),
- success: function (data) {
- alert(data.info);
- },
- error: function (xhr, type) {
- var data = $.parseJSON(xhr.responseText);
- alert(data.message);
- }
- });
- }else{
-
- }
- }
- function save(id){
- var price = $("#price_"+id).val();
- var geturl='/monitor/index.php/Monitor/monitorSave';
- $.ajax({
- type: 'GET',
- url: geturl,
- data: {
- id: id,
- price: price
- },
- dataType: 'json',
- context: $('body'),
- success: function (data) {
- alert(data.info);
- },
- error: function (xhr, type) {
- var data = $.parseJSON(xhr.responseText);
- alert(data.message);
- }
- });
- }
- function del(id){
- var r=confirm("确认删除!")
- if (r==true){
- var geturl='/monitor/index.php/Monitor/monitorDelete';
- $.ajax({
- type: 'GET',
- url: geturl,
- data: {
- id: id
- },
- dataType: 'json',
- context: $('body'),
- success: function (data) {
- if(data.errorCode == 0){
- location.reload(true);
- }else{
- alert(data.info);
- }
- },
- error: function (xhr, type) {
- var data = $.parseJSON(xhr.responseText);
- alert(data.message);
- }
- });
- }else{
-
- }
- }
- 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("$#$",".");
- }
- </script>
- </head>
- <body>
- <div class="panel panel-default" style="width: 1348px;">
- <div class="panel-heading">
- <div class="row">
- <div class="col-sm-10">
- <h2 class="panel-title padding_title">极速比价</h2>
- </div>
- <div class="col-sm-2">
- </div>
- </div>
- </div>
- <div class="panel-body">
- <form class="form-horizontal" action="/monitor/index.php/monitor/priceList" method="get">
- <div class="form-group">
- <div class="row">
- <label class="col-md-1 control-label">网站:</label>
- <div class="col-md-2">
- <select class="form-control" id="site" name="site_name">
- <?php if(is_array($site)): foreach($site as $key=>$vo): if($site_name == $vo['id']): if(($vo["id"] == 12) OR ($vo["id"] == 19)): ?><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"] == 12) OR ($vo["id"] == 19)): ?><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>
- <label class="col-md-1 control-label">酒店名称:</label>
- <input type="text" name="hotel_name" class="col-md-2 form-control" style ="display: inline; width: inherit;" placeholder="酒店名称" <?php if(!empty($hotel_name)): ?>value="<?php echo ($hotel_name); ?>"<?php endif; ?>/>
- <label class="col-md-1 control-label">房间类型:</label>
- <input type="text" name="room_type" class="col-md-2 form-control" style ="display: inline; width: inherit;" placeholder="房间类型" <?php if(!empty($room_type)): ?>value="<?php echo ($room_type); ?>"<?php endif; ?>/>
- <label class="col-md-1 control-label">早餐:</label>
- <div class="col-md-2">
- <select class="form-control" id="breakfast_type" name="breakfast_type">
- <option value="-1" selected="selected" >所有</option>
- <?php if($breakfast == 0): ?><option value="0" selected="selected" >无早</option>
- <?php else: ?>
- <option value="0">无早</option><?php endif; ?>
- <?php if($breakfast == 1): ?><option value="1" selected="selected" >单早</option>
- <?php else: ?>
- <option value="1">单早</option><?php endif; ?>
- <?php if($breakfast == 2): ?><option value="2" selected="selected" >双早</option>
- <?php else: ?>
- <option value="2">双早</option><?php endif; ?>
- <?php if($breakfast == 3): ?><option value="3" selected="selected" >三早</option>
- <?php else: ?>
- <option value="3">三早</option><?php endif; ?>
- </select>
- </div>
- </div>
- <div class="row" style ="margin-top:30px; margin-left:5px">
- <label class="col-md-1 control-label">开始日期:</label>
- <input type="date" name="start_time" class="col-md-2 form-control" style ="display: inline; width: inherit;"
- <?php if(!empty($start_time)): ?>value="<?php echo ($start_time); ?>"<?php endif; ?>/>
- <label class="col-md-1 control-label" style ="margin-left:20px">结束日期:</label>
- <input type="date" name="end_time" class="col-md-2 form-control" style ="display: inline; width: inherit;"
- <?php if(!empty($end_time)): ?>value="<?php echo ($end_time); ?>"<?php endif; ?>/>
- <label class="col-md-1 control-label">数据类型:</label>
- <div class="col-md-2">
- <select class="form-control" id="date_type" name="date_type">
- <?php if($date_type == 0): ?><option value="0" selected="selected" >劣势价格</option>
- <option value="1">其他价格</option>
- <?php elseif($date_type == 1): ?>
- <option value="0">劣势价格</option>
- <option value="1" selected="selected">其他价格</option>
- <?php else: ?>
- <option value="0" selected="selected" >劣势价格</option>
- <option value="1">其他价格</option><?php endif; ?>
- </select>
- </div>
- <div class="col-md-1">
- <button type="submit" class="btn btn-default">查询</button>
- </div>
- <div class="col-md-1">
- <a class="btn btn-default" onclick="saveAll()">一键保存</a>
- </div>
- </div>
- </div>
- </form>
- <div class="row">
- <label class="col-md-1"><input name="Fruit" type="checkbox" value="0" />星期日 </label>
- <label class="col-md-1"><input name="Fruit" type="checkbox" value="1" />星期一 </label>
- <label class="col-md-1"><input name="Fruit" type="checkbox" value="2" />星期二</label>
- <label class="col-md-1"><input name="Fruit" type="checkbox" value="3" />星期三 </label>
- <label class="col-md-1"><input name="Fruit" type="checkbox" value="4" />星期四</label>
- <label class="col-md-1"><input name="Fruit" type="checkbox" value="5" />星期五</label>
- <label class="col-md-1"><input name="Fruit" type="checkbox" value="6" />星期六 </label>
- <input class="col-md-2" id="priceAll" onkeyup="clearNoNum(this)" maxlength="8" value=""></input>
- <div class="col-md-1"><a class="btn btn-default" onclick="priceAll()">批量修改</a></div>
- </div>
- <table class="table table-hover" >
- <thead class="navbar-inner">
- <tr>
- <th>ID</th>
- <th>网站名称</th>
- <th>酒店名称</th>
- <th>房间类型</th>
- <th>有/无早餐</th>
- <th>查询时间</th>
- <th>本地价格</th>
- <th>网站价格</th>
- <th>保存</th>
- <th>删除</th>
- </tr>
- </thead>
- <tbody>
- <?php if(is_array($list)): foreach($list as $key=>$vo): ?><tr>
- <td><?php echo ($vo["id"]); ?></td>
- <td><?php echo ($vo["site_name"]); ?></td>
- <td><a href="<?php echo ($vo["url"]); ?>"><?php echo ($vo["hotel_name"]); ?></a></td>
- <td><?php echo ($vo["room_type"]); ?></td>
- <?php if(($vo["breakfast"] == 0)): ?><td>无早</td>
- <?php elseif(($vo["breakfast"] == 1)): ?>
- <td>单早</td>
- <?php elseif(($vo["breakfast"] == 2)): ?>
- <td>双早</td>
- <?php elseif(($vo["breakfast"] == 3)): ?>
- <td>三早</td>
- <?php else: ?>
- <td>无早</td><?php endif; ?>
- <td><?php echo ($vo["query_date"]); ?></script></td>
- <td><input id="price_<?php echo ($vo["id"]); ?>" style="color:red" onkeyup="clearNoNum(this)" maxlength="8" value="<?php echo ($vo["room_price"]); ?>"></input></td>
- <td><?php echo ($vo["site_price"]); ?></td>
- <td><a onclick="save(<?php echo ($vo["id"]); ?>)">保存</a></td>
- <td><a onclick="del(<?php echo ($vo["id"]); ?>)">删除</a></td>
- </tr><?php endforeach; endif; ?>
-
- </tbody>
- </table>
- </div>
- </div>
- </body>
- </html>
|