{load(fhead)}
<style type="text/css">
	.input{
	border: 1px solid #E1B48E;
	padding:2px;
	background-color: #FFFCF7;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 18px;
	font-weight: bold;
	color: #DB0000;
	width:217px
	}
	.checkbox{background:none;border:none;width:16px}
	#cztpl table{border-collapse: collapse;}
</style>
<script type="text/javascript">
  function $(id){
    return document.getElementById(id);
  }
</script>
<!--$item = $vd['item'];-->
<body class="mainbg">
<input type="hidden" id="webdir" name="webdir" value="{$vd['root']}"/>
<input type="hidden" id="platform" value="b2b"/>
<div id="mainhearder"><span>您的位置：<a href="{$vd['root']}index.php?m=mod_b2b&a=Home">直销商管理系统</a> >> 我要进货 >> 购卡填单</span></div>
<div id="hearder"><span>购买订单</span></div>
  <form name="submitform" id="submitform" method="post" action="{$vd['root']}index.php?m=mod_b2b&c=<!--if($vd['scoredpid']==0){-->pay<!--}else{-->ScoredPay<!--}-->" onsubmit="return checksubmit()">
  <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
  <td class="tableleft">
    <table border="0" width="100%" style="border-collapse: collapse;" bordercolor="#CFDCF2">
      <tr>
        <td class="buylt">商品名称：</td>
        <td class="buyrt"><a href="javascript:toggle('0','0','cp');"><b>{$item['pname']}</b><img src="{$vd['content']}images/icon_productxx.gif" border=0></a></td>
      </tr>
      <tr style="display:none">
        <td class="buylt">商品面值：</td>
        <td class="buyrt">
        	{$vd['lang']['moneysymbol']}{$item['listprice']}{$vd['lang']['moneyunit']}
        </td>
      </tr>
      <tr>
        <td class="buylt">进货价：</td>
        <td class="buyrt"><font color="#ff0000" onmouseover="showcprice(1)" onmouseout="showcprice(0)">鼠标移此</font> <span id="cprice" class="cprice" style="display:none">读取中..</span>
        <DIV id="cp0" style="display:none;" class="cpxx">
        <div id="cpinfo"><div class="cp"><span><a href="javascript:toggle('0','0','cp');"><img src="{$vd['content']}images/close.gif" border="0" align="absmiddle"/></a></span><img src="{$vd['content']}images/point1.gif" align="absmiddle"> 商品信息</div>
      <p><b>商品简介：</b>{#ubbcode($item['pdesc'], $vd)}<br/>
        <b>官方网址：</b><a href="{$item['czweb']}" target="_blank">{$item['web']}</a><br>
        <b>充值网址：</b><a href="{$item['czweb']}" target="_blank">{$item['czweb']}</a><br></p>
        </div></DIV>
        </td>
      </tr>
      <tr>
        <td class="buylt">商品类型：</td>
        <td class="buyrt">{#ProductType($item['ptype'])}</td>
      </tr>
      <tr style="display:none">
        <td class="buylt">库存状态：</td>
        <td class="buyrt"><span id="thisstock">读取中..</span></td>
      </tr>
      <!--if( $item['ptype'] == 1 || $item['ptype'] == 2){-->
      <tr>
        <td class="buylt">充值{$item['idlable']}：</td>
        <td class="buyrt"><input id="ubzczacount" name="ubzczacount" type="text"  class="input"/> *</td>
      </tr>
      <tr>
        <td class="buylt">重复{$item['idlable']}：</td>
        <td class="buyrt"><input id="ubzreczacount" name="ubzreczacount" type="text"  class="input" /> *</td>
      </tr>
      <!--}-->
      
      <input type="hidden" id="ubztpl" value="{$vd['item']['cztpl']}" />
      
      <!--if( isset($vd['xml']) && $vd['xml'] == 1){-->
      
      <!--if($vd['vip'] > 0){-->
      <!--$sc=str_replace(VROOT.'/','',$vd['sc']);-->
      <!--}else{-->
      <!--$sc=$vd['sc'];-->
      <!--}-->
      <input type="hidden" id="ubzsystpl" value="{$vd['item']['syscztpl']}" />
      <input type="hidden" id="tpldir" value="{$vd['root']}{$sc}" />
      <script type="text/javascript" src="{$vd['root']}{$sc}systpl/czui.js"></script>
      <!--}-->
      <!--if( isset($vd['extcontent']) ){-->
      {$vd['extcontent']}
      <!--}-->
      <!--if( isset($vd['tplcontent']) ){-->
      {$vd['tplcontent']}
      <!--}-->
      
      <!--if( $item['ptype'] == 3 && $item['disparea'] == 1 ){-->
      <tr>
        <td class="buylt">选择{$item['idlable']}：</td>
        <td class="buyrt">
        <div id="cardsdiv">
        	<!--if(count($vd['cardrs']) == 0){-->
        	库存已经没有号码可选
        	<!--}else{-->
        	<!--foreach($vd['cardrs'] as $carditem){-->
        	<div><input id="ubzczacount" name="ubzczacount" type="radio" value="{$carditem}"/>{$carditem}</div>
        	<!--}-->
        	<!--}-->
        </div>
        <select style="display:none" id="ubzqty" name="ubzqty"><option value="1">1</option></select>
        </td>
      </tr>
      <!--}else{-->
      <!--if(!isset($vd['xml']) || (isset($vd['xml'])&&$vd['xml']==0)){-->
      <tr>
        <td class="buylt">购买数量：</td>
        <td class="buyrt">
        	<select name="ubzqty" id="ubzqty" onchange="ChangeNum()">
        		<option value="0">请选择</option>
        		<!--if( isset($vd['qtylist']) ){-->
            {$vd['qtylist']}
            <!--}-->
        	</select>&nbsp;<!--if(isset($item['buyaday']) && $item['buyaday'] > 0){--><font color="#ff0000"><b>每天最多购买 {$item['buyaday']} 个</b></font><!--}-->&nbsp;
        </td>
      </tr>
      <!--}-->
      <!--}-->
      <!--if(isset($vd['info']['qtyctrl']) && $vd['info']['qtyctrl'] == 1){-->
      <tr>
        <td class="buylt">注意：</td>
        <td class="buyrt" style="color:#ff0000">
        <!--if( $vd['info']['qtylist'] != ''){-->
                支持购买数量：<b>{$vd['info']['qtylist']}</b>
              <!--}else{-->
                单次最小数量：<b>{$vd['info']['qtymin']}</b>&nbsp;单次最大数量：<b>{$vd['info']['qtymax']}</b>
              <!--}-->
        </td>
      </tr>
      <!--}-->

      <!--if( $item['ptype'] == 0 ){-->
      <tr>
        <td class="buylt">购后动作：</td>
        <td class="buyrt">
          <input type="radio" name="getatonce" value="0" checked > 购后取卡
         &nbsp;<!--if($item['quickuse']==1 && $item['quickusetime'] > 0){--><font color="#ff0000"><b>请购买后{$item['quickusetime']}小时内使用</b></font><!--}-->
        </td>
      </tr>
      <!--}-->
      <tr>
        <td class="buylt">购卡备注：</td>
        <td class="buyrt"><textarea name="others" wrap="VIRTUAL" rows="3" scrolling="yes" style="padding:5px;width:213px"></textarea></td>
      </tr>
      <tr id="tradepwdtr" style="display:none">
        <td class="buylt">交易密码：</td>
        <td class="buyrt"><input type="password" id="tradepwd" name="tradepwd" size="16" class="input"/></td>
      </tr>
      <tr>
        <td class="buylt">售玩家单价：</td>
        <td class="buyrt"><input type="text" id="priceforplayer" name="priceforplayer" value="{$item['listprice']}" style="width:100px;background:#f4f4f4" onkeyup="ChangeNum()" class="input" readOnly /> {$vd['lang']['moneyunit']}</td>
      </tr>
      <tr>
        <td class="buylt">应收玩家金额：</td>
        <td class="buyrt"><input type="text" id="dollarsforplayer" name="dollarsforplayer" value="{$item['listprice']}" style="width:100px;background:#f4f4f4" class="input" readOnly /> {$vd['lang']['moneyunit']}</td>
      </tr>
      <!--if($vd['scoredpid'] == 0 && $item['scored'] > 0){-->
      <tr>
        <td class="buylt">赠送积分：</td>
        <td class="buyrt"><input type="hidden" id="cscored"  name="cscored" value="{$item['scored']}" /> <input type="text" readonly id="scored"  name="scored" value="{$item['scored']}" style="width:100px" class="input"  /> 点</td>
      </tr>
      <!--}-->
      <!--if($vd['scoredpid'] > 0){-->
      <tr>
        <td class="buylt">所需积分：</td>
        <td class="buyrt">
          <input type="hidden" id="scored" readonly name="scored" value="{$vd['cp']['scored']}" style="width:100px"/>
          <input type="text" id="needscored" readonly name="needscored" value="{$vd['cp']['scored']}" style="width:100px"/> 点
        </td>
      </tr>
      <tr>
        <td class="buylt">用户当前积分：</td>
        <td class="buyrt"><b>{$vd['ainfo']['scored']}</b> 点</td>
      </tr>
      <!--}-->
      <!--if( $item['buylit'] == 1 ){-->
      <!--$proptmp=array();if(isset($item['prop']) && $item['prop'] != ''){;$proptmp = unserialize($item['prop']);}-->
      <tr>
        <td class="buylt"><!--if(isset($proptmp['buylitobject']) && $proptmp['buylitobject']==0){-->禁止购买<!--}else{-->开放购买<!--}-->：</td>
        <td class="buyrt">
        <font color="#ff0000"><b>每天{$item['buylitstardate']}时到{$item['buylitenddate']}</b></font> <font color="#0000ff"><b><!--if(isset($proptmp['buylitobject']) && $proptmp['buylitobject']==0){-->禁止购买<!--}else{-->开放购买<!--}--></b></font>
        </td>
      </tr>
      <!--}-->
    </table>
    <input id="ubzcprice" name="oneprice" type="hidden" />
    <input id="ubzdollars" name="ubzdollars" type="hidden" />
    <input id="tprice" name="tprice" type="hidden" />
    <input id="ubzptype" name="ubzptype" type="hidden" value="{$item['ptype']}"/>
    <input id="ubzpid" name="ubzpid" type="hidden" value="{$item['pid']}"/>
    <input id="ubzqtylist" name="ubzqtylist" type="hidden" value="{$item['qtylist']}"/>
    <input id="ubzqtymin" name="ubzqtymin" type="hidden" value="{$item['qtymin']}"/>
    <input id="ubzqtymax" name="ubzqtymax" type="hidden" value="{$item['qtymax']}"/>
    <input id="ubzidlable" name="ubzidlable" type="hidden" value="{$item['idlable']}"/>
    <input id="ubzdisparea" name="ubzdisparea" type="hidden" value="{$item['disparea']}"/>
    <input id="ubzdispserv" name="ubzdispserv" type="hidden" value="{$item['dispserv']}"/>
    <input id="scoredpid" name="scoredpid" type="hidden" value="{$vd['scoredpid']}"/>
    <input id="ubzcname" name="ubzcname" type="hidden" value=""/>
    <input id="ubzunit" name="ubzunit" type="hidden" value="{$item['unit']}"/>
    <input id="ubzmaxqty" name="ubzmaxqty" type="hidden" value="<!--echo isset($vd['info']['maxqty']) ? 1 : 0;-->"/>
    <input id="moneyunit" name="moneyunit" type="hidden" value="{$vd['lang']['moneyunit']}"/>
    <input id="moneysymbol" name="moneysymbol" type="hidden" value="{$vd['lang']['moneysymbol']}"/>
  </td>
  </tr>
</table>
<br>
<input name="Submit" type="Submit" class="button" value="<!--if($vd['scoredpid']==0){-->我要购买<!--}else{-->积分兑换<!--}-->" id="btnsubmit">　<input name="goback" type="button" class="button" value="<!--if($vd['scoredpid']==0){-->购买其他<!--}else{-->兑换其他<!--}-->" onclick="javascript:self.close();">
<br><br>
</form>
<!--if($item['palert'] != ''){-->
<style type="text/css">html,body{height:100%;}</style>
<div id="light" class="white" > 
<div class="div_content">
  <div class="lightboxhearder" align="left"><span>购买注意事项：</span></div>
  <div class="lbcontent">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td height="80px" valign="top"><p><font color=#ff0000>{#ubbcode($item['palert'])}</font></p></td>
    </tr>
    <tr>
    <td align=center><br><INPUT TYPE="checkbox" NAME="nextnoalert" value="1" id="noalert" onclick="setpalert();"><label for="noalert" onclick="setpalert()">以后本商品的注意不再提醒</label></td>
    </tr>
    <tr>
    <td height="40" valign="middle" align="center"><input type="button" value="我知道了" onclick="resetproduct();"> <input type="button" value="放弃购买" onclick="javascript:self.close();"></td>
    </tr>
    </table>
  </div>
</div>
</div>
<div id="fade" class="black_overlay"></div>
<!--}-->
</body>
</html>
<script type="text/javascript">
 
  function showcprice(flag){
    $("cprice").style.display = (flag == 1)? "" : "none";
  }
  
  firstclick = 0;
  
  function checksubmit()
  {
  	if($("ubzqty"))
  	{}
    else
  	{
  		alert("请先选择充值游戏！");
      return false;
  	}
    qty = $("ubzqty").options[$("ubzqty").selectedIndex].value;
    if(qty <= 0)
    {
    	alert("请先选择数量！");
      return false;
    }
    
    <!--if( $item['ptype'] == 1 || $item['ptype'] == 2 ){-->
    tt1 = $("ubzczacount").value;
    tt2 = $("ubzreczacount").value;
    if(tt1 == "")
    {
      $("ubzczacount").focus();
      alert("充值帐号不能为空！");
      return false;
    }
    
    if(tt1 !== tt2)
    {
      $("ubzreczacount").focus();
      alert("两次帐号输入不一致，请重新输入");
      return false;
    }
    <!--}-->
    <!--if( isset($vd['info']['v']) ){-->
      if({$vd['info']['maxqty']} < qty)
      {
        alert("平台管理员的余额不足，您无法购买这么多的商品，请重新选择\n\n或者联系管理员");
        return false;
      }
      
      <!--if(isset($vd['info']['qtyctrl']) && $vd['info']['qtyctrl'] == 1){-->
        <!--if( $vd['info']['qtylist'] != ''){-->
          spqtylist = ",{$vd['info']['qtylist']},";
          if(spqtylist.indexOf("," + qty + ",") == -1)
          {
            alert("您好，请选择含在序列 {$vd['info']['qtylist']} 中的对应数量！");
            return false;
          }
        <!--}else{-->
          sqtymax = {$vd['info']['qtymax']};
          sqtymin = {$vd['info']['qtymin']};
          if(sqtymax < qty)
          {
            alert("您好，单次购买的最大量为 {$vd['info']['qtymax']} ，请重新选择数量！");
            return false;
          }
          if(sqtymin > qty)
          {
            alert("您好，单次购买的最小量为 {$vd['info']['qtymin']} ，请重新选择数量！");
            return false;
          }
        <!--}-->
      <!--}-->
      
      cktype = new Array("ubzcztype","ubzczarea1","ubzczarea2","ubzczother");
      <!--for($i=0;$i<4;$i++){-->
      <!--if( isset($vd['info']['v'][$i]) && $vd['info']['v'][$i] == 1 ){-->
        if($(cktype[{$i}]))
        {
          if($(cktype[{$i}]).value == "")
          {
            alert("请先选择<!--echo $vd['info']['txt'][$i];-->！");
            return false;
          }
        }
        else
        {
          alert("请先选择<!--echo $vd['info']['txt'][$i];-->！\n如果没有看到<!--echo $vd['info']['txt'][$i];-->，请稍等片刻或者重新刷新本页！");
          return false;
        }
      <!--}-->
      <!--}-->
    <!--}-->
    
    <!--if($item['ptype'] == 1 || $item['ptype'] == 2 || $item['ptype'] == 4 || $item['ptype'] == 5 || $item['ptype'] == 6) {-->
    //看看是不是有需要自动检查的东西
    if( $("needinput") )
    {
    	nv = $("needinput").value;
    	nlabel = $("needinputlabel").value;
    	ntype = $("needinputtype").value;
    	if(nv != "" && nlabel != "" && ntype != "")
    	{
    		nvarr = nv.split(",");
    		nlabelarr = nlabel.split(",");
    		ntypearr = ntype.split(",");
    		nvlen = nvarr.length;
    		for(i = 0; i < nvlen; i++)
    		{
    			if($(nvarr[i]) && $(nvarr[i]).value == "")
    			{
    				altstr = ntypearr[i] == "radio" || ntypearr[i] == "select" ? "选择"  : "输入";
    				altstr = "请您" + altstr + nlabelarr[i];
    				alert(altstr);
    				return false;
    			}
    		}
    	}
    }
    <!--}-->
    
    if(firstclick > 0)
    {
      $("btnsubmit").disabled = true;
      alert("为了避免重复下单，请到购卡记录中查看是否已经扣款\n\n如果已经扣款，您可以点击补单或者联系管理员退款后重新下单");
      return false;
    }
    
    if (qty>0)
    {
      var str = "确认购买 {$item["pname"]} "+ qty +" 个吗？并请注意以下购买注意事项：\n\n\n1、本商品一经购买无法退换货，请注意不要选择错误；\n2、购买后请尽快充值，不要将卡密放至库存中，以防止过期；\n3、到官方充值时请注意区分卡号及密码的大小写；";
      $("btnsubmit").disabled = true;
      if(confirm(str))
      {
        firstclick = firstclick + 1;
        return true;
      }
      else
      {
        $("btnsubmit").disabled = false;
        return false;
      }
    }
    else
    {
      alert("请先选择数量！");
      return false;
    }
  }

  
  function getCookie(c_name)
  {
    if (document.cookie.length>0)
    {
      c_start=document.cookie.indexOf(c_name + "=");
      if (c_start!=-1)
      {
        c_start=c_start + c_name.length+1;
        c_end=document.cookie.indexOf(";",c_start);
        if (c_end==-1) c_end=document.cookie.length;
        return unescape(document.cookie.substring(c_start,c_end));
      }
    }
    return "";
  }
  
  if(getCookie('umebiz_com_8') == "1")
  {
    obj = $("tradepwdtr");
    obj.style.display = "";
  }
  
  function toggle(id,allid,name)
  {
    if (document.getElementById)
    {
      target=document.getElementById(name + id);
      if (target.style.display=="block")
      {
        target.style.display="none";
      }
      else
      {
        target.style.display="block";
        for(var i = 1;i<=allid;i++)
        {
          if (id!=i)
          {
            target=document.getElementById(name + i);
            if (target.style.display=="block")
            {
              target.style.display="none";
            }
          }
        }
      }
    }
  }
  
  <!--if($item['palert'] != ''){-->
  $("fade").style.display = "";
  $("light").style.display = "";
  $("btnsubmit").disabled = true;
  if(getCookie('umebiz_alert_{$item['pid']}') == "0")
  {
    resetproduct();
  }
  
  function resetproduct()
  {
    $("btnsubmit").disabled = false;
    $("fade").style.display = "none";
    $("light").style.display = "none";
  }
  
  function setpalert()
  {
    val = $("noalert").checked ? 0 : 1;
    setCookie('umebiz_alert_{$item['pid']}', val, 365);
  }
  <!--}-->
</script>
<script src="{$vd['content']}js/prdzone.js"></script>
<script src="{$vd['content']}js/buy.js"></script>