goods.html 1.2 KB
Newer Older
骆昊的技术专栏's avatar
骆昊的技术专栏 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
<!DOCTYPE html>
{% load staticfiles %}
<html>
	<head>
		<meta charset="utf-8">
		<style>
			img { display: inline-block; width: 150px; height: 150px; border: 1px solid gray; }
			th, td { margin: 0; padding: 0; width: 250px; text-align: left; }
			.name { font-size: 14px; font-weight: bolder; }
			.price { color: red; font-size: 18px; }
			a { display: inline-block; width: 120px; height: 30px; line-height: 30px; text-align: center; background-color: red; }
			a:link, a:visited { color: white; text-decoration: none; }
			.left { float: left; width: 1000px;}
			.right { float: right; }
		</style>
	</head>
	<body>
		<div class="left">
			<h1>商品列表</h1>
			<hr>
		</div>
		<div class="right">
			<a href="/show_cart">查看购物车</a>
		</div>
		<table style="clear:both;">
			<tr>
				<th>商品名称</th>
				<th>商品价格</th>
				<th>商品图片</th>
				<th>操作</th>
			</tr>
			{% for goods in goods_list %}
			<tr>
				<td class="name">{{ goods.name }}</td>
				<td class="price">&yen;{{ goods.price }}</td>
				<td>
					<img src="{% static goods.image %}" alt="{{ goods.name }}">
				</td>
				<td>
					<a href="/add_to_cart/{{ goods.id }}">加入购物车</a>
				</td>
			</tr>
			{% endfor %}
		</table>
	</body>
</html>