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
Plain Diff
Browse Files
Authored by
Rock Zhang
9 years ago
Commit
0986f55a90e38c9dc8b6709ecab5522671686a05
2 parents
e6346920
a924419f
Merge branch 'feature/cart' of git.dev.yoho.cn:web/yohobuy into feature/cart
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
92 additions
and
34 deletions
static/js/shopping-cart/cart-info.js
static/js/shopping-cart/cart.js
static/js/shopping-cart/good.js
template/m.yohobuy.com/actions/index/shoppingCart/index.phtml
template/m.yohobuy.com/partials/shopping-cart/gift-advance-good.phtml
template/m.yohobuy.com/partials/shopping-cart/good.phtml
yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php
static/js/shopping-cart/cart-info.js
0 → 100644
View file @
0986f55
/**
* 购物车信息读取
* @author: liangzhifeng<zhifeng.liang@yoho.cn>
* @date: 2015/12/15
*/
var
info
=
window
.
cookie
(
'cart-info'
);
// info 必须是 JSON 字符串
try
{
info
=
JSON
.
parse
(
info
);
}
catch
(
e
)
{
info
=
{
deliveryId
:
null
,
deliveryTimeId
:
null
,
paymentTypeId
:
null
,
yohoCoin
:
null
,
addressId
:
null
,
couponCode
:
null
,
couponValue
:
null
,
invoice
:
null
,
invoiceText
:
null
,
invoiceType
:
null
,
msg
:
null
};
window
.
setCookie
(
'cart-info'
,
JSON
.
stringify
(
info
));
}
exports
.
cartInfo
=
function
(
key
,
value
)
{
if
(
value
===
undefined
)
{
return
info
[
key
];
}
info
[
key
]
=
value
;
window
.
setCookie
(
'cart-info'
,
JSON
.
stringify
(
info
));
};
...
...
static/js/shopping-cart/cart.js
View file @
0986f55
...
...
@@ -8,9 +8,13 @@ var $ = require('jquery'),
lazyLoad
=
require
(
'yoho.lazyload'
),
Hammer
=
require
(
'yoho.hammer'
);
var
chosePanel
=
require
(
'./chose-panel'
),
cartInfo
=
require
(
'./cart-info'
).
cartInfo
;
var
$cartContent
=
$
(
'.cart-content'
);
var
navHammer
;
var
navHammer
,
cartType
=
'ordinary'
;
require
(
'./good'
);
...
...
@@ -32,4 +36,34 @@ navHammer.on('tap', function(e) {
//trigger lazyload
$
(
window
).
trigger
(
'scroll'
);
});
\ No newline at end of file
});
$
(
'.btn-balance'
).
on
(
'touchend'
,
function
()
{
window
.
location
.
href
=
'/shoppingCart/orderEnsure?cartType='
+
cartType
;
});
$
(
'.advance-buy'
).
on
(
'touchend'
,
function
()
{
var
$advanceBuy
=
$
(
'#advanceBuy'
),
$mainCart
=
$
(
'#mainCart'
);
if
(
$advanceBuy
.
hasClass
(
'hide'
))
{
$mainCart
.
removeClass
(
'show'
).
addClass
(
'hide'
);
$advanceBuy
.
removeClass
(
'hide'
).
addClass
(
'show'
);
}
else
{
$advanceBuy
.
removeClass
(
'show'
).
addClass
(
'hide'
);
$mainCart
.
removeClass
(
'hide'
).
addClass
(
'show'
);
}
});
$
(
'.chose'
).
on
(
'touchend'
,
function
()
{
//var id = $(this).closest('.gift-advance-good').data('id');
chosePanel
.
show
();
});
cartInfo
=
0
;
\ No newline at end of file
...
...
static/js/shopping-cart/good.js
View file @
0986f55
...
...
@@ -9,14 +9,10 @@ var $ = require('jquery'),
lazyLoad
=
require
(
'yoho.lazyload'
);
var
dialog
=
require
(
'../me/dialog'
),
tip
=
require
(
'../plugin/tip'
),
chosePanel
=
require
(
'./chose-panel'
);
tip
=
require
(
'../plugin/tip'
);
var
$names
;
//chosePanel = require('./chose-panel');
var
cartType
=
'ordinary'
;
var
$names
;
//var $curDelPanel;
...
...
@@ -153,27 +149,3 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
//})
$
(
'.btn-balance'
).
on
(
'touchend'
,
function
()
{
window
.
location
.
href
=
'/shoppingCart/orderEnsure?cartType='
+
cartType
;
});
$
(
'.advance-buy'
).
on
(
'touchend'
,
function
()
{
var
$advanceBuy
=
$
(
'#advanceBuy'
),
$mainCart
=
$
(
'#mainCart'
);
if
(
$advanceBuy
.
hasClass
(
'hide'
))
{
$mainCart
.
removeClass
(
'show'
).
addClass
(
'hide'
);
$advanceBuy
.
removeClass
(
'hide'
).
addClass
(
'show'
);
}
else
{
$advanceBuy
.
removeClass
(
'show'
).
addClass
(
'hide'
);
$mainCart
.
removeClass
(
'hide'
).
addClass
(
'show'
);
}
});
$
(
'.chose'
).
on
(
'touchend'
,
function
()
{
//var id = $(this).closest('.gift-advance-good').data('id');
chosePanel
.
show
();
});
...
...
template/m.yohobuy.com/actions/index/shoppingCart/index.phtml
View file @
0986f55
...
...
@@ -70,4 +70,5 @@
{
{>
product/recommend-for-you
}
}
</div>
{
{>
shopping-cart/chose-panel
}
}
{
{>
layout/footer
}
}
\ No newline at end of file
...
...
template/m.yohobuy.com/partials/shopping-cart/gift-advance-good.phtml
View file @
0986f55
...
...
@@ -31,4 +31,6 @@
</p>
<button class="chose">选择</button>
</div>
</div>
\ No newline at end of file
...
...
template/m.yohobuy.com/partials/shopping-cart/good.phtml
View file @
0986f55
<div class="shopping-cart-good clearfix" data-id={{id}}>
<span class="checkbox icon-cb-checked iconfont"></span>
<div class="info">
<img class="thumb lazy" data-original={{thumb}}>
<div class="">
<a class="" href="{{url}}">
<img class="thumb lazy" data-original="{{thumb}}">
</a>
{{#if isGift}}
<p class="few-tag">赠品</p>
{{/if}}
{{#if isAdvanceBuy}}
<p class="few-tag">加价购</p>
{{/if}}
{{#if isSoldOut}}
<p class="few-tag">失效</p>
{{/if}}
</div>
<div class="deps">
<p class="name row">{{name}}</p>
<p class="row">
...
...
yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php
View file @
0986f55
...
...
@@ -25,7 +25,7 @@ class ShoppingCartController extends AbstractAction
'shoppingCartPage'
=>
true
,
'shoppingCart'
=>
CartModel
::
getCartData
(
$uid
,
$shoppingKey
)
);
print_r
(
$data
);
// 渲染模板
$this
->
_view
->
display
(
'index'
,
$data
);
}
...
...
Please
register
or
login
to post a comment