<{include file="index/header.html"}> 
<{include file="caiji/nav.html"}> 
<link href="<{$__PUBLIC__}>plug/kindeditor/themes/default/default.css"/>
<div class="filter">  
	 
</div>
<style type="text/css"> 
input#get_goods{ padding:6px 10px; margin-left:5px; float: left; }
.simg{ width:800px; height:100px; padding:10px; border:1px solid #efefef; float:left; }
.simg .img{ margin:0 10px 0 0; float:left; }
</style>
<div class="main"> 
<form action="?m=caiji&a=collect_save" method="post" id="form" back="false" status="true">
	<table class="etable"> 
		<tr>
			<td width="100">天猫地址：</td>
			<td>
				<select name="ctype" id="ctype" style="float: left;">
					<option value="1">天猫</option>
					<option value="2">天猫超市</option>
					<option value="3">淘宝</option>
				</select>
				<input type="text" name="curl" id="curl" size="50"/>
				<input type="button" id="get_goods" value="获取"/>
			</td>
		</tr>
		<tr>
			<td>分类：</td>
			<td>
				<div class="cats_list"></div>
				<input type="hidden" name="cid" value="" id="cid"/>  
			</td>
		</tr>
		<input type="hidden" name="shop_id" size="5" value="<{$smarty.get.spid}>"/> 
		<tr>
			<td>标题：</td>
			<td><input type="text" name="title" size="50"/></td>
		</tr>
		<tr>
			<td>卖点：</td>
			<td><input type="text" name="intro" size="50"/></td>
		</tr>
		<tr>
			<td>主图：</td>
			<td><div class="simg"> </div> </td>
		</tr> 
		<tr>
			<td>市场价：</td>
			<td>
				<input type="text" name="price" size="10" value=""/>
				<span style="float:left; padding:5px 3px 0 10px;">市场价</span>
				<input type="text" name="market_price" size="10" value=""/>
				<span style="float:left; padding:5px 3px 0 10px;">库存</span>
				<input type="text" name="stock" size="10" value="0"/>
			</td>
		</tr>
		<tr>
			<td>内容：</td>
			<td><textarea name="content" cols="130" rows="22" id="content"></textarea></td>
		</tr>
		<tr>
			<td>图片本地</td>
			<td><input type="checkbox" name="local_status" value="1"/></td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td><input type="submit" name="submit" value="采集到本地"/></td>
		</tr> 
	</table>
	</form>
</div>
<{include file="index/footer.html"}> 
<script type="text/javascript" src="<{$__PUBLIC__}>plug/kindeditor/kindeditor-min.js"></script>
<script type="text/javascript"> 
var editor;
KindEditor.ready(function(K) {
	editor = K.create('textarea[name="content"]', { 
		afterBlur: function () { this.sync(); },
		allowPreviewEmoticons : false,
		allowImageUpload : false,
		cssData:'body { font-size: 12px; color:#333; line-height:25px; font-family: Microsoft YaHei,tahoma; }',
		items : [   'formatblock', 'fontname', 'fontsize', '|', 	
			'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'strikethrough', 'lineheight', '|', 
			'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', '|', 
			'image', 'emoticons', 'baidumap', 'link', 'unlink', '|',  
			'clearhtml', 'quickformat', 'source', 'fullscreen',  '|', 'about'
		]	// 换行用 '/', 
	});
}); 
category_next('0');	
$(function(){
	$("input#get_goods").click(function(){ 
		url = $("#curl").val(); 
		ctype = $("#ctype option:selected").val(); 
		$.post("?m=caiji&a=goods_collect", {url:url, ctype:ctype}, function(result){ 
			data = jQuery.parseJSON(result); 
			if(data.error == '0'){
				$("input[name='title']").val(data.title);
				$("input[name='intro']").val(data.intro);
				$("input[name='market_price']").val(data.market_price);
				/*
				// sku list 
				skuhtml = '';
				$.each(data.sku, function(k, v){
					skuhtml += '<dl>';
					skuhtml +=  '	<dt>'+v.name+'</dt>	';
					$.each(v.value,function(k, v){
						skuhtml +=  '<dd><a href="#">'+v+'</a></dd>';
					}); 
					skuhtml +=  '</dl>'; 
				});
				$(".skubox").html(skuhtml);
				*/
				// 主图
				shtml = '';
				$.each(data.simg, function(k, v){
					shtml += '<div class="img"><img src="'+v+'_100x100.jpg"/></div><input type="hidden" name="goods_img[]" value="'+v+'"/>'; 
				});
				$(".simg").html(shtml);
				// 内容
				editor.html(data.content);
			}else{
				$.alert(data.msg);
			} 
		});	
	}); 
}); 
</script>