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
xiaowei
9 years ago
Commit
c8fd4243a55746c822676d24631c4a767947d8e3
2 parents
cd907d99
ff4dc719
Merge branch 'develop' of
http://git.dev.yoho.cn/web/yohobuy
into develop
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
326 additions
and
86 deletions
framework
library/Plugin/Helpers.php
static/js/product/detail/desc.js
static/js/product/detail/detail.js
static/js/product/detail/like.js
static/js/shopping-cart/chose-panel.js
static/js/shopping-cart/gift-advance.js
static/js/shopping-cart/good.js
static/js/shopping-cart/order-ensure.js
static/js/shopping-cart/order-info.js
static/package.json
static/sass/shopping-cart/_chose-panel.scss
static/sass/shopping-cart/_index.scss
template/m.yohobuy.com/actions/index/shoppingCart/index.phtml
template/m.yohobuy.com/actions/index/shoppingCart/order-ensure.phtml
template/m.yohobuy.com/partials/layout/use.phtml
template/m.yohobuy.com/partials/shopping-cart/cart-content.phtml
template/m.yohobuy.com/partials/shopping-cart/chose-panel.phtml
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
framework
@
e9d066dd
Subproject commit
75bbc3b075de19f239532f60c5995d06c5f814e2
Subproject commit
e9d066dd88a8e7e37103021c427a205a5cfcdcec
...
...
library/Plugin/Helpers.php
View file @
c8fd424
...
...
@@ -190,7 +190,7 @@ class Helpers
*/
public
static
function
transPrice
(
$price
)
{
return
(
!
empty
(
$price
)
&&
!
is_float
(
$price
))
?
$price
.
'.00'
:
$price
;
return
(
!
empty
(
$price
)
&&
!
is_float
(
$price
))
?
$price
.
'.00'
:
number_format
(
$price
,
2
,
'.'
,
''
)
;
}
/**
...
...
static/js/product/detail/desc.js
View file @
c8fd424
...
...
@@ -114,7 +114,7 @@ function search() {
}
function
scrollHandler
()
{
if
(
!
end
||
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
5
0
)
{
if
(
!
end
||
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
20
0
)
{
search
();
}
}
...
...
static/js/product/detail/detail.js
View file @
c8fd424
...
...
@@ -18,11 +18,6 @@ var goodsDiscountEl = document.getElementById('goodsDiscount'),
var
$cart
=
$
(
'.cart-bar'
);
require
(
'./desc'
);
require
(
'./comments-consults'
);
require
(
'../recommend-for-you-product-desc'
);
//add extra marign-bottom for footer to show the yoho copyright
function
showFooter
()
{
var
$cartBar
=
$
(
'.cart-bar'
);
...
...
@@ -74,6 +69,10 @@ if (goodsDiscountHammer && $discountFolder.children().length > 0) {
});
}
require
(
'./desc'
);
require
(
'./comments-consults'
);
require
(
'../recommend-for-you-product-desc'
);
//购物车商品数量
$
.
ajax
({
type
:
'GET'
,
...
...
static/js/product/detail/like.js
View file @
c8fd424
...
...
@@ -73,14 +73,13 @@ if (addToCartHammer) {
addToCartHammer
.
on
(
'tap'
,
function
(
e
)
{
chosePanel
.
show
();
// 统计代码:用于统计用户加入购物车的动作
// if (window._yas) {
// window._yas.sendCustomInfo({
// pd: productId,
// by: 1
// }, false);
// }
//统计代码:用于统计用户加入购物车的动作
if
(
window
.
_yas
)
{
window
.
_yas
.
sendCustomInfo
({
pd
:
productId
,
by
:
1
},
true
);
}
});
}
...
...
static/js/shopping-cart/chose-panel.js
View file @
c8fd424
...
...
@@ -11,7 +11,8 @@ var $ = require('jquery');
// var $page = $('.yoho-page');
var
$num
;
var
$num
,
$chosed
;
// var tpl;
...
...
@@ -64,41 +65,69 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
var
$this
=
$
(
this
),
$that
=
$
(
e
.
target
).
closest
(
'.chose-items'
),
numArray
,
index
;
index
,
i
;
if
(
$this
.
hasClass
(
'chosed'
))
{
$this
.
parent
().
find
(
'.block'
).
removeClass
(
'chosed'
);
$that
.
find
(
'.num .left-num'
).
html
(
''
);
}
else
if
(
$this
.
hasClass
(
'disable'
))
{
$this
.
css
(
'background-color'
,
'#000'
);
return
;
}
else
if
(
!
$this
.
hasClass
(
'chosed'
))
{
$this
.
siblings
(
'.chosed'
).
removeClass
(
'chosed'
);
$this
.
addClass
(
'chosed'
);
index
=
$this
.
index
();
var
$siblingBlock
=
$this
.
closest
(
'.block-list'
).
siblings
(
':first'
),
currentNumArray
=
$this
.
data
(
'numstr'
).
split
(
'/'
);
$this
.
siblings
(
'.chosed'
).
removeClass
(
'chosed'
);
$this
.
toggleClass
(
'chosed'
);
index
=
$this
.
index
();
$chosed
=
$
(
'.block-list>ul>li.chosed'
);
//根据颜色切换图片
if
(
$this
.
closest
(
'.block-list'
).
hasClass
(
'color-list'
))
{
$
(
'.chose-panel .basic-info'
).
find
(
'.thumb'
).
addClass
(
'hide'
).
eq
(
index
).
removeClass
(
'hide'
);
}
//根据颜色切换图片
if
(
$this
.
closest
(
'.block-list'
).
hasClass
(
'color-list'
))
{
$
(
'.chose-panel .basic-info'
).
find
(
'.thumb'
).
addClass
(
'hide'
).
eq
(
index
).
removeClass
(
'hide'
);
}
//剩余的商品数
if
(
$that
.
find
(
'.color-list ul>li'
).
hasClass
(
'chosed'
)
&&
$that
.
find
(
'.size-list ul>li'
).
hasClass
(
'chosed'
))
{
numArray
=
$this
.
closest
(
'.block-list'
).
siblings
(
':first'
).
find
(
'.chosed'
).
data
(
'numstr'
).
split
(
'/'
);
$that
.
find
(
'.num .left-num'
).
html
(
'剩余'
+
numArray
[
index
]
+
'件'
);
}
else
{
$that
.
find
(
'.num .left-num'
).
html
(
''
);
if
(
$chosed
.
length
===
0
)
{
$this
.
closest
(
'ul>li'
).
each
(
function
()
{
$
(
this
).
removeClass
(
'zero-stock'
);
if
(
0
===
$
(
this
).
data
(
'num'
)
-
0
)
{
$
(
this
).
addClass
(
'zero-stock'
);
}
});
$siblingBlock
.
find
(
'ul>li'
).
each
(
function
()
{
$
(
this
).
removeClass
(
'zero-stock'
);
if
(
0
===
$
(
this
).
data
(
'num'
)
-
0
)
{
$
(
this
).
addClass
(
'zero-stock'
);
}
});
}
else
if
(
$chosed
.
length
===
1
&&
$this
.
hasClass
(
'chosed'
))
{
numArray
=
$chosed
.
data
(
'numstr'
).
split
(
'/'
);
$siblingBlock
.
find
(
'.block'
).
removeClass
(
'zero-stock'
);
for
(
i
=
0
;
i
<
numArray
.
length
;
i
++
)
{
if
(
0
===
numArray
[
i
]
-
0
)
{
$siblingBlock
.
find
(
'.block'
).
eq
(
i
).
addClass
(
'zero-stock'
);
}
}
//点击切换
}
else
if
(
$chosed
.
length
===
1
&&
!
$this
.
hasClass
(
'chosed'
))
{
$siblingBlock
.
find
(
'ul>li'
).
each
(
function
()
{
$
(
this
).
removeClass
(
'zero-stock'
);
if
(
0
===
$
(
this
).
data
(
'num'
)
-
0
)
{
$
(
this
).
addClass
(
'zero-stock'
);
}
});
$that
.
find
(
'.num .left-num'
).
html
(
''
);
}
else
if
(
$chosed
.
length
===
2
)
{
$siblingBlock
.
find
(
'.block'
).
removeClass
(
'zero-stock'
);
for
(
i
=
0
;
i
<
currentNumArray
.
length
;
i
++
)
{
if
(
0
===
currentNumArray
[
i
]
-
0
)
{
$siblingBlock
.
find
(
'.block'
).
eq
(
i
).
addClass
(
'zero-stock'
);
}
}
numArray
=
$siblingBlock
.
find
(
'.chosed'
).
data
(
'numstr'
).
split
(
'/'
);
$that
.
find
(
'.num .left-num'
).
html
(
'剩余'
+
numArray
[
index
]
+
'件'
);
}
}).
on
(
'touchstart'
,
'.btn-minus'
,
function
()
{
var
num
=
+
$num
.
val
();
var
num
=
+
$num
.
val
(),
$chosed
=
$
(
'.block-list>ul>li.chosed'
);
//若颜色和尺码没有被同时选中,则不能点击
if
(
$
(
'.block-list>ul>li.chosed'
)
.
length
<
2
)
{
if
(
$
chosed
.
length
<
2
)
{
return
;
}
...
...
static/js/shopping-cart/gift-advance.js
View file @
c8fd424
...
...
@@ -7,23 +7,23 @@
var
$
=
require
(
'jquery'
),
lazyLoad
=
require
(
'yoho.lazyload'
);
var
chosePanel
=
require
(
'./chose-panel'
);
//
var chosePanel = require('./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
//$('.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
...
...
static/js/shopping-cart/good.js
View file @
c8fd424
...
...
@@ -9,7 +9,8 @@ var $ = require('jquery'),
lazyLoad
=
require
(
'yoho.lazyload'
);
var
dialog
=
require
(
'../me/dialog'
),
tip
=
require
(
'../plugin/tip'
);
tip
=
require
(
'../plugin/tip'
),
chosePanel
=
require
(
'./chose-panel'
);
var
$names
;
...
...
@@ -33,6 +34,7 @@ lazyLoad({
try_again_css
:
'order-failure'
});
$names
=
$
(
'.name'
);
if
(
$names
.
length
>
0
)
{
$names
[
0
].
mlellipsis
(
2
);
...
...
@@ -155,4 +157,23 @@ $('.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
();
});
...
...
static/js/shopping-cart/order-ensure.js
View file @
c8fd424
...
...
@@ -81,6 +81,7 @@ function orderCompute() {
sumPrice
:
res
.
order_amount
,
salePrice
:
res
.
discount_amount
,
freight
:
res
.
promotion_formula_list
[
1
].
promotion_amount
,
couponPrice
:
res
.
coupon_amount
,
yohoCoin
:
res
.
use_yoho_coin
,
price
:
res
.
last_order_amount
});
...
...
static/js/shopping-cart/order-info.js
View file @
c8fd424
...
...
@@ -3,6 +3,7 @@
* @author: bikai<kai.bi@yoho.cn>
* @date: 2015/12/14
*/
var
$
=
require
(
'jquery'
);
var
info
=
window
.
cookie
(
'order-info'
);
// info 必须是 JSON 字符串
...
...
@@ -10,10 +11,10 @@ try {
info
=
JSON
.
parse
(
info
);
}
catch
(
e
)
{
info
=
{
deliveryId
:
null
,
deliveryTimeId
:
null
,
paymentTypeId
:
null
,
yohoCoin
:
null
,
deliveryId
:
1
,
deliveryTimeId
:
1
,
paymentTypeId
:
1
,
yohoCoin
:
$
(
'.coin'
).
data
(
'yoho-coin'
)
||
0
,
addressId
:
null
,
couponCode
:
null
,
couponValue
:
null
,
...
...
static/package.json
View file @
c8fd424
...
...
@@ -21,7 +21,7 @@
"yoho.iswiper"
:
"3.0.1"
,
"iscroll"
:
"5.1.2"
,
"import-style"
:
"1.0.0"
,
"yoho.lazyload"
:
"1.1.
3
"
,
"yoho.lazyload"
:
"1.1.
4
"
,
"yoho.handlebars"
:
"3.0.3"
,
"yoho.hammer"
:
"2.0.4"
},
...
...
static/sass/shopping-cart/_chose-panel.scss
View file @
c8fd424
...
...
@@ -105,10 +105,16 @@
color
:
#e10
;
}
&
.
disable
{
&
.
zero-stock
{
color
:
#e0e0e0
;
border-color
:
#e0e0e0
;
}
&
.zero-stock.chosed
{
border-color
:
#e0e0e0
;
background
:
none
;
color
:
#e0e0e0
;
background-color
:
#f0f0f0
;
}
}
.num
{
...
...
static/sass/shopping-cart/_index.scss
View file @
c8fd424
...
...
@@ -177,4 +177,148 @@
font-size
:
28rem
/
$pxConvertRem
;
}
}
.gift-advance-good
{
position
:
relative
;
padding
:
20rem
/
$pxConvertRem
0
;
margin-left
:
34rem
/
$pxConvertRem
;
height
:
160rem
/
$pxConvertRem
;
border-bottom
:
1px
solid
#e0e0e0
;
&
:last-child
{
border-bottom
:
none
;
}
}
.advance-block
.gift-advance-good
:last-child
{
border-bottom
:
none
;
}
.advance-block
:last-child
.gift-advance-good
:last-child
{
border-bottom
:
1px
solid
#e0e0e0
;
}
.thumb-wrap
{
position
:
relative
;
float
:
left
;
width
:
120rem
/
$pxConvertRem
;
height
:
160rem
/
$pxConvertRem
;
.thumb
{
width
:
100%
;
height
:
100%
;
}
}
.tag
{
position
:
absolute
;
bottom
:
0
;
left
:
0
;
right
:
0
;
height
:
25rem
/
$pxConvertRem
;
color
:
#fff
;
text-align
:
center
;
background
:
#a1ce4e
;
&
:before
{
content
:
'赠品'
;
}
}
.deps
{
margin-left
:
135rem
/
$pxConvertRem
;
}
.name
{
font-size
:
28rem
/
$pxConvertRem
;
}
.row
:nth-child
(
2
)
{
font-size
:
22rem
/
$pxConvertRem
;
height
:
45rem
/
$pxConvertRem
;
line-height
:
45rem
/
$pxConvertRem
;
>
span
{
margin-right
:
15rem
/
$pxConvertRem
;
}
}
.row
:nth-child
(
3
)
{
position
:
relative
;
}
.color
,
.size
{
color
:
#b6b6b6
;
}
.price
{
font-size
:
24rem
/
$pxConvertRem
;
color
:
#000
;
}
.count
{
font-size
:
20rem
/
$pxConvertRem
;
color
:
#999
;
margin-left
:
22rem
/
$pxConvertRem
;
}
.chose
{
position
:
absolute
;
width
:
88rem
/
$pxConvertRem
;
height
:
58rem
/
$pxConvertRem
;
background
:
#f8f8f8
;
border
:
1px
solid
#ccc
;
right
:
20rem
/
$pxConvertRem
;
top
:
71rem
/
$pxConvertRem
;
font-size
:
26rem
/
$pxConvertRem
;
}
.title
{
height
:
50rem
/
$pxConvertRem
;
line-height
:
50rem
/
$pxConvertRem
;
padding-left
:
20rem
/
$pxConvertRem
;
font-size
:
24rem
/
$pxConvertRem
;
background
:
#f8f8f8
;
}
.advance-block
.tag
{
background
:
#eb76aa
;
&
:before
{
content
:
'加价购'
;
}
}
}
.shopping-cart-zero
{
.cart-zero
{
width
:
100%
;
height
:
auto
;
padding-top
:
2rem
;
padding-bottom
:
20%
;
i
{
font-size
:
6em
;
display
:
block
;
margin
:
0
auto
;
text-align
:
center
;
color
:
#505050
;
}
p
{
display
:
block
;
text-align
:
center
;
font-size
:
1
.2em
;
color
:
#505050
;
padding
:
.6rem
0
;
}
a
{
width
:
27%
;
height
:
1
.2rem
;
overflow
:
hidden
;
line-height
:
1
.2rem
;
border
:
1px
solid
#505050
;
border-radius
:
.2rem
;
display
:
block
;
margin
:
0
auto
;
text-align
:
center
;
}
}
}
\ No newline at end of file
...
...
template/m.yohobuy.com/actions/index/shoppingCart/index.phtml
View file @
c8fd424
{
{>
layout/header
}
}
<div
class=
"shopping-cart-page yoho-page"
>
<div
id=
"mainCart"
class=
"shopping-cart-page yoho-page"
>
{
{#
shoppingCart
}
}
{
{#if
cartNav
}
}
<ul
class=
"cart-nav clearfix"
>
...
...
@@ -44,4 +45,29 @@
{
{/
shoppingCart
}
}
</div>
<div
id=
"advanceBuy"
class=
"shopping-cart-page yoho-page hide"
>
{
{#
shoppingCart
}
}
{
{#
commonCart
}
}
{
{#
advanceBuy
}
}
<span>
{
{promotionTitle
}
}
</span>
{
{#
goods
}
}
{
{>
shopping-cart/gift-advance-good
}
}
{
{/
goods
}
}
{
{/
advanceBuy
}
}
{
{/
commonCart
}
}
{
{/
shoppingCart
}
}
</div>
<div
class=
"shopping-cart-zero yoho-page hide"
>
<div
class=
"cart-zero"
>
<i
class=
"iconfont"
>
62
c</i>
<p>您的购物车暂无商品</p>
<a
href=
""
>随便逛逛</a>
</div>
{
{>
product/recommend-for-you
}
}
</div>
{
{>
layout/footer
}
}
\ No newline at end of file
...
...
template/m.yohobuy.com/actions/index/shoppingCart/order-ensure.phtml
View file @
c8fd424
...
...
@@ -41,7 +41,7 @@
<section
class=
"block"
>
<ul
class=
"sale-invoice"
>
{
{#
if
coupon
}
}
{
{#
coupon
}
}
<li
class=
"coupon"
>
<a
href=
"/shoppingCart/selectCoupon"
>
<!--
<a
href=
"{{url}}"
>
-->
...
...
@@ -65,7 +65,7 @@
{
{/if
}
}
</a>
</li>
{
{/
if
}
}
{
{/
coupon
}
}
<li
class=
"coin"
data-yoho-coin=
"{{yohoCoin}}"
>
<span
class=
"title"
>YOHO币</span>
...
...
@@ -112,11 +112,17 @@
</li>
<li>
<span>运费</span>
+
¥
{
{freight
}
}
+
{
{freight
}
}
</li>
{
{#couponPrice
}
}
<li>
<span>优惠券</span>
-
¥
{
{.
}
}
</li>
{
{/couponPrice
}
}
<li>
<span>YOHO币</span>
-
¥
{
{yohoCoin
}
}
-
{
{yohoCoin
}
}
</li>
<li
class=
"cost"
>
应付金额:
<em>¥
{
{price
}
}</em>
...
...
@@ -154,6 +160,12 @@
<span>运费</span>
+
\
{
{freight
}
}
</li>
\
{
{#couponPrice
}
}
<li>
<span>优惠券</span>
-
¥\
{
{.
}
}
</li>
\
{
{/couponPrice
}
}
<li>
<span>YOHO币</span>
-
¥\
{
{yohoCoin
}
}
...
...
template/m.yohobuy.com/partials/layout/use.phtml
View file @
c8fd424
...
...
@@ -206,6 +206,7 @@
{{#if shoppingCartPage}}
<script>
seajs.use('js/shopping-cart/cart');
seajs.use('js/product/recommend-for-you');
</script>
{{/if}}
{{#if giftAdvancePage}}
...
...
template/m.yohobuy.com/partials/shopping-cart/cart-content.phtml
View file @
c8fd424
...
...
@@ -16,16 +16,16 @@
</a>
</li>
{{/ freebie}}
{{# advanceBuy}}
{{#
if
advanceBuy}}
<li class="advance-buy">
<span class="iconfont"></span>
加价购
<a
href={{url}}
>
<a>
<span class="count">{{count}}</span>
<span class="iconfont icon-right-arrow"></span>
</a>
</li>
{{/
advanceBuy
}}
{{/
if
}}
</ul>
{{/if}}
...
...
@@ -54,4 +54,4 @@
<a class="btn-balance">
结算
</a>
</div>
\ No newline at end of file
</div>
...
...
template/m.yohobuy.com/partials/shopping-cart/chose-panel.phtml
View file @
c8fd424
...
...
@@ -25,7 +25,7 @@
<span>颜色</span>
<ul
class=
"clearfix"
data-type=
"color"
>
{
{#
colors
}
}
<li
class=
"block {{#if chosed}}chosed{{/if}} {{#unless colorNum}}
disable{{/unless}}"
data-id=
{
{id
}
}
data-numstr=
"{{sizeNumStr}}"
>
<li
class=
"block {{#if chosed}}chosed{{/if}} {{#unless colorNum}}
zero-stock{{/unless}}"
data-num=
"{{colorNum}}"
data-numstr=
"{{sizeNumStr}}"
>
{
{name
}
}
</li>
{
{/
colors
}
}
...
...
@@ -35,7 +35,7 @@
<span>尺码</span>
<ul
class=
"clearfix"
data-type=
"size"
>
{
{#
sizes
}
}
<li
class=
"block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}
disable{{/unless}}"
data-id=
{
{id
}
}
data-numstr=
"{{colorNumStr}}"
>
<li
class=
"block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}
zero-stock{{/unless}}"
data-id=
{
{id
}
}
data-num=
"{{sizeNum}}"
data-numstr=
"{{colorNumStr}}"
>
{
{name
}
}
</li>
{
{/
sizes
}
}
...
...
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
View file @
c8fd424
...
...
@@ -23,7 +23,7 @@ class CartModel
* @param int $productSku 商品SKU
* @param int $buyNumber 购买数量
* @param int $goodsType 商品类型,0表示普通商品,1表示加价购商品
* @param int
int
$isEdit 是否是编辑商品SKU,0表示不是编辑
* @param int $isEdit 是否是编辑商品SKU,0表示不是编辑
* @param null|int $promotionId 促销id,默认null(加价购有关)
* @param null|int $uid 用户UID,可以不传
* @return array 加入购物车接口返回的数据
...
...
@@ -406,7 +406,7 @@ class CartModel
$oneGoods
[
'name'
]
=
$single
[
'product_name'
];
$oneGoods
[
'color'
]
=
$single
[
'color_name'
];
$oneGoods
[
'size'
]
=
$single
[
'size_name'
];
$oneGoods
[
'price'
]
=
Helpers
::
transPrice
(
$single
[
'
real_price'
]);
// last_price有些带.00,有些不带,real_price都不带.00
$oneGoods
[
'price'
]
=
Helpers
::
transPrice
(
$single
[
'
sales_price'
]);
$oneGoods
[
'count'
]
=
$single
[
'buy_number'
];
$result
[
'goods'
][]
=
$oneGoods
;
...
...
@@ -428,18 +428,20 @@ class CartModel
}
// 有货币
$result
[
'yohoCoin'
]
=
isset
(
$orderCompute
[
'use_yoho_coin'
])
?
isset
(
$orderCompute
[
'use_yoho_coin'
])
:
$payReturn
[
'yoho_coin'
];
$result
[
'yohoCoin'
]
=
(
isset
(
$orderCompute
[
'use_yoho_coin'
])
&&
!
empty
(
$orderCompute
[
'use_yoho_coin'
]))
?
$orderCompute
[
'use_yoho_coin'
]
:
$payReturn
[
'yoho_coin'
];
// 订单数据
if
(
isset
(
$payReturn
[
'shopping_cart_data'
])
&&
!
empty
(
$payReturn
[
'shopping_cart_data'
]))
{
$sumPrice
=
isset
(
$orderCompute
[
'order_amount'
])
?
$orderCompute
[
'order_amount'
]
:
$payReturn
[
'shopping_cart_data'
][
'order_amount'
];
$salePrice
=
isset
(
$orderCompute
[
'discount_amount'
])
?
$orderCompute
[
'discount_amount'
]
:
$payReturn
[
'shopping_cart_data'
][
'discount_amount'
];
$freight
=
isset
(
$orderCompute
[
'promotion_formula_list'
][
'promotion_amount'
])
?
$orderCompute
[
'promotion_formula_list'
][
1
][
'promotion_amount'
]
:
$payReturn
[
'shopping_cart_data'
][
'promotion_formula_list'
][
1
][
'promotion_amount'
];
$couponPrice
=
isset
(
$orderCompute
[
'coupon_amount'
])
?
$orderCompute
[
'coupon_amount'
]
:
false
;
$salePrice
=
isset
(
$orderCompute
[
'discount_amount'
])
?
$orderCompute
[
'discount_amount'
]
:
$payReturn
[
'shopping_cart_data'
][
'promotion_formula_list'
][
3
][
'promotion_amount'
];
$price
=
isset
(
$orderCompute
[
'last_order_amount'
])
?
$orderCompute
[
'last_order_amount'
]
:
$payReturn
[
'shopping_cart_data'
][
'last_order_amount'
];
$freight
=
isset
(
$orderCompute
[
'promotion_formula_list'
][
'promotion_amount'
])
?
$orderCompute
[
'promotion_formula_list'
][
'promotion_amount'
]
:
$payReturn
[
'shopping_cart_data'
][
'promotion_formula_list'
][
1
][
'promotion_amount'
];
$result
[
'sumPrice'
]
=
Helpers
::
transPrice
(
$sumPrice
);
$result
[
'salePrice'
]
=
Helpers
::
transPrice
(
$salePrice
);
$result
[
'price'
]
=
Helpers
::
transPrice
(
$price
);
$result
[
'freight'
]
=
strtr
(
$freight
,
array
(
'¥'
=>
''
,
'¥'
=>
''
))
.
'.00'
;
$result
[
'freight'
]
=
$freight
;
$result
[
'couponPrice'
]
=
$couponPrice
;
}
// 发票有关数据
...
...
@@ -468,7 +470,7 @@ class CartModel
// 优惠券数据
$coupons
=
array
();
!
empty
(
$orderCompute
[
'coupon_amount'
])
&&
$coupons
[
'value'
]
=
$orderInfo
[
'couponValue'
];
$coupons
+=
self
::
getCouponList
(
$uid
,
0
,
1
,
true
);
$coupons
+=
self
::
getCouponList
(
$uid
,
true
);
$result
[
'coupon'
]
=
$coupons
;
}
...
...
@@ -535,7 +537,7 @@ class CartModel
if
(
isset
(
$coupons
[
'data'
]))
{
if
(
$onlyTotal
)
{
$result
[
'count'
]
=
$coupons
[
'data'
][
'total'
]
;
$result
[
'count'
]
=
count
(
$coupons
[
'data'
][
'couponList'
])
;
}
else
{
$couponArr
=
array
();
isset
(
$coupons
[
'data'
][
'couponList'
])
&&
$couponArr
=
$coupons
[
'data'
][
'couponList'
];
...
...
@@ -605,7 +607,6 @@ class CartModel
{
$result
=
array
();
$oneGoods
=
array
();
// 购买的可用商品列表
$validGoods
=
Helpers
::
formatCartGoods
(
$data
[
'goods_list'
]);
!
empty
(
$validGoods
)
&&
$result
[
'goods'
]
=
$validGoods
;
...
...
Please
register
or
login
to post a comment