Python-100-Days/Day41-55/code/shop/templates/cart.html

55 lines
1.5 KiB
HTML
Raw Normal View History

2018-05-25 13:26:52 +08:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
th, td { margin: 0; padding: 0; width: 180px; text-align: left; }
.name { font-size: 14px; font-weight: bolder; width: 280px; }
.price { color: red; font-size: 18px; }
a { display: inline-block; text-align: center; background-color: red; }
.back { width: 120px; height: 30px; line-height: 30px; }
.del { width: 60px; height: 20px; line-height: 20px; }
a:link, a:visited { color: white; text-decoration: none; }
.left { float: left; width: 1000px;}
.right { float: right; }
.total { text-align: right; }
</style>
</head>
<body>
<div class="left">
<h1>购物车列表</h1>
<hr>
</div>
<div class="right">
2018-05-25 17:00:43 +08:00
<a href="/" class="back">返回</a>
2018-05-25 13:26:52 +08:00
</div>
2018-05-25 17:00:43 +08:00
{% if cart %}
2018-05-25 13:26:52 +08:00
<table style="clear: both;">
<tr>
<th>商品名称</th>
<th>商品单价</th>
<th>商品数量</th>
<th>商品总价</th>
<th>操作</th>
</tr>
2018-05-25 17:00:43 +08:00
{% for item in cart.cart_items %}
2018-05-25 13:26:52 +08:00
<tr>
2018-05-25 17:00:43 +08:00
<td class="name">{{ item.goods.name }}</td>
<td class="price">&yen;{{ item.goods.price }}</td>
2018-05-25 13:26:52 +08:00
<td>{{ item.amount }}</td>
2018-05-25 17:00:43 +08:00
<td class="price">&yen;{{ item.total }}</td>
2018-05-25 13:26:52 +08:00
<td>
<a href="" class="del">删除</a>
</td>
</tr>
{% endfor %}
<tr>
<td colspan="5" class="total price">&yen;{{ cart.total }}元</td>
</tr>
</table>
2018-05-25 17:00:43 +08:00
<a href="" class="back">清空购物车</a>
2018-05-25 13:26:52 +08:00
{% else %}
<h3 style="clear: both;">购物车中暂时没有商品!</h3>
{% endif %}
</body>
</html>