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
Rock Zhang
9 years ago
Commit
8f78a23b206923dad3f599a4cd4efb7354ca722e
1 parent
27db5a1a
修复限购商品支付的有关问题
Code Review By Rock Zhang
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
23 additions
and
28 deletions
static/js/cart/chose-panel.js
static/js/cart/order-ensure.js
static/js/cart/select-address.js
static/js/product/detail/like.js
template/m.yohobuy.com/actions/cart/index/order-ensure.phtml
template/m.yohobuy.com/actions/product/detail/index.phtml
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
static/js/cart/chose-panel.js
View file @
8f78a23
...
...
@@ -473,7 +473,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
}
else
if
(
limitProductCode
)
{
// 当前面板选择的是限购商品
url
=
'http://m.yohobuy.com/cart/index/orderEnsure
?limitproductcode='
+
limitProductCode
+
'&sku='
+
url
=
$
(
'#limitProductPay'
).
val
()
+
'
?limitproductcode='
+
limitProductCode
+
'&sku='
+
productSku
+
'&skn='
+
skn
+
'&buy_number='
+
buyNumber
;
//打开结算页面,结束函数执行。
...
...
static/js/cart/order-ensure.js
View file @
8f78a23
...
...
@@ -75,6 +75,7 @@ isLimitGood() && (function() {
a
.
push
(
data
);
orderInfo
(
'skuList'
,
JSON
.
stringify
(
a
));
orderInfo
(
'limitUrlSufix'
,
location
.
search
);
})();
if
(
queryString
.
cartType
||
queryString
.
carttype
||
!
orderInfo
(
'cartType'
))
{
...
...
static/js/cart/select-address.js
View file @
8f78a23
...
...
@@ -26,7 +26,7 @@ $('.address-item').on('touchend', function() {
orderInfo
(
'addressId'
,
addressId
);
orderInfo
(
'address'
,
address
);
window
.
location
.
href
=
$this
.
data
(
'href'
);
window
.
location
.
href
=
$this
.
data
(
'href'
)
+
(
orderInfo
(
'limitUrlSufix'
)
||
''
)
;
}).
on
(
'touchend'
,
'.edit'
,
function
()
{
window
.
location
.
href
=
$
(
this
).
data
(
'href'
);
return
false
;
...
...
static/js/product/detail/like.js
View file @
8f78a23
...
...
@@ -68,7 +68,7 @@ $('#likeBtn').on('touchstart', function() {
$
(
'#addtoCart'
).
on
(
'touchstart'
,
function
()
{
$
(
'.cart-bar'
).
hide
();
productCode
||
chosePanel
.
setLimitGoodModeWithSknId
(
productCode
,
skn
);
productCode
&&
chosePanel
.
setLimitGoodModeWithSknId
(
productCode
,
skn
);
chosePanel
.
show
();
//统计代码:用于统计用户加入购物车的动作
...
...
template/m.yohobuy.com/actions/cart/index/order-ensure.phtml
View file @
8f78a23
...
...
@@ -43,7 +43,7 @@
<ul
class=
"sale-invoice"
>
{
{#if
isOrdinaryCart
}
}
<li
class=
"coupon"
>
<a
href=
"
/cart/index/selectCoupon
"
>
<a
href=
"
{{#if isLimit}}javascript:void(0);{{else}}/cart/index/selectCoupon{{/if}}
"
>
<span
class=
"title"
>优惠券</span>
{
{#
coupon
}
}
<!--<span
class=
"coupon-count"
>
...
...
@@ -57,7 +57,7 @@
</span>
{
{^
}
}
<span
class=
"not-used coupon-use"
>
未使用
{
{#if
isLimit
}
}该商品不可使用优惠券
{
{else
}
}未使用
{
{/if
}
}
<i
class=
"iconfont"
>
614
;</i>
</span>
{
{/if
}
}
...
...
template/m.yohobuy.com/actions/product/detail/index.phtml
View file @
8f78a23
...
...
@@ -158,9 +158,10 @@
{
{#if
noLimitCode
}
}
<a
href=
"javascript:;"
class=
"sold-out"
>立即购买</a>
{
{/if
}
}
<input
type=
"hidden"
name=
"limitCodeUrl"
value=
"{{limitCodeUrl}}"
>
<input
type=
"hidden"
id=
"limitCodeUrl"
name=
"limitCodeUrl"
value=
"{{limitCodeUrl}}"
>
<input
type=
"hidden"
id=
"limitProductPay"
name=
"limitProductPay"
value=
"{{limitProductPay}}"
>
{
{#limitProductCode
}
}
<input
type=
"hidden"
name=
"limitProductCode"
value=
"{{.}}"
>
<input
type=
"hidden"
id=
"limitProductCode"
name=
"limitProductCode"
value=
"{{.}}"
>
{
{/limitProductCode
}
}
<a
href=
"javascript:;"
id=
"likeBtn"
class=
"favorite iconfont {{#isCollect}}liked{{/isCollect}}"
>
605
;</a>
...
...
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
View file @
8f78a23
...
...
@@ -336,28 +336,22 @@ class CartModel
'buy_number'
=>
$buyNumber
)
));
$result
[
'isLimit'
]
=
true
;
}
$pay
=
CartData
::
cartPay
(
$uid
,
$cartType
,
0
,
$skuList
);
// 限购商品结算接口返回逻辑判定
if
(
$isLimitGoods
)
{
if
(
!
$pay
)
{
$result
[
'needReload'
]
=
true
;
}
elseif
(
isset
(
$pay
[
'code'
])
&&
$pay
[
'code'
]
!=
200
)
{
$result
[
'error'
]
=
true
;
}
return
$result
;
}
do
{
if
(
!
$pay
||
$pay
[
'code'
]
!=
200
||
empty
(
$pay
[
'data'
][
'goods_list'
]))
{
if
(
$isLimitGoods
)
{
$result
[
'error'
]
=
true
;
}
else
{
$result
[
'cartUrl'
]
=
Helpers
::
url
(
'/cart/index/index'
);
}
// 普通或者预售商品为空返回
if
(
!
$pay
||
empty
(
$pay
[
'data'
][
'goods_list'
]))
{
$result
[
'cartUrl'
]
=
Helpers
::
url
(
'/cart/index/index'
);
return
$result
;
}
break
;
}
if
(
$pay
&&
isset
(
$pay
[
'code'
])
&&
$pay
[
'code'
]
===
200
)
{
$payReturn
=
$pay
[
'data'
];
$address
=
array
();
$orderCompute
=
array
();
...
...
@@ -518,7 +512,8 @@ class CartModel
$coupons
[
'couponName'
]
=
$orderInfo
[
'couponName'
];
}
$result
[
'coupon'
]
=
$coupons
;
}
}
while
(
false
);
return
$result
;
}
...
...
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
View file @
8f78a23
...
...
@@ -327,6 +327,7 @@ class DetailModel
$result
[
'cartInfo'
][
'limitProductCode'
]
=
$baseInfo
[
'limitProductCode'
];
$result
[
'cartInfo'
][
'limitCodeUrl'
]
=
self
::
getLimitCodeUrl
(
$baseInfo
[
'erpProductId'
]);
$result
[
'cartInfo'
][
'limitProductPay'
]
=
Helpers
::
url
(
'/cart/index/orderEnsure'
);
}
else
{
$result
[
'cartInfo'
][
'addToCartUrl'
]
=
Helpers
::
url
(
'/product/buy_'
.
$productId
.
'_'
.
$goodsId
.
'.html'
);
}
...
...
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
View file @
8f78a23
...
...
@@ -306,10 +306,7 @@ class IndexController extends AbstractAction
if
(
isset
(
$order
[
'cartUrl'
]))
{
// 普通或者预售商品为空时
$this
->
go
(
$order
[
'cartUrl'
]);
}
if
(
isset
(
$order
[
'needReload'
]))
{
// 限购商品支付接口返回为空时
$this
->
go
(
Helpers
::
url
(
$this
->
server
(
'REQUEST_URI'
)));
}
if
(
isset
(
$order
[
'error'
]))
{
// 限购商品支付接口返回为错误时
if
(
isset
(
$order
[
'error'
]))
{
// 限购商品支付接口返回为空或错误时
$this
->
error
();
}
...
...
Please
register
or
login
to post a comment