Authored by uedxwg

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

... ... @@ -81,17 +81,21 @@ class BindData
* @param string $area 国别码
* @param string $password 密码
*/
public static function bindMobile($openId, $nickname, $sourceType, $mobile, $area, $password = '')
public static function bindMobile($openId, $sourceType, $mobile, $area, $password = '', $nickname = '')
{
$param = Yohobuy::param();
$param['method'] = 'app.passport.bind';
$param['mobile'] = $mobile;
$param['open_id'] = $openId;
$param['nickname'] = $nickname;
$param['source_type'] = $sourceType;
$param['area'] = $area;
if (!empty($password)) {
if (!empty($nickname))
{
$param['nickname'] = $nickname;
}
if (!empty($password))
{
$param['password'] = $password;
}
$param['client_secret'] = Sign::getSign($param);
... ... @@ -99,7 +103,6 @@ class BindData
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 换绑手机检验
* @param string $mobile 手机号
... ... @@ -116,7 +119,6 @@ class BindData
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 换绑手机
* @param string $uid 用户Id
... ... @@ -138,5 +140,4 @@ class BindData
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}
... ...
... ... @@ -595,9 +595,13 @@ class Helpers
$oneGoods['inValid'] = true;
} elseif ($value['goods_type'] == 'gift' && !isset($value['isAdvanceBuy'])) {
$oneGoods['isGift'] = true;
$oneGoods['salesPrice'] = self::transPrice($value['sales_price']);
$oneGoods['price'] = self::transPrice($value['sale_price']);
} elseif ($value['goods_type'] == 'price_gift') {
$oneGoods['showCheckbox'] = true;
$oneGoods['isAdvanceBuy'] = true;
$oneGoods['salesPrice'] = self::transPrice($value['sales_price']);
$oneGoods['price'] = self::transPrice($value['sale_price']);
} else {
$oneGoods['showCheckbox'] = true;
}
... ... @@ -634,6 +638,7 @@ class Helpers
$gift['promotionTitle'] = $value['promotion_title'];
foreach ($value['goods_list'] as $single) {
$oneGoods = array();
$oneGoods['id'] = $single['product_skn'];
$oneGoods['name'] = $single['product_name'];
$oneGoods['thumb'] = !empty($single['goods_images']) ? Images::getImageUrl($single['goods_images'], 120, 160) : '';
... ...
... ... @@ -14,6 +14,8 @@ var chosePanel = require('./chose-panel'),
var $cartContent = $('.cart-content');
var navHammer,
advanceBuyHammer,
freebieHammer,
cartType = $('#cartType').val();
var hasChecked = $('.cart-content:not(.hide) .icon-cb-checked').length > 0 ? true : false; //是否有选中商品
... ... @@ -56,13 +58,27 @@ if ($('.cart-nav').length > 0) {
}, 3000);
}
$('.advance-buy').on('touchend', function() {
window.location.href = '/cart/index/advanceBuy?cartType=' + cartType;
});
if ($('.advance-buy').length > 0) {
advanceBuyHammer = new Hammer(document.getElementsByClassName('advance-buy')[0]);
advanceBuyHammer.on('tap', function(e) {
window.location.href = '/cart/index/advanceBuy?cartType=' + cartType;
});
}
$('.freebie').on('touchend', function() {
window.location.href = '/cart/index/gift?cartType=' + cartType;
});
if ($('.freebie').length > 0) {
freebieHammer = new Hammer(document.getElementsByClassName('freebie')[0]);
freebieHammer.on('tap', function(e) {
window.location.href = '/cart/index/gift?cartType=' + cartType;
});
}
//$('.advance-buy').on('touchend', function() {
// window.location.href = '/cart/index/advanceBuy?cartType=' + cartType;
//});
//
//$('.freebie').on('touchend', function() {
// window.location.href = '/cart/index/gift?cartType=' + cartType;
//});
$('.btn-balance').on('touchend', function() {
if ($('.low-stocks').length > 0) {
... ... @@ -78,8 +94,6 @@ $('.btn-balance').on('touchend', function() {
});
$('.chose').on('touchend', function() {
//var id = $(this).closest('.gift-advance-good').data('id');
chosePanel.show();
});
... ...
... ... @@ -208,11 +208,11 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
curColorIndex = index;
$('#good-num').val(1);
// 设置按钮的样式和文字
updateConformButtonClassAndText();
// 修改颜色时修改商品图片
changeGoodImgWhenClickColor();
// 设置按钮的样式和文字
updateConformButtonClassAndText();
}).on('touchstart', '.size-list .block', function() {
var $this = $(this),
index,
... ... @@ -232,11 +232,12 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
$allChoseItems.find('.num .left-num').html('');
$('#left-num').val(0);
hasChooseSize = false;
curSizeIndex = null;
$curSizeBlock = null;
// 当前尺码不是选中状态,选中时
} else {
hasChooseSize = true;
curGoodNum = $this.data('num');
// 之前选中的尺码去掉勾选样式
... ... @@ -253,18 +254,21 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
$('#left-num').val(0);
}
if (curGoodNum === 0 && hasChooseColor) {
$this.addClass('zero-stock');
}
curSizeIndex = index;
$curSizeBlock = $this;
}
$this.toggleClass('chosed');
curSizeIndex = index;
$curSizeBlock = $this;
$('#good-num').val(1);
// 设置按钮的样式和文字
updateConformButtonClassAndText();
// 重置颜色块的样式
resetColorZeroStock($siblingBlock);
// 设置按钮的样式和文字
updateConformButtonClassAndText();
});
$yohoPage.on('touchstart', '.btn-minus', function() {
... ... @@ -281,7 +285,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
return;
}
if (num < 0) {
tip.show('您选择的数量不能为~');
tip.show('您选择的数量不能为负数~');
return;
}
... ... @@ -295,7 +299,6 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
return;
}
if (num - 0 === leftNum || 0 === leftNum) {
return;
}
... ...
... ... @@ -93,7 +93,7 @@ function orderCompute() {
}).then(function(res) {
var priceHtml;
if (!res.length) {
if ($.type(res) !== 'object') {
window.location.reload();
} else {
/*if (res.order_amount) {
... ...
... ... @@ -70,6 +70,16 @@ $('#coupon-list').on('touchend', '.employ-main', function() {
orderInfo('couponCode', $this.data('coupon-code'));
orderInfo('couponName', $this.data('coupon-name'));
}).on('touchstart', '.employ-main', function() {
var $this = $(this);
$this.siblings().removeClass('focus');
$this.addClass('focus');
}).on('touchend touchcancel', '.employ-main', function() {
var $this = $(this);
$this.siblings().removeClass('focus');
$this.removeClass('focus');
});
$('body').on('touchend', '.not-use', function() {
... ...
... ... @@ -42,13 +42,10 @@ optHammer.on('tap', function(e) {
}).then(function(res) {
$('#dialog-wrapper').hide();
if (!res) {
tip.show('网络错误');
return;
}
if (res.code === 200) {
tip.show('删除成功');
} else {
tip.show(res.message || '网络错误');
if (res.message) {
tip.show(res.message);
}
window.location.href = '/home/orders';
}).fail(function() {
... ... @@ -74,13 +71,10 @@ optHammer.on('tap', function(e) {
}).then(function(res) {
$('#dialog-wrapper').hide();
if (!res) {
tip.show('网络错误');
return;
}
if (res.code === 200) {
tip.show('取消成功');
} else {
tip.show(res.message || '网络错误');
if (res.message) {
tip.show(res.message);
}
window.location.href = '/home/orders';
}).fail(function() {
... ...
... ... @@ -105,6 +105,8 @@
right: 20rem / $pxConvertRem;
top: 71rem / $pxConvertRem;
font-size: 26rem / $pxConvertRem;
line-height: 58rem / $pxConvertRem;
text-align: center;
}
.title {
... ...
... ... @@ -3,6 +3,14 @@
position: relative;
padding-left: 16rem / $pxConvertRem;
.prevent-img-click {
width: 20rem / $pxConvertRem;
height: 200rem / $pxConvertRem;
position: absolute;
background-color: transparent;
z-index: 99;
}
.checkbox {
position: absolute;
top: 50%;
... ...
... ... @@ -234,9 +234,9 @@
}
}
.price-cal {
font-family: monospace;
}
// .price-cal {
// font-family: monospace;
// }
.cost {
border-top: 1px solid #f7f7f7;
... ...
... ... @@ -40,6 +40,9 @@
background-size: 100% 100%;
color: #fff;
position: relative;
&.focus {
background-image: image-url('me/employ/employ-red.jpg');
}
span{
width: 34.482759%;
height: 100%;
... ...
... ... @@ -12,7 +12,7 @@
{{else}}
{{# freebie}}
<div class="advance-block gift-block" data-promotion-id="{{promotionId}}">
<p class="title">{{title}}</p>
<p class="title">{{promotionTitle}}</p>
{{#goods}}
{{> cart/gift-advance-good}}
{{/goods}}
... ...
... ... @@ -20,7 +20,7 @@
<span class="iconfont">&#xe620;</span>
赠品
<span class="iconfont icon-right-arrow">&#xe614;</span>
<span class="count">{{count}}</span>
<span class="count">{{giftCount}}</span>
</a>
</li>
{{/ freebie}}
... ...
... ... @@ -11,7 +11,7 @@
<span class="price market-price">&yen;{{marketPrice}}</span>
{{/if}}
</p>
<button class="chose">选择</button>
<span class="chose">选择</span>
</div>
... ...
... ... @@ -8,6 +8,7 @@
{{/if}}
<div class="info">
<div class="prevent-img-click"></div>
<a href="{{link}}">
<img class="thumb lazy" data-original="{{thumb}}">
</a>
... ...
... ... @@ -5,11 +5,11 @@
<a class="swiper-slide" href="{{url}}">
<img class="swiper-lazy img-box" data-src="{{thumb}}">
<div class="price">
<span class="sale-price {{^price}}no-price{{/price}}">&yen;{{salePrice}}</span>
{{#price}}<span class="old-price">&yen;{{.}}</span>{{/price}}
<span class="sale-price {{^price}}no-price{{/price}}">¥{{salePrice}}</span>
{{#price}}<span class="old-price">¥{{.}}</span>{{/price}}
</div>
<div class="swiper-lazy-preloader"></div>
</a>
{{/recommendList}}
</div>
</div>
\ No newline at end of file
</div>
... ...
... ... @@ -46,7 +46,7 @@ class CartModel
*
* @param integer $uid 用户ID
* @param string $shoppingKey 未登录用户唯一识别码
* @param string $cartType 购物车类型
* @param string $cartType 购物车类型,默认是是所有购物车,ordinary为普通购物车,advance为预售购物车
* @param bool $onlyGift 只获取赠品的商品数据
* @param bool $onlyAdvanceBuy 只获取加价购的商品数据
* @return array|mixed 处理之后的购物车数据
... ... @@ -73,7 +73,7 @@ class CartModel
$cart = $cartData['data'];
if ($cartType !== 'all') { // 加价购或者赠品数据
if ($onlyGift || $onlyAdvanceBuy) { // 加价购或者赠品数据
$result = self::procCartData($cart['ordinary_cart_data'], $onlyGift, $onlyAdvanceBuy);
break;
}
... ... @@ -99,7 +99,7 @@ class CartModel
// 以上两个购物车中都有数据, 默认显示普通购物车
else {
$result['cartNav'] = true;
$result['cartType'] = 'ordinary';
$result['cartType'] = $cartType !== 'all' ? $cartType : 'ordinary';
}
/* 普通购物车 */
... ...
... ... @@ -40,10 +40,11 @@ class IndexController extends AbstractAction
$shoppingKey = Helpers::getShoppingKeyByCookie();
$uid = $this->getUid(true);
$cartType = $this->get('cartType', 'all');
$data = array(
'shoppingCartPage' => true,
'shoppingCart' => CartModel::getCartData($uid, $shoppingKey)
'shoppingCart' => CartModel::getCartData($uid, $shoppingKey, $cartType)
);
// 渲染模板
... ...
... ... @@ -225,14 +225,14 @@ class BindController extends AbstractAction
$openId = $this->post('openId');
$areaCode = $this->post('areaCode', '86');
$sourceType = $this->post('sourceType');
$nickname = $this->post('nickname');
$password = $this->post('password');
// $nickname = $this->post('nickname');//nickname不同步信息
$password = !empty($this->post('password'))?$this->post('password'):'';
if (!is_numeric($phoneNum) || !$openId || !$sourceType || !$areaCode) {
break;
}
$res = BindData::bindMobile($openId, $nickname, $sourceType, $phoneNum, $areaCode, $password);
$res = BindData::bindMobile($openId,$sourceType, $phoneNum, $areaCode, $password);
if (!isset($res['code'])) {
break;
}
... ...