|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
|
|
<head>
|
|
|
{% load static %}
|
|
|
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
|
|
<title>天天生鲜-用户中心</title>
|
|
|
<link rel="stylesheet" type="text/css" href="{% static 'css/reset.css' %}">
|
|
|
<link rel="stylesheet" type="text/css" href="{% static 'css/main.css' %}">
|
|
|
</head>
|
|
|
<body>
|
|
|
<div class="header_con">
|
|
|
<div class="header">
|
|
|
<div class="welcome fl">欢迎来到天天生鲜!</div>
|
|
|
<div class="fr">
|
|
|
{% if user.is_authenticated %}
|
|
|
<div class="login_btn fl">
|
|
|
欢迎您:<em>{{ user.username }}</em>
|
|
|
<span>|</span>
|
|
|
<a href="{% url 'user:logout' %}">退出</a>
|
|
|
</div>
|
|
|
{% else %}
|
|
|
<div class="login_btn fl">
|
|
|
<a href="{% url 'user:login' %}">登录</a>
|
|
|
<span>|</span>
|
|
|
<a href="{% url 'user:register' %}">注册</a>
|
|
|
</div>
|
|
|
{% endif %}
|
|
|
<div class="user_link fl">
|
|
|
<span>|</span>
|
|
|
<a href="{% url 'user:user' %}">用户中心</a>
|
|
|
<span>|</span>
|
|
|
<a href="cart.html">我的购物车</a>
|
|
|
<span>|</span>
|
|
|
<a href="{% url 'user:order' 1 %}">我的订单</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="search_bar clearfix">
|
|
|
<a href="{% url 'goods:index' %}" class="logo fl"><img src="{% static 'images/logo.png' %}"></a>
|
|
|
<div class="sub_page_name fl">| 用户中心</div>
|
|
|
<div class="search_con fr">
|
|
|
<form action="/search" method="get">
|
|
|
<input type="text" class="input_text fl" name="q" placeholder="搜索商品">
|
|
|
<input type="submit" class="input_btn fr" name="" value="搜索">
|
|
|
</form>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="main_con clearfix">
|
|
|
<div class="left_menu_con clearfix">
|
|
|
<h3>用户中心</h3>
|
|
|
<ul>
|
|
|
<li><a href="{% url 'user:user' %}" {% if page == 'user' %}class="active"{% endif %}>· 个人信息</a></li>
|
|
|
<li><a href="{% url 'user:order' 1 %}" {% if page == 'order' %}class="active"{% endif %}>· 全部订单</a></li>
|
|
|
<li><a href="{% url 'user:address' %}" {% if page == 'address' %}class="active"{% endif %}>· 收货地址</a></li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
<div class="right_content clearfix">
|
|
|
<h3 class="common_title2">全部订单</h3>
|
|
|
{% for order in order_page %}
|
|
|
<ul class="order_list_th w978 clearfix">
|
|
|
<li class="col01">{{ order.create_time }}</li>
|
|
|
<li class="col02">订单号:{{ order.order_id }}</li>
|
|
|
<li class="col02 stress">{{ order.status_name }}</li>
|
|
|
</ul>
|
|
|
|
|
|
<table class="order_list_table w980">
|
|
|
<tbody>
|
|
|
<tr>
|
|
|
<td width="55%">
|
|
|
{% for order_sku in order.order_skus %}
|
|
|
<ul class="order_goods_list clearfix">
|
|
|
<li class="col01"><img src="{{ order_sku.sku.image.url }}"></li>
|
|
|
<li class="col02">{{ order_sku.sku.name }}<em>{{ order_sku.price }}元/{{ order_sku.sku.unite }}</em></li>
|
|
|
<li class="col03">{{ order_sku.count }}</li>
|
|
|
<li class="col04">{{ order_sku.amount }}元</li>
|
|
|
</ul>
|
|
|
{% endfor %}
|
|
|
</td>
|
|
|
<td width="15%">{{ order.total_price|add:order.transit_price }}(含运费:{{ order.transit_price }})元</td>
|
|
|
<td width="15%">{{ order.status_name }}</td>
|
|
|
<td width="15%"><a href="#" status="{{ order.order_status }}" order_id="{{ order.order_id }}"class="oper_btn">去付款</a></td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
{% endfor %}
|
|
|
|
|
|
<div class="pagenation">
|
|
|
{% csrf_token %}
|
|
|
{% if order_page.has_previous %}
|
|
|
<a href="{% url 'user:order' order_page.previous_page_number %}">上一页</a>
|
|
|
{% endif %}
|
|
|
{% for pindex in pages %}
|
|
|
{% if pindex == order_page.number %}
|
|
|
<a href="{% url 'user:order' pindex %}" class="active">{{ pindex }}</a>
|
|
|
{% else %}
|
|
|
<a href="{% url 'user:order' pindex %}">{{ pindex }}</a>
|
|
|
{% endif %}
|
|
|
{% endfor %}
|
|
|
{% if order_page.has_next %}
|
|
|
<a href="{% url 'user:order' order_page.next_page_number %}">下一页></a>
|
|
|
{% endif %}
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="footer">
|
|
|
<div class="foot_link">
|
|
|
<a href="#">关于我们</a>
|
|
|
<span>|</span>
|
|
|
<a href="#">联系我们</a>
|
|
|
<span>|</span>
|
|
|
<a href="#">招聘人才</a>
|
|
|
<span>|</span>
|
|
|
<a href="#">友情链接</a>
|
|
|
</div>
|
|
|
<p>CopyRight © 2016 北京天天生鲜信息技术有限公司 All Rights Reserved</p>
|
|
|
<p>电话:010-****888 京ICP备*******8号</p>
|
|
|
</div>
|
|
|
<script src="{% static 'js/jquery-1.12.4.min.js' %}"></script>
|
|
|
<script>
|
|
|
$('.oper_btn').each(function () {
|
|
|
status = $(this).attr('status')
|
|
|
if (status == 1){
|
|
|
$(this).text('去支付')
|
|
|
}
|
|
|
else if (status == 4){
|
|
|
$(this).text('去评价')
|
|
|
}
|
|
|
else if (status == 5){
|
|
|
$(this).text('已完成')
|
|
|
}
|
|
|
})
|
|
|
$('.oper_btn').click(function () {
|
|
|
status = $(this).attr('status')
|
|
|
// 获取订单id
|
|
|
order_id = $(this).attr('order_id')
|
|
|
if(status == 1){
|
|
|
// 进行支付
|
|
|
csrf = $('input[name="csrfmiddlewaretoken"]').val()
|
|
|
|
|
|
params = {'order_id': order_id, 'csrfmiddlewaretoken': csrf}
|
|
|
// 发起ajax post请求 访问/order/pay 传递订单id:order_id
|
|
|
$.post('/order/pay', params, function (data) {
|
|
|
if(data.res == 3){
|
|
|
//引导用户到支付页面
|
|
|
window.open(data.response)
|
|
|
// 发起ajax post请求 访问/order/check 传递订单id:order_id
|
|
|
$.post('/order/check', params, function (data){
|
|
|
if (data.res==3){
|
|
|
alert(data.message)
|
|
|
// 刷新页面
|
|
|
location.reload()
|
|
|
}
|
|
|
else {
|
|
|
alert(data.errmsg)
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
else{
|
|
|
alert(data.errmsg)
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
else if (status==4){
|
|
|
// 引导用户去评论
|
|
|
location.href = '/order/comment/' + order_id
|
|
|
}
|
|
|
else if (status==5){
|
|
|
|
|
|
}
|
|
|
})
|
|
|
</script>
|
|
|
</body>
|
|
|
</html> |