<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
	<link href="__STATIC__/css/admin/style.css" rel="stylesheet"/>
	<title><?php echo L('website_manage');?></title>
	<script>
	var URL = '__URL__';
	var SELF = '__SELF__';
	var ROOT_PATH = '__ROOT__';
	var APP	 =	 '__APP__';
	//语言项目
	var lang = new Object();
	<?php $_result=L('js_lang');if(is_array($_result)): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): $mod = ($i % 2 );++$i;?>lang.<?php echo ($key); ?> = "<?php echo ($val); ?>";<?php endforeach; endif; else: echo "" ;endif; ?>
	</script>
</head>

<body>
<div id="J_ajax_loading" class="ajax_loading"><?php echo L('ajax_loading');?></div>
<?php if(($sub_menu != '') OR ($big_menu != '')): ?><div class="subnav">
    <div class="content_menu ib_a blue line_x">
    	<?php if(!empty($big_menu)): ?><a class="add fb J_showdialog" href="javascript:void(0);" data-uri="<?php echo ($big_menu["iframe"]); ?>" data-title="<?php echo ($big_menu["title"]); ?>" data-id="<?php echo ($big_menu["id"]); ?>" data-width="<?php echo ($big_menu["width"]); ?>" data-height="<?php echo ($big_menu["height"]); ?>"><em><?php echo ($big_menu["title"]); ?></em></a>　<?php endif; ?>
        <?php if(!empty($sub_menu)): if(is_array($sub_menu)): $key = 0; $__LIST__ = $sub_menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): $mod = ($key % 2 );++$key; if($key != 1): ?><span>|</span><?php endif; ?>
        <a href="<?php echo U($val['module_name'].'/'.$val['action_name'],array('menuid'=>$menuid)); echo ($val["data"]); ?>" class="<?php echo ($val["class"]); ?>"><em><?php echo L($val['name']);?></em></a><?php endforeach; endif; else: echo "" ;endif; endif; ?>
    </div>
</div><?php endif; ?>
<div class="subnav">
    <h1 class="title_2 line_x">采集器修改</h1>
