<script type="text/javascript" src="<{$config.weburl}>/script/artdialog/artDialog.source.js?skin=default"></script>
<script type="text/javascript" src="<{$config.weburl}>/script/artdialog/plugins/iframeTools.source.js"></script>
<script type="text/javascript">
function seebig(url,id)
{
	if(url=='')
		return;
	url = url.substr(0,url.lastIndexOf('/')+1)+'big_'+url.substr(url.lastIndexOf('/')+1);
    $('#imgmove').html('<a href="'+url+'" target="_blank">'+
	'<img id="img'+id+'" width="280" border="0" src="'+url+'" ></a>');
}
var weburl='<{$config.weburl}>';
function copyToClipboard(txt)
{
	try{
		window.clipboardData.setData("Text",txt);  
		alert('<{$lang.copysuc}>'); 
	}
	catch(e){alert('<{$lang.noace}>');}
}

</script>
<script src="<{$config.weburl}>/script/my_lightbox.js" language="javascript"></script>
<link href="<{$config.weburl}>/module/buy/templates/buys.css" rel="stylesheet" type="text/css" />
<div class="menu_bottom L1">
  <div class="headtop_L"> <{$lang.you_here}> &raquo; <a href='<{$config.weburl}>/'><{$lang.home}></a> &raquo; Buy Details</div>
</div>
<{if $de.statu<=0}>
<div class="leftbars">
  <div class="content4"> The product is not approved </div>
</div>
<{else}>
<div class="leftbars">
  <div class="content4" style="width:740px;">
    <div class="b_tit">
      <h1>Buy <{$de.title}></h1>
      <div class="b_clr"><span class="b_statu"><em><{if $de.deff_time>0}>Quote<{else}>End quote<{/if}></em></span></div>
      <div class="clear"></div>
    </div>
    <div class="b_inf">
      <div class="b_list b_goods">
        <ul class="b_lists">
          <li>Brief introduction &nbsp; <{$de.con|truncate:80:"...":true}></li>
          <li><{$lang.pro_city}> &nbsp; <{$cominfo.province}><{$cominfo.city}></li>
          <li class="b_clr">
            <div class="b_qtime"></div>
            <br />
            <table class="b_table">
              <tbody>
                <tr>
                  <td class="td1 bold"> Closing quote </td>
                  <td class="td2 bold"> Expected orders </td>
                  <td class="td1 bold"> Expect delivery </td>
                </tr>
              <td class="td1"><{$de.valid_time|date_format}></td>
                <td class="td2"><{$de.buy_time|date_format}></td>
                <td class="td1"><{$de.delivery_time|date_format}></td>
              <tr>
                  </tbody>
            </table>
          </li>
        </ul>
        <div style=" clear:both;"></div>
        <div class="b_cdown"> <span class="b_cdown_d"><{if $de.deff_time>0}>Distance : there<{$de.deff_time}>day
          <{if $smarty.cookies.USER!=''}> <a class="b_cprice" style="cursor:pointer; width:135px; color:#FF7300;" onclick="baojia()" ><b>Quote</b></a> <{else}>
          <form method="get" style="display:none;" id="login" action="<{$config.weburl}>/login.php" >
            <input  type="hidden" name="forward" value="<{$config.weburl}>/?m=buy&s=detail&id=<{$de.id}>" />
          </form>
          <a class="b_cprice" style="cursor:pointer;width:135px;  color:#FF7300;" onclick="javascript:$('#login').submit();" ><b>Quote</b></a> <{/if}>
          <{else}>Distance : End<a class="b_cprice" style="cursor:pointer; width:135px; color:#FF7300;" onclick="javascript:alert('报价结束');">End quote</a><{/if}> </span>
          <ul class="b_ioc b_clr ">
            <li> <span class="b_bza"> <span class="b_org bold"><{$de.f_time}></span>day<{if is_numeric($de.f_time)}>Ago<{/if}>Release</span> </li>
            <li> <span class="b_bzb">Already<span class="b_org bold"><{$de.pro_num}></span>Quoted price</span></li>
            <li> <span class="b_bzc"> <span class="b_org bold"></span> <a  href="<{$config.weburl}>/shop.php?uid=<{$de.userid}>&action=mail&m=company&tid=<{$de.id}>&contype=2">Message to the buyer</a></span></li>
          </ul>
        </div>
        <div class="clear"></div>
      </div>
      <div class="b_propic">
        <div id="imgmove" class="imgmove"> <{assign var=img value=$de.cover}>
          <{html_image file=$img width=280 alt=$list.title}> </div>
        <div id="infopic" class="small_pic"> <{foreach item=pic key=num from=$de.pic}>
          <{if $pic&&$num<5}> <img onMouseOver="seebig('<{$pic}>',<{$num}>)" style="cursor:pointer" src="<{$pic}>" border=0 width="45" height="40"> <{/if}>
          <{/foreach}> </div>
      </div>
      <div class="clear"></div>
    </div>
    <div class="b_detail" >
      <div class="b_dline"></div>
      <div class="b_det_txt"> <strong>Suppliers must meet the following criteria priority </strong>
        <ul>
          <li>Area：<{$de.seller_country}> <{$de.seller_province}> <{$de.seller_city}></li>
          <li><{$de.seller_need}></li>
        </ul>
      </div>
      <div class="b_det_ta b_det_txt"> <strong>Shopping list</strong>
        <table border="0" cellspacing="0" cellpadding="0">
          <colgroup>
          <col class="name">
          <col class="qua">
          <col class="unit">
          <col class="price">
          </colgroup>
          <tbody>
            <tr class="thead">
              <th>&nbsp;Product</th>
              <th>Quantity</th>
              <th>Unit</th>
              <th>Target price </th>
            </tr>
          <{foreach item=list from=$de.prolist}>
          <tr>
            <td><{$list.pname}></td>
            <td><{$list.number}></td>
            <td><{$list.unit}></td>
            <td><{$list.price}></td>
          </tr>
          <{/foreach}>
            </tbody>
          
        </table>
      </div>
      <div class="b_det_txt"> <strong>Detailed requirements</strong>
        <p><{$de.desc}></p>
      </div>
    </div>
  </div>
