Authored by hf

do merge develop to test cart feature

... ... @@ -576,7 +576,7 @@ class Helpers
$oneGoods['id'] = $value['product_sku'];
$oneGoods['skn'] = $value['product_skn'];
$oneGoods['name'] = $value['product_name'];
$oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 90, 100) : '';
$oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 120, 160) : '';
$oneGoods['color'] = $value['color_name'];
$oneGoods['size'] = $value['size_name'];
$oneGoods['checked'] = $value['selected'] === 'Y';
... ...
... ... @@ -22,9 +22,14 @@ var navHammer,
freebieHammer,
switchChose = false;
require('../product/recommend-for-you');
require('./good');
if ($('.cart-zero').length > 0) {
require('../product/recommend-for-you');
} else {
require('./good');
}
ellipsis.init();
function cartContentShow() {
... ...
... ... @@ -67,11 +67,12 @@ function show(html, cb) {
document.documentElement.scrollLeft || document.body.scrollLeft,
document.documentElement.scrollTop || document.body.scrollTop
],
$html = $('html'); // it would make more sense to apply this to body, but IE7 won't have that
$html = $('html, body'); // it would make more sense to apply this to body, but IE7 won't have that
$html.data('scroll-position', scrollPosition);
$html.data('previous-overflow', $html.css('overflow'));
$html.css('overflow', 'hidden');
$html.css('height', '100%');
window.scrollTo(scrollPosition[0], scrollPosition[1]);
if (html) {
... ... @@ -89,11 +90,12 @@ function show(html, cb) {
//隐藏当前Panel
function hide() {
var $html = $('html'),
var $html = $('html, body'),
scrollPosition = $html.data('scroll-position');
// un-lock scroll position
$html.css('overflow', $html.data('previous-overflow'));
$html.css('height', 'auto');
window.scrollTo(scrollPosition[0], scrollPosition[1]);
$('.chose-panel').hide();
}
... ... @@ -104,7 +106,7 @@ function updateConformButtonClassAndText() {
if (2 === $chosed.closest('.zero-stock').length) {
$('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄');
} else {
$('#chose-btn-sure').css('background-color', '#eb0313').html('确定');
$('#chose-btn-sure').css('background-color', '#eb0313').html('加入购物车');
}
}
... ...
... ... @@ -19,7 +19,7 @@ var $selectAllBtn = $('.balance .checkbox'),
ellipsis.init();
lazyLoad({
try_again_css: 'good-failure'
try_again_css: 'order-failure'
});
setTimeout(function() {
... ... @@ -75,7 +75,9 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
}, function() {
tip.show('网络异常');
});
}).on('touchstart', '.icon-del', function(e) {
});
$('.icon-del').on('touchstart', function(e) {
var $this = $(this);
e.stopPropagation();
... ... @@ -112,6 +114,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
}
}, function() {
tip.show('网络异常');
window.location.reload();
});
});
});
... ...
... ... @@ -11,16 +11,26 @@ var $confim = $('.confim-mask'),
deleteId;
$('.address-item').on('touchend', function() {
orderInfo('addressId', $(this).data('address-id'));
var $this = $(this);
var addressId = $this.data('address-id');
var address = {
address_id: $this.data('address-id'),
consignee: $this.find('.name').text(),
mobile: $this.find('.tel').text(),
address_info: $this.find('.address-info').text()
};
orderInfo('addressId', addressId);
orderInfo('address', address);
}).on('touchend', '.edit', function() {
window.location.href = $(this).data('href');
return false;
}).on('touchend', '.del', function() {
deleteId = $(this).data('address-id');
}).on('touchstart', '.del', function() {
deleteId = $(this).data('id');
});
$confim.on('touchend', '.confim', function() {
if (orderInfo('addressId') === deleteId) {
orderInfo('addressId', null);
orderInfo('address', null);
}
});
... ...
... ... @@ -67,9 +67,26 @@ $newCoupon.on('submit', function() {
$('#coupon-list').on('touchend', '.employ-main', function() {
var $this = $(this);
var couponCode = $this.data('coupon-code');
orderInfo('couponCode', $this.data('coupon-code'));
orderInfo('couponName', $this.data('coupon-name'));
$.ajax({
method: 'POST',
url: '/cart/index/couponSearch',
data: {
couponCode: couponCode
}
}).then(function(res) {
if (res.code === 200) {
//tip.show('优惠券可用');
orderInfo('couponCode', res.data.coupon_code);
orderInfo('couponName', res.data.coupon_title);
window.location.href = '/cart/index/orderEnsure';
} else {
tip.show(res.message || '网络错误');
}
}).fail(function() {
tip.show('网络错误');
});
}).on('touchstart', '.employ-main', function() {
var $this = $(this);
... ...
... ... @@ -179,7 +179,7 @@ function reMarginFooter(fixedElement) {
a.async = 1;
a.src = j;
m.parentNode.insertBefore(a, m);
})(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.13.6.3/yas-debug.js', '_yas');
})(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.13.6.3/yas.js', '_yas');
(function() {
var uid = getUid();
... ...
... ... @@ -17,19 +17,13 @@ var $ = require('jquery'),
trendTopicSwiper,
goodsSwiper;
var requestFrame,
thisFunc,
start = 0,
i,
var start = 0,
swiperClass,
supportCss3,
$logotrans = $('.home-header .logo'),
isen = true;
var navHammer;
require('./maybe-like');
lazyLoad($('img.lazy'));
navHammer = new Hammer($('.nav-btn')[0]);
... ... @@ -39,13 +33,6 @@ navHammer.on('tap', function(event) {
$overlay.show().css('opacity', 0.3);
$sideNav.addClass('on');
//设置boy高宽,页面不能上下滑动
$('body').css({
height: $(window).height(),
width: $(window).width(),
overflow: 'hidden'
});
event.srcEvent.stopPropagation();
return false;
});
... ... @@ -56,10 +43,6 @@ function hideSideBar() {
$('.overlay').hide();
$('.sub-nav').removeClass('show');
$sideNav.removeClass('on');
$('body').css({
height: 'auto',
overflow: 'auto'
});
}
}
... ... @@ -68,6 +51,11 @@ $('.overlay').on('touchstart', function(e) {
return false;
});
//禁止在侧边栏可以上下滚动
$('.side-nav').on('touchmove', function() {
return false;
});
//点击一级导航,弹出二级导航
$sideNav.on('touchstart', 'li', function(e) {
if ($(this).find('.sub-nav').size() > 0) {
... ... @@ -161,28 +149,6 @@ $('.category-swiper').each(function(i, index) {
});
//logo动画
requestFrame = (function() {
var tempFunc = null,
prefixList = ['webkit', 'moz', 'ms'];
for (i = 0; i < prefixList.length; i++) {
thisFunc = prefixList[i] + 'RequestAnimationFrame';
if (window[thisFunc]) {
supportCss3 = true;
tempFunc = thisFunc;
}
}
if (supportCss3) {
return function(callback) {
window[tempFunc](callback);
};
}
return function(callback) {
window.setTimeout(callback, 67);
};
})();
function tsAnimate() {
start = start + 10;
$logotrans.css({
... ... @@ -205,9 +171,7 @@ function tsAnimate() {
if (start % 360 === 0) {
window.setTimeout(tsAnimate, 60 * 1000);
} else {
requestFrame(function() {
tsAnimate();
});
window.requestAnimationFrame(tsAnimate);
}
}
}
... ... @@ -230,3 +194,5 @@ exports.set = function(c) {
domain: '.m.yohobuy.com'
});
};
require('./maybe-like');
\ No newline at end of file
... ...
... ... @@ -71,7 +71,7 @@ function callpay(orderCode) {
} else {
$.ajax({
type: 'GET',
url: '/shopping/pay/wechatwapapi?order_code=' + orderCode,
url: '/home/wechatpay?order_code=' + orderCode,
dataType: 'json',
success: function(res) {
if (res.code === 200) {
... ...
... ... @@ -243,11 +243,11 @@ function search(opt) {
break;
case 'price':
window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid,
'', '.new-goods .good-info .good-detail-img .good-thumb');
'', '.price-goods .good-info .good-detail-img .good-thumb');
break;
case 'discount':
window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid,
'', '.new-goods .good-info .good-detail-img .good-thumb');
'', '.discount-goods .good-info .good-detail-img .good-thumb');
break;
}
}
... ...
... ... @@ -41,6 +41,7 @@
.thumb {
float: left;
width: 100rem / $pxConvertRem;
margin-right: 20rem / $pxConvertRem;
}
.text-info {
... ... @@ -48,7 +49,7 @@
.name {
font-size: 28rem / $pxConvertRem;
height: 74rem / $pxConvertRem;
overflow: hidden;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
... ...
... ... @@ -28,12 +28,16 @@
}
.few-tag {
width: 148rem / $pxConvertRem;
width: 150rem / $pxConvertRem;
position: absolute;
left: 92rem / $pxConvertRem;
text-align: center;
top: 75%;
top: 72%;
color: #fff;
span {
display: inline-block;
@include transform(scale(0.833));
}
}
.gift-tag {
... ... @@ -71,8 +75,7 @@
.thumb {
float: left;
width: 180rem / $pxConvertRem;
height: 200rem / $pxConvertRem;
width: 150rem / $pxConvertRem;
background-size: 100%;
background-repeat: no-repeat;
}
... ... @@ -80,7 +83,7 @@
.deps {
position: relative;
width: 380rem / $pxConvertRem;
margin-left: 4.7rem;
margin-left: 180rem / $pxConvertRem;
border-bottom: 1px solid #e0e0e0;
padding: 0.5rem 0;
}
... ...
... ... @@ -189,7 +189,7 @@
margin: pxToRem(20px) 0;
padding: 0 pxToRem(12px);
width: 100%;
height: pxToRem(60px);
height: pxToRem(72px);
color: #444;
background: #efefef;
font-size: pxToRem(24px);
... ...
... ... @@ -7,7 +7,7 @@
left: 0;
right: 100rem / $pxConvertRem;
width: 540rem / $pxConvertRem;
z-index: 1;
z-index: 4;
overflow: hidden;
@include transition(all .3s);
... ... @@ -188,4 +188,4 @@
display: block;
@include transform(translateX(0));
@include transition(transform 0.3s);
}
\ No newline at end of file
}
... ...
... ... @@ -5,7 +5,7 @@
<p class="infos">
收货地址
<span class="per-info">{{name}} {{phoneNum}}</span>
<span class="address">{{area}} {{address}}</span>
<span class="address">{{addressInfo}}</span>
</p>
<span class="iconfont">&#xe614;</span>
</a>
... ... @@ -46,9 +46,9 @@
<a href="/cart/index/selectCoupon">
<span class="title">优惠券</span>
{{# coupon}}
<span class="coupon-count">
<!--<span class="coupon-count">
{{count}}张可用
</span>
</span>-->
{{#if couponName}}
<span class="used coupon-use" data-name="{{couponName}}">
... ...
... ... @@ -13,7 +13,7 @@
<script id="tmpl-coupon" type="text/tmpl">
\{{#coupons}}
\{{^ notAvailable}}
<a class="employ-main" data-coupon-code="\{{ couponCode}}" data-coupon-name="\{{ couponDetailInfomation}}" href="/cart/index/orderEnsure">
<a class="employ-main" data-coupon-code="\{{ couponCode}}" data-coupon-name="\{{ couponDetailInfomation}}" href="javascript:void(0);">
<span>\{{ couponValue}}</span>
<p class="coupon-name">\{{ couponDetailInfomation}}</p>
<p>有效期:\{{ couponValidity}}</p>
... ...
... ... @@ -56,13 +56,7 @@
{{/if}}
<div class="price-compute">
<p>
<span>总价(¥{{price}})<i>-</i></span>
<span>活动价(¥{{activityPrice}})</span>
</p>
<p>
<span><i>=</i>商品总计金额 (¥{{sumPrice}})</span>
</p>
<p>{{formulaPrice}}</p>
</div>
<div class="balance">
... ...
... ... @@ -63,7 +63,7 @@
</div>
</div>
<div class="btn-wrap">
<button id="chose-btn-sure" class="btn btn-sure">确定</button>
<button id="chose-btn-sure" class="btn btn-sure">加入购物车</button>
</div>
</div>
</div>
... ...
... ... @@ -13,10 +13,10 @@
<img class="thumb lazy" data-original="{{thumb}}">
</a>
{{#if isAdvanceBuy}}
<p class="few-tag plus-tag">加价购</p>
<p class="few-tag plus-tag"><span>加价购</span></p>
{{/if}}
{{#if isGift}}
<p class="few-tag gift-tag">赠品</p>
<p class="few-tag gift-tag"><span>赠品</span></p>
{{/if}}
<div class="deps show">
... ...
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-W958MG" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-W958MG');
var _hmt = _hmt || [];
(function() {
function async_load(){
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-W958MG');
(function() {
var hm = document.createElement("script");
hm.src = "//hm.baidu.com/hm.js?c6ee7218b8321cb65fb2e98f284d8311";
hm.async = 1;
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
(function() {
var hm = document.createElement("script");
hm.src = "//hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841";
hm.async = 1;
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
(function() {
var hm = document.createElement("script");
hm.src = "http://static.yohobuy.com/js/analytics/analysis.js";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
}
window.addEventListener('load', async_load, false);
})();
</script>
<<<<<<< HEAD
<!-- End Google Tag Manager -->
<script type="text/javascript">
var _hmt = _hmt || [];
... ... @@ -35,11 +66,11 @@
if(typeof _goodsData!='undefined')
window._py.push(['pi',_goodsData]);
window._py.push(['e','']);
function(d){
-function(d){
var f = 'https:' == d.location.protocol;var c = d.createElement('script');c.type='text/javascript';c.async=1;
c.src=(f ? 'https' : 'http') + '://'+(f?'fm.ipinyou.com':'fm.p0y.cn')+'/j/t/adv.js';
var h = d.getElementsByTagName("script")[0];h.parentNode.insertBefore(c, h);
}(document);
</script>
<script src="http://static.yohobuy.com/js/analytics/analysis.js" async="async"></script>
<script src="http://static.yohobuy.com/m/v1/js/om_code.js" async="async"></script>
<script src="http://static.yohobuy.com/m/v1/js/om_code.js" async="async"></script>
\ No newline at end of file
... ...
... ... @@ -55,7 +55,7 @@ class HomeController extends AbstractAction
'cartUrl' => Helpers::url('/cart/index/index', null),
'signinUrl' => Helpers::url('/signin.html', array('refer' => Helpers::url('/home'))),
);
$uid = $this->getUid(false);
$uid = $this->getUid(true);
if ($uid) {
$data['isLogin'] = true;
$udid = $this->getUdid();
... ...
... ... @@ -324,6 +324,12 @@ class CartModel
$pay = CartData::cartPay($uid, $cartType);
// 商品为空返回
if (!$pay || (isset($pay['data']['goods_list']) && empty($pay['data']['goods_list']))) {
$result['cartUrl'] = Helpers::url('/cart/index/index');
return $result;
}
if ($pay && isset($pay['code']) && $pay['code'] === 200) {
$payReturn = $pay['data'];
$address = array();
... ... @@ -335,8 +341,8 @@ class CartModel
}
// 根据地址id查询地址信息
if (isset($orderInfo['addressId'])) {
$address = UserModel::getAddressDataById($uid, $orderInfo['addressId']);
if (isset($orderInfo['address'])) {
$address = $orderInfo['address'];
}
// 收货人有关信息
... ... @@ -344,8 +350,8 @@ class CartModel
$result['addressId'] = isset($address['address_id']) ? $address['address_id'] : $payReturn['delivery_address']['address_id'];
$result['name'] = isset($address['consignee']) ? $address['consignee'] : $payReturn['delivery_address']['consignee'];
$result['phoneNum'] = isset($address['mobile']) ? $address['mobile'] : $payReturn['delivery_address']['mobile'];
$result['area'] = isset($address['area']) ? $address['area'] : $payReturn['delivery_address']['area'];
$result['address'] = isset($address['address']) ? $address['address'] : $payReturn['delivery_address']['address'];
// $result['area'] = isset($address['area']) ? $address['area'] : $payReturn['delivery_address']['area'];
$result['addressInfo'] = isset($address['address_info']) ? $address['address_info'] : $payReturn['delivery_address']['area'] . ' ' . $payReturn['delivery_address']['address'];
$isSupport = isset($address['is_support']) ? $address['is_support'] : $payReturn['delivery_address']['is_support'];
$result['isSupport'] = $isSupport === 'Y';
}
... ... @@ -477,9 +483,10 @@ class CartModel
isset($orderInfo['msg']) && $result['msg'] = $orderInfo['msg'];
// 优惠券数据
$coupons = array();
!empty($orderCompute['coupon_amount']) && $coupons['couponName'] = $orderInfo['couponName'];
$coupons += self::getCouponList($uid, true);
$coupons = array('couponName' => '');
if (!empty($orderCompute['coupon_amount'])) {
$coupons['couponName'] = $orderInfo['couponName'];
}
$result['coupon'] = $coupons;
}
... ... @@ -553,11 +560,10 @@ class CartModel
do {
if (isset($coupons['data']['couponList'])) {
foreach ($coupons['data']['couponList'] as $val) {
$notAvailableRes = self::searchCoupon($uid, $val['couponCode']);
// $notAvailableRes = self::searchCoupon($uid, $val['couponCode']);
// 处理可用的优惠券
if ($val['isValidity'] === 'N' || (isset($notAvailableRes['code']) && $notAvailableRes['code'] !== 200)) {
if ($val['isValidity'] === 'N') {
$val['notAvailable'] = true;
// continue;
}
$result[] = $val;
}
... ... @@ -788,8 +794,9 @@ class CartModel
}
// 结算数据
$result['price'] = Helpers::transPrice($data['shopping_cart_data']['order_amount']);
$result['activityPrice'] = Helpers::transPrice($data['shopping_cart_data']['discount_amount']);
$result['formulaPrice'] = $data['shopping_cart_data']['promotion_formula'];
/*$result['price'] = Helpers::transPrice($data['shopping_cart_data']['order_amount']);
$result['activityPrice'] = Helpers::transPrice($data['shopping_cart_data']['discount_amount']);*/
$result['count'] = $data['shopping_cart_data']['selected_goods_count'];
$result['isAllSelected'] = ($data['shopping_cart_data']['goods_count'] === $data['shopping_cart_data']['selected_goods_count']) && ($data['shopping_cart_data']['selected_goods_count'] >0);
$result['sumPrice'] = Helpers::transPrice($data['shopping_cart_data']['last_order_amount']);
... ...
... ... @@ -284,22 +284,17 @@ class IndexController extends AbstractAction
$orderInfo = json_decode($cookieData, true);
$cartType = $orderInfo['cartType'];
}
$cartKey = 'commonCart';
if ($cartType === 'advance') {
$cartKey = 'preSellCart';
}
$shoppingKey = Helpers::getShoppingKeyByCookie();
$uid = $this->getUid(true);
$cartGoods = CartModel::getCartData($uid, $shoppingKey);
if (isset($cartGoods['isEmptyCart']) || empty($cartGoods[$cartKey])) {
$this->go(Helpers::url('/cart/index/index'));
$order = CartModel::cartPay($uid, $cartType, $orderInfo);
if (isset($order['cartUrl'])) {
$this->go($order['cartUrl']);
}
$data = array(
'orderEnsurePage' => true,
'isOrdinaryCart' => ($cartType !== 'advance'),
'orderEnsure' => CartModel::cartPay($uid, $cartType, $orderInfo)
'orderEnsure' => $order
);
$this->_view->display('order-ensure', $data);
... ...
... ... @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "1.2.6"
application.version = "1.2.7"
; 网站SEO信息
application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停"
... ...
... ... @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "1.2.6"
application.version = "1.2.7"
; 网站SEO信息
application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停"
... ...
... ... @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "1.2.6"
application.version = "1.2.7"
; 网站SEO信息
application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停"
... ...
... ... @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "1.2.6"
application.version = "1.2.7"
; 网站SEO信息
application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停"
... ...