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
Email Patches
Plain Diff
Browse Files
Authored by
邱骏
6 years ago
Commit
69d5198b7e03480bb85234f9b869b87d7d5c6d69
1 parent
4a43d0dd
普通团可以增加购买数量,并且如果有最小数量限制的时候,不能小于最小数量
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
66 additions
and
18 deletions
apps/activity/views/action/group/goodsDetail.hbs
apps/activity/views/action/group/progress.hbs
apps/cart/controllers/buy-now-controller.js
apps/cart/models/buy-now-model.js
public/hbs/activity/group/chose-panel.hbs
public/js/activity/group-detail.page.js
public/js/activity/group-progress.page.js
public/js/activity/group/chose-panel.js
public/js/cart/buynow-order-ensure.page.js
apps/activity/views/action/group/goodsDetail.hbs
View file @
69d5198
...
...
@@ -174,9 +174,8 @@
<span
class=
"bottom-title"
>
单人购买
</span>
{{/if}}
</button>
<button
class=
"buynow join-group-btn"
{{#
ifcond
activityIdDetail
.
peopleNum
"=="
'0'
}}
style=
"background-color: #b0b0b0;"
{{/
ifcond
}}
id=
"buynow"
>
id=
"buynow"
data-joinLimit=
"
{{
activityIdDetail
.
joinLimit
}}
"
data-saleNum=
"
{{
activityIdDetail
.
saleNum
}}
"
>
<span
class=
"bottom-title"
>
{{
activityIdDetail
.
formatCollagePrice
}}
</span>
{{#if
groupNo
}}
<span
class=
"bottom-title"
>
确认参团
{{#if
isShowPop
}}
,仅限新人
{{/if}}
</span>
...
...
apps/activity/views/action/group/progress.hbs
View file @
69d5198
...
...
@@ -42,7 +42,6 @@
{{>
group
/
progress-countdown
}}
<div
class=
"status-btn positive invite-join"
>
邀请小伙伴拼团
{{#
ifcond
joinLimit
'=='
1
}}
(仅限新人)
{{/
ifcond
}}
</div>
{{/
ifcond
}}
{{#
ifcond
pageGo
'==='
2
}}
<div
class=
"status-tip"
>
还差
<span
class=
"red"
>
{{
lackNum
}}
人
</span>
拼团成功,剩余时间
</div>
{{>
group
/
progress-countdown
}}
...
...
apps/cart/controllers/buy-now-controller.js
View file @
69d5198
...
...
@@ -194,6 +194,7 @@ class BuyNowController {
product_sku
:
product_sku
,
group_no
,
activity_id
:
activity_id
,
buy_number
:
buy_number
})
]);
...
...
@@ -430,7 +431,7 @@ class BuyNowController {
udid
:
udid
,
group_no
:
req
.
body
.
group_no
,
sku_type
:
req
.
body
.
sku_type
,
buy_number
:
1
,
buy_number
:
req
.
body
.
buy_number
||
1
,
gift_card_code
:
req
.
body
.
gift_card_code
,
address_id
:
req
.
body
.
address_id
,
delivery_time
:
2
,
...
...
@@ -501,13 +502,14 @@ class BuyNowController {
let
productSku
=
req
.
body
.
productSku
;
let
activityId
=
req
.
body
.
activityId
;
let
groupNo
=
req
.
body
.
groupNo
||
''
;
let
buyNum
=
req
.
body
.
buyNum
||
1
;
let
params
=
{
uid
:
uid
,
product_sku
:
productSku
,
group_no
:
groupNo
,
activity_id
:
activityId
,
buy_number
:
10
buy_number
:
buyNum
};
co
(
function
*
()
{
...
...
apps/cart/models/buy-now-model.js
View file @
69d5198
...
...
@@ -80,7 +80,7 @@ class BuyNowModel extends global.yoho.BaseModel {
uid
:
params
.
uid
,
product_sku
:
params
.
product_sku
,
group_no
:
params
.
group_no
||
''
,
buy_number
:
1
,
buy_number
:
params
.
buy_number
||
1
,
yoho_coin_mode
:
0
,
// 是否使用有货币
yoho_bill_term
:
0
,
// H5 不支持分期
is_support_apple_pay
:
'N'
,
// H5 不支持 APPLE PAY
...
...
public/hbs/activity/group/chose-panel.hbs
View file @
69d5198
...
...
@@ -49,9 +49,12 @@
<span
class=
"operator iconfont disabled"
>

</span>
</a>
<input
id=
"good-num"
class=
"good-num disabled"
type=
"text"
value=
"
{{
@root
.
buyNumber
}}
"
disabled=
"true"
>
<a
class=
"btn btn-plus"
href=
"javascript:void(0);"
>
<span
class=
"operator iconfont disabled"
>

</span>
</a>
<a
class=
"btn btn-plus"
href=
"javascript:void(0);"
>
<span
class=
"operator iconfont disabled"
>

</span>
</a>
{{#
ifcond
@root
.
joinLimit
'=='
2
}}
<span
style=
"height: 2.35rem;line-height: 2.35rem; padding: 0.1rem 0.4rem;color: red; font-size: 0.6rem; margin-left: 0.5rem; border-radius: 0.2rem; border: 1px solid red;"
>
{{
@root
.
saleNum
}}
件起售
</span>
{{/
ifcond
}}
</div>
<!--<span class="left-num-discount">即将售罄</span>-->
<!--<span class="left-num-discount">限购
{{
buy_limit_number
}}
件</span>-->
...
...
public/js/activity/group-detail.page.js
View file @
69d5198
...
...
@@ -336,13 +336,15 @@ class Detail extends Page {
if
(
!
this
.
pickData
.
goodsList
)
{
return
;
}
this
.
pickData
.
activityId
=
document
.
getElementById
(
'activityId'
).
value
;
this
.
pickData
.
groupNo
=
document
.
getElementById
(
'groupNo'
).
value
;
this
.
pickData
.
joinLimit
=
document
.
getElementById
(
'buynow'
).
dataset
.
joinlimit
||
'1'
;
this
.
pickData
.
saleNum
=
document
.
getElementById
(
'buynow'
).
dataset
.
salenum
||
'1'
;
chosePanel
.
show
({
data
:
this
.
pickData
}).
then
(
result
=>
{
if
(
result
&&
result
.
sku
)
{
console
.
log
(
result
);
if
(
result
.
buyNow
)
{
// 立即购买
let
nextUrl
=
location
.
origin
+
'/cart/index/buynow/orderensure?product_sku='
+
result
.
sku
.
skuId
+
'&buy_number='
+
result
.
buyNum
+
'&is_group=1&activity_id='
+
this
.
pickData
.
activityId
;
...
...
public/js/activity/group-progress.page.js
View file @
69d5198
...
...
@@ -230,7 +230,7 @@ class GroupProgress extends Page {
}).
then
(
result
=>
{
if
(
result
&&
result
.
sku
)
{
if
(
result
.
buyNow
)
{
let
query
=
`
is_group
=
1
&
product_sku
=
$
{
result
.
sku
.
skuId
}
&
buy_number
=
1
&
activity_id
=
$
{
this
.
data
.
activityId
}
&
group_no
=
$
{
this
.
data
.
groupNo
}
`
;
// eslint-disable-line
let
query
=
`
is_group
=
1
&
product_sku
=
$
{
result
.
sku
.
skuId
}
&
buy_number
=
$
{
result
.
buyNum
}
&
activity_id
=
$
{
this
.
data
.
activityId
}
&
group_no
=
$
{
this
.
data
.
groupNo
}
`
;
// eslint-disable-line
let
nextUrl
=
location
.
origin
+
`
/
cart
/
index
/
buynow
/
orderensure
?
$
{
query
}
`
;
if
(
!
yoho
.
isLogin
())
{
...
...
@@ -271,6 +271,7 @@ class GroupProgress extends Page {
if
(
!
data
||
data
.
code
!==
200
)
{
return
;
}
let
groupProductDetail
=
data
.
data
.
collageProductSingleBo
||
{};
let
color_length
=
0
;
...
...
@@ -306,6 +307,8 @@ class GroupProgress extends Page {
this
.
pickData
.
buy_limit_number
=
1
;
this
.
pickData
.
goodsList
=
data
.
data
.
goods_list
;
this
.
pickData
.
isSoldOutSoon
=
isSoldOutSoon
;
this
.
pickData
.
joinLimit
=
groupProductDetail
.
joinLimit
.
toString
()
||
'1'
;
this
.
pickData
.
saleNum
=
groupProductDetail
.
saleNum
||
1
;
// 默认显示第一种颜色的尺码
this
.
pickData
.
defaultImage
=
data
.
data
.
goods_list
[
0
].
color_image
;
...
...
public/js/activity/group/chose-panel.js
View file @
69d5198
...
...
@@ -78,6 +78,11 @@ class ChosePanel {
this
.
_setSelector
();
this
.
_initBlockStatus
();
if
(
this
.
data
.
joinLimit
===
'2'
)
{
// 如果是普通团,则让增加数量的按钮可用
$goodNum
.
val
(
parseInt
(
this
.
data
.
saleNum
,
10
));
this
.
data
.
buyNumber
=
parseInt
(
this
.
data
.
saleNum
,
10
);
$
(
'.btn-plus'
).
find
(
'.operator'
).
removeClass
(
'disabled'
);
}
innerScroll
.
disableScroll
(
$choseArea
);
}
...
...
@@ -141,6 +146,13 @@ class ChosePanel {
$yohoPage
.
on
(
'touchstart'
,
'#chose-btn-buynow'
,
(
e
)
=>
{
return
this
.
_choseBtnSureClick
(
e
,
true
);
});
$yohoPage
.
on
(
'touchend'
,
'.btn-plus, .btn-minus'
,
(
e
)
=>
{
let
button
=
e
.
currentTarget
;
if
(
!
$
(
button
).
find
(
'.operator'
).
hasClass
(
'disabled'
))
{
return
this
.
_numClick
(
e
);
}
});
}
/**
...
...
@@ -178,14 +190,26 @@ class ChosePanel {
let
buyNum
;
buyNum
=
$
(
e
.
currentTarget
).
hasClass
(
'btn-minus'
)
?
this
.
data
.
buyNumber
-
1
:
this
.
data
.
buyNumber
+
1
;
if
(
buyNum
<
1
)
{
$btnMinus
.
find
(
'.operator'
).
addClass
(
'disabled'
);
return
;
}
else
if
(
buyNum
===
1
)
{
$btnMinus
.
find
(
'.operator'
).
addClass
(
'disabled'
);
if
(
this
.
data
.
joinLimit
===
'2'
)
{
if
(
buyNum
<
parseInt
(
this
.
data
.
saleNum
,
10
))
{
$btnMinus
.
find
(
'.operator'
).
addClass
(
'disabled'
);
return
;
}
else
if
(
buyNum
===
parseInt
(
this
.
data
.
saleNum
,
10
))
{
$btnMinus
.
find
(
'.operator'
).
addClass
(
'disabled'
);
}
else
{
$btnMinus
.
find
(
'.operator'
).
removeClass
(
'disabled'
);
}
}
else
{
$btnMinus
.
find
(
'.operator'
).
removeClass
(
'disabled'
);
if
(
buyNum
<
1
)
{
$btnMinus
.
find
(
'.operator'
).
addClass
(
'disabled'
);
return
;
}
else
if
(
buyNum
===
1
)
{
$btnMinus
.
find
(
'.operator'
).
addClass
(
'disabled'
);
}
else
{
$btnMinus
.
find
(
'.operator'
).
removeClass
(
'disabled'
);
}
}
if
(
this
.
_checkSku
(
buyNum
))
{
this
.
data
.
buyNumber
=
buyNum
;
$goodNum
.
val
(
buyNum
);
...
...
@@ -209,6 +233,11 @@ class ChosePanel {
_choseBtnSureClick
()
{
let
self
=
this
;
let
skuId
=
this
.
_checkSku
();
let
buyNum
=
1
;
if
(
self
.
data
.
joinLimit
===
'2'
)
{
buyNum
=
self
.
data
.
buyNumber
;
}
if
(
skuId
)
{
$
.
ajax
({
...
...
@@ -218,12 +247,13 @@ class ChosePanel {
productSku
:
skuId
,
activityId
:
self
.
data
.
activityId
,
groupNo
:
self
.
data
.
groupNo
,
buyNum
:
buyNum
}
}).
then
(
data
=>
{
if
(
data
&&
data
.
code
===
200
)
{
this
.
_resolve
&&
this
.
_resolve
({
sku
:
{
skuId
},
buyNum
:
1
,
// 拼团只支持一件
buyNum
:
buyNum
,
// 拼团只支持一件
buyNow
:
true
});
}
else
{
...
...
@@ -286,6 +316,10 @@ class ChosePanel {
$goodNum
.
val
(
1
);
this
.
data
.
buyNumber
=
1
;
if
(
this
.
data
.
joinLimit
===
'2'
)
{
$goodNum
.
val
(
parseInt
(
this
.
data
.
saleNum
,
10
));
this
.
data
.
buyNumber
=
parseInt
(
this
.
data
.
saleNum
,
10
);
}
$choseBtnSure
.
css
(
'background-color'
,
'#d0021b'
).
text
(
'确定'
);
}
...
...
@@ -296,6 +330,10 @@ class ChosePanel {
}
else
{
$goodNum
.
val
(
1
);
this
.
data
.
buyNumber
=
1
;
if
(
this
.
data
.
joinLimit
===
'2'
)
{
$goodNum
.
val
(
parseInt
(
this
.
data
.
saleNum
,
10
));
this
.
data
.
buyNumber
=
parseInt
(
this
.
data
.
saleNum
,
10
);
}
$choseBtnSure
.
css
(
'background-color'
,
'#d0021b'
).
text
(
'确定'
);
}
}
...
...
public/js/cart/buynow-order-ensure.page.js
View file @
69d5198
...
...
@@ -164,6 +164,8 @@ function submitGroupOrder(verifyCode) {
loading
.
showLoadingMask
();
isSubmiting
=
true
;
console
.
log
(
qs
);
let
postData
=
{
product_sku
:
qs
.
product_sku
,
buy_number
:
qs
.
buy_number
,
...
...
Please
register
or
login
to post a comment