</div>
<div class="rightbar">
  <div class="right1 m1">
    <div class="b_sectitle" >
      <div class="title_left1 L2"><{$lang.seller_det}></div>
    </div>
    <div class="seccon"> <{if $de.view_right==false}>
      <li><{$lang.no_right}></li>
      <{else}>
      <{if $cominfo.company}>
      <table width="100%" border="0" style="margin-left:5px;"cellspacing="0">
        <tr height="22">
          <td colspan="2"><b><a href="<{geturl user=$cominfo.user uid=$cominfo.userid}>"><{$cominfo.company}></a></b></td>
        </tr>
        <tr height="22">
          <td colspan="2"><{if $cominfo.business}> <img src="<{$config.weburl}>/image/default/check_right.gif" /><{$lang.pass_th}>
            <{else}> <img src="<{$config.weburl}>/image/default/no_right.gif" /><{$lang.not_pass}>
            <{/if}> </td>
        </tr>
        <tr height="22">
          <td width="80"><{$lang.user_g}></td>
          <td width="*"><{$cominfo.grouplogo}>&nbsp;&nbsp;[<a href="<{$config.weburl}>/main.php?m=friend&s=admin_friends&friendid=<{$cominfo.userid}>"><{$lang.add_friend}></a>]</td>
        </tr>
        <tr height="22">
          <td><{$lang.cont}></td>
          <td><{$cominfo.contact}>  <{if $cominfo.qq!=''}> <a href="tencent://message/?uin=<{$cominfo.qq}>&Site=<{$config.weburl}>&Menu=yes"> <img align="absmiddle" border="0" src="http://wpa.qq.com/pa?p=1:<{$cominfo.qq}>:4" /></a> <{/if}>
            
            <{if $cominfo.msn!=''}> <a href="msnim:chat?contact=<{$cominfo.msn}>"> <img align="absmiddle" src="<{$config.weburl}>/image/default/ico_msn.gif" width="16" height="16"/></a> <{/if}>
            
            <{if $cominfo.skype!=''}> <a href="skype:<{$cominfo.skype}>?call"> <img align="absmiddle" border="0" src="<{$config.weburl}>/image/default/skypeonline.png"></a> <{/if}></td>
        </tr>
        <tr height="22">
          <td><{$lang.tel}></td>
          <td><{$cominfo.tel}></td>
        </tr>
        <tr height="22">
          <td><{$lang.fax}></td>
          <td><{$cominfo.fax}></td>
        </tr>
        <tr height="22">
          <td><{$lang.mobile}></td>
          <td><{$cominfo.mobile}></td>
        <tr height="22">
          <td><{$lang.pro_city}></td>
          <td><{$cominfo.province}><{$cominfo.city}></td>
        </tr>
        <tr height="22">
          <td><{$lang.addr}></td>
          <td><{$cominfo.addr}></td>
        </tr>
      </table>
      <{else}>
      <table width="100%" border="0" style="margin-left:5px;"cellspacing="0">
        <tr height="22">
          <td><{$lang.cont}></td>
          <td><{$cominfo.name}>  <{if $cominfo.qq!=''}> <a href="tencent://message/?uin=<{$cominfo.qq}>&Site=<{$config.weburl}>&Menu=yes"> <img align="absmiddle" border="0" src="http://wpa.qq.com/pa?p=1:<{$cominfo.qq}>:4" /></a> <{/if}>
            
            <{if $cominfo.msn!=''}> <a href="msnim:chat?contact=<{$cominfo.msn}>"> <img align="absmiddle" src="<{$config.weburl}>/image/default/ico_msn.gif" width="16" height="16"/></a> <{/if}>
            
            <{if $cominfo.skype!=''}> <a href="skype:<{$cominfo.skype}>?call"> <img align="absmiddle" border="0" src="<{$config.weburl}>/image/default/skypeonline.png"></a> <{/if}></td>
        </tr>
        <tr height="22">
          <td><{$lang.tel}></td>
          <td><{$cominfo.telphone}></td>
        </tr>
        <tr height="22">
          <td><{$lang.mobile}></td>
          <td><{$cominfo.mobile}></td>
        <tr height="22">
          <td><{$lang.pro_city}></td>
          <td><{$cominfo.prov}> <{$cominfo.pcity}></td>
        </tr>
      </table>
      <{/if}>
      <{/if}> </div>
    <div class="clear"></div>
  </div>
  <div class="b_sectitle m1" >
    <div class="title_left1 L2">Other Procurement</div>
  </div>
  <div class="b_seccon">
    <ul class="b_rul">
      <{foreach item=slist key=num from=$relbuy}>
      <li> 
        <div class="b_rinf">
          <ul>
            <li> <a href="<{$config.weburl}>/?m=buy&s=detail&id=<{$slist.id}>"><{$slist.title|truncate:22}> </a> </li>
            <li>Purchase quantity<span class="b_org bold"><{$slist.number}></span></li>
          </ul>
        </div>
        <div class="clear"></div>
      </li>
      <{/foreach}>
    </ul>
  </div>
