Authored by hf

code review by hf: merge liangzhifeng and zhangzhen codes do fixes some bugs

Showing 41 changed files with 295 additions and 338 deletions
... ... @@ -303,6 +303,7 @@ class AbstractAction extends Controller_Abstract
if (!$this->_uid) {
$cookie = $this->getCookie('_UID');
// 兼容老的
if (!empty($cookie)) {
$cookieList = explode('::', $cookie);
if (isset($cookieList[1]) && is_numeric($cookieList[1])) {
... ... @@ -321,6 +322,13 @@ class AbstractAction extends Controller_Abstract
$this->_usession = $cookieList[3];
$this->_vip = $cookieList[2];
}
}
// 新的, 如果老站没有同步成功,再尝试从SESSION获取
elseif ($useSession) {
$uid = $this->getSession('_LOGIN_UID');
if (!empty($uid)) {
$this->_uid = $uid;
}
}
}
return $this->_uid;
... ...
... ... @@ -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';
... ... @@ -633,11 +633,13 @@ class Helpers
$gift = array();
$oneGoods = array();
$number = 0;
foreach ($advanceGoods as $value) {
$gift = array();
$gift['promotionId'] = $value['promotion_id'];
$gift['promotionTitle'] = $value['promotion_title'];
$number = 0;
foreach ($value['goods_list'] as $single) {
$oneGoods = array();
$oneGoods['id'] = $single['product_skn'];
... ... @@ -648,12 +650,14 @@ class Helpers
$oneGoods['count'] = $single['storage_number'];
$gift['goods'][] = $oneGoods;
$number ++;
}
$arr[] = $gift;
// 计算加价购商品数目
$count += count($value['goods_list']);
//$count += count($value['goods_list']);
$count += $number;
}
return $arr;
... ... @@ -746,7 +750,7 @@ class Helpers
public static function syncUserSession($uid, $refer = '', $callback = 'call')
{
return 'http://mapi.yohobuy.com/Passport/session/index?callback=' . $callback
. '&sign=' .md5(md5($uid . 'Js8Yn0!EwPM45-ws')) . '&uid=' . $uid . '&go=' . $refer;
. '&sign=' . md5(md5($uid . 'Js8Yn0!EwPM45-ws')) . '&uid=' . $uid . '&go=' . $refer;
}
/**
... ...
... ... @@ -10,11 +10,13 @@ var $ = require('jquery'),
var chosePanel = require('./chose-panel'),
dialog = require('../me/dialog'),
loading = require('../plugin/loading'),
tip = require('../plugin/tip');
var $cartContent = $('.cart-content'),
cartType = $('#cartType').val(),
$cartNav = $('.cart-nav'),
$cartPage = $('.shopping-cart-page'),
hasShowCartPresellTip = false;
var navHammer,
... ... @@ -22,8 +24,31 @@ var navHammer,
freebieHammer,
switchChose = false;
require('../product/recommend-for-you');
require('./good');
var isRefreshByDelete = window.cookie('_yoho-cart-refreshByDelete') === 'true' ? true : false;
loading.showLoadingMask();
function needLoadRecommandForYou() {
return window.isCookiesEnabled() ?
$('.cart-goods').length <= 0 && !isRefreshByDelete :
$('.cart-goods').length <= 0;
}
if (needLoadRecommandForYou()) {
require('../product/recommend-for-you');
} else {
if (isRefreshByDelete) {
$('body').css('background-color', '#f0f0f0');
}
require('./good');
}
$cartPage.css('display', 'block');
loading.hideLoadingMask();
window.setCookie('_yoho-cart-refreshByDelete', false);
ellipsis.init();
... ...
... ... @@ -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('加入购物车');
}
}
... ...
... ... @@ -14,6 +14,8 @@ var $ = require('jquery'),
var $page = $('.gift-advance-page'),
queryString = $.queryString();
require('../common');
lazyLoad($('.lazy'));
function getProductInfo(skn, promotionId) {
... ...
... ... @@ -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();
... ... @@ -106,12 +108,14 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
});
orderInfo('couponCode', null);
orderInfo('couponName', null);
window.setCookie('_yoho-cart-refreshByDelete', true);
window.location.href = '/cart/index/index?cartType=' + $('#cartType').val();
} else {
tip.show(data.message);
}
}, function() {
tip.show('网络异常');
window.location.reload();
});
});
});
... ...
... ... @@ -26,6 +26,8 @@ var dispatchModeHammer,
orderInfo = order.orderInfo,
isSubmiting;
require('../common');
lazyLoad();
if (window.getUid() !== orderInfo('uid')) {
... ...
... ... @@ -6,6 +6,8 @@
var $ = require('jquery');
var info = window.cookie('order-info');
require('../common');
function init() {
info = {
uid: window.getUid(),
... ...
... ... @@ -10,17 +10,31 @@ var $ = require('jquery'),
var $confim = $('.confim-mask'),
deleteId;
require('../common');
$('.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(),
is_support: $this.data('is-support')
};
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);
}
});
... ...
... ... @@ -21,6 +21,8 @@ var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()),
var winH = $(window).height();
require('../common');
// conponNotAvaliableTmpl = Handlebars.compile($('#tmpl-coupon-not-avaliable').html()),
function fixedLayOut() {
... ... @@ -67,9 +69,27 @@ $newCoupon.on('submit', function() {
$('#coupon-list').on('touchend', '.employ-main', function() {
var $this = $(this);
var couponCode = $this.data('coupon-code');
$.ajax({
method: 'POST',
url: '/cart/index/couponSearch',
data: {
couponCode: couponCode
}
}).then(function(res) {
if (res.code === 200) {
orderInfo('couponCode', $this.data('coupon-code'));
orderInfo('couponName', $this.data('coupon-name'));
//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);
... ...
... ... @@ -58,6 +58,17 @@ function setCookie(name, value, options) {
}
}
function isCookiesEnabled() {
var cookieEnabled = (navigator.cookieEnabled) ? true : false;
if (typeof navigator.cookieEnabled === 'undefined' && !cookieEnabled) {
document.cookie = 'testcookie';
cookieEnabled = (document.cookie.indexOf('testcookie') !== -1) ? true : false;
}
return (cookieEnabled);
}
function getUser() {
var c = cookie('_UID'),
user;
... ... @@ -179,7 +190,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();
... ... @@ -276,6 +287,8 @@ window.cookie = cookie;
window.setCookie = setCookie;
window.isCookiesEnabled = isCookiesEnabled;
window.getUser = getUser;
window.getUid = 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
... ...
... ... @@ -119,7 +119,11 @@ $submit.on('touchend', function() {
});
// 省市区列表异步加载
$.get('/home/locationList').then(function(html) {
$.ajax({
method: 'GET',
url: '/home/locationList',
timeout: 60000
}).then(function(html) {
$addressListPage.html(html);
// 省市区
... ... @@ -141,7 +145,7 @@ $.get('/home/locationList').then(function(html) {
if (e.target.tagName.toLowerCase() !== 'li') {
$this = $this.parent('li');
}
newArea.push($this.children('.caption').text());
newArea.push($this.children('.caption').text().trim());
$this.siblings().hide();
$this.children('ul').show().children('li').show();
... ... @@ -157,7 +161,7 @@ $.get('/home/locationList').then(function(html) {
var $this = $(e.target);
// 填结果到 html
newArea.push($this.children('.caption').text());
newArea.push($this.text().trim());
$('[name="area"]').val(newArea.join(' '));
$('[name="area_code"]').val($this.data('id'));
... ...
... ... @@ -16,6 +16,8 @@ var $action = $('.action'),
$addressItem = $('.address-item'),
deleteId;
require('../common');
$pageWrap.first().css('min-height', function() {
return $(window).height() - $('#yoho-header').height() - $footer.height();
});
... ...
... ... @@ -12,30 +12,35 @@ var $dialogWrapper,
dialogTpl,
dialogTemplate;
dialogTpl = '<div id="dialog-wrapper" class="dialog-wrapper">' +
'<div class="dialog-box">' +
'{{# hasHeader}}' +
'{{/ hasHeader}}' +
'<div class="dialog-content">{{dialogText}}</div>' +
'{{# hasFooter}}' +
'<div class="dialog-footer">' +
'{{# leftBtnText}}' +
'<span class="dialog-left-btn">{{.}}</span>' +
'{{/ leftBtnText}}' +
'{{# rightBtnText}}' +
'<span class="dialog-right-btn">{{.}}</span>' +
'{{/ rightBtnText}}' +
'</div>' +
'{{/ hasFooter}}' +
'</div>' +
function getInstance() {
if (dialogTpl === undefined) {
dialogTpl = '<div id="dialog-wrapper" class="dialog-wrapper">' +
'<div class="dialog-box">' +
'{{# hasHeader}}' +
'{{/ hasHeader}}' +
'<div class="dialog-content">{{dialogText}}</div>' +
'{{# hasFooter}}' +
'<div class="dialog-footer">' +
'{{# leftBtnText}}' +
'<span class="dialog-left-btn">{{.}}</span>' +
'{{/ leftBtnText}}' +
'{{# rightBtnText}}' +
'<span class="dialog-right-btn">{{.}}</span>' +
'{{/ rightBtnText}}' +
'</div>' +
'{{/ hasFooter}}' +
'</div>' +
'</div>';
dialogTemplate = Handlebars.compile(dialogTpl);
dialogTemplate = Handlebars.compile(dialogTpl);
}
return dialogTemplate;
}
exports.showDialog = function(data, callback, callbackForLeft) {
var dialogStr = dialogTemplate(data),
var dialogTemplate = getInstance(),
dialogStr = dialogTemplate(data),
$dialogBox,
defaultHideDuraton,
dialogWrapperHammer;
... ... @@ -73,6 +78,11 @@ exports.showDialog = function(data, callback, callbackForLeft) {
}, defaultHideDuraton);
}
//禁止在dialog上可以上下滚动
$dialogWrapper.on('touchmove', function() {
return false;
});
dialogWrapperHammer.on('tap', function(event) {
if ($(event.target).hasClass('dialog-left-btn')) {
... ... @@ -83,5 +93,9 @@ exports.showDialog = function(data, callback, callbackForLeft) {
} else if ($(event.target).hasClass('dialog-right-btn')) {
callback();
}
// 防止出现点透问题
event.preventDefault();
event.srcEvent.stopPropagation();
});
};
... ...
... ... @@ -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;
}
}
... ...
{
"name": "yohobuy",
"version": "1.2.6",
"version": "1.2.7",
"description": "yohobuy statics",
"keywords": [],
"homepage": "",
... ...
... ... @@ -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;
}
... ... @@ -120,10 +123,10 @@
}
.count {
font-size: 28rem / $pxConvertRem;
font-size: 20rem / $pxConvertRem;
color: #999;
display: inline-block;
width: 19%;
width: 22%;
position: absolute;
text-align: center;
}
... ... @@ -152,10 +155,10 @@
display: inline-block;
color: #fff;
background: #d1021c;
border: 1px solid #9d0000;
@include border-radius(0.5rem);
padding: 4rem / $pxConvertRem 0.5rem;
margin-left: 0.2rem;
@include border-radius(16rem / $pxConvertRem);
padding: 0rem / $pxConvertRem 12rem / $pxConvertRem;
margin-left: 8rem / $pxConvertRem;
font-size: 20rem / $pxConvertRem;
}
.la-tag {
... ...
... ... @@ -8,6 +8,7 @@
margin-bottom: 120rem / $pxConvertRem;
overflow-x: hidden;
background: #f0f0f0;
display: none;
.yoho-tip {
z-index: 4;
... ... @@ -77,7 +78,7 @@
padding: 10px;
background: #000;
color: #fff;
font-size: 20px;
font-size: 12px;
@include border-radius(5px);
text-align: center;
width: 7rem;
... ...
... ... @@ -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
}
... ...
@charset "utf-8";
@import "compass", "compass/reset";
$pxConvertRem: 40;
* {
-webkit-tap-highlight-color: rgba(0,0,0,0);
-moz-tap-highlight-color: rgba(0,0,0,0);
tap-highlight-color: rgba(0,0,0,0);
}
html, body {
font-family: helvetica,Arial,"黑体";
width: 100%;
font-size: 12px;
line-height: 1.4;
}
.clearfix:before,
.clearfix:after {
content: "";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
*zoom: 1;
}
button, input, select, textarea {
font-family: inherit;
font-size: 100%;
margin: 0;
}
img {
max-width: 100%;
display: block;
border: 0;
margin: 0 auto;
}
a {
text-decoration: none;
outline: none;
color: #000;
&:link,
&:visited,
&:hover,
&:actived {
color: #000;
}
}
*:focus {
outline: none;
}
.hide {
display: none;
}
.overflow-hidden {
overflow: hidden;
}
@font-face {
font-family: "iconfont";
src: font-url('iconfont.eot'); /* IE9*/
src: font-url('iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
font-url('iconfont.woff') format('woff'), /* chromefirefox */
font-url('iconfont.ttf') format('truetype'), /* chromefirefoxoperaSafari, Android, iOS 4.2+*/
font-url('iconfont.svg#iconfont') format('svg'); /* iOS 4.1- */
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
text-decoration: none;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
.yoho-tip {
position: fixed;
display: none;
text-align: center;
width: 70%;
padding: 34px 0;
top: 50%;
left: 50%;
margin-left: -35%;
margin-top: -45px;
background-color: rgba(0,0,0,.7);
color: #fff;
font-size: 18px;
border: none;
z-index:4;
@include border-radius(10px);
}
.tap-hightlight {
&.highlight {
background: #eee!important;
}
}
.load-more-info {
width: 100%;
height: 70rem / $pxConvertRem;
line-height: 70rem / $pxConvertRem;
text-align: center;
font-size: 14px;
overflow: hidden;
.status {
&.hide {
display: none;
}
}
}
/*px转化rem*/
@function pxToRem($px) {
$pxConvertRem: 40px;
@if $px == 0 {
@return 0;
} @else {
@return $px / $pxConvertRem * 1rem;
}
}
@mixin rem-sprite ($map,$sprite) {
$offsetY: nth(sprite-position($map,$sprite),2);
background-image: sprite-url($map);
background-repeat: no-repeat;
background-position: 0 pxToRem($offsetY);
background-size: pxToRem(sprite-width($map)) pxToRem(sprite-height($map));
}
@import "layout/header";
@import "layout/footer";
@import "layout/footer_tab";
@import "good";
@import "lazy-failure";
@import "filter";
@import "loading";
@import "passport/index";
@import "guang/index";
@import "home/index";
@import "category/index";
@import "product/index";
@import "index/index";
@import "cart/index";
@import "me/index"; //个人中心
... ... @@ -15,7 +15,7 @@
.swiper-container {
padding: pxToRem(30px) 0 pxToRem(20px);
width: 100%;
height: pxToRem(252px);
// height: pxToRem(252px);
// overflow: hidden;
.swiper-slide {
... ...
... ... @@ -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}}">
... ...
... ... @@ -2,7 +2,7 @@
<div class="my-address-page select-address-page yoho-page">
<div class="page-wrap">
{{# address}}
<a class="address-item" data-address-id="{{address_id}}" href="/cart/index/orderEnsure">
<a class="address-item" data-address-id="{{address_id}}" data-is-support="{{is_support}}" href="/cart/index/orderEnsure">
<span class="name">{{consignee}}</span>
<span class="tel">{{mobile}}</span>
<p class="address-info">{{area}} {{address}}</p>
... ...
... ... @@ -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');
</script>
<!-- End Google Tag Manager -->
<script type="text/javascript">
var _hmt = _hmt || [];
(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);
})();
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";
hm.async = 1;
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
}
window.addEventListener('load', async_load, false);
})();
</script>
<script>
var _hmt = _hmt || [];
(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);
})();
window._py = window._py||[];
window._py.push(['a', 'MC..o8vMMWxEXDCiqYckD81lUX']);
window._py.push(['domain','stats.ipinyou.com']);
window._py.push(['e','']);
if(typeof _goodsData!='undefined'){
window._py.push(['pi',_goodsData]);
}
-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
... ...
... ... @@ -18,8 +18,8 @@
{{#if devEnv}}
<script src="http://localhost:8000/static/js/sea.js?nowrap"></script>
<script>seajs.config({base: 'http://localhost:8000/'});</script>
{{/if}}
{{> layout/use}}
{{/if}}
{{> layout/use}}
{{> layout/analysis}}
</body>
</html>
\ 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();
... ...
... ... @@ -89,7 +89,7 @@ class CartModel
}
// 普通购物车空,则显示预售购物车
if ($ordinaryCount === '0' && $ordinaryCount) {
if ($ordinaryCount === '0' && $ordinarySoldOut) {
$result['cartNav'] = false;
$result['cartType'] = 'advance';
}
... ... @@ -324,6 +324,12 @@ class CartModel
$pay = CartData::cartPay($uid, $cartType);
// 商品为空返回
if (!$pay || 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);
... ...
... ... @@ -17,6 +17,9 @@ class LoginController extends AbstractAction
*/
public function indexAction()
{
// 设置登录有效时间30分钟, 防机器刷
$this->setSession('_LOGIN_EXPIRE', time() + 1800);
// 清除客户端
$this->setCookie('_UID', '');
$this->setCookie('_TOKEN', '');
... ... @@ -51,6 +54,9 @@ class LoginController extends AbstractAction
*/
public function internationalAction()
{
// 设置登录有效时间30分钟, 防机器刷
$this->setSession('_LOGIN_EXPIRE', time() + 1800);
$refer = $this->get('refer');
if (!empty($refer)) {
$this->setCookie('refer', $refer);
... ... @@ -80,6 +86,7 @@ class LoginController extends AbstractAction
$this->setCookie('_SPK', '');
// 清除服务端会话
$this->setSession('_TOKEN', '');
$this->setSession('_LOGIN_UID', '');
$refer = $this->server('HTTP_REFERER', SITE_MAIN);
$token = $this->get('token');
... ... @@ -123,6 +130,12 @@ class LoginController extends AbstractAction
break;
}
/* 设置登录有效时间30分钟, 防机器刷 */
$expire = $this->getSession('_LOGIN_EXPIRE');
if (empty($expire) || $expire < time()) {
break;
}
/* 调用登录接口进行登录 */
// 获取未登录时的唯一识别码
$shoppingKey = Helpers::getShoppingKeyByCookie();
... ... @@ -143,6 +156,7 @@ class LoginController extends AbstractAction
$token = Helpers::makeToken($data['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $data['data']['uid']);
} while (false);
$this->echoJson($data);
... ... @@ -211,8 +225,9 @@ class LoginController extends AbstractAction
if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) {
$token = Helpers::makeToken($result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
} else {
$this->go($refer);
... ... @@ -248,8 +263,9 @@ class LoginController extends AbstractAction
if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) {
$token = Helpers::makeToken($result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
} else {
$this->go($refer);
... ... @@ -285,8 +301,9 @@ class LoginController extends AbstractAction
if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) {
$token = Helpers::makeToken($result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
} else {
$this->go($refer);
... ...
... ... @@ -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有货 | 潮流购物逛不停"
... ...