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
Email Patches
Plain Diff
Browse Files
Authored by
姜枫
9 years ago
Commit
d71d674da5065f5308ca717c305af65cece9557b
1 parent
7a80aaa9
add shop cart free shipping tip
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
35 additions
and
8 deletions
apps/me/controllers/order.js
apps/me/views/partial/order/detail/order-status.hbs
apps/shopping/controllers/cart.js
apps/shopping/models/cart.js
apps/shopping/views/partial/cart/statement.hbs
config/common.js
public/tpl/shopping/cart-content.hbs
apps/me/controllers/order.js
View file @
d71d674
...
...
@@ -41,6 +41,7 @@ const detail = (req, res, next) => {
const
pageData
=
result
[
0
];
const
thumb
=
result
[
1
];
console
.
log
(
pageData
);
res
.
display
(
'index'
,
{
isMe
:
true
,
...
...
apps/me/views/partial/order/detail/order-status.hbs
View file @
d71d674
<div
class=
"order-status order"
data-code=
"
{{
orderCode
}}
"
>
<div
class=
"order-status order"
data-code=
"
{{
orderCode
}}
"
>
<div
class=
"basic"
>
<p>
订单号:
{{
orderCode
}}
</p>
<p>
订单状态:
{{
statusStr
}}
</p>
...
...
apps/shopping/controllers/cart.js
View file @
d71d674
...
...
@@ -18,7 +18,6 @@ exports.index = (req, res, next) => {
if
(
result
.
code
===
200
)
{
res
.
header
(
'Cache-Control'
,
'no-store'
);
res
.
display
(
'cart'
,
_
.
merge
({
module
:
'shopping'
,
page
:
'cart'
,
...
...
@@ -135,7 +134,7 @@ exports.addToCart = (req, res, next) => {
shoppingKey
:
req
.
cookies
.
_SPK
||
null
,
uid
:
req
.
user
.
uid
}).
then
((
result
)
=>
{
res
.
cookie
(
'_SPK'
,
result
.
data
.
shopping_key
,
{
maxAge
:
1000
*
60
*
60
*
24
*
365
,
httpOnly
:
true
,
path
:
'/'
});
res
.
cookie
(
'_SPK'
,
result
.
data
.
shopping_key
,
{
maxAge
:
1000
*
60
*
60
*
24
*
365
,
httpOnly
:
true
,
path
:
'/'
});
res
.
json
(
result
);
}).
catch
(
next
);
};
...
...
@@ -165,6 +164,9 @@ exports.toggleSelectGoods = (req, res, next) => {
}
cartModel
.
toggleSelectGoods
(
params
).
then
(
result
=>
{
console
.
log
(
result
)
res
.
json
(
_
.
merge
(
cartModel
.
filterCartData
(
result
,
uid
),
{
code
:
result
.
code
,
message
:
result
.
message
}));
}).
catch
(
next
);
};
...
...
apps/shopping/models/cart.js
View file @
d71d674
...
...
@@ -295,6 +295,20 @@ const filterCartData = (result, uid) => {
});
}
let
freeShippingTip
=
''
;
if
(
_
.
has
(
result
,
'data.ordinary_cart_data.promotion_info'
))
{
let
promotions
=
result
.
data
.
ordinary_cart_data
.
promotion_info
;
let
promotion
=
_
.
find
(
promotions
,
p
=>
{
return
p
.
promotion_type
===
'FreeShippingCost'
;
});
if
(
promotion
)
{
freeShippingTip
=
promotion
.
promotion_title
;
}
}
return
_
.
merge
(
resData
,
{
hasGoods
:
advancedGoods
.
length
||
ordinaryGoods
.
length
||
invalidGoods
.
length
,
preSalePros
:
(
advancedSoldOutGoods
.
length
||
advancedGoods
.
length
)
?
...
...
@@ -304,6 +318,7 @@ const filterCartData = (result, uid) => {
selectedNum
:
selectedAdvanceNum
+
selectedOrdinaryNum
,
checkAll
:
totalNum
===
(
selectedAdvanceNum
+
selectedOrdinaryNum
),
totalMoney
:
totalAdvanceMoney
+
totalOrdinaryMoney
,
freeShippingTip
:
freeShippingTip
,
noStorage
});
};
...
...
apps/shopping/views/partial/cart/statement.hbs
View file @
d71d674
{{#if
freeShippingTip
}}
<div
class=
"fregit-remark"
>
<span>
免运费
</span>
满399免运费
{{
freeShippingTip
}}
</div>
{{/if}}
<div
class=
"cart-statement"
>
<div
class=
"actions"
>
<div
class=
"action"
>
...
...
@@ -28,4 +30,4 @@
<div
class=
"checkout"
>
<span
class=
"btn
{{#
unless
selectedNum
}}
disable
{{/
unless
}}
"
id=
"checkout_btn"
>
去结算
</span>
</div>
</div>
\ No newline at end of file
</div>
...
...
config/common.js
View file @
d71d674
...
...
@@ -23,8 +23,8 @@ module.exports = {
cookieDomain
:
'yohoblk.com'
,
domains
:
{
singleApi
:
'http://single.yoho.cn/'
,
api
:
'http://api.yoho.yohoops.org/'
,
service
:
'http://service.yoho.yohoops.org/'
,
api
:
'http://api-test3.yohops.com:9999/'
,
service
:
'http://service-test3.yohops.com:9999/'
,
search
:
'http://search.yohoops.org/yohosearch/'
},
useOneapm
:
false
,
...
...
public/tpl/shopping/cart-content.hbs
View file @
d71d674
...
...
@@ -203,6 +203,13 @@
</div>
{{/if}}
{{#if
@root
.
freeShippingTip
}}
<div
class=
"fregit-remark"
>
<span>
免运费
</span>
{{
@root
.
freeShippingTip
}}
</div>
{{/if}}
<div
class=
"cart-statement"
>
<div
class=
"actions"
>
<div
class=
"action"
>
...
...
@@ -229,4 +236,4 @@
<div
class=
"checkout"
>
<span
class=
"btn
{{#
unless
selectedNum
}}
disable
{{/
unless
}}
"
id=
"checkout_btn"
>
去结算
</span>
</div>
</div>
\ No newline at end of file
</div>
...
...
Please
register
or
login
to post a comment