Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
李奇
8 years ago
Commit
0dbe864fe61a7557a57a6afdbc9b9a1a13884adf
2 parents
25f34277
c6cd9c17
Merge branch 'master' into feature/cs-quit-queue
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
134 additions
and
96 deletions
apps/activity/controllers/feature.js
apps/activity/controllers/individuation.js
apps/activity/models/individuation.js
apps/cart/controllers/order.js
apps/cart/helpers/pay/wechat.js
apps/product/views/action/detail/detail.hbs
apps/product/views/action/detail/new/detail.hbs
apps/product/views/partial/reds-shop/item.hbs
apps/product/views/partial/reds-shop/modules.hbs
config/common.js
doraemon/views/layout.hbs
doraemon/views/partial/analysis.hbs
package.json
public/js/cart/order-ensure.js
public/js/cart/pay.page.js
public/scss/product/detail/_detail.css
utils/redshop-process.js
apps/activity/controllers/feature.js
View file @
0dbe864
...
...
@@ -2,9 +2,6 @@
const
model
=
require
(
'../models/feature'
);
exports
.
index
=
function
(
req
,
res
,
next
)
{
// 唤起 APP 的路径
res
.
locals
.
appPath
=
`
yohobuy
:
//yohobuy.com/goapp?openby:yohobuy={"action":"go.h5","params":{"param":{"share_id":"${req.query.share_id}"},"share":"/operations/api/v5/webshare/getShare","shareparam":{"share_id":"${req.query.share_id}"},"url":"https://activity.yoho.cn/feature/${req.params.code}.html"}}`;
model
.
index
({
code
:
req
.
params
.
code
,
type
:
req
.
query
.
type
...
...
@@ -12,13 +9,21 @@ exports.index = function(req, res, next) {
if
(
!
result
)
{
return
next
();
}
let
title
=
req
.
query
.
title
||
result
.
name
||
'专题活动'
;
// 唤起 APP 的路径
res
.
locals
.
appPath
=
`
yohobuy
:
//yohobuy.com/goapp?openby:yohobuy={"action":"go.h5","params":{"param":{"share_id":"${req.query.share_id}","title":"${title}"},"share":"/operations/api/v5/webshare/getShare","shareparam":{"share_id":"${req.query.share_id}"},"title":"${title}","url":"https://activity.yoho.cn/feature/${req.params.code}.html"}}`;
res
.
render
(
'feature/index'
,
{
module
:
'activity'
,
page
:
'feature'
,
title
:
result
.
name
||
'Yoho!Buy有货'
,
title
:
title
,
content
:
result
,
activity_id
:
req
.
params
.
code
,
isFeature
:
true
isFeature
:
true
,
loadJs
:
[{
src
:
global
.
yoho
.
config
.
jsSdk
}]
});
}).
catch
(
next
);
};
...
...
apps/activity/controllers/individuation.js
View file @
0dbe864
...
...
@@ -17,7 +17,8 @@ exports.productLst = function(req, res, next) {
uid
:
uid
,
udid
:
udid
,
yh_channel
:
req
.
query
.
yh_channel
||
(
req
.
cookies
.
_Channel
&&
channels
[
req
.
cookies
.
_Channel
])
||
1
,
limit
:
req
.
query
.
limit
limit
:
req
.
query
.
limit
,
gender
:
req
.
query
.
gender
},
req
.
query
));
}
else
{
let
keys
=
[
'sort'
,
'misort'
,
'msort'
,
'gender'
,
'brand'
],
...
...
apps/activity/models/individuation.js
View file @
0dbe864
...
...
@@ -24,6 +24,11 @@ let _getProduct = function(o) {
};
};
const
gender
=
{
1
:
'1,3'
,
2
:
'2,3'
};
module
.
exports
=
{
productLst
:
function
(
params
)
{
return
api
.
get
(
''
,
Object
.
assign
({
...
...
@@ -47,7 +52,9 @@ module.exports = {
udid
:
params
.
udid
||
0
,
yh_channel
:
params
.
yh_channel
,
limit
:
params
.
limit
,
need_filter
:
'null'
need_filter
:
'null'
,
rec_pos
:
'100008'
,
gender
:
params
.
gender
||
gender
[
params
.
yh_channel
]
},
{
cache
:
true
}).
then
(
res
=>
{
...
...
apps/cart/controllers/order.js
View file @
0dbe864
...
...
@@ -71,9 +71,10 @@ exports.orderEnsure = (req, res, next) => {
];
/* tar note 170426 品众去除 */
// if (_.isUndefined(req.cookies._isNewUser)) {
// allPromise.push(orderModel.isNewUser(uid));
// }
/* tar note 170601 品众代码恢复 */
if
(
_
.
isUndefined
(
req
.
cookies
.
_isNewUser
))
{
allPromise
.
push
(
orderModel
.
isNewUser
(
uid
));
}
return
Promise
.
all
(
allPromise
).
then
(
result
=>
{
let
order
=
result
[
0
];
...
...
@@ -81,15 +82,16 @@ exports.orderEnsure = (req, res, next) => {
let
address
=
result
[
2
];
/* tar note 170426 品众去除 */
// let isNewUser = result[3];
// if (!_.isUndefined(isNewUser)) {
// if (isNewUser) {
// res.cookie('_isNewUser', true, actCkOpthn);
// } else {
// res.cookie('_isNewUser', false, actCkOpthn);
// }
// }
/* tar note 170601 品众代码恢复 */
let
isNewUser
=
result
[
3
];
if
(
!
_
.
isUndefined
(
isNewUser
))
{
if
(
isNewUser
)
{
res
.
cookie
(
'_isNewUser'
,
true
,
actCkOpthn
);
}
else
{
res
.
cookie
(
'_isNewUser'
,
false
,
actCkOpthn
);
}
}
if
(
order
.
cartUrl
)
{
logger
.
info
(
`
orderEnsure
:
order
cartUrl
has
value
:
$
{
order
.
cartUrl
},
order
data
is
null
`
);
...
...
apps/cart/helpers/pay/wechat.js
View file @
0dbe864
...
...
@@ -107,7 +107,7 @@ const tools = {
nonce_str
:
common
.
nonceStr
(),
body
:
'有货订单号:'
+
params
.
orderCode
,
out_trade_no
:
'YOHOBuy_'
+
params
.
orderCode
,
total_fee
:
_
.
parseInt
(
params
.
totalFee
*
100
),
total_fee
:
Math
.
round
(
params
.
totalFee
*
100
),
trade_type
:
'JSAPI'
,
time_start
:
moment
().
format
(
'YYYYMMDDHHmmss'
),
time_expire
:
moment
().
add
(
2
,
'hours'
).
format
(
'YYYYMMDDHHmmss'
),
...
...
apps/product/views/action/detail/detail.hbs
View file @
0dbe864
...
...
@@ -39,7 +39,6 @@
{{/
goodsSubtitle
}}
<div
class=
"price-date"
>
<div
class=
"goods-price data-bind"
>
<h1
class=
"current-price"
></h1>
<h1
class=
"previous-price"
></h1>
...
...
@@ -47,13 +46,13 @@
<button
class=
"limit-sale data-can-get-limit-code data-bind"
id=
'limit-sale'
>
获取限购码
</button>
<button
class=
"got-limit-sale data-code-empty data-bind"
>
限购码已被抢光
</button>
<button
class=
"got-limit-sale data-got-code data-bind"
>
已获取限购码
</button>
{{#if
periodOfMarket
}}
<div
class=
"period-of-market"
>
<h1>
上市期:
</h1>
<h1
>
{{
periodOfMarket
}}
</h1>
</div>
{{/if}}
</div>
{{#if
periodOfMarket
}}
<div
class=
"period-of-market"
>
<h1>
上市期:
</h1>
<h1
>
{{
periodOfMarket
}}
</h1>
</div>
{{/if}}
<div
class=
"price-date data-bind"
>
<div
class=
"student-price"
>
...
...
apps/product/views/action/detail/new/detail.hbs
View file @
0dbe864
...
...
@@ -52,14 +52,13 @@
<button
class=
"limit-sale data-can-get-limit-code data-bind"
id=
'limit-sale'
>
获取限购码
</button>
<button
class=
"got-limit-sale data-code-empty data-bind"
>
限购码已被抢光
</button>
<button
class=
"got-limit-sale data-got-code data-bind"
>
已获取限购码
</button>
{{#if
periodOfMarket
}}
<div
class=
"period-of-market"
>
<h1>
上市期:
</h1>
<h1
>
{{
periodOfMarket
}}
</h1>
</div>
{{/if}}
</div>
{{#if
periodOfMarket
}}
<div
class=
"period-of-market"
>
<h1>
上市期:
</h1>
<h1
>
{{
periodOfMarket
}}
</h1>
</div>
{{/if}}
{{!--占位: 学生价/会员价--}}
<div
id=
"placeholder-pricedata"
></div>
...
...
apps/product/views/partial/reds-shop/item.hbs
View file @
0dbe864
...
...
@@ -16,14 +16,16 @@
{{/
within
}}
{{/if}}
</a>
{{#
ifor
isGood
four
}}
{{#if
showProductInfo
}}
<div
class=
"item-info"
>
<div
class=
"text"
>
{{
text
}}
</div>
<div
class=
"name"
>
{{
name
}}
</div>
<div
class=
"price"
>
{{
salesPrice
}}
</div>
</div>
{{/if}}
{{/
ifor
}}
{{#if
showProductInfo
}}
{{#
ifor
isGood
four
}}
{{#
unless
parent
.
noShowProductInfo
}}
<div
class=
"item-info"
>
<div
class=
"text"
>
{{
text
}}
</div>
<div
class=
"name"
>
{{
name
}}
</div>
<div
class=
"price"
>
{{
salesPrice
}}
</div>
</div>
{{/
unless
}}
{{/
ifor
}}
{{/if}}
</div>
...
...
apps/product/views/partial/reds-shop/modules.hbs
View file @
0dbe864
...
...
@@ -51,7 +51,7 @@
{{#
isEqual
module_type
'SingleImage'
}}
<div
class=
"items-s1 clearfix"
>
{{#
each
..
/
pics
}}
{{>
reds-shop
/
item
index
=
@
..
/
index
single
=
true
}}
{{>
reds-shop
/
item
index
=
@
..
/
index
single
=
true
parent
=
..
/
..
}}
{{/
each
}}
</div>
{{#if
..
/
isModuleMargin
}}
...
...
@@ -61,7 +61,7 @@
{{#
isEqual
module_type
'DoubleImage'
}}
<div
class=
"items-s2 clearfix"
>
{{#
each
..
/
pics
}}
{{>
reds-shop
/
item
index
=
@
..
/
index
double
=
true
}}
{{>
reds-shop
/
item
index
=
@
..
/
index
double
=
true
parent
=
..
/
..
}}
{{/
each
}}
</div>
{{#if
..
/
isModuleMargin
}}
...
...
@@ -71,7 +71,7 @@
{{#
isEqual
module_type
'TripleImage'
}}
<div
class=
"
{{#
isEqual
..
/
displayType
1
}}
items-3-3
{{/
isEqual
}}{{#
isEqual
..
/
displayType
2
}}
items-3-3 items-small
{{/
isEqual
}}{{#
isEqual
..
/
displayType
3
}}
items-3-2 items-3-2-right
{{/
isEqual
}}{{#
isEqual
..
/
displayType
4
}}
items-3-2 items-3-2-left
{{/
isEqual
}}
clearfix"
>
{{#
each
..
/
pics
}}
{{>
reds-shop
/
item
index
=
@
..
/
index
triple
=
true
}}
{{>
reds-shop
/
item
index
=
@
..
/
index
triple
=
true
parent
=
..
/
..
}}
{{/
each
}}
</div>
{{#if
..
/
isModuleMargin
}}
...
...
config/common.js
View file @
0dbe864
...
...
@@ -22,7 +22,7 @@ const domains = {
module
.
exports
=
{
app
:
'h5'
,
appVersion
:
'5.7.
0
'
,
// 调用api的版本
appVersion
:
'5.7.
1
'
,
// 调用api的版本
port
:
6001
,
siteUrl
:
'//m.yohobuy.com'
,
assetUrl
:
'//127.0.0.1:5001'
,
...
...
doraemon/views/layout.hbs
View file @
0dbe864
...
...
@@ -124,9 +124,6 @@
{{#
loadJs
}}
<script
type=
"text/javascript"
src=
"
{{
src
}}
"
></script>
{{/
loadJs
}}
{{#
isFeature
}}
<script
type=
"text/javascript"
src=
"//cdn.yoho.cn/js-sdk/1.2.2/jssdk.js"
></script>
{{/
isFeature
}}
{{#
unless
devEnv
}}
{{>
analysis
}}
{{/
unless
}}
...
...
doraemon/views/partial/analysis.hbs
View file @
0dbe864
...
...
@@ -76,7 +76,8 @@
}());
{{!--/* tar add 170426 品众代码去除 */--}}
{{!--window._fxcmd = window._fxcmd || [];
{{!--/* tar add 170601 品众代码恢复 */--}}
window
.
_fxcmd
=
window
.
_fxcmd
||
[];
_fxcmd
.
sid
=
'bb3b16fa1106a6ab8619da0095755f32'
;
_fxcmd
.
trackAll
=
false
;
// 参数配置(可选)...
...
...
@@ -89,7 +90,7 @@
_pzfx
.
src
=
'//static.w3t.cn/fx/1/1/fx.js'
;
var
sc
=
document
.
getElementsByTagName
(
'script'
)[
0
];
sc
.
parentNode
.
insertBefore
(
_pzfx
,
sc
);
}, 1000);
--}}
},
1000
);
</script>
...
...
package.json
View file @
0dbe864
{
"name"
:
"m-yohobuy-node"
,
"version"
:
"5.7.
4
"
,
"version"
:
"5.7.
10
"
,
"private"
:
true
,
"description"
:
"A New Yohobuy Project With Express"
,
"repository"
:
{
...
...
public/js/cart/order-ensure.js
View file @
0dbe864
...
...
@@ -327,14 +327,15 @@ function submitOrder() {
}
/* tar add 170426 品众代码去除 */
// if (window._fxcmd) {
// window._fxcmd.push(['trackOrder', {
// oid: res.data.order_code,
// otp: res.data.order_amount,
// u_info: cookie.get('_UID'),
// u_type: cookie.get('_isNewUser') ? 1 : 0
// }, []]);
// }
/* tar note 170601 品众代码恢复 */
if
(
window
.
_fxcmd
)
{
window
.
_fxcmd
.
push
([
'trackOrder'
,
{
oid
:
res
.
data
.
order_code
,
otp
:
res
.
data
.
order_amount
,
u_info
:
cookie
.
get
(
'_UID'
),
u_type
:
cookie
.
get
(
'_isNewUser'
)
?
1
:
0
},
[]]);
}
cookie
.
remove
([
'order-info'
,
'activity-info'
]);
window
.
location
.
href
=
url
;
...
...
public/js/cart/pay.page.js
View file @
0dbe864
...
...
@@ -146,42 +146,56 @@ if ($aliPayEL && $aliPayEL.length > 0 && $aliPayEL.data('href')) {
});
}
// 微信支付
function
callpay
(
orderCode
)
{
/**
* 获取微信支付数据
* @param {*} orderCode
*/
function
getWechatPayData
(
orderCode
)
{
let
jsApiParameters
;
$
.
ajax
({
type
:
'GET'
,
url
:
'/cart/index/new/pay'
,
data
:
{
order_code
:
orderCode
,
payment
:
'22_platform'
,
},
dataType
:
'json'
,
success
:
function
(
res
)
{
if
(
res
.
code
===
200
)
{
jsApiParameters
=
res
.
data
.
jsApiParameters
;
jsApiCall
(
orderCode
,
jsApiParameters
);
}
else
{
tip
.
show
(
'微信支付调取失败'
);
}
},
error
:
function
()
{
tip
.
show
(
'请刷新本页面,完成微信支付'
);
},
complete
:
function
()
{
$loadingToast
.
addClass
(
'hide'
);
}
});
}
// 微信支付
function
callpay
(
orderCode
)
{
$loadingToast
.
removeClass
(
'hide'
);
if
(
typeof
WeixinJSBridge
===
'undefined'
)
{
if
(
document
.
addEventListener
)
{
document
.
addEventListener
(
'WeixinJSBridgeReady'
,
jsApiCall
,
false
);
document
.
addEventListener
(
'WeixinJSBridgeReady'
,
function
()
{
getWechatPayData
(
orderCode
);
},
false
);
}
else
if
(
document
.
attachEvent
)
{
document
.
attachEvent
(
'WeixinJSBridgeReady'
,
jsApiCall
);
document
.
attachEvent
(
'onWeixinJSBridgeReady'
,
jsApiCall
);
document
.
attachEvent
(
'WeixinJSBridgeReady'
,
function
()
{
getWechatPayData
(
orderCode
);
});
document
.
attachEvent
(
'onWeixinJSBridgeReady'
,
function
()
{
getWechatPayData
(
orderCode
);
});
}
}
else
{
$
.
ajax
({
type
:
'GET'
,
url
:
'/cart/index/new/pay'
,
data
:
{
order_code
:
orderCode
,
payment
:
'22_platform'
,
},
dataType
:
'json'
,
success
:
function
(
res
)
{
if
(
res
.
code
===
200
)
{
jsApiParameters
=
res
.
data
.
jsApiParameters
;
jsApiCall
(
orderCode
,
jsApiParameters
);
}
else
{
tip
.
show
(
'微信支付调取失败'
);
}
},
error
:
function
()
{
tip
.
show
(
'请刷新本页面,完成微信支付'
);
},
complete
:
function
()
{
$loadingToast
.
addClass
(
'hide'
);
}
});
getWechatPayData
(
orderCode
);
}
}
...
...
public/scss/product/detail/_detail.css
View file @
0dbe864
...
...
@@ -568,9 +568,12 @@ $basicBtnC: #eb0313;
}
.period-of-market
{
float
:
right
;
color
:
#d0021b
;
padding
:
0
30px
;
background-color
:
#fff
;
line-height
:
54px
;
color
:
#b0b0b0
;
font-size
:
24px
;
border-bottom
:
1px
solid
#e0e0e0
;
h1
{
display
:
inline-block
;
...
...
utils/redshop-process.js
View file @
0dbe864
...
...
@@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2017-03-23 11:02:31
* @Last Modified by: Targaryen
* @Last Modified time: 2017-05-
02 11:09:37
* @Last Modified time: 2017-05-
26 16:42:29
*/
/* 红人店铺数据处理 */
...
...
@@ -34,7 +34,8 @@ const _linkhandle = (linkParent) => {
switch
(
parseInt
(
linkParent
.
linkType
,
10
))
{
case
0
:
return
helpers
.
urlFormat
(
''
,
{
filter_poolId
:
linkParent
.
resource
filter_poolId
:
linkParent
.
resource
,
title
:
linkParent
.
text
},
'list'
);
case
1
:
return
helpers
.
urlFormat
(
'/product/'
+
linkParent
.
resource
+
'.html'
);
...
...
@@ -56,7 +57,7 @@ const _picsHandle = (moduleData) => {
let
pics
=
[];
_
.
forEach
(
_
.
get
(
moduleData
,
'data'
,
[]),
value
=>
{
let
showProductInfo
=
fals
e
;
let
showProductInfo
=
tru
e
;
if
(
_
.
has
(
value
,
'showProductInfo'
))
{
showProductInfo
=
value
.
showProductInfo
;
...
...
@@ -325,12 +326,18 @@ const pushGoodsInfo = (decorators, goodsList) => {
_
.
forEach
(
_
.
get
(
value
,
'pics'
,
[]),
(
subValue
,
subKey
)
=>
{
let
hasGoods
=
_
.
get
(
goodsObj
,
`
$
{
subValue
.
skn
}.
default_images
`
,
false
);
if
(
!
hasGoods
)
{
decorators
[
key
].
noShowProductInfo
=
true
;
}
if
(
subValue
.
skn
&&
hasGoods
)
{
let
salesPrice
=
_
.
get
(
goodsObj
,
`
$
{
subValue
.
skn
}.
sales_price
`
,
''
);
let
marketPrice
=
_
.
get
(
goodsObj
,
`
$
{
subValue
.
skn
}.
market_price
`
,
''
);
let
imageSrc
=
_
.
get
(
goodsObj
,
`
$
{
subValue
.
skn
}.
default_images
`
,
''
);
decorators
[
key
].
pics
[
subKey
].
showProductInfo
=
salesPrice
!==
0
;
if
(
salesPrice
===
0
)
{
decorators
[
key
].
noShowProductInfo
=
true
;
}
decorators
[
key
].
pics
[
subKey
].
name
=
_
.
get
(
goodsObj
,
`
$
{
subValue
.
skn
}.
product_name
`
,
''
);
decorators
[
key
].
pics
[
subKey
].
salesPrice
=
salesPrice
?
'¥'
+
salesPrice
:
''
;
decorators
[
key
].
pics
[
subKey
].
marketPrice
=
marketPrice
?
'¥'
+
marketPrice
:
''
;
...
...
Please
register
or
login
to post a comment