<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%option explicit%>
<!--#include file="../Conn.asp"-->
<!--#include file="../HSK_Cls/HSK.MemberCls.asp"-->
<%
response.cachecontrol="no-cache"
response.addHeader "pragma","no-cache"
response.expires=-1
response.expiresAbsolute=now-1
Response.Addheader "Content-Type","text/html; charset=gb2312"

Dim KSCls
Set KSCls = New SearchLaiLuDetailCls
KSCls.Run()
Set KSCls = Nothing

Class SearchLaiLuDetailCls
	Private ComeUrl,Action,LoginTF
	Private KS,KSUser,RS,I,ID
	Private Sub Class_Initialize()
		Set KS=New PublicCls
		Set KSUser = New UserCls
	End Sub
	Private Sub Class_Terminate()
		Set KS=Nothing
		Set KSUser=Nothing
		Call CloseConn()
	End Sub
	
	Public Sub Run()
		ComeUrl=Request.ServerVariables("HTTP_REFERER")
		LoginTF=Cbool(KSUser.UserLoginChecked)
		IF LoginTF=false  Then
		  GCls.ComeUrl=ComeUrl	'GCls.GetUrl()
		  Response.Redirect("/user/login/")
		  Exit Sub
		End If
		
		IF KS.CheckOuterUrl()=False Then
			ID=KS.ChkClng(KS.S("ID"))
			IF ID<>0 Then
				If KS.S("Action") = "Check" Then
					Call CheckUrl()
				Else
					If KS.ChkClng(KS.S("UserType")) = 2 Then	'2为接手人 ,1发布者
						Call JieShouMain()
					ElseIf KS.ChkClng(KS.S("UserType")) = 1 Then
						Call FaBuMain()
					End If
				End If
			End If
		End If
		
	End Sub
	
Sub FaBuMain()
Set RS=Server.CreateObject("ADODB.RECORDSET")
RS.Open "Select Top 1 ID,Title,KS_ProductUrl,KS_ShopName,KS_LailuSearch From KS_U_sxyrw Where Inputer='" & KSUser.UserName & "' And ID="& ID,Conn,1,1
If Not RS.Eof Then
	IF Not KS.IsNul(RS("KS_LailuSearch")) Then
	Dim KS_LailuSearch: KS_LailuSearch = Split(RS("KS_LailuSearch"),"^%^")

