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
Plain Diff
Browse Files
Authored by
Rock Zhang
9 years ago
Commit
e3ee1e6a691ccd00da26983625cd48005afc2610
2 parents
a1d902d4
b6e4da12
Merge branch 'feature/cart' into develop
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
384 additions
and
139 deletions
library/Plugin/Helpers.php
static/js/cart/cart.js
static/js/cart/chose-panel.js
static/js/cart/gift-advance.js
static/js/cart/good.js
static/js/cart/order-ensure.js
static/js/me/order-detail.js
static/sass/cart/_chose-panel.scss
static/sass/cart/_gift-advance-good.scss
static/sass/cart/_index.scss
template/m.yohobuy.com/actions/cart/index/gift-advance.phtml
template/m.yohobuy.com/actions/product/detail/index.phtml
template/m.yohobuy.com/partials/cart/cart-content.phtml
template/m.yohobuy.com/partials/cart/chose-panel.phtml
template/m.yohobuy.com/partials/cart/gift-advance-good.phtml
template/m.yohobuy.com/partials/cart/good.phtml
template/m.yohobuy.com/partials/layout/page_header.phtml
yohobuy/m.yohobuy.com/application/controllers/Home.php
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
library/Plugin/Helpers.php
View file @
e3ee1e6
...
...
@@ -571,9 +571,10 @@ class Helpers
$oneGoods
[
'id'
]
=
$value
[
'product_sku'
];
$oneGoods
[
'skn'
]
=
$value
[
'product_skn'
];
$oneGoods
[
'name'
]
=
$value
[
'product_name'
];
$oneGoods
[
'thumb'
]
=
!
empty
(
$value
[
'goods_images'
])
?
Images
::
getImageUrl
(
$value
[
'goods_images'
],
120
,
12
0
)
:
''
;
$oneGoods
[
'thumb'
]
=
!
empty
(
$value
[
'goods_images'
])
?
Images
::
getImageUrl
(
$value
[
'goods_images'
],
90
,
10
0
)
:
''
;
$oneGoods
[
'color'
]
=
$value
[
'color_name'
];
$oneGoods
[
'size'
]
=
$value
[
'size_name'
];
$oneGoods
[
'isSelected'
]
=
$value
[
'selected'
]
===
'Y'
;
$oneGoods
[
'price'
]
=
self
::
transPrice
(
$value
[
'sales_price'
]);
$oneGoods
[
'count'
]
=
$value
[
'buy_number'
];
$oneGoods
[
'lowStocks'
]
=
(
$value
[
'buy_number'
]
<
$value
[
'storage_number'
]);
...
...
@@ -633,7 +634,7 @@ class Helpers
$arr
[]
=
$gift
;
// 计算加价购商品数目
$count
+=
count
(
$value
[
'goods_list'
])
;
$count
+=
$value
[
'max_select_number'
]
;
}
return
$arr
;
...
...
static/js/cart/cart.js
View file @
e3ee1e6
...
...
@@ -13,7 +13,8 @@ var chosePanel = require('./chose-panel');
var
$cartContent
=
$
(
'.cart-content'
);
var
navHammer
,
cartType
=
'ordinary'
;
cartType
=
'ordinary'
,
cartInfo
;
require
(
'./good'
);
...
...
@@ -71,4 +72,4 @@ $('.chose').on('touchend', function() {
cartInfo
=
0
;
\ No newline at end of file
cartInfo
=
0
;
...
...
static/js/cart/chose-panel.js
View file @
e3ee1e6
...
...
@@ -5,14 +5,33 @@
* @date: 2015/10/21
*/
var
$
=
require
(
'jquery'
);
var
$
=
require
(
'jquery'
),
tip
=
require
(
'../plugin/tip'
),
loading
=
require
(
'../plugin/loading'
);
// Handlebars = require('yoho.handlebars');
// var $page = $('.yoho-page');
var
$num
,
$chosed
;
$chosed
,
re
=
/
\d
+/
,
leftNum
,
$colorList
=
$
(
'.color-list ul>li'
),
$sizeList
=
$
(
'.size-list ul>li'
),
firstColorId
=
$colorList
.
eq
(
0
).
data
(
'id'
),
colorIndex
;
//初始化购物车面板显示
$sizeList
.
each
(
function
()
{
colorIndex
=
$
(
this
).
data
(
'colorid'
);
if
(
colorIndex
===
firstColorId
)
{
$
(
this
).
removeClass
(
'hide'
);
}
});
// confirm;
// var tpl;
...
...
@@ -35,8 +54,11 @@ var $num,
// $num = $('#good-num');
// }
function
show
()
{
$
(
'.chose-panel'
).
show
();
$
(
'body'
).
css
(
'overflow'
,
'hidden'
);
$num
=
$
(
'#good-num'
);
}
...
...
@@ -58,10 +80,46 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
remove
();
}).
on
(
'touchstart'
,
'#chose-btn-sure'
,
function
()
{
//确定
}).
on
(
'touchstart'
,
'.block'
,
function
(
e
)
{
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
),
$that
=
$
(
e
.
target
).
closest
(
'.chose-items'
),
numArray
,
...
...
@@ -69,7 +127,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
i
;
var
$siblingBlock
=
$this
.
closest
(
'.block-list'
).
siblings
(
':first'
),
currentNumArray
=
$this
.
data
(
'numstr
'
).
split
(
'/'
);
currentNumArray
=
(
$this
.
data
(
'numstr'
)
+
'
'
).
split
(
'/'
);
$this
.
siblings
(
'.chosed'
).
removeClass
(
'chosed'
);
$this
.
toggleClass
(
'chosed'
);
...
...
@@ -96,7 +154,20 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
}
});
}
else
if
(
$chosed
.
length
===
1
&&
$this
.
hasClass
(
'chosed'
))
{
numArray
=
$chosed
.
data
(
'numstr'
).
split
(
'/'
);
if
(
$this
.
closest
(
'.block-list'
).
hasClass
(
'color-list'
))
{
$sizeList
.
addClass
(
'hide'
);
//切换尺码信息
$sizeList
.
each
(
function
()
{
colorIndex
=
$
(
this
).
data
(
'colorid'
);
if
(
colorIndex
===
$this
.
data
(
'id'
))
{
$
(
this
).
removeClass
(
'hide'
);
}
});
}
numArray
=
(
$chosed
.
data
(
'numstr'
)
+
''
).
split
(
'/'
);
$siblingBlock
.
find
(
'.block'
).
removeClass
(
'zero-stock'
);
for
(
i
=
0
;
i
<
numArray
.
length
;
i
++
)
{
if
(
0
===
numArray
[
i
]
-
0
)
{
...
...
@@ -104,6 +175,9 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
}
}
}
else
if
(
$chosed
.
length
===
1
&&
!
$this
.
hasClass
(
'chosed'
))
{
$
(
'#chose-btn-sure'
).
css
(
'background-color'
,
'#eb0313'
);
$
(
'#chose-btn-sure'
).
html
(
'确定'
);
$siblingBlock
.
find
(
'ul>li'
).
each
(
function
()
{
$
(
this
).
removeClass
(
'zero-stock'
);
if
(
0
===
$
(
this
).
data
(
'num'
)
-
0
)
{
...
...
@@ -123,19 +197,23 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
if
(
2
===
$chosed
.
closest
(
'.zero-stock'
).
length
)
{
$
(
'#chose-btn-sure'
).
css
(
'background-color'
,
'#c0c0c0'
);
$
(
'#chose-btn-sure'
).
html
(
'已售罄'
);
}
else
{
$
(
'#chose-btn-sure'
).
css
(
'background-color'
,
'#eb0313'
);
$
(
'#chose-btn-sure'
).
html
(
'确定'
);
}
}
}).
on
(
'touchstart'
,
'.btn-minus'
,
function
()
{
var
num
=
+
$num
.
val
(),
$chosed
=
$
(
'.block-list>ul>li.chosed'
);
$chosed
=
$
(
'.block-list>ul>li.chosed'
),
leftNum
=
re
.
exec
(
$
(
'.num .left-num'
).
html
());
//若颜色和尺码没有被同时选中,则不能点击
if
(
$chosed
.
length
<
2
)
{
return
;
}
if
(
num
===
0
)
{
if
(
num
===
1
||
0
===
leftNum
-
0
)
{
return
;
}
...
...
@@ -147,6 +225,10 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
if
(
$
(
'.block-list>ul>li.chosed'
).
length
<
2
)
{
return
;
}
leftNum
=
re
.
exec
(
$
(
'.num .left-num'
).
html
());
if
(
num
-
0
===
leftNum
-
0
||
0
===
leftNum
-
0
)
{
return
;
}
//TODO:库存数验证
$num
.
val
(
num
+
1
);
...
...
static/js/cart/gift-advance.js
View file @
e3ee1e6
...
...
@@ -5,25 +5,56 @@
*/
var
$
=
require
(
'jquery'
),
lazyLoad
=
require
(
'yoho.lazyload'
);
lazyLoad
=
require
(
'yoho.lazyload'
),
Handlebars
=
require
(
'yoho.handlebars'
),
tip
=
require
(
'../plugin/tip'
),
chosePanel
=
require
(
'./chose-panel'
);
//var chosePanel = require('./chose-panel');
var
panelTmpl
,
$page
=
$
(
'.gift-advance-page'
),
$chosePanel
=
$
(
'#chose-panel'
);
lazyLoad
(
$
(
'.lazy'
));
//$('.gift-advance-page').on('touchstart', '.chose', function() {
// var id = $(this).closest('.gift-advance-good').data('id');
//
// $.ajax({
// type: 'GET',
// url: '/shoppingCart/goodinfo',
// data: {
// id: id
// },
// success: function(data) {
// if (data.code === 200) {
// chosePanel.show(data.data);
// }
// }
// });
//});
\ No newline at end of file
$
.
get
(
'/cart/index/giftinfoTpl'
,
function
(
html
)
{
if
(
!
html
)
{
tip
.
show
(
'网络错误'
);
return
;
}
panelTmpl
=
Handlebars
.
compile
(
html
);
}).
fail
(
function
()
{
tip
.
show
(
'网络错误'
);
});
function
getProductInfo
(
skn
,
promotionId
)
{
$
.
get
(
'/cart/index/giftinfo'
,
{
skn
:
skn
,
promotionId
:
promotionId
}).
then
(
function
(
res
)
{
if
(
!
res
)
{
tip
.
show
(
'网络错误'
);
return
;
}
if
(
!
panelTmpl
)
{
return
;
}
if
(
res
.
code
===
200
)
{
$chosePanel
.
html
(
panelTmpl
({
cartInfo
:
res
.
data
}));
chosePanel
.
show
();
}
else
{
tip
.
show
(
res
.
message
||
'网络错误'
);
}
}).
fail
(
function
()
{
tip
.
show
(
'网络错误'
);
});
}
$page
.
on
(
'touchend'
,
'.chose'
,
function
()
{
var
$this
=
$
(
this
),
id
=
$this
.
closest
(
'.gift-advance-good'
).
data
(
'id'
),
promotionId
=
$this
.
closest
(
'.advance-block'
).
data
(
'promotion-id'
);
getProductInfo
(
id
,
promotionId
);
});
...
...
static/js/cart/good.js
View file @
e3ee1e6
...
...
@@ -12,18 +12,10 @@ var $ = require('jquery'),
var
dialog
=
require
(
'../me/dialog'
),
tip
=
require
(
'../plugin/tip'
);
var
$names
,
$selectAllBtn
=
$
(
'.balance .iconfont'
);
var
$names
;
//var $curDelPanel;
////删除面板显示后任何点击行为都将触发隐藏面板
//function docTouchEvt() {
// $curDelPanel && $curDelPanel.addClass('hide');
//
// //
// $(document).off('touchstart', docTouchEvt);
//}
var
requesting
=
false
;
ellipsis
.
init
();
...
...
@@ -55,25 +47,26 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
}
else
{
$this
.
removeClass
(
'icon-checkbox'
).
addClass
(
'icon-cb-checked'
);
}
}
$
.
ajax
({
type
:
'GET'
,
url
:
'/cart/index/getCartData'
,
data
:
{
id
:
id
},
success
:
function
(
data
)
{
if
(
data
)
{
$
(
'#good-totalprice'
).
html
(
'¥'
+
data
.
commonCart
.
price
);
$
(
'#good-activityPrice'
).
html
(
'¥'
+
data
.
commonCart
.
activityPrice
);
$
(
'#good-total'
).
html
(
data
.
commonCart
.
count
+
'件总计:¥'
+
data
.
commonCart
.
sumPrice
);
$
.
ajax
({
type
:
'GET'
,
url
:
'/cart/index/getCartData'
,
data
:
{
skuList
:
JSON
.
stringfy
(
id
)
},
success
:
function
(
data
)
{
if
(
data
)
{
$
(
'#good-totalprice'
).
html
(
'¥'
+
data
.
commonCart
.
price
);
$
(
'#good-activityPrice'
).
html
(
'¥'
+
data
.
commonCart
.
activityPrice
);
$
(
'#good-total'
).
html
(
'总计:¥'
+
data
.
commonCart
.
sumPrice
+
' ('
+
data
.
commonCart
.
count
+
'件)'
);
}
},
error
:
function
()
{
tip
.
show
(
'网络错误'
);
}
},
error
:
function
()
{
tip
.
show
(
'网络错误'
);
}
});
});
}
else
if
(
data
.
code
===
200
)
{
tip
.
show
(
'网络错误'
);
}
}).
fail
(
function
()
{
tip
.
show
(
'网络错误'
);
});
...
...
@@ -167,30 +160,122 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
// });
//})
$
(
'.down'
).
on
(
'touchend'
,
function
()
{
chosePanel
.
show
();
});
$
(
'.cut'
).
on
(
'touchend'
,
function
()
{
var
id
=
$
(
this
).
closest
(
'.shopping-cart-good'
).
data
(
'id'
);
function
requestUpdateAllGoodsCheckStatus
(
theGoods
,
successHandeler
)
{
if
(
requesting
)
{
return
;
}
requesting
=
true
;
$
.
ajax
({
type
:
'GET'
,
url
:
'/cart/index/modify'
,
data
:
{
old_product_sku
:
id
,
new_product_sku
:
id
,
buy_number
:
'0'
,
selected
:
'Y'
},
success
:
function
(
data
)
{
if
(
data
.
code
===
200
)
{
window
.
history
.
go
(
0
);
}
},
error
:
function
()
{
tip
.
show
(
'网络错误'
);
url
:
'select'
,
type
:
'post'
,
data
:
{
skuList
:
JSON
.
stringify
(
theGoods
)
},
success
:
function
(
res
)
{
if
(
res
.
code
===
200
)
{
successHandeler
();
}
else
{
tip
.
show
(
res
.
message
);
}
},
error
:
function
(
err
)
{
tip
.
show
(
'网络异常'
);
},
complete
:
function
()
{
requesting
=
false
;
}
});
}
function
didUpdateAllGoodsCheckStatus
()
{
var
$checkedBoxs
=
$
(
'.shopping-cart-good .icon-cb-checked'
),
$uncheckedBoxs
=
$
(
'.shopping-cart-good .icon-checkbox'
);
var
shouldSelectAll
;
if
(
$selectAllBtn
.
hasClass
(
'icon-cb-checked'
))
{
$selectAllBtn
.
removeClass
(
'icon-cb-checked'
).
addClass
(
'icon-checkbox'
);
shouldSelectAll
=
true
;
}
else
{
$selectAllBtn
.
removeClass
(
'icon-checkbox'
).
addClass
(
'icon-cb-checked'
);
shouldSelectAll
=
false
;
}
if
(
!
shouldSelectAll
)
{
$uncheckedBoxs
.
each
(
function
(
idx
,
uncheckedBox
)
{
$
(
uncheckedBox
).
removeClass
(
'icon-checkbox'
).
addClass
(
'icon-cb-checked'
);
});
}
else
{
$checkedBoxs
.
each
(
function
(
idx
,
checkedBox
)
{
$
(
checkedBox
).
removeClass
(
'icon-cb-checked'
).
addClass
(
'icon-checkbox'
);
});
}
}
function
bottomCheckBoxHandeler
(
isSelected
,
type
,
handlerAfterTouch
)
{
var
goodInfo
=
{};
var
$goods
=
$
(
'.cart-content:not(.hide) .shopping-cart-good'
);
var
$good
=
null
;
var
goodsList
=
[];
function
GoodInfo
(
properties
)
{
this
.
goods_type
=
properties
.
goods_type
;
this
.
buy_number
=
properties
.
buy_number
;
this
.
product_sku
=
properties
.
product_sku
;
this
.
selected
=
properties
.
selected
;
}
goodInfo
.
goods_type
=
type
;
goodInfo
.
selected
=
isSelected
?
'Y'
:
'N'
;
$goods
.
each
(
function
(
idx
,
good
)
{
$good
=
$
(
good
);
goodInfo
.
product_sku
=
$
(
good
).
data
(
'id'
);
goodInfo
.
buy_number
=
$good
.
find
(
'.count'
).
eq
(
0
).
text
().
trim
().
replace
(
'×'
,
''
);
goodsList
.
push
(
new
GoodInfo
(
goodInfo
));
});
console
.
log
(
goodsList
);
requestUpdateAllGoodsCheckStatus
(
goodsList
,
handlerAfterTouch
);
}
//获取当前购物车类型
function
getCartType
()
{
var
$navItem
=
$
(
'.cart-nav '
).
find
(
'li'
),
type
=
'ordinary'
;
if
(
$navItem
.
eq
(
0
).
hasClass
(
'active'
))
{
type
=
'ordinary'
;
}
else
{
type
=
'advance'
;
}
return
type
;
}
//是否要全选
function
willBeSelected
()
{
var
isSelected
=
true
;
var
$this
=
$
(
this
);
if
(
$this
.
hasClass
(
'icon-cb-checked'
))
{
isSelected
=
true
;
}
else
{
isSelected
=
false
;
}
return
isSelected
;
}
//全选按钮点击事件
$selectAllBtn
.
on
(
'touchend'
,
function
()
{
bottomCheckBoxHandeler
(
willBeSelected
(),
getCartType
(),
didUpdateAllGoodsCheckStatus
);
});
$
(
'.down'
).
on
(
'touchend'
,
function
()
{
chosePanel
.
show
();
});
...
...
static/js/cart/order-ensure.js
View file @
e3ee1e6
...
...
@@ -17,7 +17,8 @@ var dispatchModeHammer,
$invoice
=
$
(
'.invoice'
),
$price
=
$
(
'.price-cal'
),
payType
,
priceTmpl
=
Handlebars
.
compile
(
$
(
'#tmpl-price'
).
html
());
priceTmpl
=
Handlebars
.
compile
(
$
(
'#tmpl-price'
).
html
()),
queryString
=
$
.
queryString
();
lazyLoad
();
...
...
@@ -101,7 +102,7 @@ function submitOrder() {
url
:
'/cart/index/orderSub'
,
data
:
{
addressId
:
orderInfo
(
'addressId'
),
cartType
:
orderInfo
(
'cartType'
)
,
cartType
:
queryString
.
cartType
||
queryString
.
carttype
||
'ordinary'
,
deliveryId
:
orderInfo
(
'deliveryId'
),
deliveryTimeId
:
orderInfo
(
'deliveryTimeId'
),
invoiceText
:
$invoice
.
find
(
'[name="invoice-title"]'
).
val
()
||
orderInfo
(
'invoiceText'
),
...
...
@@ -132,7 +133,7 @@ function submitOrder() {
window
.
location
.
href
=
url
;
}
else
{
loading
.
hideLoadingMask
();
tip
.
show
(
res
.
mess
e
ge
||
'网络出错'
);
tip
.
show
(
res
.
mess
a
ge
||
'网络出错'
);
}
}).
fail
(
function
()
{
loading
.
hideLoadingMask
();
...
...
static/js/me/order-detail.js
View file @
e3ee1e6
...
...
@@ -80,7 +80,7 @@ optHammer.on('tap', function(e) {
}
else
{
tip
.
show
(
res
.
message
||
'网络错误'
);
}
window
.
location
.
reload
()
;
window
.
location
.
href
=
'/home/orders'
;
}).
fail
(
function
()
{
tip
.
show
(
'网络错误'
);
});
...
...
static/sass/cart/_chose-panel.scss
View file @
e3ee1e6
...
...
@@ -8,7 +8,8 @@
right
:
0
;
background
:
rgba
(
0
,
0
,
0
,.
3
);
z-index
:
3
;
.main
{
position
:
absolute
;
height
:
pxToRem
(
610px
);
...
...
@@ -85,6 +86,10 @@
top
:
20rem
/
$pxConvertRem
;
}
}
.size-list
li
.hide
{
display
:
none
;
}
.block
{
float
:
left
;
...
...
static/sass/cart/_gift-advance-good.scss
View file @
e3ee1e6
...
...
@@ -40,10 +40,10 @@
height
:
25rem
/
$pxConvertRem
;
color
:
#fff
;
text-align
:
center
;
background
:
#
a1ce4e
;
background
:
#
eb76aa
;
&
:before
{
content
:
'
赠品
'
;
content
:
'
加价购
'
;
display
:
block
;
font-size
:
12px
;
line-height
:
25rem
/
$pxConvertRem
;
...
...
@@ -56,6 +56,7 @@
}
.name
{
margin-bottom
:
20rem
/
$pxConvertRem
;
width
:
440rem
/
$pxConvertRem
;
font-size
:
28rem
/
$pxConvertRem
;
}
...
...
@@ -114,10 +115,10 @@
background
:
#f8f8f8
;
}
.advance-block
.tag
{
background
:
#eb76aa
;
.gift-block
.tag
{
background
:
#a1ce4e
;
&
:before
{
content
:
'
加价购
'
;
content
:
'
赠品
'
;
}
}
}
...
...
static/sass/cart/_index.scss
View file @
e3ee1e6
...
...
@@ -157,6 +157,7 @@
display
:
block
;
height
:
40rem
/
$pxConvertRem
;
line-height
:
40rem
/
$pxConvertRem
;
color
:
#d0253b
;
}
.tip
{
...
...
template/m.yohobuy.com/actions/cart/index/gift-advance.phtml
View file @
e3ee1e6
...
...
@@ -2,7 +2,7 @@
<div
class=
"gift-advance-page yoho-page"
>
{
{#if
advanceBuyPage
}
}
{
{#
advanceBuy
}
}
<div
class=
"advance-block"
>
<div
class=
"advance-block"
data-promotion-id=
"{{promotionId}}"
>
<p
class=
"title"
>
{
{title
}
}</p>
{
{#goods
}
}
{
{>
cart/gift-advance-good
}
}
...
...
@@ -10,11 +10,16 @@
</div>
{
{/
advanceBuy
}
}
{
{else
}
}
{
{#
gift
}
}
{
{>
cart/gift-advance-good
}
}
{
{/
gift
}
}
{
{#
freebie
}
}
<div
class=
"advance-block gift-block"
data-promotion-id=
"{{promotionId}}"
>
<p
class=
"title"
>
{
{title
}
}</p>
{
{#goods
}
}
{
{>
cart/gift-advance-good
}
}
{
{/goods
}
}
</div>
{
{/
freebie
}
}
{
{/if
}
}
<div
id=
"chose-panel"
></div>
</div>
{
{>
layout/footer
}
}
...
...
template/m.yohobuy.com/actions/product/detail/index.phtml
View file @
e3ee1e6
...
...
@@ -114,7 +114,7 @@
<div
id=
"productDesc"
>
</div>
{
{>
product/recommend-for-you
}
}
{
{>
shopping-
cart/chose-panel
}
}
{
{>
cart/chose-panel
}
}
{
{#cartInfo
}
}
<div
class=
"cart-bar"
>
...
...
template/m.yohobuy.com/partials/cart/cart-content.phtml
View file @
e3ee1e6
...
...
@@ -52,7 +52,7 @@
<span class="iconfont icon-cb-checked"></span>
<p>
<span id="good-total">
{{count}}件总计:¥{{sumPrice}}
总计:¥{{sumPrice}} ({{count}}件)
</span>
<span class="tip">(不含运费)</span>
</p>
...
...
template/m.yohobuy.com/partials/cart/chose-panel.phtml
View file @
e3ee1e6
{
{#cartInfo
}
}
<div
class=
"chose-panel"
>
<div
class=
"main"
>
<div
class=
"infos"
>
<div class="basic-info">
<div
class=
"basic-info"
>
{
{#thumbs
}
}
{
{#if
@first
}
}
<img
class=
"thumb"
src=
{
{img
}
}>
...
...
@@ -25,17 +25,18 @@
<span>颜色</span>
<ul
class=
"clearfix"
data-type=
"color"
>
{
{#
colors
}
}
<li class="block {{#if chosed}}chosed{{/if}} {{#unless colorNum}}zero-stock{{/unless}}" data-num="{{colorNum}}" data-numstr="{{sizeNumStr}}" data-skcid="{{skcId}}">
<li
class=
"block {{#if chosed}}chosed{{/if}} {{#unless colorNum}}zero-stock{{/unless}}"
data-num=
"{{colorNum}}"
data-
id=
"{{id}}"
data-
numstr=
"{{sizeNumStr}}"
data-skcid=
"{{skcId}}"
>
{
{name
}
}
</li>
{
{/
colors
}
}
</ul>
</div>
<div
class=
"size-list block-list"
>
<span>尺码</span>
<span>尺码</span>
<ul
class=
"clearfix"
data-type=
"size"
>
{
{#
sizes
}
}
<li class="block
{{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-id={{id}} data-num="{{sizeNum}}" data-numstr="{{colorNumStr}}" data-skuid="{{skuId}}" data-goodid="{{good
Id}}">
<li
class=
"block
hide {{#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=
"{{goods
Id}}"
>
{
{name
}
}
</li>
{
{/
sizes
}
}
...
...
@@ -47,7 +48,7 @@
<a
class=
"btn btn-minus"
href=
"javascript:void(0);"
>
<span
class=
"iconfont"
>
625
;</span>
</a>
<input id="good-num" class="good-num" type="text" value=
{{num}}
>
<input
id=
"good-num"
class=
"good-num"
type=
"text"
value=
"1"
>
<a
class=
"btn btn-plus"
href=
"javascript:void(0);"
>
<span
class=
"iconfont"
>
624
;</span>
</a>
...
...
@@ -57,7 +58,8 @@
</div>
</div>
<div
class=
"btn-wrap"
>
<button id="chose-btn-sure" class="btn btn-sure">
加入购物车
</button>
<button
id=
"chose-btn-sure"
class=
"btn btn-sure"
>
确定
</button>
</div>
</div>
</div>
{
{/cartInfo
}
}
\ No newline at end of file
...
...
template/m.yohobuy.com/partials/cart/gift-advance-good.phtml
View file @
e3ee1e6
...
...
@@ -6,25 +6,14 @@
<div class="deps">
<p class="name row">{{name}}</p>
<p class="row">
{{#if color}}
<span class="color">
颜色:{{color}}
</span>
{{/if}}
{{#if size}}
<span class="size">
尺码:{{size}}
</span>
{{/if}}
</p>
<p class="row">
<span class="price">
¥{{
price
}}
¥{{
#if price}}{{price}}{{else}}{{marketPrice}}{{/if
}}
</span>
{{#if price}}
<span class="price market-price">
¥{{marketPrice}}
</span>
{{/if}}
<span class="count">
×{{count}}
</span>
...
...
template/m.yohobuy.com/partials/cart/good.phtml
View file @
e3ee1e6
...
...
@@ -75,6 +75,7 @@
×{{count}}
</span>
</div>
</div>
<!--<div class="opt-panel hide">
<div class="put-in-favorite">
<span class="iconfont"></span>
...
...
template/m.yohobuy.com/partials/layout/page_header.phtml
View file @
e3ee1e6
...
...
@@ -6,6 +6,9 @@
{
{#navHome
}
}
<a
href=
"{{.}}"
class=
"iconfont nav-home"
>
611
;</a>
{
{/navHome
}
}
{
{#navPhone
}
}
<a
href=
"{{.}}"
class=
"iconfont nav-home"
>
63
e;</a>
{
{/navPhone
}
}
{
{#navTitle
}
}
<p
class=
"nav-title"
>
{
{.
}
}</p>
{
{/navTitle
}
}
...
...
@@ -34,4 +37,4 @@
</li>
</ul>
</div>
{
{/pageHeader
}
}
\ No newline at end of file
{
{/pageHeader
}
}
...
...
yohobuy/m.yohobuy.com/application/controllers/Home.php
View file @
e3ee1e6
...
...
@@ -849,10 +849,11 @@ class HomeController extends AbstractAction
}
$this
->
setTitle
(
'订单详情'
);
$this
->
setNavHeader
(
'订单详情'
);
$this
->
setNavHeader
(
'订单详情'
,
true
,
false
);
$this
->
_view
->
display
(
'order-detail'
,
array
(
'orderDetailPage'
=>
true
,
'navPhone'
=>
'tel:400-889-9646'
,
'orderDetail'
=>
$orderDetail
,
));
}
...
...
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
View file @
e3ee1e6
...
...
@@ -582,15 +582,14 @@ class CartModel
{
$data
=
array
();
// 品牌信息
if
(
isset
(
$productData
[
'brand_info'
])
&&
!
empty
(
$productData
[
'brand_info'
]))
{
$data
[
'thumb'
]
=
Helpers
::
getImageUrl
(
$productData
[
'brand_info'
][
'brand_ico'
],
120
,
120
);
}
$data
[
'name'
]
=
$productData
[
'product_name'
];
$data
[
'price'
]
=
$productData
[
'market_price'
];
$data
[
'salePrice'
]
=
$productData
[
'sales_price'
];
$data
[
'storage'
]
=
$productData
[
'storage_sum'
];
$data
[
'price'
]
=
Helpers
::
transPrice
(
$productData
[
'market_price'
]);
$data
[
'salePrice'
]
=
Helpers
::
transPrice
(
$productData
[
'sales_price'
]);
if
(
isset
(
$productData
[
'storage_sum'
]))
{
$data
[
'storage'
]
=
$productData
[
'storage_sum'
];
}
$data
[
'num'
]
=
1
;
if
(
$num
!==
null
)
{
$data
[
'num'
]
=
$num
;
}
...
...
@@ -603,25 +602,62 @@ class CartModel
$oneColor
=
array
();
$sizes
=
array
();
$oneSize
=
array
();
$thumbImageList
=
array
();
$colorNum
=
0
;
$totalStorageNum
=
0
;
// 总库存数
$colorStorageGroup
=
array
();
// 颜色分组的库存总数集合, 多个之间用/分隔
foreach
(
$goodsList
as
$val
)
{
// 颜色
$oneColor
=
array
();
$oneColor
[
'id'
]
=
$val
[
'color_id'
];
$oneColor
[
'name'
]
=
$val
[
'color_name'
];
$colorNum
=
0
;
$sizeStorageStr
=
''
;
// 尺码
foreach
(
$val
[
'size_list'
]
as
$one
)
{
$oneSize
=
array
();
$oneSize
[
'id'
]
=
$one
[
'size_id'
];
$oneSize
[
'skuId'
]
=
$one
[
'product_sku'
];
$oneSize
[
'goodsId'
]
=
$val
[
'goods_id'
];
$oneSize
[
'colorId'
]
=
$val
[
'color_id'
];
$oneSize
[
'name'
]
=
$one
[
'size_name'
];
$oneSize
[
'sizeNum'
]
=
$one
[
'storage_number'
];
$colorNum
+=
$one
[
'storage_number'
];
$sizeStorageStr
.=
$one
[
'storage_number'
]
.
'/'
;
$sizes
[]
=
$oneSize
;
$colorStorageGroup
[
$one
[
'size_name'
]][
$val
[
'color_name'
]]
=
$one
[
'storage_number'
];
}
// 统计尺码对应的各个颜色的库存量
foreach
(
$sizes
as
&
$sizeArr
)
{
$sizeArr
[
'colorNumStr'
]
=
implode
(
'/'
,
array_values
(
$colorStorageGroup
[
$sizeArr
[
'name'
]
])
);
}
$sizes
[]
=
$oneSize
;
$oneColor
[
'sizes'
]
=
$sizes
;
// 颜色
$oneColor
=
array
();
$oneColor
[
'id'
]
=
$val
[
'color_id'
];
$oneColor
[
'skcId'
]
=
$val
[
'product_skc'
];
$oneColor
[
'name'
]
=
$val
[
'color_name'
];
$oneColor
[
'goodsName'
]
=
$productData
[
'product_name'
];
$oneColor
[
'colorNum'
]
=
$colorNum
;
$oneColor
[
'sizeNumStr'
]
=
rtrim
(
$sizeStorageStr
,
'/'
);
$colors
[]
=
$oneColor
;
// 缩略图
foreach
(
$val
[
'images_list'
]
as
$image
)
{
$thumbImageList
[]
=
array
(
'img'
=>
Helpers
::
getImageUrl
(
$image
[
'image_url'
],
80
,
106
)
);
}
// 商品库存总数
$totalStorageNum
+=
$colorNum
;
}
$data
[
'thumbs'
]
=
$thumbImageList
;
$data
[
'colors'
]
=
$colors
;
$data
[
'sizes'
]
=
$sizes
;
$data
[
'totalNum'
]
=
$totalStorageNum
;
}
return
$data
;
...
...
@@ -665,7 +701,7 @@ class CartModel
// 失效商品列表
$notValidGoods
=
Helpers
::
formatCartGoods
(
$data
[
'sold_out_goods_list'
]);
if
(
!
empty
(
$notValidGoods
))
{
$result
[
'
$
notValidGoods'
]
=
$notValidGoods
;
$result
[
'notValidGoods'
]
=
$notValidGoods
;
}
// 赠品和加价购商品
...
...
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
View file @
e3ee1e6
...
...
@@ -79,7 +79,7 @@ class IndexController extends AbstractAction
$result
=
array
();
if
(
$this
->
isAjax
())
{
$productId
=
$this
->
post
(
'
id
'
,
0
);
$productId
=
$this
->
post
(
'
skuList
'
,
0
);
$uid
=
$this
->
getUid
(
true
);
$shoppingKey
=
Helpers
::
getShoppingKeyByCookie
();
$result
=
CartModel
::
selectGoods
(
$uid
,
$productId
,
$shoppingKey
);
...
...
@@ -208,11 +208,11 @@ class IndexController extends AbstractAction
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
//
if ($this->isAjax()) {
$skn
=
$this
->
get
(
'skn'
,
null
);
$promotionId
=
$this
->
get
(
'promotionId'
,
null
);
$result
=
CartModel
::
giftProductData
(
$skn
,
$promotionId
);
}
//
}
if
(
empty
(
$result
))
{
echo
' '
;
...
...
Please
register
or
login
to post a comment