Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
Lynnic
9 years ago
Commit
d56e6bbe5d39b2e068660af01e811654017f4592
1 parent
52a902cf
购物车逻辑修改
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
38 deletions
static/js/cart/chose-panel.js
template/m.yohobuy.com/actions/product/detail/index.phtml
static/js/cart/chose-panel.js
View file @
d56e6bb
...
...
@@ -5,7 +5,9 @@
* @date: 2015/10/21
*/
var
$
=
require
(
'jquery'
);
var
$
=
require
(
'jquery'
),
tip
=
require
(
'../plugin/tip'
),
loading
=
require
(
'../plugin/loading'
);
// Handlebars = require('yoho.handlebars');
...
...
@@ -24,7 +26,6 @@ var $num,
$sizeList
.
each
(
function
()
{
colorIndex
=
$
(
this
).
data
(
'colorid'
);
if
(
colorIndex
===
firstColorId
)
{
$
(
this
).
removeClass
(
'hide'
);
}
...
...
@@ -79,41 +80,44 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
remove
();
}).
on
(
'touchstart'
,
'#chose-btn-sure'
,
function
()
{
// var productSku,
// buyNumber = $('#good-num') - 0;
// promotionId,
// goodsType,
// isEdit;
// //确定
// $chosed = $('.block-list>ul>li.chosed');
// if (2 === $chosed.length && 2 !== $chosed.closest('.zero-stock').length) {
// if (confirm) {
// return false;
// }
// confirm = true;
// loading.showLoadingMask();
// $.ajax({
// method: 'POST',
// url: '/cart/index/add',
// data: {
// product_id: productId,
// content: content
// }
// }).done(function(res) {
// if (res.code === 200) {
// loading.hideLoadingMask();
// confirm = false;
// remove();
// }
// }).fail(function() {
// tip.show('网络出了点问题~');
// confirm = false;
// });
// }
var
productSku
,
buyNumber
=
$
(
'#good-num'
)
-
0
;
// promotionId,
// goodsType,
// isEdit;
$chosed
=
$
(
'.block-list>ul>li.chosed'
);
if
(
2
===
$chosed
.
length
&&
0
===
$chosed
.
closest
(
'.zero-stock'
).
length
)
{
productSku
=
$sizeList
.
closest
(
'.chosed'
).
data
(
'skuid'
);
// if (confirm) {
// return false;
// }
// confirm = true;
loading
.
showLoadingMask
();
$
.
ajax
({
method
:
'POST'
,
url
:
'/cart/index/add'
,
data
:
{
productSku
:
productSku
,
buyNumber
:
buyNumber
}
}).
done
(
function
(
res
)
{
if
(
res
.
code
===
200
)
{
loading
.
hideLoadingMask
();
// confirm = false;
remove
();
}
}).
fail
(
function
()
{
tip
.
show
(
'网络出了点问题~'
);
// confirm = false;
});
}
}).
on
(
'touchstart'
,
'.block'
,
function
(
e
)
{
var
$this
=
$
(
this
),
...
...
template/m.yohobuy.com/actions/product/detail/index.phtml
View file @
d56e6bb
...
...
@@ -114,7 +114,7 @@
<div
id=
"productDesc"
>
</div>
{
{>
product/recommend-for-you
}
}
{
{>
shopping-
cart/chose-panel
}
}
{
{>
cart/chose-panel
}
}
{
{#cartInfo
}
}
<div
class=
"cart-bar"
>
...
...
Please
register
or
login
to post a comment