Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
19 changed files
with
128 additions
and
64 deletions
@@ -23,18 +23,17 @@ class Yohobuy | @@ -23,18 +23,17 @@ class Yohobuy | ||
23 | // const SERVICE_URL = 'http://service.api.yohobuy.com/'; | 23 | // const SERVICE_URL = 'http://service.api.yohobuy.com/'; |
24 | // const YOHOBUY_URL = 'http://www.yohobuy.com/'; | 24 | // const YOHOBUY_URL = 'http://www.yohobuy.com/'; |
25 | 25 | ||
26 | -// const API_URL = 'http://apih5.yoho.cn/'; | ||
27 | -// const API_URL2 = 'http://apih5.yoho.cn/'; | ||
28 | -// const SERVICE_URL = 'http://serviceh5.yoho.cn/'; | ||
29 | -// const YOHOBUY_URL = 'http://www.yohobuy.com/'; | ||
30 | -// const API_OLD = 'http://api2.open.yohobuy.com/'; | ||
31 | - | ||
32 | - /* 测试环境 */ | ||
33 | - const API_URL = 'http://testapi.yoho.cn:28078/'; | ||
34 | - const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; | 26 | + const API_URL = 'http://apih5.yoho.cn/'; |
27 | + const API_URL2 = 'http://apih5.yoho.cn/'; | ||
28 | + const SERVICE_URL = 'http://serviceh5.yoho.cn/'; | ||
35 | const YOHOBUY_URL = 'http://www.yohobuy.com/'; | 29 | const YOHOBUY_URL = 'http://www.yohobuy.com/'; |
36 | - const API_OLD = 'http://test2.open.yohobuy.com/'; | 30 | + const API_OLD = 'http://api2.open.yohobuy.com/'; |
37 | 31 | ||
32 | +// /* 测试环境 */ | ||
33 | +// const API_URL = 'http://testapi.yoho.cn:28078/'; | ||
34 | +// const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; | ||
35 | +// const YOHOBUY_URL = 'http://www.yohobuy.com/'; | ||
36 | +// const API_OLD = 'http://test2.open.yohobuy.com/'; | ||
38 | 37 | ||
39 | /** | 38 | /** |
40 | * 私钥列表 | 39 | * 私钥列表 |
@@ -24,15 +24,20 @@ class LoginData | @@ -24,15 +24,20 @@ class LoginData | ||
24 | * @param string $area 地区编号 | 24 | * @param string $area 地区编号 |
25 | * @param string $profile 邮箱或手机号 | 25 | * @param string $profile 邮箱或手机号 |
26 | * @param string $password 密码 | 26 | * @param string $password 密码 |
27 | + * @param string $shoppingKey 未登录用户唯一识别码, 默认为空 | ||
27 | * @return array | 28 | * @return array |
28 | */ | 29 | */ |
29 | - public static function signin($area, $profile, $password) | 30 | + public static function signin($area, $profile, $password, $shoppingKey = null) |
30 | { | 31 | { |
31 | $param = Yohobuy::param(); | 32 | $param = Yohobuy::param(); |
32 | $param['method'] = 'app.passport.signin'; | 33 | $param['method'] = 'app.passport.signin'; |
33 | $param['area'] = $area; | 34 | $param['area'] = $area; |
34 | $param['profile'] = $profile; | 35 | $param['profile'] = $profile; |
35 | $param['password'] = $password; | 36 | $param['password'] = $password; |
37 | + if (!empty($shoppingKey)) { | ||
38 | + $param['shopping_key'] = $shoppingKey; | ||
39 | + } | ||
40 | + | ||
36 | $param['client_secret'] = Sign::getSign($param); | 41 | $param['client_secret'] = Sign::getSign($param); |
37 | 42 | ||
38 | return Yohobuy::post(Yohobuy::API_URL, $param); | 43 | return Yohobuy::post(Yohobuy::API_URL, $param); |
@@ -59,9 +64,10 @@ class LoginData | @@ -59,9 +64,10 @@ class LoginData | ||
59 | * @param string $nickname 姓名 | 64 | * @param string $nickname 姓名 |
60 | * @param string $openId 第三方唯一识别码 | 65 | * @param string $openId 第三方唯一识别码 |
61 | * @param string $sourceType 登录方式 | 66 | * @param string $sourceType 登录方式 |
67 | + * @param string $shoppingKey 未登录用户唯一识别码, 默认为空 | ||
62 | * @return array 登录返回结果 | 68 | * @return array 登录返回结果 |
63 | */ | 69 | */ |
64 | - public static function signinByOpenID($nickname, $openId, $sourceType) | 70 | + public static function signinByOpenID($nickname, $openId, $sourceType, $shoppingKey = null) |
65 | { | 71 | { |
66 | // 构建必传参数 | 72 | // 构建必传参数 |
67 | $param = Yohobuy::param(); | 73 | $param = Yohobuy::param(); |
@@ -71,6 +77,9 @@ class LoginData | @@ -71,6 +77,9 @@ class LoginData | ||
71 | $param['source_type'] = $sourceType; | 77 | $param['source_type'] = $sourceType; |
72 | $param['nickname'] = $nickname; | 78 | $param['nickname'] = $nickname; |
73 | $param['client_secret'] = Sign::getSign($param); | 79 | $param['client_secret'] = Sign::getSign($param); |
80 | + if (!empty($shoppingKey)) { | ||
81 | + $param['shopping_key'] = $shoppingKey; | ||
82 | + } | ||
74 | 83 | ||
75 | return Yohobuy::get(Yohobuy::API_URL, $param); | 84 | return Yohobuy::get(Yohobuy::API_URL, $param); |
76 | } | 85 | } |
@@ -191,7 +191,7 @@ class Helpers | @@ -191,7 +191,7 @@ class Helpers | ||
191 | */ | 191 | */ |
192 | public static function transPrice($price) | 192 | public static function transPrice($price) |
193 | { | 193 | { |
194 | - return (!empty($price) && !is_float($price)) ? $price . '.00' : number_format($price, 2, '.', ''); | 194 | + return number_format($price, 2, '.', ''); |
195 | } | 195 | } |
196 | 196 | ||
197 | /** | 197 | /** |
@@ -5,7 +5,6 @@ | @@ -5,7 +5,6 @@ | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | var $ = require('jquery'), | 7 | var $ = require('jquery'), |
8 | - lazyLoad = require('yoho.lazyload'), | ||
9 | Hammer = require('yoho.hammer'); | 8 | Hammer = require('yoho.hammer'); |
10 | 9 | ||
11 | var chosePanel = require('./chose-panel'), | 10 | var chosePanel = require('./chose-panel'), |
@@ -16,14 +15,21 @@ var $cartContent = $('.cart-content'), | @@ -16,14 +15,21 @@ var $cartContent = $('.cart-content'), | ||
16 | cartType = $('#cartType').val(), | 15 | cartType = $('#cartType').val(), |
17 | hasShowCartPresellTip = false; | 16 | hasShowCartPresellTip = false; |
18 | 17 | ||
18 | +var $cartContentShow = $cartContent.not('.hide'); | ||
19 | + | ||
19 | var navHammer, | 20 | var navHammer, |
20 | advanceBuyHammer, | 21 | advanceBuyHammer, |
21 | - freebieHammer; | 22 | + freebieHammer, |
23 | + switchChose = false; | ||
24 | + | ||
25 | +require('../product/recommend-for-you'); | ||
22 | 26 | ||
23 | -var hasChecked = $('.cart-content:not(.hide) .icon-cb-checked').length > 0 ? true : false; //是否有选中商品 | 27 | +function hasChecked() { |
28 | + return $cartContentShow.find('.icon-cb-checked').length > 0 ? true : false; | ||
29 | +} | ||
24 | 30 | ||
25 | function shouldSelectGift() { | 31 | function shouldSelectGift() { |
26 | - var $freebie = $('.freebie'); | 32 | + var $freebie = $cartContentShow.find('.freebie'); |
27 | 33 | ||
28 | if ($freebie.length <= 0) { | 34 | if ($freebie.length <= 0) { |
29 | return false; | 35 | return false; |
@@ -33,9 +39,15 @@ function shouldSelectGift() { | @@ -33,9 +39,15 @@ function shouldSelectGift() { | ||
33 | } | 39 | } |
34 | 40 | ||
35 | function shouldLowStocks() { | 41 | function shouldLowStocks() { |
36 | - var $lowStocks = $('.low-stocks'), | 42 | + var $lowStocks, |
37 | result = false; | 43 | result = false; |
38 | 44 | ||
45 | + if ('ordinary' === cartType) { | ||
46 | + $lowStocks = $('.common .low-stocks'); | ||
47 | + } else if ('advance' === cartType) { | ||
48 | + $lowStocks = $('.presell .low-stocks'); | ||
49 | + } | ||
50 | + | ||
39 | if ($lowStocks.length <= 0) { | 51 | if ($lowStocks.length <= 0) { |
40 | return result; | 52 | return result; |
41 | } | 53 | } |
@@ -58,7 +70,7 @@ function showChooseGifDialog() { | @@ -58,7 +70,7 @@ function showChooseGifDialog() { | ||
58 | rightBtnText: '去选择' | 70 | rightBtnText: '去选择' |
59 | } | 71 | } |
60 | }, function() { | 72 | }, function() { |
61 | - window.location.href = $('.freebie').find('a').attr('href'); | 73 | + window.location.href = $cartContentShow.find('.freebie > a').attr('href'); |
62 | }, function() { | 74 | }, function() { |
63 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; | 75 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; |
64 | }); | 76 | }); |
@@ -66,7 +78,7 @@ function showChooseGifDialog() { | @@ -66,7 +78,7 @@ function showChooseGifDialog() { | ||
66 | 78 | ||
67 | require('./good'); | 79 | require('./good'); |
68 | 80 | ||
69 | -lazyLoad($('img.lazy')); | 81 | +//lazyLoad($('img.lazy')); |
70 | 82 | ||
71 | if (typeof window.cookie === 'function' && 'y' === window.cookie('_hasShowCartPresellTip')) { | 83 | if (typeof window.cookie === 'function' && 'y' === window.cookie('_hasShowCartPresellTip')) { |
72 | $('#presell-tip').removeClass('show').addClass('hide'); | 84 | $('#presell-tip').removeClass('show').addClass('hide'); |
@@ -77,8 +89,11 @@ if (typeof window.cookie === 'function' && 'y' === window.cookie('_hasShowCartPr | @@ -77,8 +89,11 @@ if (typeof window.cookie === 'function' && 'y' === window.cookie('_hasShowCartPr | ||
77 | 89 | ||
78 | if ('advance' === cartType) { | 90 | if ('advance' === cartType) { |
79 | $cartContent.toggleClass('hide'); | 91 | $cartContent.toggleClass('hide'); |
80 | - $('presell-cart-nav').addClass('active'); | ||
81 | - $('common-cart-nav').removeClass('active'); | 92 | + $('#common-cart-nav').removeClass('active'); |
93 | + $('#presell-cart-nav').addClass('active'); | ||
94 | + $('.shopping-cart-good .name').each(function() { | ||
95 | + this.mlellipsis(2); | ||
96 | + }); | ||
82 | } | 97 | } |
83 | 98 | ||
84 | if ($('.cart-nav').length > 0) { | 99 | if ($('.cart-nav').length > 0) { |
@@ -104,7 +119,14 @@ if ($('.cart-nav').length > 0) { | @@ -104,7 +119,14 @@ if ($('.cart-nav').length > 0) { | ||
104 | //切换普通商品和预售商品购物车显示 | 119 | //切换普通商品和预售商品购物车显示 |
105 | $cartContent.toggleClass('hide'); | 120 | $cartContent.toggleClass('hide'); |
106 | 121 | ||
107 | - hasChecked = $('.cart-content:not(.hide) .icon-cb-checked').length > 0 ? true : false; | 122 | + $cartContentShow = $cartContent.not('.hide'); |
123 | + | ||
124 | + if (switchChose === false) { | ||
125 | + $cartContentShow.find('.shopping-cart-good .name').each(function() { | ||
126 | + this.mlellipsis(2); | ||
127 | + }); | ||
128 | + switchChose = true; | ||
129 | + } | ||
108 | 130 | ||
109 | //trigger lazyload | 131 | //trigger lazyload |
110 | $(window).trigger('scroll'); | 132 | $(window).trigger('scroll'); |
@@ -133,16 +155,17 @@ if ($('.freebie').length > 0) { | @@ -133,16 +155,17 @@ if ($('.freebie').length > 0) { | ||
133 | } | 155 | } |
134 | 156 | ||
135 | $('.btn-balance').on('touchend', function() { | 157 | $('.btn-balance').on('touchend', function() { |
136 | - if (shouldSelectGift()) { | ||
137 | - showChooseGifDialog(); | 158 | + if (shouldLowStocks()) { |
159 | + tip.show('所选商品中含有库存不足的商品'); | ||
138 | return false; | 160 | return false; |
139 | } | 161 | } |
140 | - if (shouldLowStocks()) { | ||
141 | - tip.show('库存不足无法结算'); | 162 | + |
163 | + if (shouldSelectGift()) { | ||
164 | + showChooseGifDialog(); | ||
142 | return false; | 165 | return false; |
143 | } | 166 | } |
144 | 167 | ||
145 | - if (hasChecked) { | 168 | + if (hasChecked()) { |
146 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; | 169 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; |
147 | } else { | 170 | } else { |
148 | tip.show('请先勾选商品'); | 171 | tip.show('请先勾选商品'); |
@@ -153,10 +176,6 @@ $('.chose').on('touchend', function() { | @@ -153,10 +176,6 @@ $('.chose').on('touchend', function() { | ||
153 | chosePanel.show(); | 176 | chosePanel.show(); |
154 | }); | 177 | }); |
155 | 178 | ||
156 | -if ($('.shopping-cart-good').length <= 0) { | ||
157 | - require('../product/recommend-for-you'); | ||
158 | -} | ||
159 | - | ||
160 | function notAllowScroll() { | 179 | function notAllowScroll() { |
161 | var docH = $(document).height(), | 180 | var docH = $(document).height(), |
162 | winH = $(window).height(); | 181 | winH = $(window).height(); |
@@ -22,9 +22,11 @@ lazyLoad({ | @@ -22,9 +22,11 @@ lazyLoad({ | ||
22 | try_again_css: 'good-failure' | 22 | try_again_css: 'good-failure' |
23 | }); | 23 | }); |
24 | 24 | ||
25 | -$('.shopping-cart-good .name').each(function() { | ||
26 | - this.mlellipsis(2); | ||
27 | -}); | 25 | +setTimeout(function() { |
26 | + $('.shopping-cart-good .name').each(function() { | ||
27 | + this.mlellipsis(2); | ||
28 | + }); | ||
29 | +}, 0); | ||
28 | 30 | ||
29 | function GoodInfo(properties) { | 31 | function GoodInfo(properties) { |
30 | this.goods_type = properties.goods_type; | 32 | this.goods_type = properties.goods_type; |
@@ -104,7 +106,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -104,7 +106,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
104 | }); | 106 | }); |
105 | orderInfo('couponCode', null); | 107 | orderInfo('couponCode', null); |
106 | orderInfo('couponName', null); | 108 | orderInfo('couponName', null); |
107 | - history.go(0); | 109 | + window.location.href = '/cart/index/index?cartType=' + $('#cartType').val(); |
108 | } else { | 110 | } else { |
109 | tip.show(data.message); | 111 | tip.show(data.message); |
110 | } | 112 | } |
@@ -164,7 +166,7 @@ function didUpdateAllGoodsCheckStatus() { | @@ -164,7 +166,7 @@ function didUpdateAllGoodsCheckStatus() { | ||
164 | $(checkedBox).removeClass('icon-cb-checked').addClass('icon-checkbox'); | 166 | $(checkedBox).removeClass('icon-cb-checked').addClass('icon-checkbox'); |
165 | }); | 167 | }); |
166 | } | 168 | } |
167 | - window.history.go(0); | 169 | + window.location.href = '/cart/index/index?cartType=' + $('#cartType').val(); |
168 | } | 170 | } |
169 | 171 | ||
170 | function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { | 172 | function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { |
@@ -190,7 +192,22 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { | @@ -190,7 +192,22 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { | ||
190 | 192 | ||
191 | //全选按钮点击事件 | 193 | //全选按钮点击事件 |
192 | $selectAllBtn.on('touchend', function() { | 194 | $selectAllBtn.on('touchend', function() { |
193 | - bottomCheckBoxHandeler($(this).hasClass('icon-cb-checked'), $('#cartType').val(), didUpdateAllGoodsCheckStatus); | 195 | + var cartType = $('#cartType').val(), |
196 | + isSelect = $(this).hasClass('icon-cb-checked'); | ||
197 | + | ||
198 | + if ('ordinary' === cartType) { | ||
199 | + if (!isSelect && $('.common .low-stocks').length > 0) { | ||
200 | + tip.show('所选商品中含有库存不足的商品'); | ||
201 | + return false; | ||
202 | + } | ||
203 | + } else if ('advance' === cartType) { | ||
204 | + if (!isSelect && $('.presell .low-stocks').length > 0) { | ||
205 | + tip.show('所选商品中含有库存不足的商品'); | ||
206 | + return false; | ||
207 | + } | ||
208 | + } | ||
209 | + | ||
210 | + bottomCheckBoxHandeler(isSelect, cartType, didUpdateAllGoodsCheckStatus); | ||
194 | }); | 211 | }); |
195 | 212 | ||
196 | $('.down').on('touchend', function() { | 213 | $('.down').on('touchend', function() { |
@@ -3,7 +3,6 @@ | @@ -3,7 +3,6 @@ | ||
3 | * @author: chenglong<chenglong.wang@yoho.cn> | 3 | * @author: chenglong<chenglong.wang@yoho.cn> |
4 | * @date: 2015/11/12 | 4 | * @date: 2015/11/12 |
5 | */ | 5 | */ |
6 | - | ||
7 | var $ = require('jquery'), | 6 | var $ = require('jquery'), |
8 | Hammer = require('yoho.hammer'), | 7 | Hammer = require('yoho.hammer'), |
9 | Swiper = require('yoho.iswiper'); | 8 | Swiper = require('yoho.iswiper'); |
@@ -41,7 +41,7 @@ optHammer.on('tap', function(e) { | @@ -41,7 +41,7 @@ optHammer.on('tap', function(e) { | ||
41 | } | 41 | } |
42 | }).then(function(res) { | 42 | }).then(function(res) { |
43 | $('#dialog-wrapper').hide(); | 43 | $('#dialog-wrapper').hide(); |
44 | - if (!res) { | 44 | + if ($.type(res) !== 'object') { |
45 | return; | 45 | return; |
46 | } | 46 | } |
47 | if (res.message) { | 47 | if (res.message) { |
@@ -70,7 +70,7 @@ optHammer.on('tap', function(e) { | @@ -70,7 +70,7 @@ optHammer.on('tap', function(e) { | ||
70 | } | 70 | } |
71 | }).then(function(res) { | 71 | }).then(function(res) { |
72 | $('#dialog-wrapper').hide(); | 72 | $('#dialog-wrapper').hide(); |
73 | - if (!res) { | 73 | + if ($.type(res) !== 'object') { |
74 | return; | 74 | return; |
75 | } | 75 | } |
76 | if (res.message) { | 76 | if (res.message) { |
@@ -27,7 +27,7 @@ | @@ -27,7 +27,7 @@ | ||
27 | } | 27 | } |
28 | } | 28 | } |
29 | 29 | ||
30 | - .few-tag{ | 30 | + .few-tag { |
31 | width: 148rem / $pxConvertRem; | 31 | width: 148rem / $pxConvertRem; |
32 | position: absolute; | 32 | position: absolute; |
33 | left: 92rem / $pxConvertRem; | 33 | left: 92rem / $pxConvertRem; |
@@ -90,6 +90,7 @@ | @@ -90,6 +90,7 @@ | ||
90 | width: 80%; | 90 | width: 80%; |
91 | color: #5a5a5a; | 91 | color: #5a5a5a; |
92 | font-size: 0.6rem; | 92 | font-size: 0.6rem; |
93 | + line-height: 0.7rem; | ||
93 | } | 94 | } |
94 | 95 | ||
95 | .color-size-row > span { | 96 | .color-size-row > span { |
@@ -137,6 +137,13 @@ | @@ -137,6 +137,13 @@ | ||
137 | color: #999; | 137 | color: #999; |
138 | } | 138 | } |
139 | } | 139 | } |
140 | + | ||
141 | + .checkbox { | ||
142 | + display: inline-block; | ||
143 | + width: 80rem / $pxConvertRem; | ||
144 | + text-align: center; | ||
145 | + margin-right: -20rem / $pxConvertRem; | ||
146 | + } | ||
140 | 147 | ||
141 | .coin-check { | 148 | .coin-check { |
142 | float: right; | 149 | float: right; |
@@ -9,6 +9,10 @@ $basicBtnC:#eb0313; | @@ -9,6 +9,10 @@ $basicBtnC:#eb0313; | ||
9 | overflow: hidden; | 9 | overflow: hidden; |
10 | background-color: #f0f0f0; | 10 | background-color: #f0f0f0; |
11 | 11 | ||
12 | + .yoho-tip { | ||
13 | + z-index: 4; | ||
14 | + } | ||
15 | + | ||
12 | .page-block { | 16 | .page-block { |
13 | background-color: #fff; | 17 | background-color: #fff; |
14 | box-sizing: border-box; | 18 | box-sizing: border-box; |
@@ -19,13 +19,13 @@ | @@ -19,13 +19,13 @@ | ||
19 | {{^}} | 19 | {{^}} |
20 | {{#if cartNav}} | 20 | {{#if cartNav}} |
21 | <ul class="cart-nav clearfix"> | 21 | <ul class="cart-nav clearfix"> |
22 | - <li class="active"> | ||
23 | - <span id="common-cart-nav"> | 22 | + <li class="active" id="common-cart-nav"> |
23 | + <span > | ||
24 | 普通商品({{commonGoodsCount}}) | 24 | 普通商品({{commonGoodsCount}}) |
25 | </span> | 25 | </span> |
26 | </li> | 26 | </li> |
27 | - <li> | ||
28 | - <span id="presell-cart-nav"> | 27 | + <li id="presell-cart-nav"> |
28 | + <span > | ||
29 | 预售商品({{presellGoodsCount}}) | 29 | 预售商品({{presellGoodsCount}}) |
30 | </span> | 30 | </span> |
31 | <div id="presell-tip" class="presell-tip hide"> | 31 | <div id="presell-tip" class="presell-tip hide"> |
@@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
14 | 14 | ||
15 | {{#if freebieOrAdvanceBuy}} | 15 | {{#if freebieOrAdvanceBuy}} |
16 | <ul class="freebie-and-advance-buy"> | 16 | <ul class="freebie-and-advance-buy"> |
17 | - {{# freebie}} | 17 | + {{#if freebie}} |
18 | <li class="freebie"> | 18 | <li class="freebie"> |
19 | <a href="/cart/index/gift?cartType={{cartType}}"> | 19 | <a href="/cart/index/gift?cartType={{cartType}}"> |
20 | <span class="iconfont"></span> | 20 | <span class="iconfont"></span> |
@@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
23 | <span class="count">{{giftCount}}</span> | 23 | <span class="count">{{giftCount}}</span> |
24 | </a> | 24 | </a> |
25 | </li> | 25 | </li> |
26 | - {{/ freebie}} | 26 | + {{/if}} |
27 | {{#if advanceBuy}} | 27 | {{#if advanceBuy}} |
28 | <li class="advance-buy"> | 28 | <li class="advance-buy"> |
29 | <a href="/cart/index/advanceBuy?cartType={{cartType}}"> | 29 | <a href="/cart/index/advanceBuy?cartType={{cartType}}"> |
@@ -782,7 +782,7 @@ class HomeController extends AbstractAction | @@ -782,7 +782,7 @@ class HomeController extends AbstractAction | ||
782 | $this->auditJumpLogin(); | 782 | $this->auditJumpLogin(); |
783 | 783 | ||
784 | $this->setTitle('支付中心'); | 784 | $this->setTitle('支付中心'); |
785 | - $this->setNavHeader('支付中心', Helpers::url('/cart/index/index')); | 785 | + $this->setNavHeader('支付中心', Helpers::url('/home/orders'), ''); |
786 | 786 | ||
787 | $orderCode = $this->get('order_code'); | 787 | $orderCode = $this->get('order_code'); |
788 | if (empty($orderCode)) { | 788 | if (empty($orderCode)) { |
@@ -313,10 +313,10 @@ class CartModel | @@ -313,10 +313,10 @@ class CartModel | ||
313 | * | 313 | * |
314 | * @param int $uid 用户ID | 314 | * @param int $uid 用户ID |
315 | * @param string $cartType 购物车类型,ordinary表示普通购物车 | 315 | * @param string $cartType 购物车类型,ordinary表示普通购物车 |
316 | - * @param null|string $cookieData cookie中记录的一些订单有关数据 | 316 | + * @param array $orderInfo cookie中记录的一些订单有关数据 |
317 | * @return array 接口返回的数据 | 317 | * @return array 接口返回的数据 |
318 | */ | 318 | */ |
319 | - public static function cartPay($uid, $cartType, $cookieData) | 319 | + public static function cartPay($uid, $cartType, $orderInfo) |
320 | { | 320 | { |
321 | $result = array(); | 321 | $result = array(); |
322 | 322 | ||
@@ -324,13 +324,11 @@ class CartModel | @@ -324,13 +324,11 @@ class CartModel | ||
324 | 324 | ||
325 | if ($pay && isset($pay['code']) && $pay['code'] === 200) { | 325 | if ($pay && isset($pay['code']) && $pay['code'] === 200) { |
326 | $payReturn = $pay['data']; | 326 | $payReturn = $pay['data']; |
327 | - $orderInfo = array(); | ||
328 | $address = array(); | 327 | $address = array(); |
329 | $orderCompute = array(); | 328 | $orderCompute = array(); |
330 | 329 | ||
331 | // cookie保存的数据 | 330 | // cookie保存的数据 |
332 | - if (!empty($cookieData)) { | ||
333 | - $orderInfo = json_decode($cookieData, true); | 331 | + if (!empty($orderInfo)) { |
334 | $orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']); | 332 | $orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']); |
335 | } | 333 | } |
336 | 334 | ||
@@ -408,7 +406,7 @@ class CartModel | @@ -408,7 +406,7 @@ class CartModel | ||
408 | $oneGoods['name'] = $single['product_name']; | 406 | $oneGoods['name'] = $single['product_name']; |
409 | $oneGoods['color'] = $single['color_name']; | 407 | $oneGoods['color'] = $single['color_name']; |
410 | $oneGoods['size'] = $single['size_name']; | 408 | $oneGoods['size'] = $single['size_name']; |
411 | - $oneGoods['price'] = Helpers::transPrice($single['sales_price']); | 409 | + $oneGoods['price'] = Helpers::transPrice($single['last_price']); |
412 | $oneGoods['count'] = $single['buy_number']; | 410 | $oneGoods['count'] = $single['buy_number']; |
413 | 411 | ||
414 | //gift=>是否赠品,advanceBuy=>是否加价购; | 412 | //gift=>是否赠品,advanceBuy=>是否加价购; |
@@ -277,6 +277,12 @@ class IndexController extends AbstractAction | @@ -277,6 +277,12 @@ class IndexController extends AbstractAction | ||
277 | 277 | ||
278 | // 购物车商品为空跳转到购物车页面 | 278 | // 购物车商品为空跳转到购物车页面 |
279 | $cartType = $this->get('cartType', 'ordinary'); | 279 | $cartType = $this->get('cartType', 'ordinary'); |
280 | + $cookieData = $this->getCookie('order-info', null); | ||
281 | + $orderInfo = array(); | ||
282 | + if (!empty($cookieData)) { | ||
283 | + $orderInfo = json_decode($cookieData, true); | ||
284 | + $cartType = $orderInfo['cartType']; | ||
285 | + } | ||
280 | $cartKey = 'commonCart'; | 286 | $cartKey = 'commonCart'; |
281 | if ($cartType === 'advance') { | 287 | if ($cartType === 'advance') { |
282 | $cartKey = 'preSellCart'; | 288 | $cartKey = 'preSellCart'; |
@@ -289,12 +295,10 @@ class IndexController extends AbstractAction | @@ -289,12 +295,10 @@ class IndexController extends AbstractAction | ||
289 | $this->go(Helpers::url('/cart/index/index')); | 295 | $this->go(Helpers::url('/cart/index/index')); |
290 | } | 296 | } |
291 | 297 | ||
292 | - $cookieData = $this->getCookie('order-info', null); | ||
293 | - $uid = $this->getUid(true); | ||
294 | $data = array( | 298 | $data = array( |
295 | 'orderEnsurePage' => true, | 299 | 'orderEnsurePage' => true, |
296 | 'isOrdinaryCart' => ($cartType !== 'advance'), | 300 | 'isOrdinaryCart' => ($cartType !== 'advance'), |
297 | - 'orderEnsure' => CartModel::cartPay($uid, $cartType, $cookieData) | 301 | + 'orderEnsure' => CartModel::cartPay($uid, $cartType, $orderInfo) |
298 | ); | 302 | ); |
299 | 303 | ||
300 | $this->_view->display('order-ensure', $data); | 304 | $this->_view->display('order-ensure', $data); |
@@ -124,7 +124,9 @@ class LoginController extends AbstractAction | @@ -124,7 +124,9 @@ class LoginController extends AbstractAction | ||
124 | } | 124 | } |
125 | 125 | ||
126 | /* 调用登录接口进行登录 */ | 126 | /* 调用登录接口进行登录 */ |
127 | - $data = LoginData::signin($area, $profile, $password); | 127 | + // 获取未登录时的唯一识别码 |
128 | + $shoppingKey = Helpers::getShoppingKeyByCookie(); | ||
129 | + $data = LoginData::signin($area, $profile, $password, $shoppingKey); | ||
128 | if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['uid'])) { | 130 | if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['uid'])) { |
129 | break; | 131 | break; |
130 | } | 132 | } |
@@ -191,7 +193,8 @@ class LoginController extends AbstractAction | @@ -191,7 +193,8 @@ class LoginController extends AbstractAction | ||
191 | 193 | ||
192 | $result = array(); | 194 | $result = array(); |
193 | if (isset($realName, $email, $userId)) { | 195 | if (isset($realName, $email, $userId)) { |
194 | - $result = LoginData::signinByOpenID($realName, $userId, 'alipay'); | 196 | + $shoppingKey = Helpers::getShoppingKeyByCookie(); |
197 | + $result = LoginData::signinByOpenID($realName, $userId, 'alipay', $shoppingKey); | ||
195 | } | 198 | } |
196 | 199 | ||
197 | //判定是否需要绑定手机号 | 200 | //判定是否需要绑定手机号 |
@@ -227,7 +230,8 @@ class LoginController extends AbstractAction | @@ -227,7 +230,8 @@ class LoginController extends AbstractAction | ||
227 | $partnerInfo = $qqconnect->getUserInfo($access); | 230 | $partnerInfo = $qqconnect->getUserInfo($access); |
228 | $result = array(); | 231 | $result = array(); |
229 | if (!empty($partnerInfo) && isset($partnerInfo['nickname'])) { | 232 | if (!empty($partnerInfo) && isset($partnerInfo['nickname'])) { |
230 | - $result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['openid'], 'qq'); | 233 | + $shoppingKey = Helpers::getShoppingKeyByCookie(); |
234 | + $result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['openid'], 'qq', $shoppingKey); | ||
231 | } | 235 | } |
232 | 236 | ||
233 | //判定是否需要绑定手机号 | 237 | //判定是否需要绑定手机号 |
@@ -264,7 +268,8 @@ class LoginController extends AbstractAction | @@ -264,7 +268,8 @@ class LoginController extends AbstractAction | ||
264 | 268 | ||
265 | $result = array(); | 269 | $result = array(); |
266 | if ($partnerInfo && is_array($partnerInfo)) { | 270 | if ($partnerInfo && is_array($partnerInfo)) { |
267 | - $result = LoginData::signinByOpenID($partnerInfo['screen_name'], $access['uid'], 'sina'); | 271 | + $shoppingKey = Helpers::getShoppingKeyByCookie(); |
272 | + $result = LoginData::signinByOpenID($partnerInfo['screen_name'], $access['uid'], 'sina', $shoppingKey); | ||
268 | } | 273 | } |
269 | //判定是否需要绑定手机号 | 274 | //判定是否需要绑定手机号 |
270 | if (isset($result['data']['is_bind']) && $result['data']['is_bind'] == 'N') { | 275 | if (isset($result['data']['is_bind']) && $result['data']['is_bind'] == 'N') { |
-
Please register or login to post a comment