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
aca1a4b1b51a7525ef6a2941be3b64414053be16
2 parents
76f2c6aa
8721b7c8
Merge branch 'release/1.0' of
http://git.yoho.cn/fe/yoho-blk
into release/1.0
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
138 additions
and
79 deletions
apps/editorial/models/editorial.js
apps/shopping/controllers/cart.js
apps/shopping/controllers/order.js
apps/shopping/controllers/pay.js
apps/shopping/models/cart.js
apps/shopping/models/pay.js
apps/shopping/views/action/pay-success.hbs
apps/shopping/views/partial/cart/cart-list-body.hbs
config/common.js
public/js/shopping/pay.page.js
public/scss/shopping/_cart-products.css
public/scss/shopping/_order.css
apps/editorial/models/editorial.js
View file @
aca1a4b
...
...
@@ -447,10 +447,10 @@ const _getArticlePre = (id, appType) => {
id
:
id
,
app_type
:
appType
}).
then
((
result
)
=>
{
//console.log(result.message)
//
console.log(result.message)
if
(
result
&&
result
.
code
===
200
)
{
//console.log(result)
// console.log(result)
return
camelCase
(
result
.
data
);
}
else
{
logger
.
error
(
'上一篇 is not 200'
);
...
...
apps/shopping/controllers/cart.js
View file @
aca1a4b
...
...
@@ -16,6 +16,9 @@ exports.index = (req, res, next) => {
cartModel
.
getCartData
(
shoppingKey
,
uid
).
then
((
result
)
=>
{
if
(
result
.
code
===
200
)
{
res
.
header
(
'Cache-Control'
,
'no-cache'
);
res
.
display
(
'cart'
,
_
.
merge
({
module
:
'shopping'
,
page
:
'cart'
,
...
...
apps/shopping/controllers/order.js
View file @
aca1a4b
...
...
@@ -17,54 +17,61 @@ const index = (req, res, next) => {
orderModel
.
index
(
req
.
user
.
uid
).
then
(
result
=>
{
let
data
=
result
.
data
;
// 设置头部路径索引focus
data
.
bcNavFocus
=
2
;
// 构造诡异的配送方式数据【显示普通快递的文字,确用顺丰发货和顺丰的快递费】
data
.
delivery_way
=
_
.
concat
(
_
.
assign
(
_
.
find
(
data
.
delivery_way
,
{
delivery_way_id
:
2
}),
{
delivery_way_name
:
'普通快递'
}));
// 发票抬头
data
.
invoices
.
invoiceTitle
=
[
{
name
:
'个人'
,
value
:
1
,
myClass
:
'personal'
},
{
name
:
'单位'
,
value
:
2
}
];
// 返回购物车链接
data
.
goCartLink
=
helper
.
urlFormat
(
'/shopping/cart'
);
// 拆单是否显示左右切换
_
.
forEach
(
data
.
shopping_cart_data
.
package_list
,
i
=>
{
if
(
i
.
goods_list
.
length
>
4
)
{
i
.
showToggle
=
true
;
}
});
if
(
data
.
goods_list
&&
data
.
goods_list
.
length
>
0
)
{
// 设置头部路径索引focus
data
.
bcNavFocus
=
2
;
// 构造诡异的配送方式数据【显示普通快递的文字,确用顺丰发货和顺丰的快递费】
data
.
delivery_way
=
_
.
concat
(
_
.
assign
(
_
.
find
(
data
.
delivery_way
,
{
delivery_way_id
:
2
}),
{
delivery_way_name
:
'普通快递'
}));
// 发票抬头
data
.
invoices
.
invoiceTitle
=
[
{
name
:
'个人'
,
value
:
1
,
myClass
:
'personal'
},
{
name
:
'单位'
,
value
:
2
}
];
// 返回购物车链接
data
.
goCartLink
=
helper
.
urlFormat
(
'/shopping/cart'
);
// 拆单是否显示左右切换
_
.
forEach
(
data
.
shopping_cart_data
.
package_list
,
i
=>
{
if
(
i
.
goods_list
.
length
>
4
)
{
i
.
showToggle
=
true
;
}
});
// 是否打印价格radio
data
.
printPriceRadio
=
[
{
value
:
'1'
,
name
:
'是'
},
{
value
:
'0'
,
name
:
'否'
,
checked
:
true
}
];
res
.
header
(
'Cache-Control'
,
'no-cache'
);
res
.
display
(
'order'
,
{
content
:
data
,
defaultHeader
:
false
});
}
else
{
res
.
redirect
(
'/shopping/cart'
);
}
// 是否打印价格radio
data
.
printPriceRadio
=
[
{
value
:
'1'
,
name
:
'是'
},
{
value
:
'0'
,
name
:
'否'
,
checked
:
true
}
];
res
.
display
(
'order'
,
{
content
:
data
,
defaultHeader
:
false
});
}).
catch
(
next
);
};
...
...
apps/shopping/controllers/pay.js
View file @
aca1a4b
...
...
@@ -11,6 +11,7 @@ const OrderData = require('../models/order');
const
PayHelpers
=
require
(
'../helpers/payment'
);
const
camelCase
=
global
.
yoho
.
camelCase
;
const
helpers
=
global
.
yoho
.
helpers
;
const
_
=
require
(
'lodash'
);
/**
...
...
@@ -24,13 +25,39 @@ const online = (req, res, next) => {
let
uid
=
req
.
user
.
uid
;
PayData
.
getPayInfo
(
uid
,
orderCode
).
then
(
result
=>
{
res
.
display
(
'pay'
,
Object
.
assign
({
defaultHeader
:
false
,
module
:
'shopping'
,
page
:
'pay'
,
title
:
'支付页面'
,
username
:
req
.
user
.
username
},
result
));
let
order
=
result
.
order
;
let
promotion
=
order
.
promotionFormulas
;
let
coin
=
0
;
let
amount
=
_
.
toNumber
(
order
.
paymentAmount
);
_
.
forEach
(
promotion
,
p
=>
{
if
(
p
.
promotion
===
'YOHO币'
)
{
coin
=
_
.
toNumber
(
p
.
promotionAmount
.
substring
(
2
,
p
.
promotionAmount
.
length
))
*
100
;
}
});
if
(
amount
>
0
)
{
res
.
display
(
'pay'
,
Object
.
assign
({
defaultHeader
:
false
,
module
:
'shopping'
,
page
:
'pay'
,
title
:
'支付页面'
,
username
:
req
.
user
.
username
},
result
));
}
else
{
res
.
display
(
'pay-success'
,
{
defaultHeader
:
false
,
content
:
{
cost
:
order
.
paymentAmount
,
orderNum
:
order
.
orderCode
,
coin
:
coin
,
orderHref
:
helpers
.
urlFormat
(
'/me/order/detail'
,
{
orderCode
:
order
.
orderCode
}),
walkHref
:
helpers
.
urlFormat
(
'/'
)
}
});
}
}).
catch
(
next
);
};
...
...
@@ -76,16 +103,25 @@ const callback = (req, res) => {
let
query
=
req
.
query
;
PayHelpers
.
afterPay
(
query
,
payId
,
req
.
user
).
then
(
result
=>
{
if
(
result
.
code
===
200
)
{
let
data
=
result
.
data
;
if
(
result
.
code
===
200
&&
result
.
data
&&
result
.
data
.
order
)
{
let
order
=
result
.
data
.
order
;
let
promotion
=
order
.
promotionFormulas
;
let
coin
=
0
;
_
.
forEach
(
promotion
,
p
=>
{
if
(
p
.
promotion
===
'YOHO币'
)
{
coin
=
_
.
toNumber
(
p
.
promotionAmount
.
substring
(
2
,
p
.
promotionAmount
.
length
))
*
100
;
}
});
res
.
display
(
'pay-success'
,
{
defaultHeader
:
false
,
content
:
{
cost
:
data
.
pay
,
orderNum
:
data
.
orderCode
,
onlineCost
:
data
.
pay
,
orderHref
:
helpers
.
urlFormat
(
'/me/order/detail'
,
{
orderCode
:
data
.
orderCode
}),
cost
:
order
.
paymentAmount
,
orderNum
:
order
.
orderCode
,
coin
:
coin
,
orderHref
:
helpers
.
urlFormat
(
'/me/order/detail'
,
{
orderCode
:
order
.
orderCode
}),
walkHref
:
helpers
.
urlFormat
(
'/'
)
}
});
...
...
apps/shopping/models/cart.js
View file @
aca1a4b
...
...
@@ -282,7 +282,7 @@ const filterCartData = (result, uid) => {
ordinaryGoods
=
_
.
concat
(
ordinaryGoods
,
ordinaryCartData
.
goods_list
,
soldOutWithStorage
);
// 正常商品
invalidGoods
=
_
.
concat
(
invalidGoods
,
ordinaryCartData
.
off_shelves_goods_list
,
soldOutWithoutStorage
);
// 失效商品
_
.
forEach
(
ordinaryGoods
,
function
(
good
)
{
_
.
forEach
(
ordinaryGoods
,
good
=>
{
buyNumber
=
parseInt
(
good
.
buy_number
,
10
);
storageNumber
=
parseInt
(
good
.
storage_number
,
10
);
totalNum
+=
buyNumber
;
...
...
apps/shopping/models/pay.js
View file @
aca1a4b
...
...
@@ -221,8 +221,7 @@ const procOrderData = (payResult, uid) => {
code
:
200
,
message
:
'支付成功,请等待发货'
,
data
:
{
pay
:
amount
,
orderCode
:
orderCode
order
:
order
}
};
...
...
apps/shopping/views/action/pay-success.hbs
View file @
aca1a4b
...
...
@@ -18,8 +18,8 @@
!
</p>
<p
class=
"order-num"
>
订单编号:
{{
orderNum
}}
</p>
{{#if
onlineCost
}}
<p
class=
"payment-online"
>
在线支付:¥
{{
round
onlineCost
2
}}
</p>
{{#if
cost
}}
<p
class=
"payment-online"
>
在线支付:¥
{{
round
cost
2
}}
</p>
{{/if}}
{{#if
coin
}}
<p
class=
"payment-coin"
>
有货币支付:
{{
coin
}}
</p>
...
...
@@ -43,4 +43,4 @@
</div>
{{/
content
}}
</div>
</div>
\ No newline at end of file
</div>
...
...
apps/shopping/views/partial/cart/cart-list-body.hbs
View file @
aca1a4b
...
...
@@ -79,7 +79,7 @@
</a>
</li>
<li
class=
"pro-info"
>
{{!-- <div class="brand-name">{{brandName}}</div> --}}
<a
class=
"brand-name"
href=
"/product/shop/
{{
brand_domain
}}
"
>
{{
brand_name
}}
</a>
<div
class=
"pro-name"
><a
href=
"/product/pro_
{{
product_id
}}
_
{{
goods_id
}}
/
{{
cn_alphabet
}}
.html"
target=
"_blank"
>
{{
product_name
}}
</a></div>
<div
class=
"color-size editable"
data-productId=
"
{{
product_id
}}
"
id=
"edit_
{{
product_id
}}
"
data-productSkn=
"
{{
product_skn
}}
"
>
{{#if
color_name
}}
...
...
config/common.js
View file @
aca1a4b
...
...
@@ -22,8 +22,8 @@ module.exports = {
},
cookieDomain
:
'yohoblk.com'
,
domains
:
{
api
:
'http://dev-api.yohops.com:9999/'
,
// devapi.yoho.cn:58078 testapi.yoho.cn:28078 devapi.yoho.cn:58078
service
:
'http://dev-service.yohops.com:9999/'
,
// testservice.yoho.cn:28077 devservice.yoho.cn:58077
api
:
'http://api-test1.yohops.com:9999/'
,
// devapi.yoho.cn:58078 testapi.yoho.cn:28078 devapi.yoho.cn:58078
service
:
'http://service-test1.yohops.com:9999/'
,
// testservice.yoho.cn:28077 devservice.yoho.cn:58077
search
:
'http://192.168.102.216:8080/yohosearch/'
},
useOneapm
:
false
,
...
...
public/js/shopping/pay.page.js
View file @
aca1a4b
...
...
@@ -87,3 +87,5 @@ $('#go-pay-btn').click(function() {
}
});
});
console
.
log
(
window
.
history
);
...
...
public/scss/shopping/_cart-products.css
View file @
aca1a4b
...
...
@@ -53,8 +53,9 @@ $hoverColor: #379ed6;
padding
:
24px
30px
;
li
{
float
:
left
;
display
:
table-cell
;
height
:
134px
;
vertical-align
:
middle
;
}
.chk
{
...
...
@@ -92,10 +93,17 @@ $hoverColor: #379ed6;
width
:
342px
;
padding-left
:
42px
;
font-size
:
12px
;
font-weight
:
bold
;
.brand-name
{
margin-bottom
:
19px
;
display
:
block
;
font-size
:
18px
;
font-weight
:
bold
;
line-height
:
50px
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
max-width
:
300px
;
}
.size
{
...
...
@@ -108,11 +116,10 @@ $hoverColor: #379ed6;
}
.pro-name
{
height
:
3
0
px
;
height
:
3
6
px
;
width
:
234px
;
word-wrap
:
break-word
;
margin-bottom
:
13px
;
line-height
:
1.3em
;
margin-bottom
:
5px
;
overflow
:
hidden
;
:hover
{
cursor
:
pointer
;
...
...
@@ -123,6 +130,7 @@ $hoverColor: #379ed6;
.pro-name
>
a
{
height
:
100%
;
display
:
block
;
line-height
:
18px
;
}
.price
{
...
...
@@ -165,7 +173,7 @@ $hoverColor: #379ed6;
}
.editable
{
padding
:
5px
;
padding
:
5px
0
;
width
:
200px
;
position
:
relative
;
...
...
public/scss/shopping/_order.css
View file @
aca1a4b
...
...
@@ -427,6 +427,10 @@
.brand-name
{
display
:
block
;
line-height
:
50px
;
width
:
338px
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
}
.name
{
...
...
Please
register
or
login
to post a comment