<!--<?php
if ($action == 'buy') {print <<<EOT
-->
<style type="text/css">
.t{margin-top:8px;border:4px solid $forumcolortwo;}
.t table tr td{padding:.8em 0 .8em 3em;}
.t table tr th{text-align:right;font-weight:normal;}
.t table{border:2px solid $tablecolor;}
.t .h{padding-left:1em;text-align:left}
</style>

<div class="bdbA">
	<div id="breadcrumbs">
		<a class="crumbs-item gray3" href="$db_bfn" title="$db_bbsname">$db_bbsname</a>
		<span class="crumbs-item current"><i> </i>商品購買</span>
		<span class="crumbs-item current"><i> </i><strong>$trade[name]</strong></span>
	</div>
</div>
<form action="trade.php?action=buy" method="post">
<input type="hidden" name="step" value="3" />
<input type="hidden" name="tid" value="$tid" />
<div class="t f_one" style="margin-top:8px">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
	<tr><th class="h" colspan="2">確認商品交易</th></tr>
	<tr>
		<th style="width:30%;">商品名稱︰</th>
		<td class="s8"><a href="read.php?tid=$tid">$trade[name]</a></td>
	</tr>
	<tr>
		<th>當前價格︰</th>
		<td>$trade[costprice]</td>
	</tr>
	<tr>
		<th>所 在 地︰</th>
		<td>$trade[locus]</td>
	</tr>
	<tr>
		<th>賣　　家︰</th>
		<td><a href="u.php?action=trade&uid=$trade[uid]">$trade[username]</a></td>
	</tr>
	<tr>
		<th>收貨地址︰</th>
		<td><input type="text" class="input" name="address" size="60" /> &nbsp;郵政編碼︰ <input type="text" class="input" name="zip" size="8" /></td>
	</tr>
	<tr>
		<th>收 貨 人︰</th>
		<td><input type="text" class="input" name="consignee" /></td>
	</tr>
	<tr>
		<th>聯系電話︰</th>
		<td><input type="text" class="input" name="tel" /></td>
	</tr>
	<tr>
		<th>購買數量︰</th>
		<td><input type="text" class="input" name="quantity" value="1" size="6" /></td>
	</tr>
	<tr>
		<th>運送方式︰</th>
		<td>
<!--
EOT;
if ($trade['transport']) {print <<<EOT
-->
			<input type="radio" name="transport" value="1" /> 平郵︰$trade[mailfee] 元<br />
			<input type="radio" name="transport" value="2" /> 快遞︰$trade[expressfee] 元<br />
			<input type="radio" name="transport" value="3" /> EMS︰$trade[emsfee] 元<br />
			<!-- 如果沒有運費發生，您可以在拍下該商品後，要求賣家修改運費 -->
<!--
EOT;
}print <<<EOT
-->
		</td>
	</tr>
	<tr>
		<th>給賣家留言︰</th>
		<td><textarea name="descrip" style="width:360px;height:40px"></textarea></td>
	</tr>
	<tr><td></td><td><input type="submit" class="btn" value="確認無誤，購買" /></td></tr>
	<tr class="f_one"><td style="height:8px;" colspan="2"></td></tr>
</table></div>
</form>
<!--
EOT;
} elseif ($action == 'order') {print <<<EOT
-->
<style type="text/css">
.t{margin-top:8px;border:4px solid $forumcolortwo;}
.t table tr td{padding:.8em 0 .8em 3em;}
.t table tr th{text-align:right;font-weight:normal;}
.t table{border:2px solid $tablecolor;}
.t .h{padding-left:1em;text-align:left}
</style>
<div class="bdbA">
	<div id="breadcrumbs">
		<a class="crumbs-item gray3" href="$db_bfn" title="$db_bbsname"><strong>$db_bbsname</strong></a>
		<span class="crumbs-item current"><i> </i>訂單詳細信息</span>
	</div>
</div>
<div class="t f_one" style="margin-top:8px">
<table width="100%" cellspacing="0" cellpadding="0">
	<tr><th class="h" colspan="2">訂單詳細信息</th></tr>
	<tr class="tr2"><th>訂單商品信息</th><td></td></tr>
	<tr>
		<th>商品名稱︰</th>
		<td><a href="read.php?tid=$order[tid]">$order[subject]</a></td>
	</tr>
	<tr>
		<th>購買數量︰</th>
		<td>$order[quantity]</td>
	</tr>
	<tr>
		<th>商品單價︰</th>
		<td>$order[price]</td>
	</tr>
	<tr>
		<th>購買日期︰</th>
		<td>$order[buydate]</td>
	</tr>
	<tr>
		<th>賣　　家︰</th>
		<td><a href="u.php?action=trade&uid=$order[uid]">$order[username]</a></td>
	</tr>
	<tr>
		<th>備　　注︰</th>
		<td>$order[descrip]</td>
	</tr>
	<tr class="tr2"><th>商品物流信息</th><td></td></tr>
	<tr>
		<th>運費方式︰</th>
		<td>
<!--
EOT;
if ($order['transport'] && $order['transportfee']) {
$o_lang = array('1' => '平郵', '2' => '快遞', '3' => 'EMS');
print <<<EOT
-->
			{$o_lang[$order[transport]]} $order[transportfee]
<!--
EOT;
} else {print <<<EOT
-->
			賣家承擔
<!--
EOT;
}print <<<EOT
-->
		</td>
	</tr>
	<tr>
		<th>收貨地址︰</th>
		<td>$order[address]</td>
	</tr>
	<tr>
		<th>收 貨 人︰</th>
		<td>$order[consignee]</td>
	</tr>
	<tr>
		<th>聯系電話︰</th>
		<td>$order[tel]</td>
	</tr>
	<tr class="tr2"><th>總金額及支付</th><td></td></tr>
	<tr>
		<th>總金額︰</th>
		<td>$order[price] * $order[quantity] + $order[transportfee] = $totalpay</td>
	</tr>
	<tr>
		<th>交易狀態︰</th>
		<td>
<!--
EOT;
if ($order['ifpay'] == 4) {print <<<EOT
-->
			<div style="margin:1em 0;color:#f00">交易失敗</div>
<!--
EOT;
} elseif ($order['ifpay'] == 3) {print <<<EOT
-->
			<div style="margin:1em 0;color:#00f">交易完成</div>
<!--
EOT;
} elseif ($order['ifpay'] == 2) {print <<<EOT
-->
			<div style="margin:1em 0;color:#00f">賣家已發貨，確認收貨</div>
<!--
EOT;
if ($order['buyer'] == $winduid) {
if ($order['payment'] == 1) {print <<<EOT
-->
			<div>
			賣家已發貨，以下是發貨信息︰<div style="margin:5px 0;border:1px solid #8C8A8C;width:400px;padding:5px">$order[tradeinfo]<br />發貨時間︰$order[tradedate]</div>
			請于收到貨後，確認收貨<br /><br />
				<form action="trade.php?action=get&oid=$oid" method="post">
					<div><input type="submit" class="btn" value="確認收貨" /></div>
				</form>
			</div>
<!--
EOT;
} elseif ($order['payment'] == 2) {print <<<EOT
-->
			<div><b>賣家已發貨，請于收到貨後，<a href="http://www.alipay.com">到支付寶確認收貨</a></b><br /><br />
				如果您的支付寶狀態已經更改，但論壇狀態還沒有修改，您也可以手動確認
				<form action="trade.php?action=get&oid=$oid" method="post" onsubmit="if(confirm('確定收到貨了嗎?')){ return true;} else {return false;}">
					<div><input type="submit" class="btn" value="確認收貨" /></div>
				</form>
			</div>
<!--
EOT;
}}} elseif ($order['ifpay'] == 1) {print <<<EOT
-->
			<div style="margin:1em 0;color:#00f">買家已付款，等待賣家發貨</div>
<!--
EOT;
if ($order['seller'] == $winduid) {
if ($order['payment'] == 1) {print <<<EOT
-->
			<div>
			該買家使用線下交易方式付款，以下是付款信息︰<div style="margin:5px 0;border:1px solid #8C8A8C;width:400px;padding:5px">$order[tradeinfo]</div>
				請核對信息後，盡快發貨<br /><br />
				<form action="trade.php?action=send&oid=$oid" method="post">
				物流公司︰<input type="text" name="logistics" /><br />
				物流單號︰<input type="text" name="orderid" /><br />
					<div style="padding-left:5em"><input type="submit" class="btn" value="確認發貨" /></div>
				</form>
			</div>
<!--
EOT;
} elseif ($order['payment'] == 2) {print <<<EOT
-->
			<div>該買家使用支付寶線上付款，<a href="http://www.alipay.com">您可以馬上發貨，並到支付寶更新狀態</a></div>
<!--
EOT;
}}} elseif ($order['ifpay'] == 0) {print <<<EOT
-->
			<div style="margin:1em 0;color:#f00">等待買家付款</div>
<!--
EOT;
if ($winduid == $order['buyer']) {
if ($order['paymethod'] & 1) {print <<<EOT
-->
			<div style="width:350px;float:left">線下交易 (請輸入您的付款信息，以便賣家確認) <br />
				<form action="trade.php?action=pay&oid=$oid&method=1" method="post">
				<textarea name="tradeinfo" style="width:250px;height:50px"></textarea>
				<div style="margin:3px 0"><input type="submit" class="btn" value="提 交" /></div>
				</form>
			</div>
<!--
EOT;
}if ($order['paymethod'] & 2) {print <<<EOT
-->
			<div style="float:left">在線支付 <br /><a href="trade.php?action=pay&oid=$oid&method=2"><img src="$imgpath/alipay.gif" /></a></div>
<!--
EOT;
}}}print <<<EOT
-->
		</td>
	</tr>
</table>
</div>
<!--
EOT;
}?>-->