更新
This commit is contained in:
55
Python-100-Days/Day41-55/shop_origin/templates/cart.html
Normal file
55
Python-100-Days/Day41-55/shop_origin/templates/cart.html
Normal file
@@ -0,0 +1,55 @@
|
||||
<!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">
|
||||
<a href="list_goods" class="back">返回</a>
|
||||
</div>
|
||||
{% if cart_items %}
|
||||
<table style="clear: both;">
|
||||
<tr>
|
||||
<th>商品名称</th>
|
||||
<th>商品单价</th>
|
||||
<th>商品数量</th>
|
||||
<th>商品总价</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
{% for item in cart_items %}
|
||||
<tr>
|
||||
<td class="name">{{ item.name }}</td>
|
||||
<td class="price">¥{{ item.unit_price }}</td>
|
||||
<td>{{ item.amount }}</td>
|
||||
<td class="price">¥{{ item.total_price }}</td>
|
||||
<td>
|
||||
<a href="" class="del">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tr>
|
||||
<td colspan="5" class="total price">¥{{ cart.total }}元</td>
|
||||
</tr>
|
||||
</table>
|
||||
<a href="clear_cart" class="back">清空购物车</a>
|
||||
{% else %}
|
||||
<h3 style="clear: both;">购物车中暂时没有商品!</h3>
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
||||
46
Python-100-Days/Day41-55/shop_origin/templates/goods.html
Normal file
46
Python-100-Days/Day41-55/shop_origin/templates/goods.html
Normal file
@@ -0,0 +1,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">¥{{ 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>
|
||||
Reference in New Issue
Block a user