Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
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
梁志锋
9 years ago
Commit
1567cbd2b9a54a0e0763f65aa5cdfca54af1b128
1 parent
dd0efa2e
购物车修改
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
15 deletions
static/js/cart/cart.js
static/js/cart/chose-panel.js
static/js/cart/gift-advance.js
template/m.yohobuy.com/partials/cart/cart-content.phtml
template/m.yohobuy.com/partials/cart/chose-panel.phtml
static/js/cart/cart.js
View file @
1567cbd
...
...
@@ -14,6 +14,7 @@ var chosePanel = require('./chose-panel'),
var
$cartContent
=
$
(
'.cart-content'
);
var
navHammer
,
$advanceBuy
=
$
(
'.advance-buy'
),
cartType
=
$
(
'#cartType'
).
val
();
var
hasChecked
=
$
(
'.cart-goods .icon-cb-checked'
).
length
>
0
?
true
:
false
;
//是否有选中商品
...
...
@@ -56,6 +57,10 @@ if ($('.cart-nav').length > 0) {
},
3000
);
}
$
(
'.advance-buy'
).
on
(
'touchend'
,
function
()
{
window
.
location
.
href
=
'/cart/index/advanceBuy?cartType='
+
cartType
;
});
$
(
'.btn-balance'
).
on
(
'touchend'
,
function
()
{
if
(
hasChecked
)
{
window
.
location
.
href
=
'/cart/index/orderEnsure?cartType='
+
cartType
;
...
...
static/js/cart/chose-panel.js
View file @
1567cbd
...
...
@@ -17,9 +17,6 @@ var $chosePanel = $('#chose-panel'),
$num
,
$chosed
,
$imgsThumb
,
// re = /\d+/,
$leftNum
,
leftNum
,
confirming
,
...
...
@@ -31,6 +28,7 @@ var $chosePanel = $('#chose-panel'),
$curSizeBlock
,
$sizeRowList
,
cbFn
,
cartType
,
$allChoseItems
,
$yohoPage
=
$
(
'.yoho-page'
);
...
...
@@ -41,10 +39,10 @@ function init() {
hasChooseColor
=
false
;
hasChooseSize
=
false
;
$curSizeBlock
=
null
;
$imgsThumb
=
$
(
'.chose-panel'
).
find
(
'.thumb'
),
$allChoseItems
=
$
(
'.chose-items'
),
$sizeRowList
=
$
(
'.size-list ul'
),
$leftNum
=
$
(
'#left-num'
),
$imgsThumb
=
$
(
'.chose-panel'
).
find
(
'.thumb'
);
$allChoseItems
=
$
(
'.chose-items'
);
$sizeRowList
=
$
(
'.size-list ul'
);
$leftNum
=
$
(
'#left-num'
);
$firstRow
=
$sizeRowList
.
eq
(
0
);
$firstRow
.
toggleClass
(
'hide'
);
$curSizeRow
=
$firstRow
;
...
...
@@ -77,7 +75,7 @@ function show(html, cb) {
//隐藏当前Panel
function
hide
()
{
$
(
'.chose-panel'
).
hide
();
cbFn
=
null
;
//
cbFn = null;
}
//修改加入购物车的文字和背景
...
...
@@ -168,7 +166,6 @@ $yohoPage.on('touchstart', '.color-list .block', function(e) {
// 之前选中的尺码去掉勾选样式
if
(
$preSiblingBlock
.
length
>
0
)
{
$preSiblingBlock
.
removeClass
(
'chosed'
);
}
curSizeBlock
=
$curSizeRow
.
children
().
get
(
scindex
);
...
...
@@ -328,7 +325,8 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
productSku
:
productSku
,
buyNumber
:
buyNumber
,
promotionId
:
promotionId
,
isEdit
:
isEdit
isEdit
:
isEdit
,
cartType
:
cartType
}
}).
done
(
function
(
res
)
{
loading
.
hideLoadingMask
();
...
...
@@ -338,7 +336,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
hide
();
if
(
cbFn
)
{
cbFn
(
res
.
location
);
cbFn
();
}
}
if
(
res
.
message
)
{
...
...
static/js/cart/gift-advance.js
View file @
1567cbd
...
...
@@ -10,7 +10,8 @@ var $ = require('jquery'),
loading
=
require
(
'../plugin/loading'
),
chosePanel
=
require
(
'./chose-panel'
);
var
$page
=
$
(
'.gift-advance-page'
);
var
$page
=
$
(
'.gift-advance-page'
),
queryString
=
$
.
queryString
();
lazyLoad
(
$
(
'.lazy'
));
...
...
@@ -24,7 +25,9 @@ function getProductInfo(skn, promotionId) {
tip
.
show
(
'网络错误'
);
return
;
}
chosePanel
.
show
(
html
);
chosePanel
.
show
(
html
,
function
(){
window
.
location
.
href
=
'/cart/index/orderEnsure?cartType='
+
queryString
.
cartType
;
});
},
function
()
{
tip
.
show
(
'网络错误'
);
}).
always
(
function
()
{
...
...
template/m.yohobuy.com/partials/cart/cart-content.phtml
View file @
1567cbd
...
...
@@ -25,7 +25,7 @@
<li class="advance-buy">
<span class="iconfont"></span>
加价购
<a href="
/cart/index/advanceBuy
">
<a href="">
<span class="count">{{advanceBuyCount}}</span>
<span class="iconfont icon-right-arrow"></span>
</a>
...
...
template/m.yohobuy.com/partials/cart/chose-panel.phtml
View file @
1567cbd
...
...
@@ -37,7 +37,7 @@
<ul
class=
"size-row clearfix hide"
>
{
{#
size
}
}
<li
class=
"block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}"
data-id=
{
{id
}
}
data-colorid=
"{{colorId}}"
data-num=
"{{sizeNum}}"
data-numstr=
"{{colorNumStr}}"
data-skuid=
"{{skuId}}"
data-goodid=
"{{goodsId}}"
>
<li
class=
"block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}"
data-id=
"{{id}}"
data-colorid=
"{{colorId}}"
data-num=
"{{sizeNum}}"
data-numstr=
"{{colorNumStr}}"
data-skuid=
"{{skuId}}"
data-goodid=
"{{goodsId}}"
>
{
{name
}
}
</li>
{
{/
size
}
}
...
...
Please
register
or
login
to post a comment