</div>
<div class="clear"></div>
<!--报价清单-->
<div id="baojia" class="b_det_ta" style=" width:800px;height:400px; overflow-y:auto;display: none;">
  <form action="" id="from_baojia" method="post">
    Please enter your offer, such as: 200 yuan / month, a total of 2,000 yuan (quotations can not be modified)<br />
    <table border="0" cellspacing="0" cellpadding="0">
      <tr bgcolor="#E3EEF7" >
        <th width="*">Buy products</th>
        <th width="150">Purchase Quantity</th>
        <th width="150">Product Unit</th>
        <th width="150">Target Price</th>
        <th width="150">Quoted price</th>
      </tr>
      <{foreach item=list from=$de.prolist}>
      <tr>
        <td  width="*"><{$list.pname}>
          <input type="hidden" name="pname[]" value="<{$list.pname}>"/></td>
        <td  width="150"><{$list.number}>
          <input type="hidden" name="number[]" value="<{$list.number}>" /></td>
        <td  width="150"><{$list.unit}>
          <input type="hidden" name="unit[]" value="<{$list.unit}>" /></td>
        <td  width="150"><{$list.price}>
          <input type="hidden" name="price[]" value="<{$list.price}>" /></td>
        <td  width="150"><input type="text"  maxlength="6" name="bprice[]" value="" /></td>
      </tr>
      <{/foreach}>
    </table>
  </form>
</div>
<!--右边结束--> 
<script>
function baojia()
{
	art.dialog({
	lock:true,
	width:'800px',
	height:'400px',
	drag:false,resize: false, fixed:true,
	title: '报价清单',
	content:document.getElementById("baojia"),
	button: [{
		name: '提交',
		callback: function () {	
			$.ajax({
			    type: "POST",
			    url: "<{$config.weburl}>/?m=buy&s=detail",
			    data: "ajax=1&id=<{$de.id}>&"+$("#from_baojia").serialize(),
			    dataType:'text',
			    success: function(msg){
						if(msg=='ok')
							alert('成功报价');
						if(msg=='timeout')
							alert('报价结束');
						if(msg=='es')
							alert('您已经报价，请不要重复报价');
						if(msg=='uid')
							alert('请登陆后再报价');
						if(msg=='nobuy')
							alert('此求购不存在');
						if(msg=='err')
							alert('浏览器不支持该操作建议使用谷歌浏览器');
						if(msg=='error')
							alert('服务器异常，与数据库连接失败');
					},
					error: function (xmlHttp, textStatus){
						alert(textStatus);
					}
				});
				
			this.close();
		 },
		focus: true
		},{
		name: 'close',
		callback: function () {
				 this.close();
			return false;
		 },
		focus: true
		}]
	});
	
}
</script> 
<{/if}>