%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>搜索来路任务说明</title>
<link href="/style/css/task.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="/style/js/common_def.js"></script>
<style type="text/css">
body {background:#ffffff url() repeat-x 0 0; color:#106899;}
.center_tbl td {border-bottom:1px solid #E5F5FF; line-height:32px; height:34px; background-color:#FFF;}
.center_tbl tr:hover td{background-color:#EBF5FF}
.SearchDetail{overflow:auto;}
.SearchDetail_Input{cursor: pointer;height:23px;border:1px solid #cccccc;background:url(/style/images/button/button_bg.gif) left repeat-x; vertical-align:middle;}
</style>
<script language="javascript">
function setParentHeight(){
   if (parseInt(parent.document.all("myframe").style.height.replace('px','')) < document.body.scrollHeight)
   parent.document.all("myframe").style.height = document.body.scrollHeight + 'px';
}
</script>
</head>
<body onload="setParentHeight();">

<div class="SearchDetail">
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="center_tbl">
 <tr class="tdbg" height="28">
   <td width="30%" align="right" class="clefttitle"><strong>掌柜名：</strong></td>
   <td width="70%">&nbsp;<%=Rs("KS_ShopName")%></td>
 </tr>
 <tr class="tdbg" height="28">
   <td align="right" class="clefttitle"><strong>商品名称：</strong></td>
   <td>&nbsp;<%=Rs("Title")%></td>
 </tr>
 <tr class="tdbg" height="28">
   <td align="right" class="clefttitle"><strong>商品网址：</strong></td>
   <td>&nbsp;<%=Rs("KS_ProductUrl")%></td>
 </tr>
 <tr class="tdbg" height="28">
   <td align="right" class="clefttitle"><strong>搜索来路类型：</strong></td>
   <td class="red">&nbsp;<%
	If KS_LailuSearch(1)=1 Then
		KS.Echo "店铺搜索来路"
	ElseIf KS_LailuSearch(1)=2 Then
		KS.Echo "宝贝搜索来路"
	ElseIf KS_LailuSearch(1)=3 Then
		KS.Echo "买家信用评价页面来路"
	ElseIf KS_LailuSearch(1)=4 Then
		KS.Echo "直通车来路"
	ElseIf KS_LailuSearch(1)=5 Then
		KS.Echo "指定网站来路"
	End If
  %></td>
 </tr>
 <tr class="tdbg" height="28">
<%
	If KS_LailuSearch(1)=1 Then
		KS.Echo "   <td align=""right"" class=""clefttitle""><strong>搜索店铺关键字：</strong></td>"
	ElseIf KS_LailuSearch(1)=2 Or KS_LailuSearch(1)=4 Then
		KS.Echo "   <td align=""right"" class=""clefttitle""><strong>搜索宝贝关键字：</strong></td>"
	ElseIf KS_LailuSearch(1)=3 Then
		KS.Echo "   <td align=""right"" class=""clefttitle""><strong>买家信用评价地址：</strong></td>"
	ElseIf KS_LailuSearch(1)=5 Then
		KS.Echo "   <td align=""right"" class=""clefttitle""><strong>网站地址：</strong></td>"
	End If
  %>
   <td class="orange">&nbsp;<%=KS_LailuSearch(2)%> &nbsp; <input name="Copy" type="button" class="SearchDetail_Input" onClick="copyToClipboard('<%=KS_LailuSearch(2)%>','复制成功!');" value="复制" /></td>
 </tr>
 <tr class="tdbg" height="28">
 <%
	If KS_LailuSearch(1)=3 Then
		KS.Echo "   <td align=""right"" class=""clefttitle""><strong>来路提示：</strong></td>"
	ElseIf KS_LailuSearch(1)=5 Then
		KS.Echo "   <td align=""right"" class=""clefttitle""><strong>链接位置提示：</strong></td>"
	Else
		KS.Echo "   <td align=""right"" class=""clefttitle""><strong>搜索提示：</strong></td>"
	End If
  %>
   <td class="orange">&nbsp;<%=KS_LailuSearch(3)%></td>
 </tr>
 <% IF Not KS.IsNul(KS_LailuSearch(4)) Then %>
 <tr class="tdbg" height="28">
   <td align="right" class="clefttitle"><strong>宝贝链接位置截图：</strong></td>
   <td class="orange">&nbsp;<%
   		KS.Echo "<a href=""" & KS_LailuSearch(4) & """ target=""_blank"" title=""点击在新窗口查看图片""><img src=""" & KS_LailuSearch(4) & """ border=""0"" onload=""if(this.width>350){this.width='350';}""></a>"
   %></td>
 </tr>
 <% End If %>
  <tr>
  	<td colspan="2" align="center" bgcolor="#EEF1F1" style="height:60px;"><input type="image" name="Save" src="/style/images/CloseButton.gif" onClick="parent.closeWindow();" /></td>
  </tr>
</table>
</div>
</body>
</html>
<%
		End If
		RS.Close
		Set RS=Nothing
	Else
		KS.AlertHistory "传送的ID有误或该任务已被删除！","-1"
	End If
End Sub


Sub JieShouMain()
Set RS=Server.CreateObject("ADODB.RECORDSET")
RS.Open "Select Top 1 ID,Tid,Title,KS_ShopName,KS_LailuSearch From KS_U_sxyrw Where KS_BuyUserName='" & KSUser.UserName & "' And ID="& ID,Conn,1,1
If Not RS.Eof Then
	IF Not KS.IsNul(RS("KS_LailuSearch")) Then
		Dim KS_LailuSearch: KS_LailuSearch = Split(RS("KS_LailuSearch") & "^%^","^%^")
		Dim TaskType: TaskType = Left(KS.C_C(RS("Tid"),1),2)
		Dim WebUrl
		If TaskType = "淘宝" Then
			WebUrl = "http://www.taobao.com"
		ElseIf TaskType = "拍拍" Then
			WebUrl = "http://www.paipai.com"
		End If
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>搜索来路任务说明</title>
<link href="/style/css/task.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="/style/js/common_def.js"></script>
<style type="text/css">
body {background:#ffffff url() repeat-x 0 0; color:#106899;}
.center_tbl td {border-bottom:1px solid #E5F5FF; line-height:32px; height:38px; background-color:#FFF;}
.center_tbl tr:hover td{background-color:#EBF5FF}
.SearchDetail{overflow:auto;}
.SearchDetail .title{
	height: 33px;
	color: #F60;
	font-weight: bold;
	background-color: #39F;
	background-image: url(/style/images/w_b.gif);
	line-height: 33px;
}
.SearchDetail_Tips{border-bottom:1px solid #E5F5FF; color:#FF5500; padding-left:70px; padding-top:10px; background:url(/style/images/msg_bg.png) #FFFFE6 no-repeat 20px -485px; height:55px; line-height:24px;}
.SearchDetail_Input{cursor: pointer;height:23px;border:1px solid #cccccc;background:url(/style/images/button/button_bg.gif) left repeat-x; vertical-align:middle;}
</style>
<script language="javascript">
function openPrdUrl(url, obj) {
var isIe=(document.all)?true:false;
    if (isIe) {
        try {
            window.open(url);
        } catch (e) {
            try {
                alert('对不起，可能你使用了遨游浏览器，弹出的网址无法打开，请再一次点击');
                obj.onclick = function() { window.open(url); }
            } catch (ex) { }
        }
    } else if (prompt('请你使用 Ctrl+C 复制到剪贴板', url)) {
        alert("您已经成功复制了网址，请粘贴到浏览器的地址栏，然后打开");
    }
    return false;
}
function setParentHeight(){
   if (parseInt(parent.document.all("myframe").style.height.replace('px','')) < document.body.scrollHeight)
   parent.document.all("myframe").style.height = document.body.scrollHeight + 'px';
}
</script>
</head>
<body onload="setParentHeight();">

<div class="SearchDetail_Tips">
  <p>搜索来路是指：接手人在<%=TaskType%>首页搜索发布人店铺名或宝贝关键字进入到店铺进行购买交易。<br />
注意：请接手人一定要先通过商品网址验证后再拍下商品和支付，否则一切损失自负！</p>
</div>
<div class="SearchDetail">
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="center_tbl">
 <tr class="title">
  	<td colspan="2" height="28" align="center" bgcolor="#EEF1F1" ><strong><font color="#0000FF">请按下面步骤进行操作方可顺利完成任务</font></strong></td>
 </tr>
 <tr class="tdbg" height="28">
   <td align="right" class="clefttitle"><strong>掌柜名：</strong></td>
   <td>&nbsp;<%=Rs("KS_ShopName")%></td>
 </tr>
 <tr class="tdbg" height="28">
   <td align="right" class="clefttitle orange"><strong><%
   If KS_LailuSearch(1)=3 Or KS_LailuSearch(1)=5 Then
   		KS.Echo "链接位置提示："
   Else
   		KS.Echo "搜索提示："
   End If
   %></strong></td>
   <td class="orange">&nbsp;<%=KS_LailuSearch(3)%></td>
 </tr>
 <% If Not KS.IsNul(KS_LailuSearch(4)) Then %>
  <tr class="tdbg" height="28">
   <td align="right" class="clefttitle orange"><strong>宝贝链接 &nbsp;&nbsp;<br>位置截图：</strong></td>
   <td class="orange">&nbsp;<%
   		KS.Echo "<a href=""" & KS_LailuSearch(4) & """ target=""_blank"" title=""点击在新窗口查看图片""><img src=""" & KS_LailuSearch(4) & """ border=""0"" onload=""if(this.width>350){this.width='350';}""></a>"
   %></td>
 </tr>
 <% End If %>
 <tr class="tdbg">
  <td width="18%" height="25" align="right" class="clefttitle"><strong><span>第一步：</span></strong></td>
  <td width="82%">&nbsp;<%
	If KS_LailuSearch(1)=1 Then
  		KS.Echo "打开" & TaskType & "首页搜索<span class=""red rough"">店铺</span>，输入关键字： <span class=""orange"">" & KS_LailuSearch(2) & "</span> &nbsp; &nbsp; <input name=""Copy"" type=""button"" class=""SearchDetail_Input"" onClick=""copyToClipboard('" & KS_LailuSearch(2) & "','店铺名复制成功!');"" value=""复制"" title=""复制店铺名称"" /> &nbsp; <input name=""Open"" type=""button"" class=""SearchDetail_Input"" onClick=""openPrdUrl('" & WebUrl & "',this);"" value=""打开" & TaskType & "首页"" />"
	ElseIf KS_LailuSearch(1)=2 Or KS_LailuSearch(1)=4 Then
  		KS.Echo "打开" & TaskType & "首页搜索<span class=""blue rough"">宝贝</span>，输入关键字： <span class=""orange"">" & KS_LailuSearch(2) & "</span> &nbsp; &nbsp; <input name=""Copy"" type=""button"" class=""SearchDetail_Input"" onClick=""copyToClipboard('" & KS_LailuSearch(2) & "','关键字复制成功!');"" value=""复制"" title=""复制店铺名称"" /> &nbsp; <input name=""Open"" type=""button"" class=""SearchDetail_Input"" onClick=""openPrdUrl('" & WebUrl & "',this);"" value=""打开" & TaskType & "首页"" />"
	ElseIf KS_LailuSearch(1)=3 Then
  		KS.Echo "打开该买家信用评价地址：<span class=""orange"">" & KS_LailuSearch(2) & "</span> &nbsp; <input name=""Open"" type=""button"" class=""SearchDetail_Input"" onClick=""openPrdUrl('" & KS_LailuSearch(2) & "',this);"" value=""打开评价网址"" />"
	ElseIf KS_LailuSearch(1)=5 Then
  		KS.Echo "打开该网站地址：<span class=""orange"">" & KS_LailuSearch(2) & "</span> &nbsp; <input name=""Open"" type=""button"" class=""SearchDetail_Input"" onClick=""openPrdUrl('" & KS_LailuSearch(2) & "',this);"" value=""打开该网站"" />"
	End If
  %></td>
 </tr>
 <tr class="tdbg">
  <td width="18%" height="25" align="right" class="clefttitle"><strong><span>第二步：</span></strong></td>
  <td width="82%">&nbsp;<%
	If KS_LailuSearch(1)=1 Then
		KS.Echo "进入店铺后打开商品标题名称为： <span class=""orange"">" & RS("Title") & "</span> &nbsp; &nbsp; <input name=""Copy"" type=""button"" class=""SearchDetail_Input"" onClick=""copyToClipboard('" & RS("Title") & "','商品标题名称复制成功!');"" value=""复制"" title=""复制店铺名称"" />"
	ElseIf KS_LailuSearch(1)=2 Then
		KS.Echo "根据搜索提示打开搜索结果列表中掌柜名为：<span class=""orange"">" & RS("KS_ShopName") & "</span> 的商品链接"
	ElseIf KS_LailuSearch(1)=3 Then
		KS.Echo "根据搜索提示打开该买家信用评价列表中的掌柜名为：<span class=""orange"">" & RS("KS_ShopName") & "</span><br>商品标题名称：<span class=""orange"">" & RS("Title") & "</span> 的商品链接"
	ElseIf KS_LailuSearch(1)=4 Then
		If TaskType = "淘宝" Then
			KS.Echo "根据搜索提示打开搜索结果右侧“掌柜热卖”区标题名称为：<span class=""orange"">" & RS("Title") & "</span> 的商品链接"
		ElseIf TaskType = "拍拍" Then
			KS.Echo "根据搜索提示打开搜索结果左侧“卖家推荐商品”区标题名称为：<span class=""orange"">" & RS("Title") & "</span> 的商品链接"
		End If
	ElseIf KS_LailuSearch(1)=5 Then
		KS.Echo "根据提示在该网站中找到宝贝链接点击打开，确定掌柜名是：<span class=""orange"">" & RS("KS_ShopName") & "</span><br>商品标题名称：<span class=""orange"">" & RS("Title") & "</span>"
	End If
  %></td>
 </tr>
 <tr class="tdbg">
   <td  height="25" align="right" class="clefttitle"><strong>第三步：</strong></td>
   <td>&nbsp;复制刚打开的商品页面浏览器地址栏的网址，粘贴到下框再点击“验证商品网址”按钮 <br />
   <form action="" method="post" onSubmit="if(this.ProductUrl.value==''){alert('请输入商品网址！');this.ProductUrl.focus();return false;}">
   &nbsp;<input name="ProductUrl" id="ProductUrl" type="text" style="width:330px;height:20px;border:1px solid #cccccc;vertical-align:middle;" /> &nbsp; <input name="ChkProductUrl" id="ChkProductUrl" class="SearchDetail_Input" type="submit" value="验证商品网址" />
   <input name="Action" type="hidden" value="Check" />
   <input name="ID" type="hidden" value="<%=ID%>" />
   <input name="TaskType" type="hidden" value="<%=TaskType%>" />
   </form></td>
 </tr>

  <tr>
  	<td colspan="2" align="center" bgcolor="#EEF1F1" style="height:60px;"><input type="image" name="Save" src="/style/images/CloseButton.gif" onClick="parent.closeWindow();" /></td>
  </tr>
</table>
</div>
</body>
</html>
<%
		End If
		RS.Close
		Set RS=Nothing
	Else
		KS.AlertHistory "传送的ID有误或该任务已被删除！","-1"
	End If
End Sub


Sub CheckUrl()
	Dim ProductUrl: ProductUrl = Trim(KS.S("ProductUrl"))
	Dim TaskType: TaskType = Trim(KS.S("TaskType"))
	If Not KS.IsNul(ProductUrl) Then
		Dim ProductID
		If TaskType = "淘宝" Then
			ProductID = KS.reReplace(ProductUrl,"(id=\d+)",1,"")
		ElseIf TaskType = "拍拍" Then
			ProductID = KS.reReplace(ProductUrl,"paipai.com\/.*?(\w{32})",1,"")
		End If
		If Not KS.IsNul(ProductID) And Len(ProductID) > 11 Then
			ProductID = Split(ProductID,vbCrlf)(0)
			If Not Conn.Execute("Select Top 1 ID From KS_U_sxyrw Where KS_ProductUrl Like '%" & ProductID & "%' And ID=" & ID).Eof Then
				Call CheckSuccess()
			Else
				KS.AlertHistory "抱歉！您输入的商品地址与发布方指定的不符，请返回核查！\n\n如果您确定操作的步骤是正确的，请与发布人联系核查，谢谢！","-1"
			End If
		Else
			KS.AlertHistory "抱歉！您输入的商品地址不正确，请返回核查！","-1"
		End If
	End If
End Sub

Sub CheckSuccess()
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>搜索来路任务说明</title>
<style type="text/css">
body {background:#ffffff url() repeat-x 0 0; color:#20537A; font:12px/20px Arial,Verdana,Tahoma,"宋体";}
</style>
</head>
<body>
<table align="center" width="80%" border="0" cellspacing="8" cellpadding="0">
  <tr>
    <td height="100" align="center"><img src="/style/images/ok.jpg" align="absmiddle" />&nbsp; &nbsp; <strong>恭喜！商品地址验证通过，请放心拍下该宝贝！</strong></td>
  </tr>
  <tr>
    <td height="50" align="center"><input type="image" name="Save" src="/style/images/CloseButton.gif" onClick="parent.closeWindow();" /></td>
  </tr>
</table>
</body>
</html>
<%
End Sub

End Class
%>