</div>
<div class="pad_lr_10" >
    <form id="info_form" action="<?php echo U('robots/edit');?>" name="searchform" method="post" >
    <table width="100%" cellspacing="0" class="table_form">
        <tbody>
			<tr>
                <th width="150"><?php echo L('tbk_name');?>：</th>
                <td>
                    <input name="name" type="text" id="J_name" class="input-text" size="20" value="<?php echo ($info["name"]); ?>"/>
                    <span class="gray ml10"><?php echo L('tbk_name_desc');?></span>
                </td>
            </tr>
			 <tr>
				<th><font color="red">[新]</font>&nbsp; 采集模式：</th>
				<td>
					<input type="radio" value="0" name="http_mode" class="radio" id="api_mod" <?php if($info["http_mode"] == '0'): ?>checked<?php endif; ?>>
                    <label for="api_mod" class="radio_lalel">API采集</label>&nbsp;&nbsp;&nbsp;
                    <input type="radio" value="1" name="http_mode" id="tb_mod" class="radio"  <?php if($info["http_mode"] == '1'): ?>checked<?php endif; ?>>
                    <label for="tb_mod" class="radio_lalel">淘宝网采集</label>
				</td>
			</tr>
            <tr class="api_mod">
                <th><?php echo L('tbk_item_cate');?>：</th>
                <td>
                    <select class="J_tbcats mr10">
                        <option value="0">--<?php echo L('all');?>--</option>
                        <?php if(is_array($items_cate)): $i = 0; $__LIST__ = $items_cate;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$cate): $mod = ($i % 2 );++$i;?><option value="<?php echo ($cate["cid"]); ?>" <?php if($cate["cid"] == $info.cid): ?>selected<?php endif; ?> ><?php echo ($cate["name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                    </select>
                    <input type="hidden" id="J_cid" name="cid" value="<?php echo ($info["cid"]); ?>">
                    <span class="gray ml10">API的分类ID</span>
                </td>
            </tr>
			<tr class="tb_mod">
                <th>淘宝商品分类ID：</th>
                <td>
                    <input name="tb_cid" type="text" class="input-text" size="35" value="<?php echo ($info["tb_cid"]); ?>" />
                    <span class="gray ml10"><a href="http://list.taobao.com/browse/cat-0.htm?spm=0.0.0.0.rXHpFN&ad_id=&am_id=&cm_id=&pm_id=" target="_blank">查询分类cat值</a></span>
                </td>
            </tr>
			<tr>
				<th>所属分类：</th>
                <td><select class="J_cate_select mr10" data-pid="0" data-uri="<?php echo U('items_cate/ajax_getchilds', array('type'=>0));?>" data-selected="<?php echo ($selected_ids); ?>"></select>
                <input type="hidden" name="cate_id" id="J_cate_id" value="<?php echo ($info["cate_id"]); ?>" /></td></td>
			</tr>


            <tr>
                <th><?php echo L('keyword');?>：</th>
                <td>
                    <input name="keyword" type="text" class="input-text" size="40" value="<?php echo ($info["keyword"]); ?>" />
                    <span class="gray ml10"><?php echo L('tbk_keyword_desc');?></span>
                </td>
            </tr>

			<tr>
                <th>采集页数：</th>
                <td>

					<select name="page" id="page">
					<?php for($a=1;$a<=100;$a++){?>
						<option value="<?=$a?>" <?php if($info["page"] == $a): ?>selected<?php endif; ?> >采集<?=$a?>页</option>
					<?php  } ?>
                    </select>
                </td>
            </tr>


            <tr>
                <th><?php echo L('sort_order');?>：</th>
                <td>
                    <select name="sort">
						<option value="volume|desc" <?php if($info["sort"] == 'volume|desc'): ?>selected<?php endif; ?>><?php echo L('volume_desc');?></option>
                        <option value="volume|asc" <?php if($info["sort"] == 'volume|asc'): ?>selected<?php endif; ?>><?php echo L('volume_asc');?></option>
                        <option value="price|desc" <?php if($info["sort"] == 'pric|desc'): ?>selected<?php endif; ?>><?php echo L('price_desc');?></option>
                        <option value="price|asc" <?php if($info["sort"] == 'price|asc'): ?>selected<?php endif; ?>><?php echo L('price_asc');?></option>
                        <option value="credit|desc" <?php if($info["sort"] == 'credit|desc'): ?>selected<?php endif; ?>><?php echo L('credit_desc');?></option>
						<option value="credit|asc" <?php if($info["sort"] == 'credit|asc'): ?>selected<?php endif; ?>><?php echo L('credit_asc');?></option>
                    </select>
                </td>
            </tr>
 
            <tr class="api_mod">
                <th><?php echo L('tbk_item_commission_rate');?>：</th>
                <td>
                    <input type="text" name="start_commissionRate" size="5" class="input-text" value="<?php echo ($info["start_commissionRate"]); ?>" /> - 
                    <input type="text" name="end_commissionRate" size="5" class="input-text" value="<?php echo ($info["end_commissionRate"]); ?>" /> 
                    <span class="gray ml10"><?php echo L('tbk_item_commission_rate_desc');?></span>
                </td>
            </tr>
			<tr>
                <th><?php echo L('tbk_item_coupon_rate');?>：</th>
                <td>
                    <input type="text" name="start_coupon_rate" size="5" class="input-text" value="<?php echo ($info["start_coupon_rate"]); ?>"  />- 
                    <input type="text" name="end_coupon_rate" size="5" class="input-text" value="<?php echo ($info["end_coupon_rate"]); ?>" />
                    <span class="gray ml10"><?php echo L('tbk_item_coupon_rate_desc');?></span>
                </td>
            </tr>
			<tr class="tb_mod">
                <th>价格：</th>
                <td>
                    <input type="text" name="start_price" size="5" class="input-text" value="<?php echo ($info["start_price"]); ?>"/> - 
                    <input type="text" name="end_price" size="5" class="input-text" value="<?php echo ($info["end_price"]); ?>"/> 
                    <span class="gray ml10">可不填，最低价格和最高最高一起设置才有效</span>
                </td>
            </tr>
            <tr>
                <th><?php echo L('tbk_item_commission_num');?>：</th>
                <td>
                    <input type="text" name="start_volume" size="5" class="input-text" value="<?php echo ($info["start_volume"]); ?>" /> - 
                    <input type="text" name="end_volume" size="5" class="input-text" value="<?php echo ($info["end_volume"]); ?>" /> 
                    <span class="gray ml10"><?php echo L('tbk_item_commission_num_desc');?></span>
                </td>
            </tr>
            <tr  class="api_mod">
                <th><?php echo L('tbk_seller_credit');?>：</th>
                <td>
                    <select name="start_credit">
                        <option value="1heart" <?php if($info["start_credit"] == '1heart'): ?>selected<?php endif; ?>><?php echo L('n1'); echo L('heart');?></option>
                        <option value="2heart" <?php if($info["start_credit"] == '2heart'): ?>selected<?php endif; ?>><?php echo L('n2'); echo L('heart');?></option>
                        <option value="3heart" <?php if($info["start_credit"] == '3heart'): ?>selected<?php endif; ?>><?php echo L('n3'); echo L('heart');?></option>
                        <option value="4heart" <?php if($info["start_credit"] == '4heart'): ?>selected<?php endif; ?>><?php echo L('n4'); echo L('heart');?></option>
                        <option value="5heart" <?php if($info["start_credit"] == '5heart'): ?>selected<?php endif; ?>><?php echo L('n5'); echo L('heart');?></option>
                        <option value="1diamond" <?php if($info["start_credit"] == '1diamond'): ?>selected<?php endif; ?>><?php echo L('n1'); echo L('diamond');?></option>
                        <option value="2diamond" <?php if($info["start_credit"] == '2diamond'): ?>selected<?php endif; ?>><?php echo L('n2'); echo L('diamond');?></option>
                        <option value="3diamond" <?php if($info["start_credit"] == '3diamond'): ?>selected<?php endif; ?>><?php echo L('n3'); echo L('diamond');?></option>
                        <option value="4diamond" <?php if($info["start_credit"] == '4diamond'): ?>selected<?php endif; ?>><?php echo L('n4'); echo L('diamond');?></option>
                        <option value="5diamond" <?php if($info["start_credit"] == '5diamond'): ?>selected<?php endif; ?>><?php echo L('n5'); echo L('diamond');?></option>
                        <option value="1crown" <?php if($info["start_credit"] == '1crown'): ?>selected<?php endif; ?>><?php echo L('n1'); echo L('crown');?></option>
                        <option value="2crown" <?php if($info["start_credit"] == '2crown'): ?>selected<?php endif; ?>><?php echo L('n2'); echo L('crown');?></option>
                        <option value="3crown" <?php if($info["start_credit"] == '3crown'): ?>selected<?php endif; ?>><?php echo L('n3'); echo L('crown');?></option>
                        <option value="4crown" <?php if($info["start_credit"] == '4crown'): ?>selected<?php endif; ?>><?php echo L('n4'); echo L('crown');?></option>
                        <option value="5crown" <?php if($info["start_credit"] == '5crown'): ?>selected<?php endif; ?>><?php echo L('n5'); echo L('crown');?></option>
                        <option value="1goldencrown" <?php if($info["start_credit"] == '1goldencrown'): ?>selected<?php endif; ?>><?php echo L('n1'); echo L('goldencrown');?></option>
                        <option value="2goldencrown" <?php if($info["start_credit"] == '2goldencrown'): ?>selected<?php endif; ?>><?php echo L('n2'); echo L('goldencrown');?></option>
                        <option value="3goldencrown" <?php if($info["start_credit"] == '3goldencrown'): ?>selected<?php endif; ?>><?php echo L('n3'); echo L('goldencrown');?></option>
                        <option value="4goldencrown" <?php if($info["start_credit"] == '4goldencrown'): ?>selected<?php endif; ?>><?php echo L('n4'); echo L('goldencrown');?></option>
                        <option value="5goldencrown" <?php if($info["start_credit"] == '5goldencrown'): ?>selected<?php endif; ?>><?php echo L('n5'); echo L('goldencrown');?></option>
                    </select>
                     - 
                    <select name="end_credit">
                        <option value="1heart" <?php if($info["end_credit"] == '1heart'): ?>selected<?php endif; ?>><?php echo L('n1'); echo L('heart');?></option>
                        <option value="2heart" <?php if($info["end_credit"] == '2heart'): ?>selected<?php endif; ?>><?php echo L('n2'); echo L('heart');?></option>
                        <option value="3heart" <?php if($info["end_credit"] == '3heart'): ?>selected<?php endif; ?>><?php echo L('n3'); echo L('heart');?></option>
                        <option value="4heart" <?php if($info["end_credit"] == '4heart'): ?>selected<?php endif; ?>><?php echo L('n4'); echo L('heart');?></option>
                        <option value="5heart" <?php if($info["end_credit"] == '5heart'): ?>selected<?php endif; ?>><?php echo L('n5'); echo L('heart');?></option>
                        <option value="1diamond" <?php if($info["end_credit"] == '1diamond'): ?>selected<?php endif; ?>><?php echo L('n1'); echo L('diamond');?></option>
                        <option value="2diamond" <?php if($info["end_credit"] == '2diamond'): ?>selected<?php endif; ?>><?php echo L('n2'); echo L('diamond');?></option>
                        <option value="3diamond" <?php if($info["end_credit"] == '3diamond'): ?>selected<?php endif; ?>><?php echo L('n3'); echo L('diamond');?></option>
                        <option value="4diamond" <?php if($info["end_credit"] == '4diamond'): ?>selected<?php endif; ?>><?php echo L('n4'); echo L('diamond');?></option>
                        <option value="5diamond" <?php if($info["end_credit"] == '5diamond'): ?>selected<?php endif; ?>><?php echo L('n5'); echo L('diamond');?></option>
                        <option value="1crown" <?php if($info["end_credit"] == '1crown'): ?>selected<?php endif; ?>><?php echo L('n1'); echo L('crown');?></option>
                        <option value="2crown" <?php if($info["end_credit"] == '2crown'): ?>selected<?php endif; ?>><?php echo L('n2'); echo L('crown');?></option>
                        <option value="3crown" <?php if($info["end_credit"] == '3crown'): ?>selected<?php endif; ?>><?php echo L('n3'); echo L('crown');?></option>
                        <option value="4crown" <?php if($info["end_credit"] == '4crown'): ?>selected<?php endif; ?>><?php echo L('n4'); echo L('crown');?></option>
                        <option value="5crown" <?php if($info["end_credit"] == '5crown'): ?>selected<?php endif; ?>><?php echo L('n5'); echo L('crown');?></option>
                        <option value="1goldencrown" <?php if($info["end_credit"] == '1goldencrown'): ?>selected<?php endif; ?>><?php echo L('n1'); echo L('goldencrown');?></option>
                        <option value="2goldencrown" <?php if($info["end_credit"] == '2goldencrown'): ?>selected<?php endif; ?>><?php echo L('n2'); echo L('goldencrown');?></option>
                        <option value="3goldencrown" <?php if($info["end_credit"] == '3goldencrown'): ?>selected<?php endif; ?>><?php echo L('n3'); echo L('goldencrown');?></option>
                        <option value="4goldencrown" <?php if($info["end_credit"] == '4goldencrown'): ?>selected<?php endif; ?>><?php echo L('n4'); echo L('goldencrown');?></option>
                        <option value="5goldencrown" <?php if($info["end_credit"] == '5goldencrown'): ?>selected<?php endif; ?>><?php echo L('n5'); echo L('goldencrown');?></option>
                    </select>
                </td>
            </tr>
			<tr class="tb_mod">
				<th><font color="red">[新]</font> 是否包邮：</th>
				<td>
					<input name="ems" id="ems0" value="0"  type="radio" <?php if($info["ems"] == '0'): ?>checked<?php endif; ?>><label for="ems0">&nbsp;默&nbsp;认&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
					<input name="ems" id="ems1" value="1" type="radio"  <?php if($info["ems"] == '1'): ?>checked<?php endif; ?>><label for="ems1">&nbsp;包&nbsp;邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
					<span class="gray ml10"></span>
				</td>
			</tr>
            <tr>
                <th><?php echo L('tbk_more_where');?>：</th>
                <td>
                    <label class="mr10"><input type="checkbox" name="shop_type" value="B" <?php if($info["shop_type"] == 'B'): ?>checked<?php endif; ?>> <?php echo L('only_tmall');?></label>
                </td>
            </tr>

            <tr>
                <th></th>
                <td>
					<input type="hidden" name="id"  value="<?php echo ($info["id"]); ?>" />
                    <input type="submit" name="search" class="smt  mr10" value="<?php echo L('submit');?>" />
                </td>
            </tr>
        </tbody>
    </table>
    </form>
</div>
<script src="__STATIC__/js/jquery/jquery.js"></script>
<script src="__STATIC__/js/jquery/plugins/jquery.tools.min.js"></script>
<script src="__STATIC__/js/jquery/plugins/formvalidator.js"></script>
<script src="__STATIC__/js/ftxia.js"></script>
<script src="__STATIC__/js/admin.js"></script>
<script src="__STATIC__/js/dialog.js"></script>
<script>
//初始化弹窗
(function (d) {
    d['okValue'] = lang.dialog_ok;
    d['cancelValue'] = lang.dialog_cancel;
    d['title'] = lang.dialog_title;
})($.dialog.defaults);
</script>

<?php if(isset($list_table)): ?><script src="__STATIC__/js/jquery/plugins/listTable.js"></script>
<script>
$(function(){
	$('.J_tablelist').listTable();
});
</script><?php endif; ?>
<script>
$('.J_cate_select').cate_select('请选择');
$(function(){
    var uri = "<?php echo U('robots/ajax_get_tbcats');?>";
	var selectcid= "<?php echo ($info["cid"]); ?>";
    $('.J_tbcats').die('change').live('change', function(){
        var _this = $(this),
            _cid = _this.val();
        _this.nextAll('.J_tbcats').remove();
        $.getJSON(uri, {cid:_cid}, function(result){
            if(result.status == '1'){
                var _childs = $('<select class="J_tbcats mr10"><option value="0">--'+lang.all+'--</option></select>')
                for(var i=0; i<result.data.length; i++){
					if(result.data[i].cid == selectcid){
						$('<option value="'+result.data[i].cid+'" selected>'+result.data[i].name+'</option>').appendTo(_childs);
					}else{
						$('<option value="'+result.data[i].cid+'">'+result.data[i].name+'</option>').appendTo(_childs);
					}
                }
                _childs.insertAfter(_this);
            }
        });
        $('#J_cid').val(_cid);
    });

	$.formValidator.initConfig({formid:"info_form",autotip:true});
	$("#J_name").formValidator({onshow:'请填写采集器名称',onfocus:'请填写采集器名称'}).inputValidator({min:1,onerror:'请填写采集器名称'});

    <?php if($info["http_mode"] == '0'): ?>$(".tb_mod").hide();
	<?php else: ?>
		$(".api_mod").hide();<?php endif; ?>
	
	$('#api_mod').click(function() {
		$(".api_mod").show();
		$(".tb_mod").hide();
	});

	$('#tb_mod').click(function() {
		$(".tb_mod").show();
		$(".api_mod").hide();
	});

});
</script>
</body>
</html>