Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-blk
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
1
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
biao
9 years ago
Commit
bc16f014fe5bd3aaf71952c4287cb4776c24dc70
2 parents
99d46acf
7541461d
master
...
develop
feature/catch
feature/docker
feature/login-msg
feature/login-ua-ip
feature/removCamel
feature/safe-bug
feature/sessionKey
feature/setting
feature/vip
feature/webpack2
feature/wsl5.3
gray
release/2.0
release/fontBack2.0
Merge branch 'feature/my-order' into develop
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
170 additions
and
78 deletions
apps/me/controllers/order.js
apps/me/models/order.js
apps/me/router.js
apps/me/views/action/order-table.hbs
apps/me/views/partial/order.hbs
apps/me/views/partial/order/table-body.hbs
apps/me/views/partial/order/table-header.hbs
public/js/me/order.page.js
public/scss/me/order/_table.css
apps/me/controllers/order.js
View file @
bc16f01
...
...
@@ -9,12 +9,14 @@
const
mcHandler
=
require
(
'../models/menu-crumb-handler'
);
const
orderModel
=
require
(
'../models/order'
);
// fakeuid = '10931021',
/**
* 订单
*
我的
订单
*/
const
index
=
(
req
,
res
)
=>
{
orderModel
.
getOrderData
().
then
(
result
=>
{
const
type
=
req
.
query
.
type
;
const
page
=
req
.
query
.
page
;
orderModel
.
getOrderData
(
type
,
page
).
then
(
result
=>
{
res
.
render
(
'index'
,
{
page
:
'order'
,
isMe
:
true
,
...
...
@@ -27,6 +29,21 @@ const index = (req, res) => {
});
};
const
getOrderList
=
(
req
,
res
)
=>
{
const
type
=
req
.
query
.
type
;
const
page
=
req
.
query
.
page
;
orderModel
.
getOrderData
(
type
,
page
).
then
(
result
=>
{
res
.
render
(
'order-table'
,
{
layout
:
false
,
page
:
'order'
,
isMe
:
true
,
orderList
:
result
.
order
.
orderList
});
});
};
module
.
exports
=
{
index
index
:
index
,
getOrderList
:
getOrderList
};
...
...
apps/me/models/order.js
View file @
bc16f01
const
api
=
global
.
yoho
.
API
;
const
camelCase
=
global
.
yoho
.
camelCase
;
const
_getUserOrder
=
()
=>
{
const
_getUserOrder
=
(
type
,
page
)
=>
{
return
api
.
get
(
''
,
{
method
:
'app.SpaceOrders.get'
,
uid
:
'10931021'
,
type
:
1
,
page
:
1
,
type
:
type
||
1
,
page
:
page
||
1
,
limit
:
10
}).
then
(
result
=>
{
const
orderList
=
result
&&
result
.
data
&&
result
.
data
.
order_list
||
[];
...
...
@@ -15,31 +15,36 @@ const _getUserOrder = () => {
});
};
const
getOrderData
=
()
=>
{
return
_getUserOrder
().
then
(
result
=>
{
const
navBar
=
{
tabs
:
[
{
text
:
'全部订单'
,
isActive
:
true
,
type
:
'all'
},
{
text
:
'待付款'
,
type
:
'paying'
},
{
text
:
'待发货'
,
type
:
'delivering'
}
]
};
const
getOrderData
=
(
type
,
page
)
=>
{
return
_getUserOrder
(
type
,
page
).
then
(
result
=>
{
const
fakeData
=
{
title
:
'我的订单'
,
tabs
:
[
{
text
:
'全部订单'
,
isActive
:
true
,
type
:
'all'
},
{
text
:
'待付款'
,
type
:
'paying'
},
{
text
:
'待发货'
,
type
:
'delivering'
}
],
showSearch
:
true
};
const
order
=
Object
.
assign
(
fakeData
,
{
orderList
:
result
});
orderList
:
result
&&
result
.
length
&&
result
||
false
},
navBar
);
console
.
log
(
order
.
orderList
);
return
{
order
:
order
...
...
apps/me/router.js
View file @
bc16f01
...
...
@@ -14,5 +14,6 @@ const order = require(`${cRoot}/order`);
// 个人中心首页/订单
router
.
get
([
'/'
,
'/order'
],
order
.
index
);
router
.
get
(
'/getOrderList'
,
order
.
getOrderList
);
module
.
exports
=
router
;
...
...
apps/me/views/action/order-table.hbs
0 → 100644
View file @
bc16f01
{{>
order
/
table-body
}}
...
...
apps/me/views/partial/order.hbs
View file @
bc16f01
...
...
@@ -3,8 +3,6 @@
{{>
common
/
subtitle
}}
{{>
order
/
nav
}}
{{>
order
/
table-header
}}
{{#if
orderList
}}
{{>
order
/
table-body
}}
{{/if}}
{{>
order
/
table-body
}}
{{/
order
}}
</div>
...
...
apps/me/views/partial/order/table-body.hbs
View file @
bc16f01
<div
class=
"table table-body"
>
{{#if
orderList
}}
{{#
orderList
}}
<div
class=
"table"
>
<ul
class=
"header"
>
<li
class=
"content"
>
下单时间:
{{
createTime
}}
</li>
<li
class=
"content"
>
订单编号:
{{
orderCode
}}
</li>
{{#if
showMobile
}}
<li
class=
"content"
>
手机订单
</li>
{{/if}}
</ul>
<div
class=
"table-body"
>
<div
class=
"goods-container special-border"
>
{{#
orderGoods
}}
<div
class=
"good-info
{{#if
@last
}}
last
{{/if}}
"
>
<img
src=
"
{{
image
goodsImage
65
90
}}
"
>
<div
class=
"detail"
>
<p
class=
"with-bottom-space"
>
{{
productName
}}
</p>
<span
class=
"with-space"
>
颜色:
{{
colorName
}}
</span>
<span>
尺码:
<span
class=
"bold"
>
{{
sizeName
}}
</span>
</span>
<p
class=
"bold"
>
{{>
icon
/
error-round
}}{{
buyNumber
}}
</p>
<div
class=
"order"
>
<ul
class=
"header"
>
<li
class=
"content"
>
下单时间:
{{
createTime
}}
</li>
<li
class=
"content"
>
订单编号:
{{
orderCode
}}
</li>
{{#if
showMobile
}}
<li
class=
"content"
>
手机订单
</li>
{{/if}}
</ul>
<div
class=
"table-body"
>
<div
class=
"goods-container special-border"
>
{{#
orderGoods
}}
<div
class=
"good-info
{{#if
@last
}}
last
{{/if}}
"
>
<img
src=
"
{{
image
goodsImage
65
90
}}
"
>
<div
class=
"detail"
>
<p
class=
"with-bottom-space"
>
{{
productName
}}
</p>
<span
class=
"with-space"
>
颜色:
{{
colorName
}}
</span>
<span>
尺码:
<span
class=
"bold"
>
{{
sizeName
}}
</span>
</span>
<p
class=
"bold"
>
{{>
icon
/
error-round
}}{{
buyNumber
}}
</p>
</div>
</div>
<div
class=
"price bold"
>
<p
class=
"
{{#if
@last
}}
last
{{/if}}
"
>
{{
goodsAmount
}}
</p>
</div>
{{/
orderGoods
}}
</div>
<div
class=
"price bold"
>
<p>
{{
goodsAmount
}}
</p>
<div
class=
"common-column special-border"
>
<p
class=
"bold"
>
{{
amount
}}
</p>
<p
class=
"subtext"
>
{{
paymentTypeStr
}}
</p>
</div>
<div
class=
"common-column special-border"
>
<p
class=
"bold"
>
{{
statusStr
}}
</p>
<p
class=
"subtext"
>
查看详情
</p>
</div>
<div
class=
"common-column special-border"
>
{{#if
payLeftTime
}}
<p
class=
"left-time"
>
剩余
{{
payLeftTime
}}
</p>
{{/if}}
{{#if
showPayButton
}}
<button>
立即付款
</button>
{{/if}}
{{#if
showEditOption
}}
<p
class=
"subtext"
>
修改订单
</p>
<p
class=
"subtext no-space"
>
删除订单
</p>
{{^}}
<p
class=
"subtext"
>
查看详情
</p>
{{/if}}
</div>
{{/
orderGoods
}}
</div>
<div
class=
"common-column special-border"
>
<p
class=
"bold"
>
{{
amount
}}
</p>
<p
class=
"subtext"
>
{{
paymentTypeStr
}}
</p>
</div>
<div
class=
"common-column special-border"
>
<p>
{{
statusStr
}}
</p>
<p
class=
"subtext"
>
查看详情
</p>
</div>
<div
class=
"common-column special-border"
>
{{#if
payLeftTime
}}
<p
class=
"left-time"
>
剩余
{{
payLeftTime
}}
</p>
{{/if}}
{{#if
showPayButton
}}
<button>
立即付款
</button>
{{/if}}
{{#if
showEditOption
}}
<p
class=
"subtext"
>
修改订单
</p>
<p
class=
"subtext no-space"
>
删除订单
</p>
{{^}}
<p
class=
"subtext"
>
查看详情
</p>
{{/if}}
</div>
</div>
</div>
{{/
orderList
}}
{{^}}
数据为空
{{/if}}
</div>
...
...
apps/me/views/partial/order/table-header.hbs
View file @
bc16f01
<div
class=
"table"
>
<div
class=
"table
column-category
"
>
<ul
class=
"table-header header"
>
<li
class=
"big-width"
>
商品信息
</li>
<li
class=
"normal-width"
>
单价
</li>
...
...
public/js/me/order.page.js
View file @
bc16f01
...
...
@@ -4,13 +4,65 @@
* @date: 2016/07/04
*/
var
tableOperation
=
{
$header
:
$
(
'.table.column-category'
),
$body
:
$
(
'.table.table-body'
),
removeBody
:
function
()
{
this
.
$body
=
$
(
'.table.table-body'
);
this
.
$body
.
remove
();
},
appendBody
:
function
(
htmlStr
)
{
$
(
htmlStr
).
appendTo
(
this
.
$header
);
}
};
require
(
'./me'
);
function
getOrderList
(
type
,
page
)
{
tableOperation
.
removeBody
();
$
.
ajax
({
url
:
'getOrderList'
,
data
:
{
type
:
type
,
page
:
page
}
}).
done
(
function
(
res
)
{
tableOperation
.
appendBody
(
res
);
}).
fail
(
function
(
err
)
{
console
.
log
(
err
);
});
}
function
getQueryString
()
{
var
queryArr
=
location
.
search
.
substr
(
1
).
split
(
'&'
);
var
query
=
{};
queryArr
.
forEach
(
function
(
pair
)
{
var
arr
=
pair
.
split
(
'='
);
query
[
arr
[
0
]]
=
arr
[
1
];
});
return
query
;
}
$
(
'.tabs li'
).
on
(
'click'
,
function
()
{
var
$this
=
$
(
this
);
var
typeMap
=
{
all
:
1
,
paying
:
2
,
delivering
:
3
};
var
type
=
typeMap
[
$this
.
data
(
'type'
)];
var
page
=
getQueryString
().
page
;
if
(
!
$this
.
hasClass
(
'active'
))
{
$
(
'.tabs li.active'
).
removeClass
(
'active'
);
$this
.
addClass
(
'active'
);
}
getOrderList
(
type
,
page
);
});
...
...
public/scss/me/order/_table.css
View file @
bc16f01
...
...
@@ -7,6 +7,7 @@
$
bigWidth
:
355px
;
$
normalWidth
:
138px
;
$
goodImgWidth
:
65px
;
$
goodImgHeight
:
90px
;
$
normalSize
:
14px
;
...
...
@@ -65,7 +66,7 @@
img
{
width
:
$
goodImgWidth
;
height
:
90px
;
height
:
$
goodImgHeight
;
display
:
inline-block
;
box-sizing
:
border-box
;
margin
:
$
bigSpace
$
space
;
...
...
@@ -119,9 +120,20 @@
.price
{
width
:
calc
(
$
normalWidth
-
4px
);
display
:
inline-block
;
margin-top
:
$
bigSpace
;
text-align
:
center
;
vertical-align
:
top
;
p
{
width
:
$
normalWidth
;
height
:
calc
(
2
*
$
bigSpace
+
$
goodImgHeight
+
4px
);
float
:
right
;
padding-top
:
$
bigSpace
;
border-bottom
:
1px
solid
$
borderColor
;
&.last
{
border-bottom
:
none
;
}
}
}
}
...
...
Please
register
or
login
to post a comment