Authored by xuqi

build my order

... ... @@ -894,3 +894,36 @@
all: true
}
}
### 我的订单
{
order: {
allOrders: [
...
]
}
}
//订单
{
orderNum: '',
tradingStatus: '',
goods: [
{
id: '',
thumb: '',
gift: true, //是否赠品
advanceBuy: true, //是否加价购
name: '',
color: '黄色',
size: 'X',
price: '588',
count: 2
},
...
],
count: 1,
sumCost: '199.00'
}
\ No newline at end of file
... ...
... ... @@ -8,5 +8,6 @@ require('./js/home/entry');
require('./js/index/entry');
require('./js/passport/entry');
require('./js/product/entry');
require('./js/me/entry');
module.exports = yohobuy;
... ...
/**
* 个人中心js打包入口文件
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/11/10
*/
require('./order');
\ No newline at end of file
... ...
/**
* 个人中心--我的订单
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/11/10
*/
var $ = require('jquery'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload');
var $navLi = $('#order-nav > li'),
$orderContainer = $('#order-container');
var $curContainer = $orderContainer.children('.orders').first();//保存当前显示的order-container
var navHammer;
lazyLoad();
navHammer = new Hammer(document.getElementById('order-nav'));
navHammer.on('tap', function(e) {
var $cur = $(e.target).closest('li'),
index;
if ($cur.length === 0 || $cur.hasClass('active')) {
return;
}
index = $cur.index();
$navLi.filter('.active').removeClass('active');
$cur.addClass('active');
$curContainer.addClass('hide');
$curContainer = $orderContainer.children(':eq(' + index + ')').removeClass('hide');
});
... ...
@import "home", "vip-grade";
\ No newline at end of file
@import "home", "vip-grade", "order";
\ No newline at end of file
... ...
.order-page {
background: #f0f0f0;
.order {
background: #fff;
margin: 30rem / $pxConvertRem 0;
border-top: 1px solid #e0e0e0;
border-bottom: 1px solid #e0e0e0;
.header, .footer {
height: 90rem / $pxConvertRem;
line-height: 90rem / $pxConvertRem;
font-size: 30rem / $pxConvertRem;
padding: 0 30rem / $pxConvertRem;
}
.header {
border-bottom: 1px solid #e0e0e0;
}
.trading-status {
float: right;
}
.footer {
text-align: right;
border-top: 1px solid #e0e0e0;
}
.sum-cost {
color: #e01;
}
}
}
.order-nav {
border-bottom: 1px solid #e0e0e0;
background: #fff;
> li{
float: left;
height: 90rem / $pxConvertRem;
width: 25%;
line-height: 90rem / $pxConvertRem;
color: #b0b0b0;
font-size: 26rem / $pxConvertRem;
text-align: center;
&.active {
color: #000;
}
}
}
.order-good {
position: relative;
padding: 20rem / $pxConvertRem 0;
margin-left: 34rem / $pxConvertRem;
height: 160rem / $pxConvertRem;
border-bottom: 1px solid #e0e0e0;
font-size: 26rem / $pxConvertRem;
&:last-child {
border-bottom: none;
}
.thumb-wrap {
position: relative;
float: left;
width: 120rem / $pxConvertRem;
height: 160rem / $pxConvertRem;
}
.thumb {
width: 100%;
height: 100%;
}
.tag {
position: absolute;
bottom: 0;
left: 0;
right: 0;
color: #fff;
text-align: center;
font-size: 12px;
}
.gift-tag {
height: 25rem / $pxConvertRem;
background: #a1ce4e;
&:before {
content: '赠品';
}
}
.advance-buy-tag {
height: 25rem / $pxConvertRem;
background: #eb76aa;
&:before {
content: '加价购';
}
}
.deps {
margin-left: 135rem / $pxConvertRem;
}
.name {
font-size: 28rem / $pxConvertRem;
max-width: 70%;
}
.row:nth-child(2) {
height: 45rem / $pxConvertRem;
line-height: 45rem / $pxConvertRem;
> span {
margin-right: 15rem / $pxConvertRem;
}
}
.color, .size {
color: #b6b6b6;
}
.price-wrap {
position: absolute;
top: 20rem / $pxConvertRem;
right: 30rem / $pxConvertRem;
}
.price {
color: #e01;
}
.count {
display: block;
color: #999;
text-align: right;
line-height: 45rem / $pxConvertRem;
}
}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="order-page yoho-page">
{{# order}}
<ul id="order-nav" class="order-nav clearfix">
<li class="active">
全部
</li>
<li>
待付款
</li>
<li>
待发货
</li>
<li>
待收货
</li>
</ul>
<div id="order-container" class="order-container">
<div class="all orders">
{{# allOrders}}
{{> me/order/order}}
{{/ allOrders}}
</div>
<div class="obligation orders hide"></div>
<div class="unshipped orders hide"></div>
<div class="unreceived orders hide"></div>
</div>
{{/ order}}
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -188,3 +188,10 @@
seajs.use('js/shopping-cart/gift-advance');
</script>
{{/if}}
{{!-- 个人中心 --}}
{{#if orderPage}}
<script>
seajs.use('js/me/order');
</script>
{{/if}}
\ No newline at end of file
... ...
<div class="order-good" data-id={{id}}>
<div class="thumb-wrap">
<img class="thumb lazy" data-original={{thumb}}>
<p class="tag{{#if gift}} gift-tag{{/if}}{{#if advanceBuy}} advance-buy-tag{{/if}}"></p>
</div>
<div class="deps">
<p class="name row">{{name}}</p>
<p class="row">
{{#if color}}
<span class="color">
颜色:{{color}}
</span>
{{/if}}
{{#if size}}
<span class="size">
尺码:{{size}}
</span>
{{/if}}
</p>
<p class="row price-wrap">
<span class="price">
¥{{price}}
</span>
<span class="count">
×{{count}}
</span>
</p>
</div>
</div>
\ No newline at end of file
... ...
<div class="order">
<header class="header">
订单编号:{{orderNum}}
<span class="trading-status">{{tradingStatus}}</span>
</header>
<section class="order-goods">
{{# goods}}
{{> me/order/good}}
{{/ goods}}
</section>
<footer class="footer">
共{{count}}件商品 实付<span class="sum-cost">¥{{sumCost}}</span>
</footer>
</div>
\ No newline at end of file
... ...
... ... @@ -39,12 +39,45 @@ class HomeController extends AbstractAction
*/
public function ordersAction()
{
$uid = $this->getUid();
$type = $this->get('type', 1);
$orders = \Index\UserModel::getUserOrderData(967016, $type);
print_r($orders);
// $uid = $this->getUid();
// $type = $this->get('type', 1);
// $orders = \Index\UserModel::getUserOrderData(967016, $type);
$order = array(
'allOrders' => array(
array(
'orderNum' => '408539077',
'tradingStatus' => '交易成功',
'goods' => array(
array(
'id' => 1,
'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => 'Adidas Originals ZX FLUXM22508',
'color' => '黄',
'size' => '43',
'price' => '699.00',
'count' => '2'
),
array(
'id' => 1,
'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/11/04/05/0188f1aca49ac478a565ec029b5d2d4a6c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => 'B.Duck浴室玩伴mini浮水鸭',
'gift' => true,
'color' => '黄',
'size' => '43',
'price' => '0.00',
'count' => '1'
)
),
'count' => 2,
'sumCost' => '699.00'
)
)
);
$this->_view->display('order', array('order' => $order, 'orderPage' => true));
// print_r($orders);
}
/**
... ...