Authored by uedxwg

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

@@ -81,17 +81,21 @@ class BindData @@ -81,17 +81,21 @@ class BindData
81 * @param string $area 国别码 81 * @param string $area 国别码
82 * @param string $password 密码 82 * @param string $password 密码
83 */ 83 */
84 - public static function bindMobile($openId, $nickname, $sourceType, $mobile, $area, $password = '') 84 + public static function bindMobile($openId, $sourceType, $mobile, $area, $password = '', $nickname = '')
85 { 85 {
86 $param = Yohobuy::param(); 86 $param = Yohobuy::param();
87 87
88 $param['method'] = 'app.passport.bind'; 88 $param['method'] = 'app.passport.bind';
89 $param['mobile'] = $mobile; 89 $param['mobile'] = $mobile;
90 $param['open_id'] = $openId; 90 $param['open_id'] = $openId;
91 - $param['nickname'] = $nickname;  
92 $param['source_type'] = $sourceType; 91 $param['source_type'] = $sourceType;
93 $param['area'] = $area; 92 $param['area'] = $area;
94 - if (!empty($password)) { 93 + if (!empty($nickname))
  94 + {
  95 + $param['nickname'] = $nickname;
  96 + }
  97 + if (!empty($password))
  98 + {
95 $param['password'] = $password; 99 $param['password'] = $password;
96 } 100 }
97 $param['client_secret'] = Sign::getSign($param); 101 $param['client_secret'] = Sign::getSign($param);
@@ -99,7 +103,6 @@ class BindData @@ -99,7 +103,6 @@ class BindData
99 return Yohobuy::get(Yohobuy::API_URL, $param); 103 return Yohobuy::get(Yohobuy::API_URL, $param);
100 } 104 }
101 105
102 -  
103 /** 106 /**
104 * 换绑手机检验 107 * 换绑手机检验
105 * @param string $mobile 手机号 108 * @param string $mobile 手机号
@@ -116,7 +119,6 @@ class BindData @@ -116,7 +119,6 @@ class BindData
116 return Yohobuy::get(Yohobuy::API_URL, $param); 119 return Yohobuy::get(Yohobuy::API_URL, $param);
117 } 120 }
118 121
119 -  
120 /** 122 /**
121 * 换绑手机 123 * 换绑手机
122 * @param string $uid 用户Id 124 * @param string $uid 用户Id
@@ -138,5 +140,4 @@ class BindData @@ -138,5 +140,4 @@ class BindData
138 return Yohobuy::get(Yohobuy::API_URL, $param); 140 return Yohobuy::get(Yohobuy::API_URL, $param);
139 } 141 }
140 142
141 -  
142 } 143 }
@@ -595,9 +595,13 @@ class Helpers @@ -595,9 +595,13 @@ class Helpers
595 $oneGoods['inValid'] = true; 595 $oneGoods['inValid'] = true;
596 } elseif ($value['goods_type'] == 'gift' && !isset($value['isAdvanceBuy'])) { 596 } elseif ($value['goods_type'] == 'gift' && !isset($value['isAdvanceBuy'])) {
597 $oneGoods['isGift'] = true; 597 $oneGoods['isGift'] = true;
  598 + $oneGoods['salesPrice'] = self::transPrice($value['sales_price']);
  599 + $oneGoods['price'] = self::transPrice($value['sale_price']);
598 } elseif ($value['goods_type'] == 'price_gift') { 600 } elseif ($value['goods_type'] == 'price_gift') {
599 $oneGoods['showCheckbox'] = true; 601 $oneGoods['showCheckbox'] = true;
600 $oneGoods['isAdvanceBuy'] = true; 602 $oneGoods['isAdvanceBuy'] = true;
  603 + $oneGoods['salesPrice'] = self::transPrice($value['sales_price']);
  604 + $oneGoods['price'] = self::transPrice($value['sale_price']);
601 } else { 605 } else {
602 $oneGoods['showCheckbox'] = true; 606 $oneGoods['showCheckbox'] = true;
603 } 607 }
@@ -634,6 +638,7 @@ class Helpers @@ -634,6 +638,7 @@ class Helpers
634 $gift['promotionTitle'] = $value['promotion_title']; 638 $gift['promotionTitle'] = $value['promotion_title'];
635 639
636 foreach ($value['goods_list'] as $single) { 640 foreach ($value['goods_list'] as $single) {
  641 + $oneGoods = array();
637 $oneGoods['id'] = $single['product_skn']; 642 $oneGoods['id'] = $single['product_skn'];
638 $oneGoods['name'] = $single['product_name']; 643 $oneGoods['name'] = $single['product_name'];
639 $oneGoods['thumb'] = !empty($single['goods_images']) ? Images::getImageUrl($single['goods_images'], 120, 160) : ''; 644 $oneGoods['thumb'] = !empty($single['goods_images']) ? Images::getImageUrl($single['goods_images'], 120, 160) : '';
@@ -14,6 +14,8 @@ var chosePanel = require('./chose-panel'), @@ -14,6 +14,8 @@ var chosePanel = require('./chose-panel'),
14 var $cartContent = $('.cart-content'); 14 var $cartContent = $('.cart-content');
15 15
16 var navHammer, 16 var navHammer,
  17 + advanceBuyHammer,
  18 + freebieHammer,
17 cartType = $('#cartType').val(); 19 cartType = $('#cartType').val();
18 20
19 var hasChecked = $('.cart-content:not(.hide) .icon-cb-checked').length > 0 ? true : false; //是否有选中商品 21 var hasChecked = $('.cart-content:not(.hide) .icon-cb-checked').length > 0 ? true : false; //是否有选中商品
@@ -56,13 +58,27 @@ if ($('.cart-nav').length > 0) { @@ -56,13 +58,27 @@ if ($('.cart-nav').length > 0) {
56 }, 3000); 58 }, 3000);
57 } 59 }
58 60
59 -$('.advance-buy').on('touchend', function() {  
60 - window.location.href = '/cart/index/advanceBuy?cartType=' + cartType;  
61 -}); 61 +if ($('.advance-buy').length > 0) {
  62 + advanceBuyHammer = new Hammer(document.getElementsByClassName('advance-buy')[0]);
  63 + advanceBuyHammer.on('tap', function(e) {
  64 + window.location.href = '/cart/index/advanceBuy?cartType=' + cartType;
  65 + });
  66 +}
62 67
63 -$('.freebie').on('touchend', function() {  
64 - window.location.href = '/cart/index/gift?cartType=' + cartType;  
65 -}); 68 +if ($('.freebie').length > 0) {
  69 + freebieHammer = new Hammer(document.getElementsByClassName('freebie')[0]);
  70 + freebieHammer.on('tap', function(e) {
  71 + window.location.href = '/cart/index/gift?cartType=' + cartType;
  72 + });
  73 +}
  74 +
  75 +//$('.advance-buy').on('touchend', function() {
  76 +// window.location.href = '/cart/index/advanceBuy?cartType=' + cartType;
  77 +//});
  78 +//
  79 +//$('.freebie').on('touchend', function() {
  80 +// window.location.href = '/cart/index/gift?cartType=' + cartType;
  81 +//});
66 82
67 $('.btn-balance').on('touchend', function() { 83 $('.btn-balance').on('touchend', function() {
68 if ($('.low-stocks').length > 0) { 84 if ($('.low-stocks').length > 0) {
@@ -78,8 +94,6 @@ $('.btn-balance').on('touchend', function() { @@ -78,8 +94,6 @@ $('.btn-balance').on('touchend', function() {
78 }); 94 });
79 95
80 $('.chose').on('touchend', function() { 96 $('.chose').on('touchend', function() {
81 -  
82 - //var id = $(this).closest('.gift-advance-good').data('id');  
83 chosePanel.show(); 97 chosePanel.show();
84 }); 98 });
85 99
@@ -208,11 +208,11 @@ $yohoPage.on('touchstart', '.color-list .block', function() { @@ -208,11 +208,11 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
208 curColorIndex = index; 208 curColorIndex = index;
209 $('#good-num').val(1); 209 $('#good-num').val(1);
210 210
211 - // 设置按钮的样式和文字  
212 - updateConformButtonClassAndText();  
213 -  
214 // 修改颜色时修改商品图片 211 // 修改颜色时修改商品图片
215 changeGoodImgWhenClickColor(); 212 changeGoodImgWhenClickColor();
  213 +
  214 + // 设置按钮的样式和文字
  215 + updateConformButtonClassAndText();
216 }).on('touchstart', '.size-list .block', function() { 216 }).on('touchstart', '.size-list .block', function() {
217 var $this = $(this), 217 var $this = $(this),
218 index, 218 index,
@@ -232,11 +232,12 @@ $yohoPage.on('touchstart', '.color-list .block', function() { @@ -232,11 +232,12 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
232 $allChoseItems.find('.num .left-num').html(''); 232 $allChoseItems.find('.num .left-num').html('');
233 $('#left-num').val(0); 233 $('#left-num').val(0);
234 hasChooseSize = false; 234 hasChooseSize = false;
  235 + curSizeIndex = null;
  236 + $curSizeBlock = null;
235 237
236 // 当前尺码不是选中状态,选中时 238 // 当前尺码不是选中状态,选中时
237 } else { 239 } else {
238 hasChooseSize = true; 240 hasChooseSize = true;
239 -  
240 curGoodNum = $this.data('num'); 241 curGoodNum = $this.data('num');
241 242
242 // 之前选中的尺码去掉勾选样式 243 // 之前选中的尺码去掉勾选样式
@@ -253,18 +254,21 @@ $yohoPage.on('touchstart', '.color-list .block', function() { @@ -253,18 +254,21 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
253 $('#left-num').val(0); 254 $('#left-num').val(0);
254 } 255 }
255 256
  257 + if (curGoodNum === 0 && hasChooseColor) {
  258 + $this.addClass('zero-stock');
  259 + }
  260 + curSizeIndex = index;
  261 + $curSizeBlock = $this;
256 } 262 }
257 263
258 $this.toggleClass('chosed'); 264 $this.toggleClass('chosed');
259 - curSizeIndex = index;  
260 - $curSizeBlock = $this;  
261 $('#good-num').val(1); 265 $('#good-num').val(1);
262 266
263 - // 设置按钮的样式和文字  
264 - updateConformButtonClassAndText();  
265 -  
266 // 重置颜色块的样式 267 // 重置颜色块的样式
267 resetColorZeroStock($siblingBlock); 268 resetColorZeroStock($siblingBlock);
  269 +
  270 + // 设置按钮的样式和文字
  271 + updateConformButtonClassAndText();
268 }); 272 });
269 273
270 $yohoPage.on('touchstart', '.btn-minus', function() { 274 $yohoPage.on('touchstart', '.btn-minus', function() {
@@ -281,7 +285,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() { @@ -281,7 +285,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
281 return; 285 return;
282 } 286 }
283 if (num < 0) { 287 if (num < 0) {
284 - tip.show('您选择的数量不能为~'); 288 + tip.show('您选择的数量不能为负数~');
285 return; 289 return;
286 } 290 }
287 291
@@ -295,7 +299,6 @@ $yohoPage.on('touchstart', '.btn-minus', function() { @@ -295,7 +299,6 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
295 return; 299 return;
296 } 300 }
297 301
298 -  
299 if (num - 0 === leftNum || 0 === leftNum) { 302 if (num - 0 === leftNum || 0 === leftNum) {
300 return; 303 return;
301 } 304 }
@@ -93,7 +93,7 @@ function orderCompute() { @@ -93,7 +93,7 @@ function orderCompute() {
93 }).then(function(res) { 93 }).then(function(res) {
94 var priceHtml; 94 var priceHtml;
95 95
96 - if (!res.length) { 96 + if ($.type(res) !== 'object') {
97 window.location.reload(); 97 window.location.reload();
98 } else { 98 } else {
99 /*if (res.order_amount) { 99 /*if (res.order_amount) {
@@ -70,6 +70,16 @@ $('#coupon-list').on('touchend', '.employ-main', function() { @@ -70,6 +70,16 @@ $('#coupon-list').on('touchend', '.employ-main', function() {
70 70
71 orderInfo('couponCode', $this.data('coupon-code')); 71 orderInfo('couponCode', $this.data('coupon-code'));
72 orderInfo('couponName', $this.data('coupon-name')); 72 orderInfo('couponName', $this.data('coupon-name'));
  73 +}).on('touchstart', '.employ-main', function() {
  74 + var $this = $(this);
  75 +
  76 + $this.siblings().removeClass('focus');
  77 + $this.addClass('focus');
  78 +}).on('touchend touchcancel', '.employ-main', function() {
  79 + var $this = $(this);
  80 +
  81 + $this.siblings().removeClass('focus');
  82 + $this.removeClass('focus');
73 }); 83 });
74 84
75 $('body').on('touchend', '.not-use', function() { 85 $('body').on('touchend', '.not-use', function() {
@@ -42,13 +42,10 @@ optHammer.on('tap', function(e) { @@ -42,13 +42,10 @@ optHammer.on('tap', function(e) {
42 }).then(function(res) { 42 }).then(function(res) {
43 $('#dialog-wrapper').hide(); 43 $('#dialog-wrapper').hide();
44 if (!res) { 44 if (!res) {
45 - tip.show('网络错误');  
46 return; 45 return;
47 } 46 }
48 - if (res.code === 200) {  
49 - tip.show('删除成功');  
50 - } else {  
51 - tip.show(res.message || '网络错误'); 47 + if (res.message) {
  48 + tip.show(res.message);
52 } 49 }
53 window.location.href = '/home/orders'; 50 window.location.href = '/home/orders';
54 }).fail(function() { 51 }).fail(function() {
@@ -74,13 +71,10 @@ optHammer.on('tap', function(e) { @@ -74,13 +71,10 @@ optHammer.on('tap', function(e) {
74 }).then(function(res) { 71 }).then(function(res) {
75 $('#dialog-wrapper').hide(); 72 $('#dialog-wrapper').hide();
76 if (!res) { 73 if (!res) {
77 - tip.show('网络错误');  
78 return; 74 return;
79 } 75 }
80 - if (res.code === 200) {  
81 - tip.show('取消成功');  
82 - } else {  
83 - tip.show(res.message || '网络错误'); 76 + if (res.message) {
  77 + tip.show(res.message);
84 } 78 }
85 window.location.href = '/home/orders'; 79 window.location.href = '/home/orders';
86 }).fail(function() { 80 }).fail(function() {
@@ -105,6 +105,8 @@ @@ -105,6 +105,8 @@
105 right: 20rem / $pxConvertRem; 105 right: 20rem / $pxConvertRem;
106 top: 71rem / $pxConvertRem; 106 top: 71rem / $pxConvertRem;
107 font-size: 26rem / $pxConvertRem; 107 font-size: 26rem / $pxConvertRem;
  108 + line-height: 58rem / $pxConvertRem;
  109 + text-align: center;
108 } 110 }
109 111
110 .title { 112 .title {
@@ -3,6 +3,14 @@ @@ -3,6 +3,14 @@
3 position: relative; 3 position: relative;
4 padding-left: 16rem / $pxConvertRem; 4 padding-left: 16rem / $pxConvertRem;
5 5
  6 + .prevent-img-click {
  7 + width: 20rem / $pxConvertRem;
  8 + height: 200rem / $pxConvertRem;
  9 + position: absolute;
  10 + background-color: transparent;
  11 + z-index: 99;
  12 + }
  13 +
6 .checkbox { 14 .checkbox {
7 position: absolute; 15 position: absolute;
8 top: 50%; 16 top: 50%;
@@ -234,9 +234,9 @@ @@ -234,9 +234,9 @@
234 } 234 }
235 } 235 }
236 236
237 - .price-cal {  
238 - font-family: monospace;  
239 - } 237 + // .price-cal {
  238 + // font-family: monospace;
  239 + // }
240 240
241 .cost { 241 .cost {
242 border-top: 1px solid #f7f7f7; 242 border-top: 1px solid #f7f7f7;
@@ -40,6 +40,9 @@ @@ -40,6 +40,9 @@
40 background-size: 100% 100%; 40 background-size: 100% 100%;
41 color: #fff; 41 color: #fff;
42 position: relative; 42 position: relative;
  43 + &.focus {
  44 + background-image: image-url('me/employ/employ-red.jpg');
  45 + }
43 span{ 46 span{
44 width: 34.482759%; 47 width: 34.482759%;
45 height: 100%; 48 height: 100%;
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 {{else}} 12 {{else}}
13 {{# freebie}} 13 {{# freebie}}
14 <div class="advance-block gift-block" data-promotion-id="{{promotionId}}"> 14 <div class="advance-block gift-block" data-promotion-id="{{promotionId}}">
15 - <p class="title">{{title}}</p> 15 + <p class="title">{{promotionTitle}}</p>
16 {{#goods}} 16 {{#goods}}
17 {{> cart/gift-advance-good}} 17 {{> cart/gift-advance-good}}
18 {{/goods}} 18 {{/goods}}
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 <span class="iconfont">&#xe620;</span> 20 <span class="iconfont">&#xe620;</span>
21 赠品 21 赠品
22 <span class="iconfont icon-right-arrow">&#xe614;</span> 22 <span class="iconfont icon-right-arrow">&#xe614;</span>
23 - <span class="count">{{count}}</span> 23 + <span class="count">{{giftCount}}</span>
24 </a> 24 </a>
25 </li> 25 </li>
26 {{/ freebie}} 26 {{/ freebie}}
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 <span class="price market-price">&yen;{{marketPrice}}</span> 11 <span class="price market-price">&yen;{{marketPrice}}</span>
12 {{/if}} 12 {{/if}}
13 </p> 13 </p>
14 - <button class="chose">选择</button> 14 + <span class="chose">选择</span>
15 </div> 15 </div>
16 16
17 17
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 {{/if}} 8 {{/if}}
9 9
10 <div class="info"> 10 <div class="info">
  11 + <div class="prevent-img-click"></div>
11 <a href="{{link}}"> 12 <a href="{{link}}">
12 <img class="thumb lazy" data-original="{{thumb}}"> 13 <img class="thumb lazy" data-original="{{thumb}}">
13 </a> 14 </a>
@@ -5,11 +5,11 @@ @@ -5,11 +5,11 @@
5 <a class="swiper-slide" href="{{url}}"> 5 <a class="swiper-slide" href="{{url}}">
6 <img class="swiper-lazy img-box" data-src="{{thumb}}"> 6 <img class="swiper-lazy img-box" data-src="{{thumb}}">
7 <div class="price"> 7 <div class="price">
8 - <span class="sale-price {{^price}}no-price{{/price}}">&yen;{{salePrice}}</span>  
9 - {{#price}}<span class="old-price">&yen;{{.}}</span>{{/price}} 8 + <span class="sale-price {{^price}}no-price{{/price}}">¥{{salePrice}}</span>
  9 + {{#price}}<span class="old-price">¥{{.}}</span>{{/price}}
10 </div> 10 </div>
11 <div class="swiper-lazy-preloader"></div> 11 <div class="swiper-lazy-preloader"></div>
12 </a> 12 </a>
13 {{/recommendList}} 13 {{/recommendList}}
14 </div> 14 </div>
15 -</div>  
  15 +</div>
@@ -46,7 +46,7 @@ class CartModel @@ -46,7 +46,7 @@ class CartModel
46 * 46 *
47 * @param integer $uid 用户ID 47 * @param integer $uid 用户ID
48 * @param string $shoppingKey 未登录用户唯一识别码 48 * @param string $shoppingKey 未登录用户唯一识别码
49 - * @param string $cartType 购物车类型 49 + * @param string $cartType 购物车类型,默认是是所有购物车,ordinary为普通购物车,advance为预售购物车
50 * @param bool $onlyGift 只获取赠品的商品数据 50 * @param bool $onlyGift 只获取赠品的商品数据
51 * @param bool $onlyAdvanceBuy 只获取加价购的商品数据 51 * @param bool $onlyAdvanceBuy 只获取加价购的商品数据
52 * @return array|mixed 处理之后的购物车数据 52 * @return array|mixed 处理之后的购物车数据
@@ -73,7 +73,7 @@ class CartModel @@ -73,7 +73,7 @@ class CartModel
73 73
74 $cart = $cartData['data']; 74 $cart = $cartData['data'];
75 75
76 - if ($cartType !== 'all') { // 加价购或者赠品数据 76 + if ($onlyGift || $onlyAdvanceBuy) { // 加价购或者赠品数据
77 $result = self::procCartData($cart['ordinary_cart_data'], $onlyGift, $onlyAdvanceBuy); 77 $result = self::procCartData($cart['ordinary_cart_data'], $onlyGift, $onlyAdvanceBuy);
78 break; 78 break;
79 } 79 }
@@ -99,7 +99,7 @@ class CartModel @@ -99,7 +99,7 @@ class CartModel
99 // 以上两个购物车中都有数据, 默认显示普通购物车 99 // 以上两个购物车中都有数据, 默认显示普通购物车
100 else { 100 else {
101 $result['cartNav'] = true; 101 $result['cartNav'] = true;
102 - $result['cartType'] = 'ordinary'; 102 + $result['cartType'] = $cartType !== 'all' ? $cartType : 'ordinary';
103 } 103 }
104 104
105 /* 普通购物车 */ 105 /* 普通购物车 */
@@ -40,10 +40,11 @@ class IndexController extends AbstractAction @@ -40,10 +40,11 @@ class IndexController extends AbstractAction
40 40
41 $shoppingKey = Helpers::getShoppingKeyByCookie(); 41 $shoppingKey = Helpers::getShoppingKeyByCookie();
42 $uid = $this->getUid(true); 42 $uid = $this->getUid(true);
  43 + $cartType = $this->get('cartType', 'all');
