<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%option explicit%>
<!--#include file="../Conn.asp"-->
<!--#include file="TaskConfig.asp"-->
<!--#include file="../HSK_Cls/HSK.MemberCls.asp"-->
<!--#include file="QQWry/cls_ip.asp"-->
<%
Dim KSCls
Set KSCls = New TaskDetailCls
KSCls.Run()
Set KSCls = Nothing

Class TaskDetailCls
	Private ComeUrl,Action,LoginTF
	Private KS,KSUser,RS,I
	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 And (Instr(lcase(ComeUrl),"taskjieshou.asp")>0 Or Instr(lcase(ComeUrl),"taskfabu.asp")>0 Or Instr(lcase(ComeUrl),"taskdetail.asp")>0) Then
Dim ID: ID=KS.ChkClng(KS.R(KS.S("ID")))
IF ID<>0 Then
If Not KS.IsNul(KS.S("F")) And Not KS.IsNul(KS.S("V")) Then
	Conn.Execute("Update KS_U_sxyrw Set " & KS.CheckXSS(KS.S("F")) & "='" & KS.CheckXSS(KS.S("V")) & "' Where Inputer='" & KSUser.UserName & "' And ID=" & ID)
	KS.Alert "修改成功！","?id=" & ID
End If
Set RS=Server.CreateObject("ADODB.RECORDSET")
RS.Open "Select Top 1 * From KS_U_sxyrw Where ID="& ID,Conn,1,1
If Not RS.Eof Then
%><!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:24px; height:26px; clear:both; background-color:#FFF}
.center_tbl tr:hover td{background-color:#EBF5FF}
.TaskDetail .center_tbl .title{
	height: 33px;
	color: #F60;
	font-weight: bold;
	background-color: #39F;
	background-image: url(/style/images/w_b.gif);
	line-height: 33px;
}
</style>
</head>
<body>
<script language="javascript">
function DataLength(fData)
{
    var intLength=0
    for (var i=0;i<fData.length;i++)
    {
        if ((fData.charCodeAt(i) < 0) || (fData.charCodeAt(i) > 255))
            intLength=intLength+2
        else
            intLength=intLength+1   
    }
    return intLength
}
function Mod(fname,content){
	var m=confirm("确定要修改吗？");
	if (!m) return false;
	if (content=='') {
		alert('内容不能为空！');
		document.all(fname).focus();
		return false;
	}
	if(DataLength(content)>255){
		alert("内容不能超过255个字符！");
		document.all(fname).focus();
		return false;
	}
	self.location.href='?id=<%=ID%>&f=' + fname + '&v=' + escape(content);
}
</script>
<div class="TaskDetail">
<table  width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="center_tbl">
<!-- 
 <tr>
  <td colspan=2 align=center><strong>任 务 明 细</strong></td>
 </tr>
 <tr>
   <td style="height:6px"></td>
   <td></td>
 </tr>
   -->
<% If Rs("Inputer") = KSUser.UserName And KS.ChkClng(Rs("KS_Status")) > 0 And Not KS.IsNul(Rs("KS_BuyUserIP")) Then
	If (ViewTaskUserIPInformation =1 And KSUser.GroupID = 17) Or ViewTaskUserIPInformation =2 Or KSUser.GroupID = 1 Then
%>
  <tr class="tdbg">
  <td width="28%" height="25" align="right" class="clefttitle red"><strong><span>接手人所在地：</span></strong></td>
  <td width="72%" class="red">&nbsp;<%=Look_IP(Rs("KS_BuyUserIP"))%></td>
 </tr>
   <tr class="tdbg">
  <td width="28%" height="25" align="right" class="clefttitle red"><strong><span>接手人IP：</span></strong></td>
  <td width="72%" class="red">&nbsp;<%=Rs("KS_BuyUserIP")%></td>
 </tr>
 <% 
 	End If
 ElseIf KS.ChkClng(Rs("KS_Status")) > 0 And Not KS.IsNul(Rs("KS_AddUserIP")) Then
 	If (ViewTaskUserIPInformation =1 And KSUser.GroupID = 2) Or ViewTaskUserIPInformation =2 Or KSUser.GroupID = 1 Then
 %>
 <tr class="tdbg">
  <td width="28%" height="25" align="right" class="clefttitle red"><strong><span>发布人所在地：</span></strong></td>
  <td width="72%" class="red">&nbsp;<%=Look_IP(Rs("KS_AddUserIP"))%></td>
 </tr>
  <tr class="tdbg">
  <td width="28%" height="25" align="right" class="clefttitle red"><strong><span>发布人IP：</span></strong></td>
  <td width="72%" class="red">&nbsp;<%=Rs("KS_AddUserIP")%></td>
 </tr>
 <% End If
 End If %>
 <tr class="tdbg">
  <td width="28%" height="25" align="right" class="clefttitle"><strong><span>任务编号：</span></strong></td>
  <td width="72%">&nbsp;<%=Rs("KS_TaskID")%></td>
 </tr>
 <tr class="tdbg">
  <td width="28%" height="25" align="right" class="clefttitle"><strong><span>任务区：</span></strong></td>
  <td width="72%">&nbsp;<%=KS.C_C(RS("tid"),1)%></td>
 </tr>
 <tr class="tdbg">
   <td  height="25" align="right" class="clefttitle"><strong>掌柜名称：</strong></td>
   <td>&nbsp;<%=Rs("KS_ShopName")%></td>
 </tr>
 <%
Dim tmpTitle,tmpUrl
If Rs("Inputer") <> KSUser.UserName Then
	If KS.ChkClng(Rs("KS_Status")) > 0 And Not KS.IsNul(Rs("KS_BuyShopName")) Then
		IF KS.ChkCLng(Rs("KS_Verific"))=1 Then
			IF KS.ChkCLng(Rs("KS_VerificTF"))=1 Then
				tmpTitle = Rs("Title")
				If Not KS.IsNul(Rs("KS_LailuSearch")) Then
					tmpUrl = "<font color=red>搜索来路任务不能直接查看商品地址</font>"
				Else
					tmpUrl = Replace(Rs("KS_ProductUrl"),Chr(13),"<br>")
				End If
			Else
				tmpTitle = "<font color=red>需发布方审核才可以看到标题</font>"
				tmpUrl = "<font color=red>需发布方审核才可以看到地址</font>"
			End IF
		Else
			If Not KS.IsNul(Rs("KS_LailuSearch")) Then
				tmpTitle = Rs("Title")
				tmpUrl = "<font color=red>搜索来路任务不能直接查看商品地址</font>"
			Else
				tmpTitle = Rs("Title")
				tmpUrl = Replace(Rs("KS_ProductUrl"),Chr(13),"<br>")
			End If
		End IF
	Else
		tmpTitle = "<font color=red>请先绑定买号方可查看商品标题</font>"
		tmpUrl = "<font color=red>请先绑定买号方可查看商品地址</font>"
	End IF
ElseIf Rs("Inputer") = KSUser.UserName Then
	tmpTitle = Rs("Title")
	tmpUrl = Replace(Rs("KS_ProductUrl"),Chr(10),"<br>")
End If
	%>
 <tr class="tdbg" height="28">
   <td align="right" class="clefttitle"><strong>商品标题：</strong></td>
   <td>&nbsp;<%=tmpTitle%></td>
 </tr>
 <tr class="tdbg" height="28">
  <td align="right" class="clefttitle"><strong>商品地址：</strong></td>
  <td style="padding-left:4px;"><%=tmpUrl%></td>
  </tr>
  <%IF KS.ChkClng(Rs("KS_ShopCartTF"))=1 Then %>
  <tr class="tdbg" height="28">
    <td align="right" class="clefttitle"><strong>使用购物车任务：</strong></td>
    <td>&nbsp;<%IF KS.ChkClng(Rs("KS_ShopCartTF"))=1 Then KS.Echo "是" Else KS.Echo "否"%></td>
  </tr>
  <% End IF %>
  <% IF Not KS.IsNul(Rs("KS_LailuSearch")) Then %>
  <tr class="tdbg" height="28">
    <td align="right" class="clefttitle"><strong>使用搜索来路：</strong></td>
    <td>&nbsp;<%IF KS.ChkClng(Split(RS("KS_LailuSearch"),"^%^")(0))=1 Then KS.Echo "是" Else KS.Echo "否"%></td>
  </tr>
  <% End IF %>
  <tr class="tdbg" height="28">
  	<td align="right" class="clefttitle"><strong>支付方式：</strong></td>
  	<td style="color:red">&nbsp;<%
	If KS.ChkClng(Rs("KS_PayType")) = 1 Then
		KS.Echo "接手方支付"
	ElseIf KS.ChkClng(Rs("KS_PayType")) = 2 Then
		KS.Echo "红包支付"
	ElseIf KS.ChkClng(Rs("KS_PayType")) = 3 Then
		KS.Echo "发布方代付"
	End If
	%> </td>
  </tr>
  <tr class="tdbg" height="28">
  	<td align="right" class="clefttitle"><strong>任务担保价格：</strong></td>
  	<td>&nbsp;￥<%=Rs("KS_Price")%>元 </td>
  </tr>
  <tr class="tdbg" height="28">
  	<td align="right" class="clefttitle"><strong>基本发布点：</strong></td>
    <td>&nbsp;<%=Rs("KS_Point")%>点</td>
  </tr>
  <tr class="tdbg" height="28">
  	<td align="right" class="clefttitle"><strong>是否需要改价：</strong></td>
  	<td>&nbsp;<%IF KS.ChkClng(Rs("KS_ModPriceTF"))=1 Then KS.Echo "是" Else KS.Echo "否"%></td>
  </tr>
  <tr class="tdbg" height="28">
  	<td align="right" class="clefttitle"><strong>任务类型：</strong></td>
    <td>&nbsp;<%
	IF KS.ChkClng(Rs("KS_XuShiTF"))=1 Then
		KS.Echo "实物商品"
	ElseIF KS.ChkClng(Rs("KS_XuShiTF"))=2 Then
		KS.Echo "搭配套餐"
	Else
		KS.Echo "虚拟商品"
	End If%></td>
  </tr>
  <tr class="tdbg" height="28">
  	<td align="right" class="clefttitle"><strong>好评要求时限：</strong></td>
    <td>&nbsp;<%
	IF KS.ChkClng(Rs("KS_HaoPingLimit"))=1 Then
		KS.Echo "马上好评"
	ElseIF KS.ChkClng(Rs("KS_HaoPingLimit"))=2 Then
		KS.Echo "30分钟后好评"
	ElseIF KS.ChkClng(Rs("KS_HaoPingLimit"))=3 Then
		KS.Echo "1天后好评"
	ElseIF KS.ChkClng(Rs("KS_HaoPingLimit"))=4 Then
		KS.Echo "2天后好评"
	ElseIF KS.ChkClng(Rs("KS_HaoPingLimit"))=5 Then
		KS.Echo "3天后好评"
	ElseIF KS.ChkClng(Rs("KS_HaoPingLimit"))=6 Then
		KS.Echo "4天后好评"
	ElseIF KS.ChkClng(Rs("KS_HaoPingLimit"))=7 Then
		KS.Echo "5天后好评"
	ElseIF KS.ChkClng(Rs("KS_HaoPingLimit"))=8 Then
		KS.Echo "6天后好评"
	ElseIF KS.ChkClng(Rs("KS_HaoPingLimit"))=9 Then
		KS.Echo "7天后好评"
	End IF%></td>
  </tr>
  <tr class="tdbg" height="28">
  	<td align="right" class="clefttitle"><strong>商铺动态评分：</strong></td>
    <td>&nbsp;<%if Rs("KS_ShopDynamic")=0 then KS.Echo "全部不打分" Else KS.Echo "全部5分"%></td>
  </tr>
  <tr class="tdbg" height="28">
  	<td align="right" class="clefttitle"><strong>指定好评内容：</strong></td>
    <td>&nbsp;<textarea style="width:350px;height:50px;border:1px #CCC solid;" rows="4" class="textbox" name="KS_HaoPingContent" id="KS_HaoPingContent"><%= Rs("KS_HaoPingContent") %></textarea><%
	If Rs("Inputer") = KSUser.UserName Then %>&nbsp; <input name="Mod" type="button" class="button" onClick="Mod('KS_HaoPingContent',KS_HaoPingContent.value)" value="修改" /><br>
	&nbsp;<select name="HaoPingYu" id="HaoPingYu" onChange="setValue('KS_HaoPingContent',this.options[this.selectedIndex].value)">
      <option selected="selected">=========  您可以在这里快速选择常用的评语  ========</option>
      <%
      Dim Content,CI
      Content = KS.ReadFromFile("评语#.txt")
      IF Not KS.IsNul(Content) Then
         Content = Split(Content,vbCrlf)
         For CI = 0 To UBound(Content)
            IF Not KS.IsNul(Trim(Content(CI))) Then
                IF Left(Content(CI),4) = "【分类】" Then
                    KS.Echo "<optgroup label=""" & Replace(Content(CI),"【分类】","") & """></optgroup>" & vbcrlf
                Else
                    KS.Echo "<option value=""" & Content(CI) & """>" & Left(Content(CI),25) & "</option>" & vbcrlf
                End IF
            End IF
         Next
      End If
      %>
    </select><% ElseIf Not KS.IsNul(Rs("KS_HaoPingContent")) Then %>&nbsp; <input name="Copy" type="button" class="button" onClick="copyToClipboard(KS_HaoPingContent.value,'好评内容复制成功!');" value="复制" /><% End If %></td>
  </tr>
  <tr class="tdbg" height="28">
  	<td width="19%" align="right" class="clefttitle"><strong>平台留言提醒：</strong></td>
    <td>&nbsp;<textarea style="width:350px;height:50px;border:1px #CCC solid;" rows="4" class="textbox" name="KS_MessageRemind" id="KS_MessageRemind" readonly="readonly" title="不可手工输入，请选择旁边常用留言，如没有你想要的留言，请联系客服帮你增加上。"><%= Rs("KS_MessageRemind") %></textarea><%
	If Rs("Inputer") = KSUser.UserName Then %>&nbsp; <input name="Mod2" type="button" class="button" onClick="Mod('KS_MessageRemind',KS_MessageRemind.value)" value="修改" /><br>
	&nbsp;<select name="HaoPingYu" id="HaoPingYu" onChange="setValue('KS_MessageRemind',getObj('KS_MessageRemind').value + this.options[this.selectedIndex].value);if(getObj('KS_MessageRemind').value.substr(0,1)=='，'){setValue('KS_MessageRemind',getObj('KS_MessageRemind').value.substr(1,50));};if(this.options[this.selectedIndex].value=='清空'){setValue('KS_MessageRemind','');}">
      <option selected="selected">=========  您可以在这里快速选择常用的留言  ========</option>
      <option value="清空">====== 清空留言内容 ======</option>
      <%
      Content = KS.ReadFromFile("留言#.txt")
      IF Not KS.IsNul(Content) Then
         Content = Split(Content,vbCrlf)
         For CI = 0 To UBound(Content)
            IF Not KS.IsNul(Trim(Content(CI))) Then
                KS.Echo "<option value=""，" & Content(CI) & """>" & Left(Content(CI),25) & "</option>" & vbcrlf
            End IF
         Next
      End If
      Content = null
      %>
    </select><% ElseIf Not KS.IsNul(Rs("KS_MessageRemind")) Then %>&nbsp; <input name="Copy" type="button" class="button" onClick="copyToClipboard(KS_MessageRemind.value,'留言提醒复制成功!');" value="复制" /><% End If %></td>
  </tr>
  <% IF KS.ChkClng(Rs("KS_CollectTF"))=1 Then %>
  <tr class="tdbg" height="28">
  	<td align="right" class="clefttitle red"><strong>店铺和宝贝双收藏：</strong></td>
    <td>&nbsp;是</td>
  </tr>
  <% End IF %>
  <% IF Not KS.IsNul(Rs("KS_ModAddress")) Then %>
  <tr class="tdbg" height="28">
  	<td align="right" class="clefttitle red"><strong>指定收货地址：</strong></td>
    <td>&nbsp;<input type="text" style="width:350px;height:21px; line-height:21px; border:1px #CCC solid;" name="KS_ModAddress" id="KS_ModAddress" maxlength="200" value="<%=Rs("KS_ModAddress")%>" /><%
	If Rs("Inputer") = KSUser.UserName Then %>&nbsp; <input name="Mod3" type="button" class="button" onClick="Mod('KS_ModAddress',KS_ModAddress.value)" value="修改" /><% ElseIf Not KS.IsNul(Rs("KS_ModAddress")) Then %>&nbsp; <input name="Copy" type="button" class="button" onClick="copyToClipboard(KS_ModAddress.value,'收货地址复制成功!');" value="复制" /><% End If %></td>
  </tr>
  <% End IF %>
  <% IF KS.ChkClng(Rs("KS_RealNameType")) > 0 Then %>
  <tr class="tdbg" height="28">
  	<td align="right" class="clefttitle red"><strong>实名认证买号：</strong></td>
    <td>&nbsp;<%IF KS.ChkClng(Rs("KS_RealNameType")) =1 Then KS.Echo "普通实名认证买号" Else KS.Echo "掌柜号（开店铺的账号）"%></td>
  </tr>
  <% End IF %>
  <% IF KS.ChkClng(Rs("KS_ShangBao")) = 1 Then %>
  <tr class="tdbg" height="28">
  	<td align="right" class="clefttitle red"><img src="/style/images/ShangBao.gif" width="20" height="20" align="absmiddle" /> <strong>商家保障：</strong></td>
    <td>&nbsp;是</td>
  </tr>
  <% End IF %>
  <% If Rs("Inputer") = KSUser.UserName And Not KS.IsNul(Rs("province")) Then %>
  <tr class="tdbg" height="28">
  	<td align="right" class="clefttitle"><strong>指定某地区接手：</strong></td>
    <td><%Dim tmpStr
	If Not KS.IsNul(Rs("city")) Then tmpStr = "》" & Rs("city")
	If Not KS.IsNul(Rs("province")) Then KS.Echo "仅允许" & Rs("province") & tmpStr & "用户接手"
	%></td>
  </tr>
  <% End IF %>
</table>

<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" style="background-image: url(/style/images/w_b.gif)"><strong><font color="#0000FF">任务交易记录</font></strong></td>
  </tr>
  <tr class="tdbg">
  	<td width="28%" height="25" align="right" class="clefttitle"><strong><span>任务发布时间：</span></strong></td>
  	<td width="72%">&nbsp;<%=RS("AddDate")%></td>
  </tr>
  <% IF Not KS.IsNul(Rs("KS_BuyDate")) Then %>
  <tr class="tdbg">
  	<td height="25" align="right" class="clefttitle"><strong>任务接手时间：</strong></td>
  	<td>&nbsp;<%=Rs("KS_BuyDate")%> &nbsp; 接手人账号：<a href="/Task/UserInfo.asp?UserName=<%=Rs("KS_BuyUserName")%>" target="_blank"><%=Rs("KS_BuyUserName")%></a> &nbsp; 接手买号：<%=Rs("KS_BuyShopName")%></td>
  </tr>
  <% End IF %>
  <% IF Not KS.IsNul(Rs("KS_PayDate")) Then %>
  <tr class="tdbg">
  	<td height="25" align="right" class="clefttitle"><strong>任务支付时间：</strong></td>
  	<td>&nbsp;<%=Rs("KS_PayDate")%></td>
  </tr>
  <% End IF %>
  <% IF Not KS.IsNul(Rs("KS_DeliveryDate")) Then %>
  <tr class="tdbg">
  	<td height="25" align="right" class="clefttitle"><strong>任务发货时间：</strong></td>
  	<td>&nbsp;<%=Rs("KS_DeliveryDate")%></td>
  </tr>
  <% End IF %>
  <% IF Not KS.IsNul(Rs("KS_HaoPingDate")) Then %>
  <tr class="tdbg">
  	<td height="25" align="right" class="clefttitle"><strong>任务收货好评时间：</strong></td>
  	<td>&nbsp;<%=Rs("KS_HaoPingDate")%></td>
  </tr>
  <% End IF %>
  <% IF Not KS.IsNul(Rs("KS_EndDate")) Then %>
  <tr class="tdbg">
  	<td height="25" align="right" class="clefttitle"><strong>任务确认审核时间：</strong></td>
  	<td>&nbsp;<%=Rs("KS_EndDate")%></td>
  </tr>
  <% End IF %>
  <% IF Not KS.IsNul(Rs("KS_CreditDate")) Then %>
  <tr class="tdbg">
  	<td height="25" align="right" class="clefttitle"><strong>发布方平台评价时间：</strong></td>
  	<td>&nbsp;<%=Rs("KS_CreditDate")%></td>
  </tr>
  <% End IF %>
  <% IF Not KS.IsNul(Rs("KS_BuyCreditDate")) Then %>
  <tr class="tdbg">
  	<td height="25" align="right" class="clefttitle"><strong>接手方平台评价时间：</strong></td>
  	<td>&nbsp;<%=Rs("KS_BuyCreditDate")%></td>
  </tr>
  <% End IF %>
  <tr class="tdbg">
  	<td height="25" align="right" class="clefttitle"><strong>任务当前状态：</strong></td>
  	<td style="color:red">&nbsp;<%
	Select Case KS.ChkClng(Rs("KS_Status"))
		case 0
				KS.Echo "等待接手"
		case 1
			IF KS.IsNul(Rs("KS_BuyShopName")) Then
				KS.Echo "等待绑定买号"
			Else
				KS.Echo "等待支付"
			End If
		case 2
			KS.Echo "等待发货"
		case 3
			KS.Echo "等待收货"
		case 4
			KS.Echo "等待审核"
		case 5
			KS.Echo "已完成"
			If KS.IsNul(Rs("KS_CreditDate")) And KS.IsNul(Rs("KS_BuyCreditDate")) Then
				KS.Echo ",等待双方平台评价"
			Else
				If KS.IsNul(Rs("KS_CreditDate")) Then 		KS.Echo ",等待发布方平台评价"
				If KS.IsNul(Rs("KS_BuyCreditDate")) Then	KS.Echo ",等待接手方平台评价"
			End IF
	End Select
	if KS.ChkClng(Rs("ks_LockTF"))=1 then KS.echo "<span style=""color:blue;font-weight:bold""> | 已锁</span>"
	if KS.ChkClng(Rs("ks_PauseTF"))=1 then KS.echo "<span style=""color:blue;font-weight:bold""> | 已暂停</span>"
	%></td>
  </tr>
  <tr>
  	<td colspan="2" align="center" bgcolor="#EEF1F1" style="height:50px;"><input type="image" name="Save" src="/style/images/CloseButton.gif" onClick="parent.closeWindow();" /></td>
  </tr>
</table>
</div>
</body>
</html>
<%
		Else
			KS.AlertHistory "传送的ID有误或该任务已被删除！","-1"
		End If
	End If
End If
End Sub
End Class
%>