43 44
44 $data = array( 45 $data = array(
45 'shoppingCartPage' => true, 46 'shoppingCartPage' => true,
46 - 'shoppingCart' => CartModel::getCartData($uid, $shoppingKey) 47 + 'shoppingCart' => CartModel::getCartData($uid, $shoppingKey, $cartType)
47 ); 48 );
48 49
49 // 渲染模板 50 // 渲染模板
@@ -225,14 +225,14 @@ class BindController extends AbstractAction @@ -225,14 +225,14 @@ class BindController extends AbstractAction
225 $openId = $this->post('openId'); 225 $openId = $this->post('openId');
226 $areaCode = $this->post('areaCode', '86'); 226 $areaCode = $this->post('areaCode', '86');
227 $sourceType = $this->post('sourceType'); 227 $sourceType = $this->post('sourceType');
228 - $nickname = $this->post('nickname');  
229 - $password = $this->post('password'); 228 +// $nickname = $this->post('nickname');//nickname不同步信息
  229 + $password = !empty($this->post('password'))?$this->post('password'):'';
230 230
231 if (!is_numeric($phoneNum) || !$openId || !$sourceType || !$areaCode) { 231 if (!is_numeric($phoneNum) || !$openId || !$sourceType || !$areaCode) {
232 break; 232 break;
233 } 233 }
234 234
235 - $res = BindData::bindMobile($openId, $nickname, $sourceType, $phoneNum, $areaCode, $password); 235 + $res = BindData::bindMobile($openId,$sourceType, $phoneNum, $areaCode, $password);
236 if (!isset($res['code'])) { 236 if (!isset($res['code'])) {
237 break; 237 break;
238 } 238 }