Authored by Lynnic

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

Showing 100 changed files with 1709 additions and 1231 deletions

Too many changes to show.

To preserve performance only 100 of 100+ files are displayed.

... ... @@ -608,7 +608,28 @@
//注册页
{
countrys: [...], //区域列表
countryCode: '' //默认区号
countryCode: '' //默认区号
}
//验证码
{
areaCode: '',
phoneNum: ''
}
//密码页
{
... //仅头部
}
### 绑定手机号
//绑定页
{
countrys: [...], //区域列表
areaCode: '', //默认区号
sourceType: 'qq', //用户在登录页选择的第三方登录平台
openId: '' //第三方登录平台id,用于绑定手机号
}
//验证码
... ...
... ... @@ -179,6 +179,41 @@ class CartData
}
/**
* 增减购物车商品数量
*
* @param int $uid 用户ID
* @param string $sku 商品SKU
* @param int $increaseNum 增加的数目
* @param int $decreaseNum 减少的数目
* @param string $shoppingKey 未登录用户唯一识别码
* @return array 接口返回的数据
*/
public static function modifyProductNum($uid, $sku, $increaseNum, $decreaseNum, $shoppingKey)
{
$param = Yohobuy::param();
$param['method'] = 'app.Shopping.increase';
$param['product_sku'] = $sku;
if (!empty($increaseNum)) {
$param['increase_number'] = $increaseNum;
}
if (!empty($decreaseNum)) {
$param['decrease_number'] = $decreaseNum;
}
if (!empty($uid)) {
$param['uid'] = $uid;
}
if ($shoppingKey !== null) {
$param['shopping_key'] = $shoppingKey;
}
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 修改购物车商品数据
*
* @param int $uid 用户ID
... ...
... ... @@ -92,7 +92,7 @@ class BindData
$param['area'] = $area;
if (!empty($password))
{
$param['passport'] = $password;
$param['password'] = $password;
}
$param['client_secret'] = Sign::getSign($param);
... ...
... ... @@ -443,13 +443,13 @@ class Helpers
* @param string $areaMobile
* @return boolean
*/
public static function verifyAreaMobile($areaMobile)
public static function verifyAreaMobile($areaMobile, $area)
{
if (empty($areaMobile)) {
return false;
}
if (!strpos($areaMobile, '-')) {
return self::areaMobielVerify($areaMobile);
return self::areaMobielVerify($areaMobile, $area);
} else {
$mobileData = explode('-', $areaMobile);
if (count($mobileData) != 2) {
... ... @@ -580,7 +580,7 @@ class Helpers
//gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品;
if (!isset($value['goods_type'])) {
$oneGoods['isSoldOut'] = true;
} elseif ($value['goods_type'] == 'gift') {
} elseif ($value['goods_type'] == 'gift' && !isset($value['isAdvanceBuy'])) {
$oneGoods['isGift'] = true;
} elseif ($value['goods_type'] == 'price_gift') {
$oneGoods['isAdvanceBuy'] = true;
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
define("index",["jquery","hammer","swiper","lazyload","mlellipsis","iscroll-probe","handlebars","source-map","index"],function(e,t,o){var n;e("js/common"),e("js/category/entry"),e("js/guang/entry"),e("js/home/entry"),e("js/index/entry"),e("js/passport/entry"),e("js/product/entry"),e("js/me/entry"),o.exports=n}),define("js/common",["jquery"],function(e,t,o){function n(e){var t,o,n=document.cookie;return document.cookie&&""!==document.cookie&&(o=n.indexOf(e+"="),o>-1&&(o+=e.length+1,t=decodeURIComponent(c.trim(n.substring(o,n.indexOf(";",o)))))),t}function i(e,t,o){var n,i,a,s,r="";"undefined"!=typeof t&&(o=o||{},null===t&&(t="",o.expires=-1),o.expires&&("number"==typeof o.expires||o.expires.toUTCString)&&("number"==typeof o.expires?(s=new Date,s.setTime(s.getTime()+24*o.expires*60*60*1e3)):s=o.expires,r="; expires="+s.toUTCString()),n=o.path?"; path="+o.path:"",i=o.domain?"; domain="+o.domain:"",a=o.secure?"; secure":"",document.cookie=[e,"=",encodeURIComponent(t),r,n,i,a].join(""))}function a(){var e,t=n("_UID");return"undefined"==typeof t?0:(e=t.split("::"),"undefined"==typeof e||e.length<4?0:e)}function s(){var e=a();return 0===e?0:e[1]}function r(){var e=n("_g");return"undefined"==typeof e?"":JSON.parse(e).k}function l(){var e;0!==u.length&&(e=Math.min(c(window).height(),window.screen.availHeight),c("body").height()<=e-parseInt(u.css("height"),0)?u.addClass("bottom"):u.removeClass("bottom"))}function d(e){var t=c(e).outerHeight();e&&u.css("margin-bottom",t+"px")}var c=e("jquery"),u=c("#yoho-footer"),h=c(".yoho-page"),p=c(".yoho-header");!function(){var e=u.children(".op-row"),t=a();l(),0===t?e.prepend('<a href="http://m.yohobuy.com/signin.html?refer='+location.href+'">登录</a><span class="sep-line">|</span><a href="http://m.yohobuy.com/reg.html">注册</a>'):e.prepend('<span>Hi,</span><a class="user-name" href="http://m.yohobuy.com/home?tmp='+Math.random()+'">'+t[0]+'</a><a href="http://m.yohobuy.com/passport/signout/index?token='+t[3]+'">退出</a>'),e.find(".back-to-top").on("touchend",function(){return c(window).scrollTop(0),!1}),u.removeClass("hide")}(),function(e,t,o,n,i){var a=t.createElement(o),s=t.getElementsByTagName(o)[0];e.YohoAcquisitionObject=i,e[i]=function(){e[i].p=arguments},a.async=1,a.src=n,s.parentNode.insertBefore(a,s)}(window,document,"script","http://cdn.yoho.cn/yas-jssdk/1.0.13.6.3/yas-debug.js","_yas"),function(){var e=s();e=0===e?"":e,window._ozuid=e,window._yas&&window._yas(1*new Date,"1.0.13.6.3","yohobuy_m",e,"","")}(),p.on("touchstart","a",function(){p.find("a").removeClass("highlight"),c(this).addClass("highlight")}).on("touchend touchcancel","a",function(){c(this).removeClass("highlight")}),h.on("touchstart",".tap-hightlight",function(){c(this).siblings(".tap-hightlight").removeClass("highlight"),c(this).addClass("highlight")}).on("touchend touchcancel",".tap-hightlight",function(){c(this).removeClass("highlight")}),c(".nav-home").on("touchstart",function(){c(".homebuttom").toggleClass("none")}),function(){var e,t,o=0,n="webkit moz ms o".split(" "),i=window.requestAnimationFrame,a=window.cancelAnimationFrame;for(t=0;t<n.length&&(!i||!a);t++)e=n[t],i=i||window[e+"RequestAnimationFrame"],a=a||window[e+"CancelAnimationFrame"]||window[e+"CancelRequestAnimationFrame"];i&&a||(i=function(e,t){var n=(new Date).getTime(),i=Math.max(0,16-(n-o)),a=window.setTimeout(function(){e(n+i)},i);return o=n+i,a},a=function(e){window.clearTimeout(e)}),window.requestAnimationFrame=i,window.cancelAnimationFrame=a}(),c.extend({queryString:function(){var e,t,o=[],n=window.location.href.slice(window.location.href.indexOf("?")+1).split("&");for(t=0;t<n.length;t++)e=n[t].split("="),o.push(e[0]),o[e[0]]=e[1];return o}}),window.cookie=n,window.setCookie=i,window.getUser=a,window.getUid=s,window.getShoppingKey=r,window.rePosFooter=l,window.reMarginFooter=d}),define("js/category/entry",["jquery","hammer","swiper","lazyload","index"],function(e,t,o){e("js/category/index"),e("js/category/brand")}),define("js/category/index",["jquery"],function(e,t,o){var n=e("jquery"),i=n(".category-nav"),a=n(".category-container"),s=a.children(".content"),r=a.find(".sub-level li"),l=a.find(".primary-level li"),d=s.not(".hide");!function(){var e=n(".yoho-header"),t=n("#search-input"),o=n(window).height()-e.outerHeight()-t.outerHeight()-i.outerHeight();a.css("min-height",o),s.height(o)}(),n("#search-input").focus(function(){n(this).blur()}),i.bind("contextmenu",function(e){return!1}),n(".category-container").bind("contextmenu",function(e){return!1}),i.on("touchend touchcancel",function(e){var t=n(e.target).closest("li"),o=t.index();t.hasClass("focus")||(i.find("li.focus").removeClass("focus"),t.addClass("focus"),d.addClass("hide"),d=s.eq(o).removeClass("hide"))}),a.on("touchend",function(e){var t,o,i,a=n(e.target);if(o=a.closest(".p-level-item"),o.length>0){if(i=o.index(),t=a.closest(".content").find(".sub-level"),a.hasClass("focus"))return;a.closest(".primary-level").children(".focus").removeClass("focus"),a.addClass("focus"),t.not(".hide").addClass("hide"),t.eq(i).removeClass("hide")}}),a.find(".primary-level").on("touchstart touchend touchcancel","li",function(){l.removeClass("highlight"),n(this).addClass("highlight")}).on("touchend touchcancel","li",function(){n(this).removeClass("highlight")}),a.find(".sub-level").on("touchstart","li",function(){r.removeClass("highlight"),n(this).addClass("highlight")}).on("touchend touchcancel","li",function(){n(this).removeClass("highlight")}),i.on("touchstart","li",function(){i.find("li").removeClass("bytouch"),n(this).addClass("bytouch")}).on("touchend touchcancel","li",function(){i.find("li").removeClass("bytouch")})}),define("js/category/brand",["jquery","hammer","swiper","lazyload","index"],function(e,t,o){function n(){var e=p(window).scrollTop();v.eq(0).offset().top<d&&r.hide(),v.each(function(){var t=p(this).offset().top-C;e>=t&&r.css({display:"block"}).find("h2").html(p(this).find(".title-bar").text())})}function i(){var e=p(".brand-list").find("p");e.on("touchstart",function(){e.css("background","#fff"),p(this).css("background","#eee")}).on("touchend touchcancel",function(){p(this).css("background","#fff")})}function a(){var e=(u.val()+"").toLowerCase(),t={},o=0,n="";""!==e&&(p.each(c,function(o,n){p.isArray(n)&&p.each(n,function(n,i){i.name.toLowerCase().indexOf(e)>-1&&(t[o]=t[o]||[],t[o].push(i))})}),p.each(t,function(e,t){var i=['<div class="brand-list bar-',o,'">'];o++,i.push('<div class="title-bar"><h2>'),i.push(e),i.push("</h2></div>"),p.each(t,function(e,t){i.push('<p><a href="'+t.url+'">'+t.name),t.isNew&&i.push('<i class="icon-new">NEW</i>'),t.isHot&&i.push('<i class="icon-hot">HOT</i>'),i.push("</a></p>")}),i.push("</div>"),n+=i.join("")})),p(".search-result").html(n),i()}var s,r,l,d,c,u,h,p=e("jquery"),f=e("hammer"),m=e("swiper"),g=e("lazyload"),v=p(".brand-list"),w=p(".search-icon"),y=p(".newbrand-search").outerHeight(),b=p(".yoho-header").outerHeight(),C=parseInt(y)+parseInt(b)-1;l=new m(".brands-swiper",{grabCursor:!0,slidesPerView:"auto",wrapperClass:"brands-list",slideElement:"li"}),s=new m(".swiper-container",{lazyLoading:!0,loop:!0,autoplay:3e3,pagination:".swiper-pagination .pagination-inner"}),g(p("img.lazy")),p(".yoho-header").css({"z-index":2,position:"fixed",top:0}),p(".banner-top").length>0&&p(".hot-brands").css("padding-top","0"),r=p('<div class="title-bar fixed-title-bar"><h2></h2></div>'),r.css({position:"fixed",top:C}).hide(),d=C+p(".hot-brands").outerHeight()+p(".banner-top").outerHeight(),v.last().append(r),p(window).scroll(function(){window.requestAnimationFrame(n)}),i(),p(".brand-search-page").length&&(c=p.parseJSON(p("#brands-data").html()),u=p("#keyword"),u.on("input",function(){u.val().length?(w.css("color","#000"),p(this).closest(".search-box").css("width","11.25rem"),p(".search-action").show()):(w.css("color","#b2b2b2"),p(this).closest(".search-box").css("width","12.5rem"),p(".search-action").hide()),a()}).focus(),h=new f(p(".clear-text")[0]),h.on("tap",function(e){e.preventDefault(),p(".search-result").html(""),p("#keyword").val("").trigger("input"),e.srcEvent.stopPropagation()}),p("form.search-box").on("submit",function(){return!1}))}),define("js/guang/entry",["jquery","lazyload","swiper","hammer","mlellipsis","iscroll-probe","index"],function(e,t,o){e("js/guang/plus-star/list"),e("js/guang/plus-star/detail"),e("js/guang/home"),e("js/guang/list"),e("js/guang/detail")}),define("js/guang/plus-star/list",["jquery","lazyload","swiper","index"],function(e,t,o){var n,i=e("jquery"),a=e("lazyload"),s=e("swiper"),r=i("#nav-tab > li"),l=i("#ps-content > .content");a(i("img.lazy")),n=new s(".swiper-container",{lazyLoading:!0,pagination:".swiper-pagination"}),i("#nav-tab").bind("contextmenu",function(e){return!1}),i("#nav-tab").on("touchend touchcancel",function(e){var t=i(e.target).closest("li");t.hasClass("focus")||(r.toggleClass("focus"),l.toggleClass("hide"),i(document).trigger("scroll"))}),i("#nav-tab").on("touchstart",function(e){var t=e.target||e.srcElement;t.className="bytouch "+t.className}).on("touchend touchcancel",function(){r.removeClass("bytouch")})}),define("js/guang/plus-star/detail",["jquery","hammer","mlellipsis","lazyload"],function(e,t,o){var n,i,a,s,r=e("jquery"),l=e("hammer"),d=e("mlellipsis"),c=e("lazyload"),u=r("#intro"),h=r("#intro-more-txt"),p=r("#related-infos-container"),f=e("js/guang/info"),m=e("js/plugin/tip"),g=r("#brand-info").data("id"),v=r("#jump-to-app").val();e("js/plugin/wx-share"),d.init(),c(r("img.lazy")),u[0].mlellipsis(3),setTimeout(function(){n=u.text(),i=u.attr("title")}),f.initInfosEvt(p),a=new l(document.getElementById("more-intro")),a.on("tap",function(e){var t=r(e.target).closest("#more-intro");t.toggleClass("spread"),t.hasClass("spread")?(u.text(i),h.text("收起")):(u.text(n),h.text("more"),r(window).scrollTop(0,400)),e.preventDefault()}),s=new l(document.getElementById("brand-like")),s.on("tap",function(e){var t="ok",o=r(e.target);"1"!==v&&(e.preventDefault(),o.hasClass("like")&&(t="cancel"),r.ajax({type:"POST",url:"/guang/opt/favoriteBrand",data:{id:g,opt:t},success:function(e){200===e.code?o.toggleClass("like"):400===e.code||412===e.code?location.href=e.data:m.show(e.message)},error:function(){m.show("网络断开连接了~")}}))})}),define("js/guang/info",["jquery","hammer","mlellipsis","lazyload"],function(e,t,o){function n(e){d(e.find("img.lazy")),e.each(function(){var e=s(this),t=e.find(".info-title"),o=e.find(".info-text");t[0].mlellipsis(2),o[0].mlellipsis(2)})}function i(e){var t;"undefined"!=typeof e&&(t=new r(e[0]),t.on("tap",function(e){var t,o,n=s(e.target),i="ok";return t=n.closest(".like-btn"),t.length>0?(e.preventDefault(),t.hasClass("like")&&(i="cancel"),o=n.closest(".guang-info"),void s.ajax({type:"POST",url:"/guang/opt/praiseArticle",data:{id:o.data("id"),opt:i},success:function(e){var o=e.code;200===o&&(t.next(".like-count").text(e.data),t.toggleClass("like"))},error:function(){c.show("网络断开连接了~")}})):(t=n.closest(".collect-btn"),void(t.length>0&&(e.preventDefault(),t.hasClass("collected")&&(i="cancel"),o=n.closest(".guang-info"),s.ajax({type:"POST",url:"/guang/opt/collectArticle",data:{id:o.data("id"),opt:i},success:function(e){e.code&&200===e.code&&t.toggleClass("collected")},error:function(){c.show("网络断开连接了~")}}))))}),n(e.find(".guang-info")))}function a(e,t,o){var i;m||t.end||(1===t.page&&u.showLoadingMask(),i=e.find(".guang-info").length,m=!0,s.ajax({type:"GET",url:o?o:"/guang/index/page",data:t,success:function(o){var a;return" "===o?(t.end=!0,m=!1,p.addClass("hide"),void f.removeClass("hide")):(e.append(o),a=i>0?e.find(".guang-info:gt("+(i-1)+")"):e.find(".guang-info"),n(a),1===t.page&&(u.hideLoadingMask(),p.removeClass("hide"),window.rePosFooter()),t.page++,void(m=!1))},error:function(){c.show("网络断开连接了~"),m=!1}}))}var s=e("jquery"),r=e("hammer"),l=e("mlellipsis"),d=e("lazyload"),c=e("js/plugin/tip"),u=e("js/plugin/loading"),h=s("#load-more-info"),p=s(""),f=s(""),m=!1;l.init(),h.length>0&&(p=h.children(".loading"),f=h.children(".no-more")),t.initInfosEvt=i,t.setLazyLoadAndMellipsis=n,t.loadMore=a}),define("js/plugin/tip",["jquery"],function(e,t,o){function n(e,t){var o,n;"undefined"!=typeof e&&(o=e.toString(),n=t&&t>0?t:2e3,i.text(o).show(),a=setTimeout(function(){"block"===i.css("display")&&i.hide()},n))}var i,a,s=e("jquery");!function(){var e='<div id="yoho-tip" class="yoho-tip"></div>';s(".yoho-page").append(e),i=s("#yoho-tip"),i.on("touchend",function(){i.hide(),clearTimeout(a)})}(),t.show=n}),define("js/plugin/loading",["jquery"],function(e,t,o){function n(e){var t='<div class="loading-mask hide"><div class="loading"><div></div><div></div><div></div></div></div>';d=!0,void 0===e&&(e=l),e.append(t),s=e.children(".loading-mask")}function i(){d||(n(),d=!0),s.removeClass("hide")}function a(){s.addClass("hide")}var s,r=e("jquery"),l=r(".yoho-page"),d=!1;t.init=n,t.showLoadingMask=i,t.hideLoadingMask=a}),define("js/plugin/wx-share",["jquery"],function(e,t,o){var n=e("jquery");o.exports=function(){var e="http://www.yohoshow.com/api/wechat/getSignPackage";n.getJSON(e+"?pageurl="+encodeURIComponent(location.href.split("#")[0])+"&callback=?",function(e){var t,o,n,i;void 0!==e&&""!==e&&(t=e.appId.toString(),o=e.timestamp,n=e.nonceStr.toString(),i=e.signature.toString(),wx.config({debug:!1,appId:t,timestamp:o,nonceStr:n,signature:i,jsApiList:["checkJsApi","onMenuShareTimeline","onMenuShareAppMessage","onMenuShareQQ","onMenuShareWeibo","hideMenuItems","showMenuItems","hideAllNonBaseMenuItem","showAllNonBaseMenuItem","translateVoice","startRecord","stopRecord","onRecordEnd","playVoice","pauseVoice","stopVoice","uploadVoice","downloadVoice","chooseImage","previewImage","uploadImage","downloadImage","getNetworkType","openLocation","getLocation","hideOptionMenu","showOptionMenu","closeWindow","scanQRCode","chooseWXPay","openProductSpecificView","addCard","chooseCard","openCard"]}))}),wx.ready(function(){var e=n("#shareTitle").val(),t=n("#shareImg").val(),o=n("#shareDesc").val(),i=n("#shareLink").val(),a={title:e,desc:o,imgUrl:t,link:i};wx.onMenuShareAppMessage(a),wx.onMenuShareTimeline(a),wx.onMenuShareQQ(a),wx.onMenuShareWeibo(a)})}}),define("js/guang/home",["jquery","swiper","hammer","mlellipsis","lazyload","index"],function(e,t,o){function n(){var e=f.not(".hide");a(window).scrollTop()+h>=a(document).height()-.25*e.height()&&l(e,w[v])}var i,a=e("jquery"),s=e("swiper"),r=e("js/guang/info"),l=r.loadMore,d=a("#load-more-info"),c=a(""),u=a(""),h=a(window).height(),p=a("#info-list"),f=p.children(".info-list"),m=a("#guang-nav"),g=m.children(".focus"),v=g.data("type"),w={};d.length>0&&(c=d.children(".loading"),u=d.children(".no-more")),i=new s(".swiper-container",{lazyLoading:!0,pagination:".swiper-pagination",autoplay:3e3}),r.initInfosEvt(p),function(){var e=a("#gender").val();m.children(".guang-nav-item").each(function(){var t=a(this).data("type"),o=a(this).hasClass("focus");w[t]={page:o?2:1,gender:e,type:t,end:!1}})}(),m.bind("contextmenu",function(e){return!1}),m.on("touchend touchcancel",function(e){var t,o,n=a(e.target).closest(".guang-nav-item");n.hasClass("focus")||(o=n.index(),n.addClass("focus"),g.removeClass("focus"),t=f.eq(o),g=n,v=n.data("type"),1===w[v].page?(c.addClass("hide"),u.addClass("hide"),l(t,w[v])):w[v].end?(c.addClass("hide"),u.removeClass("hide")):(c.removeClass("hide"),u.addClass("hide")),f.not(".hide").addClass("hide"),t.removeClass("hide"),1===w[v].page&&window.rePosFooter())}),a(document).scroll(function(){window.requestAnimationFrame(n)}),m.on("touchstart",function(e){var t=e.target||e.srcElement;t.className="bytouch "+t.className}).on("touchend touchcancel",function(){m.find("li").removeClass("bytouch")})}),define("js/guang/list",["jquery","hammer","mlellipsis","lazyload"],function(e,t,o){function n(){i(window).scrollTop()+r>=i(document).height()-.25*p.height()&&s(p,h)}var i=e("jquery"),a=e("js/guang/info"),s=a.loadMore,r=i(window).height(),l=i("#author-infos"),d=i("#tag"),c=i("#gender"),u=i("#isApp"),h={page:2,end:!1},p=i("#info-list");a.initInfosEvt(p),l.length>0&&i.extend(h,{authorId:l.data("id"),isApp:u.val()}),d.length>0&&i.extend(h,{tag:d.val(),gender:c.val(),isApp:u.val()}),i(window).scroll(function(){window.requestAnimationFrame(n)})}),define("js/guang/detail",["jquery","mlellipsis","lazyload","iscroll-probe"],function(e,t,o){function n(e){var t=e.offset().left,o=-C+t+y/2+"px";r.css({backgroundPosition:o+" bottom"}),v&&b.css({backgroundPosition:o+" bottom"})}function i(e){var t,o,i,a=h(e.currentTarget),p=a.index();a.hasClass("focus")||(l.filter(".focus").removeClass("focus"),v&&(t=a.closest(".fixed-thumb-container").length>0?r:b,o=t.find(".thumb").eq(p),b.find(".thumb.focus").removeClass("focus"),o.addClass("focus")),a.addClass("focus"),n(a),d.not(".hide").addClass("hide"),i=d.eq(p),i.removeClass("hide"),f(i.find(".lazy")),v?u&&u.scrollToElement(c,400):h("body").animate({scrollTop:s.offset().top},400),u&&u.refresh())}function a(){var e,t,o,n,i,a=h("#scroller"),l=h(".yoho-header"),d=0;return l.length>0&&(d=l.outerHeight()),u=new m("#wrapper",{probeType:3,mouseWheel:!0,click:!0}),document.addEventListener("touchmove",function(e){e.preventDefault()},!1),w?(e=h(window).height()-d,i=b[0],t=r.outerHeight(),o=s.outerHeight(),n=s.offset().top-d,void u.on("scroll",function(){var s=-this.y,r=i.className;n-e+t>=s?-1===r.indexOf("fixed-bottom")&&b.addClass("fixed-bottom").removeClass("hide"):n>=s?-1===r.indexOf("hide")&&b.addClass("hide").removeClass("fixed-bottom fixed-top"):n+o-t>=s?-1===r.indexOf("fixed-top")&&b.addClass("fixed-top").removeClass("hide absolute").css("top",""):n+o>=s?(-1===r.indexOf("absolute")&&b.addClass("absolute").removeClass("fixed-top hide"),i.style.top=n+d+o-t-s+"px"):s>n+o&&-1===r.indexOf("hide")&&b.addClass("hide").removeClass("absolute"),a.trigger("scroll")})):void u.on("scroll",function(){a.trigger("scroll")})}var s,r,l,d,c,u,h=e("jquery"),p=e("mlellipsis"),f=e("lazyload"),m=e("iscroll-probe"),g=h(".author .intro"),v=!1,w=h(".collocation-block").length>0?!0:!1,y=0,b=h(""),c=document.querySelector("#wrapper .collocation-block"),C=h(window).width();e("js/plugin/wx-share")(),window.onload=function(){u&&u.refresh()},t.i=function(e){var t=navigator.userAgent.indexOf("iPhone")>0?!0:!1;v=t&&e,p.init(),f(h(".lazy")),h(".info-list .title, .one-good .reco-name").each(function(){this.mlellipsis(2)}),g.offset()&&parseInt(g.offset().left,10)===parseInt(g.css("margin-left"),10)&&g.css("padding-top",0),v&&(h(".yoho-header").length>0?h("#wrapper").addClass("ios has-head"):h("#wrapper").addClass("ios")),w&&(s=h(".collocation-block"),r=s.children(".thumb-container"),l=r.find("li"),d=s.find(".prod"),y=l.width(),v&&(b=h("#wrapper").after(r.clone().addClass("fixed-thumb-container fixed-bottom")).next(".thumb-container"),f(b.find(".lazy"),{event:"sporty"})),n(l.filter(".focus")),r.delegate(".thumb","touchend",i),v&&b.delegate(".thumb","touchend",i)),v&&a()}}),define("js/home/entry",["jquery","hammer","swiper","lazyload","index"],function(e,t,o){e("js/home/home"),e("js/home/maybe-like")}),define("js/home/home",["jquery","hammer","swiper","lazyload","index"],function(e,t,o){function n(){b.hasClass("menu-open")&&(b.removeClass("menu-open"),g(".overlay").hide(),g(".sub-nav").removeClass("show"),j.removeClass("on"),g("body").css({height:"auto",overflow:"auto"}))}function i(){k+=10,q.css({transform:"rotateX("+k+"deg)","-webkit-transform":"rotateX("+k+"deg)","-moz-transform":"rotateX("+k+"deg)"}),k/90%2===1&&(T?(q.addClass("animate"),T=!1):(q.removeClass("animate"),T=!0)),k/90%2===0&&k%360!==0?window.setTimeout(i,3e3):k%360===0?window.setTimeout(i,6e4):c(function(){i()})}var a,s,r,l,d,c,u,h,p,f,m,g=e("jquery"),v=e("hammer"),w=e("swiper"),y=e("lazyload"),b=g(".mobile-wrap"),C=g(".overlay"),j=g(".side-nav"),x=g(".sub-nav"),k=0,q=g(".home-header .logo"),T=!0;e("js/home/maybe-like"),y(g("img.lazy")),m=new v(g(".nav-btn")[0]),m.on("tap",function(e){return e.preventDefault(),b.addClass("menu-open"),C.show().css("opacity",.3),j.addClass("on"),g("body").css({height:g(window).height(),width:g(window).width(),overflow:"hidden"}),e.srcEvent.stopPropagation(),!1}),g(".overlay").on("touchstart",function(e){return n(),!1}),j.on("touchstart","li",function(e){return g(this).find(".sub-nav").size()>0&&(g(".sub-nav").removeClass("show"),g(this).find(".sub-nav").addClass("show")),e.stopPropagation(),e.target.pathname===location.pathname?(n(),!1):void 0}),x.each(function(){g(this).find("li").eq(0).on("touchstart",function(e){return g(".sub-nav").removeClass("show"),e.stopPropagation(),!1})}).on("touchstart",function(e){e.currentTarget!==e.target&&x.find("li").removeClass("current")}),j.children("ul").children("li").on("touchstart",function(){j.children("ul").children("li").css("background","#fff"),g(this).css("background","#eee")}).on("touchend touchcancel",function(){g(this).css("background","#fff")}),g(".banner-swiper").find("li").size()>1&&(a=new w(".banner-swiper",{lazyLoading:!0,lazyLoadingInPrevNext:!0,loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!1,paginationClickable:!0,slideElement:"li",pagination:".banner-top .pagination-inner"})),r=new w(".brands-swiper",{grabCursor:!0,slidesPerView:"auto",wrapperClass:"brands-list",slideElement:"li"}),s=new w(".recommend-swiper",{grabCursor:!0,slidesPerView:"auto",wrapperClass:"recommend-list",slideElement:"li"}),g(".trend-topic-swiper").find("li").size()>1&&(l=new w(".trend-topic-swiper",{loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!1,paginationClickable:!0,slideElement:"li",pagination:".trend-topic-content .pagination-inner"})),g(".category-swiper").each(function(e,t){p="category-swiper"+e,g(this).addClass(p),g("."+p).find(".swiper-slide").size()>1&&(d=new w("."+p,{loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!1,paginationClickable:!0,slideElement:"li",pagination:"."+p+" .pagination-inner"}))}),c=function(){var e=null,t=["webkit","moz","ms"];for(h=0;h<t.length;h++)u=t[h]+"RequestAnimationFrame",window[u]&&(f=!0,e=u);return f?function(t){window[e](t)}:function(e){window.setTimeout(e,67)}}(),setTimeout(i,3e3),g(".home-header .iconfont").on("touchstart",function(){g(this).addClass("highlight")}).on("touchend touchcancel",function(){g(this).removeClass("highlight")}),window.reMarginFooter(".footer-tab"),t.set=function(e){window.setCookie("_Channel",e,{expires:365,domain:".m.yohobuy.com"})}}),define("js/home/maybe-like",["jquery","hammer","lazyload"],function(e,t,o){function n(){v||(v=!0,p.showLoadingMask(),c.ajax({type:"GET",url:r,data:{page:w+1},success:function(e){return" "===e?(v=!1,p.hideLoadingMask(),void(y&&(r="1,3"===y?"/boys/bottomBanner":"/girls/bottomBanner",c.ajax({type:"GET",url:r,success:function(e){e&&e.img&&(c("#load-more-img").show(),c("#load-more-img a").attr("href",e.url),c("#load-more-img a > img").attr("src",e.img))},error:function(){}})))):(s=g.find(".good-info").length,g.append(e),f(0===s?g.find(".good-info").find("img.lazy"):g.find(".good-info:gt("+(s-1)+")").find("img.lazy")),v=!1,p.hideLoadingMask(),void w++)},error:function(){h.show("网络断开连接了~"),v=!1,p.hideLoadingMask()}}))}function i(){c(window).scrollTop()+m>=c(document).height()-200&&n()}var a,s,r,l,d,c=e("jquery"),u=e("hammer"),h=e("js/plugin/tip"),p=e("js/plugin/loading"),f=e("lazyload"),m=c(window).height(),g=c("#goods-list"),v=!1,w=0,y=null,b=c(".mobile-wrap").hasClass("kids-wrap")?!0:!1,C=c(".mobile-wrap").hasClass("lifestyle-wrap")?!0:!1,j=c("#maybe-like-nav");b?r="/product/recom/maylikekids":C?r="/product/recom/maylikelife":(y=c(".mobile-wrap").hasClass("boys-wrap")?"1,3":"2,3",r="/product/recom/maylike?gender="+y),l=j.children(".focus"),C&&(a=new u(j[0]),a.on("tap",function(e){var t,o=c(e.target).closest("li"),n=c(".goods-list");e.preventDefault(),o.hasClass("focus")||(d=o.index(),o.addClass("focus"),l.removeClass("focus"),n.not(".hide").addClass("hide"),t=n.eq(d),t.removeClass("hide"),l=o,c(document).trigger("scroll"),e.srcEvent.stopPropagation())})),p.init(c(".maybe-like")),c(".maybe-like p").on("touchstart",function(e){n()}),c(window).scroll(function(){window.requestAnimationFrame(i)})}),define("js/index/entry",["jquery","hammer"],function(e,t,o){e("js/index/search"),e("js/index/footer"),e("js/index/channel")}),define("js/index/search",["jquery","hammer"],function(e,t,o){var n,i,a=e("jquery"),s=e("js/plugin/security"),r=e("hammer"),l=a("#search-input input"),d=a("#search-input .clear-input"),c=a(".search-icon"),u=a("#search-form"),h=a(".history"),p=a(".history-search"),f=a("#clear-history"),m=e("js/index/write-search"),g=m.getRanToken();n=new r(f[0]),n.on("tap",function(){localStorage.removeItem("historys"),h.html(""),p.hide(),f.hide(),window.rePosFooter()}),l.on("input",function(){""===l.val()?(c.css("color","#b2b2b2"),d.addClass("hide")):(c.css("color","#666"),d.removeClass("hide"))}),i=new r(d[0]),i.on("tap",function(){l.val("").trigger("input")}),a("#search").on("touchend",function(){return s.hasDangerInput()?!1:(a(this).closest("form").submit(),!1)}),function(){var e,t,o,n="";if(localStorage&&(t=localStorage.getItem("historys"),t&&t.length>0)){for(t=t.split(g),o=t.length;o>0;o--)e=t[o-1],""!==e&&(n+='<li><a href="/?query='+e+'">'+e+"</li>");h.html(n),f.removeClass("hide"),p.removeClass("hide"),window.rePosFooter()}}(),m.bindWirteLocal(u)}),define("js/plugin/security",["jquery"],function(e,t,o){function n(e){var t,o,n,s=i("input[type!=hidden], textarea"),r=/['"<>&\|]|--/g,l=s.length,d=void 0===e||"boolean"!=typeof e?!0:e;for(o=0;l>o;o++)if(t=s.eq(o).val(),r.test(t))return d?s.eq(o).val(t.replace(r," ")):(n=t.match(r).join(" "),a.show("不可以输入 "+n+" 哦!")),!d&&!0;return!1}var i=e("jquery"),a=e("js/plugin/tip");t.hasDangerInput=n}),define("js/index/write-search",[],function(e,t,o){function n(){return a}function i(e){e.on("submit",function(){var e,t=this.query.value;if(localStorage){if(e=localStorage.getItem("historys"),e=e?e:"",e.indexOf(a+t+a)>-1)return;""===e&&(t=a+t),e+=t+a,localStorage.setItem("historys",e)}})}var a=" ??++ ";t.getRanToken=n,t.bindWirteLocal=i}),define("js/index/footer",["jquery","hammer"],function(e,t,o){function n(){var e="http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445",t=new Date;setTimeout(function(){new Date-t<2e3&&(window.location=e)},500)}var i,a=e("jquery"),s=e("hammer");e("js/common"),a("#float-layer-close").on("touchend",function(e){return a("#float-layer-app").hide(),window.setCookie("_float-layer-app","id490655927",{domain:".yohobuy.com"}),window.setCookie("_float-layer-app-close",1,{domain:".yohobuy.com",expires:1}),!1}),a("#float-layer-btn")&&a("#float-layer-btn")[0]&&(i=new s(a("#float-layer-btn")[0]),i.on("tap",function(e){n("bottom"),e.srcEvent.stopPropagation()}),"function"!=typeof window.cookie||window.cookie("_float-layer-app")?a("#float-layer-app").hide():a("#float-layer-app").show())}),define("js/index/channel",["jquery"],function(e,t,o){var n=e("jquery"),i=e("js/plugin/security"),a=n(".search-box"),s=n(".box"),r=n(".index-search"),l=n(".index-logo"),d=n(".index-channel a"),c=a.children('input[type="text"]'),u=s.children(".no-search"),h=a.children(".search-icon");e("js/common"),c.on("focus",function(){s.addClass("action"),l.addClass("action")}).on("input",function(){""===c.val()?h.addClass("empty"):h.removeClass("empty")}),u.on("touchend",function(){return s.removeClass("action"),l.removeClass("action"),c.blur(),!1}),a.children(".clear-text").on("touchstart",function(){c.val("").focus().trigger("input")}),a.children(".search-icon").on("touchstart",function(){return i.hasDangerInput()?!1:void r.submit()}),a.keyup(function(e){if(13===e.keyCode){if(i.hasDangerInput())return!1;r.submit()}}),n(".index-channel img").on("load error",function(){window.rePosFooter&&window.rePosFooter()}),d.on("touchstart",function(){d.css({background:"#000",color:"#fff",borderColor:"#fff"}),n(this).css({background:"rgba(255, 255, 255, 0.5)",color:"#000",borderColor:"#000"})}).on("touchend touchcancel",function(){n(this).css({background:"#000",color:"#fff",borderColor:"#fff"})})}),define("js/passport/entry",["jquery"],function(e,t,o){e("js/passport/register/register"),e("js/passport/register/code"),e("js/passport/register/password"),e("js/passport/login/login"),e("js/passport/login/international"),e("js/passport/back/mobile"),e("js/passport/back/code"),e("js/passport/back/email"),e("js/passport/back/email-success"),e("js/passport/back/new-password")}),define("js/passport/register/register",["jquery"],function(e,t,o){var n=e("jquery"),i=n("#phone-num"),a=n("#country-select"),s=n("#area-code"),r=n("#btn-next"),l=e("js/passport/api"),d=e("js/plugin/tip"),c=n.trim,u=d.show;l.selectCssHack(n("#country-select")),l.bindClearEvt(),i.bind("input",function(){""===c(i.val())?r.addClass("disable"):r.removeClass("disable")}),a.change(function(){s.text(a.val())}),r.on("touchstart",function(){var e=c(i.val()),t=a.val();r.hasClass("disable")||(l.phoneRegx[t].test(e)?n.ajax({url:"/passport/reg/verifymobile",type:"POST",data:{areaCode:t.replace("+",""),phoneNum:e},success:function(e){200===e.code?location.href=e.data:u(e.message)}}):u("手机号格式不正确,请重新输入"))})}),define("js/passport/api",["jquery"],function(e,t,o){function n(e){var t,o=r(".has-eye");e&&"open"===e.status?o.append('<div class="eye"></div>'):o.append('<div class="eye close"></div>'),t=o.children(".eye"),t.on("touchstart",function(e){var t=r(this),o=t.siblings(".pwd");e.preventDefault(),t.toggleClass("close"),t.hasClass("close")?o.attr("type","password"):o.attr("type","text"),o.focus()})}function i(){var e,t=r(".has-clear");t.append('<div class="clear-input"></div>'),e=t.children(".clear-input"),e.on("touchstart",function(t){var o=e.siblings(".input");o.val("").trigger("input").focus(),t.preventDefault()}),t.children(".input").bind("input",function(){var e=r(this),t=e.siblings(".clear-input"),o=l(e.val());""===o?t.hide():t.show()})}function a(e){return e.length>=6&&e.length<=20?!0:!1}function s(e){function t(){var t=e.find("option:selected").text().length;switch(t){case 2:e.outerWidth(90);break;case 3:e.outerWidth(110);break;default:e.outerWidth(130)}}var o=navigator.userAgent;o.match(/uc/i)&&o.match(/android/i)?e.change(function(){t()}):e.removeClass("in-android-uc")}var r=e("jquery"),l=r.trim,d=/^([a-zA-Z0-9]+[_|\_|\.|-]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.|-]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/,c={"+86":/^1[35847]{1}[0-9]{9}$/,"+852":/^[965]{1}[0-9]{7}$/,"+853":/^[0-9]{8}$/,"+886":/^[0-9]{10}$/,"+65":/^[98]{1}[0-9]{7}$/,"+60":/^1[1234679]{1}[0-9]{8}$/,"+1":/^[0-9]{10}$/,"+82":/^01[0-9]{9}$/,"+44":/^7[789][0-9]{8}$/,"+81":/^0[9|8|7][0-9]{9}$/,"+61":/^[0-9]{11}$/};o.exports={emailRegx:d,phoneRegx:c,bindEyesEvt:n,bindClearEvt:i,pwdValidate:a,selectCssHack:s}}),define("js/passport/register/code",["jquery"],function(e,t,o){e("js/passport/code")(!0)}),define("js/passport/code",["jquery"],function(e,t,o){var n=e("jquery");o.exports=function(t,o){function i(){n.ajax({url:"/passport/bind/bindMobile",type:"post",data:{areaCode:f.replace("+",""),phoneNum:p,openId:h,sourceType:u,nickname:c,password:""},success:function(e){200===e.code?(g.show("登录成功"),setTimeout(function(){location.href=e.data.refer},2e3)):g.show(e.message)},error:function(e){g.show("登录失败,请重试!")}})}function a(){var e,t=59;e=setInterval(function(){0===t?(l.text("重发验证码").removeClass("disable"),clearInterval(e)):l.text("重发验证码 ("+t--+"秒)")},1e3)}var s=n("#captcha"),r=n("#btn-next"),l=n("#captcha-tip"),d=parseInt(n("#isReg").val()),c=n("#nickname").val(),u=n("#sourceType").val(),h=n("#openId").val(),p=n("#phone-num").val(),f=n("#area-code").val().replace("+",""),m=e("js/passport/api"),g=e("js/plugin/tip"),v=n.trim,w=g.show,y=t?"reg":"back";m.bindClearEvt(),s.bind("input",function(){""!==v(s.val())?r.removeClass("disable"):r.addClass("disable")}),l.on("touchstart",function(){l.hasClass("disable")||n.ajax({type:"POST",url:o?"/passport/bind/sendBindMsg":"/passport/"+y+"/sendcode",data:{phoneNum:p,areaCode:f},success:function(e){200===e.code?(l.text("重发验证码 (60秒)").addClass("disable"),a()):w(e.message)}})}),r.on("touchstart",function(){r.hasClass("disable")||n.ajax({type:"POST",url:o?"/passport/bind/checkBindMsg":"/passport/"+y+"/verifycode",
data:{phoneNum:p,areaCode:f,code:v(s.val()),token:n("#token").val()},success:function(e){200===e.code?o?d?i():location.href="/passport/bind/password?phoneNum="+p+"&areaCode="+f+"&openId="+h+"&sourceType="+u+"&nickname="+c:location.href=e.data:w(e.message)}})}),a()}}),define("js/passport/register/password",["jquery"],function(e,t,o){var n=e("jquery"),i=n("#pwd"),a=n("#btn-sure"),s=e("js/passport/api"),r=e("js/plugin/tip"),l=n.trim,d=r.show;s.bindEyesEvt({status:"open"}),i.bind("input",function(){""===l(i.val())?a.addClass("disable"):a.removeClass("disable")}),a.on("touchstart",function(){var e=l(i.val());a.hasClass("disable")||(s.pwdValidate(e)===!1?d("密码6-20位,请重新输入"):n.ajax({type:"POST",url:"/passport/reg/setpassword",data:{password:e,phoneNum:n("#phone-num").val(),areaCode:n("#area-code").val(),token:n("#token").val()},success:function(e){var t;200===e.code?(t=e.data,d("注册成功"),n.ajax({url:t.session,dataType:"jsonp"}),setTimeout(function(){location.href=t.href},1e3)):d(e.message)}}))})}),define("js/passport/login/login",["jquery"],function(e,t,o){function n(){h&&p?d.removeClass("disable"):d.addClass("disable")}function i(){c.show(),u.show()}function a(){c.hide(),u.hide()}var s=e("jquery"),r=s("#account"),l=s("#pwd"),d=s("#btn-login"),c=s("#retrive-pwd-mask"),u=s("#retrive-pwd-ways"),h=!1,p=!1,f=e("js/passport/api"),m=e("js/plugin/tip"),g=s.trim,v=m.show;f.bindEyesEvt(),f.bindClearEvt(),r.bind("input",function(){h=""!==g(r.val())?!0:!1,n()}),l.bind("input",function(){p=""===g(l.val())?!1:!0,n()}),d.on("touchstart",function(){var e=g(r.val()),t=g(l.val());d.hasClass("disable")||(d.text("正在登录...").addClass("disable"),(/^[0-9]+$/.test(e)||f.emailRegx.test(e))&&f.pwdValidate(t)?s.ajax({type:"POST",url:"/passport/login/auth",data:{account:e,password:t},success:function(e){var t,o;200===e.code?(t=e.data,s.ajax({url:t.session,dataType:"jsonp",success:function(){clearTimeout(o),setTimeout(function(){location.href=t.href},1e3)}}),o=setTimeout(function(){location.href=t.href},3e3),v("登录成功")):v(e.message)},error:function(){v("网络断开连接啦~")},complete:function(){d.text("登录").removeClass("disable")}}):v("账号或密码有错误,请重新输入"))}),s("#forget-pwd").on("touchstart",function(){i()}),c.on("touchstart",function(){a()}),s("#cancel-retrive").on("touchstart",function(e){e.preventDefault(),a()}),r.trigger("input"),l.trigger("input")}),define("js/passport/login/international",["jquery"],function(e,t,o){function n(){c&&u?d.removeClass("disable"):d.addClass("disable")}var i=e("jquery"),a=i("#phone-num"),s=i("#country-select"),r=i("#area-code"),l=i("#pwd"),d=i("#btn-login"),c=!1,u=!1,h=e("js/passport/api"),p=e("js/plugin/tip"),f=i.trim,m=p.show;h.selectCssHack(s),h.bindEyesEvt(),h.bindClearEvt(),a.bind("input",function(){c=""===f(a.val())?!1:!0,n()}),l.bind("input",function(){var e=f(l.val());u=""===e?!1:!0,n()}),s.change(function(){r.text(s.val())}),d.on("touchstart",function(){var e=f(a.val()),t=s.val(),o=f(l.val());d.hasClass("disable")||(d.text("正在登录...").addClass("disable"),h.phoneRegx[t].test(e)&&h.pwdValidate(o)?i.ajax({type:"POST",url:"/passport/login/auth",data:{areaCode:t.replace("+",""),account:e,password:o},success:function(e){var t,o;200===e.code?(t=e.data,m("登录成功"),i.ajax({url:t.session,dataType:"jsonp",success:function(){clearTimeout(o),setTimeout(function(){location.href=t.href},1e3)}}),o=setTimeout(function(){location.href=t.href},3e3),m("登录成功")):m(e.message)},error:function(){m("网络断开连接啦~")},complete:function(){d.text("登录").removeClass("disable")}}):m("账号或密码有错误,请重新输入"))}),a.trigger("input"),l.trigger("input")}),define("js/passport/back/mobile",["jquery"],function(e,t,o){var n=e("jquery"),i=n("#phone-num"),a=n("#country-select"),s=n("#area-code"),r=n("#btn-next"),l=e("js/passport/api"),d=e("js/plugin/tip"),c=n.trim,u=d.show;l.selectCssHack(n("#country-select")),l.bindClearEvt(),i.bind("input",function(){""===c(i.val())?r.addClass("disable"):r.removeClass("disable")}),a.change(function(){s.text(a.val())}),r.on("touchstart",function(){var e=c(i.val()),t=a.val();r.hasClass("disable")||(l.phoneRegx[t].test(e)?n.ajax({url:"/passport/back/sendcode",type:"POST",data:{areaCode:t.replace("+",""),phoneNum:e},success:function(e){200===e.code?location.href=e.data:u(e.message)}}):u("手机号格式不正确,请重新输入"))})}),define("js/passport/back/code",["jquery"],function(e,t,o){e("js/passport/code")(!1)}),define("js/passport/back/email",["jquery"],function(e,t,o){var n=e("jquery"),i=n("#email"),a=n("#btn-sure"),s=e("js/passport/api"),r=e("js/plugin/tip"),l=n.trim,d=r.show;s.bindClearEvt(),i.bind("input",function(){""===l(i.val())?a.addClass("disable"):a.removeClass("disable")}),a.on("touchstart",function(){var e=l(i.val());a.hasClass("disable")||(s.emailRegx.test(e)?n.ajax({url:"/passport/back/sendemail",type:"POST",data:{email:e},success:function(e){200===e.code?location.href=e.data:d(e.message)}}):d("邮箱格式不正确,请重新输入"))})}),define("js/passport/back/email-success",["jquery"],function(e,t,o){var n=e("jquery"),i=n("#resend"),a=e("js/plugin/tip"),s=a.show;i.on("touchstart",function(e){e.preventDefault(),n.ajax({url:i.data("url"),type:"GET",success:function(e){s(200===e.code?e.message:e.message)}})})}),define("js/passport/back/new-password",["jquery"],function(e,t,o){var n=e("jquery"),i=n("#pwd"),a=n("#btn-ok"),s=e("js/passport/api"),r=e("js/plugin/tip"),l=n.trim,d=r.show,c=n("#phone-num");s.bindEyesEvt({status:"open"}),i.bind("input",function(){""===l(i.val())?a.addClass("disable"):a.removeClass("disable")}),a.on("touchstart",function(){var e,t,o=l(i.val()),r=!0;a.hasClass("disable")||(e={password:o},0===c.length&&(r=!1),r?(n.extend(e,{phoneNum:c.val(),areaCode:n("#areaCode").val(),token:n("#token").val()}),t="/passport/back/passwordByMobile"):(n.extend(e,{code:n("#email-code").val()}),t="/passport/back/passwordByEmail"),s.pwdValidate(o)?n.ajax({type:"POST",url:t,data:e,success:function(e){200===e.code?(d("密码修改成功"),setTimeout(function(){location.href=e.data},1e3)):d(e.message)}}):d("密码6-20位,请重新输入"))})}),define("js/product/entry",["jquery","swiper","lazyload","hammer","index"],function(e,t,o){e("js/product/newsale/newarrival"),e("js/product/newsale/discount"),e("js/product/list"),e("js/product/detail/detail"),e("js/product/detail/consultform"),e("js/product/newsale/hot-rank")}),define("js/product/newsale/newarrival",["jquery","swiper","lazyload","hammer","index"],function(e,t,o){function n(e){var t,o,n,i,a,u,f={};if(!d){if(e){for(o in T)T.hasOwnProperty(o)&&(T[o].reload=!0);switch(q.children(".active").removeClass("active"),E.addClass("active"),e.type){case"gender":t={gender:e.id};break;case"brand":t={brand:e.id};break;case"sort":t={sort:e.id};break;case"color":t={color:e.id};break;case"size":t={size:e.id};break;case"price":t={price:e.id};break;case"discount":t={discount:e.id};break;case"limit":t={limit:e.id};break;case"channel":t={channel:e.id};break;case"p_d":t={p_d:e.id}}c.extend(b,t)}if(E.hasClass("today")?(i="today",a=1):E.hasClass("week")?(i="week",a=2):E.hasClass("sale")&&(i="sale",a=3),n=T[i],u=n.page+1,n.reload)u=1;else if(n.end)return;c.extend(f,b,{dayLimit:a,page:u}),d=!0,m.showLoadingMask(),c.ajax({type:"GET",url:"/product/newsale/selectNewSale",data:f,success:function(e){var t,o;switch(i){case"today":t=s;break;case"week":t=r;break;case"sale":t=l}" "===e?(n.end=!0,n.reload&&t.html(y)):n.reload?(t.html(e),h(t.find(".lazy"))):(o=t.find(".good-info").length,t.append(e),h(t.find(".good-info:gt("+(o-1)+") .lazy"))),n.reload=!1,n.page=u,d=!1,m.hideLoadingMask(),window.rePosFooter()},error:function(){p.show("网络断开连接了~"),d=!1,m.hideLoadingMask()}})}}function i(){c(window).scrollTop()+w>c(document).height()-.25*g.height()-50&&void 0!==E&&n()}var a,s,r,l,d,c=e("jquery"),u=e("swiper"),h=e("lazyload"),p=e("js/plugin/tip"),f=e("js/plugin/filter"),m=e("js/plugin/loading"),g=c("#goods-container"),v=g.children(),s=c(v.get(0)),r=c(v.get(1)).addClass("hide"),l=c(v.get(2)).addClass("hide"),w=c(window).height(),y='<p class="no-result">未找到相关搜索结果</p>',b=e("js/product/query-param"),C=c.extend({},b),j=new Date,x=j.getMonth()+1,k=j.getDate(),q=c("#list-nav"),T={today:{reload:!0,page:0,end:!1},week:{reload:!0,page:0,end:!1},sale:{reload:!0,page:0,end:!1}},E=q.find(".active");e("js/product/suspend-cart"),c("#today a").text(x+"月"+k+"号"),c(".swiper-container .swiper-slide").length>1&&(a=new u(".swiper-container",{lazyLoading:!0,lazyLoadingInPrevNext:!0,loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!0,paginationClickable:!0,pagination:".banner-top .pagination-inner"})),c.ajax({type:"GET",url:"/product/newsale/filter",data:b,success:function(e){g.append(e),f.initFilter({fCbFn:n,hCbFn:function(){E.addClass("active"),E.siblings(".filter").removeClass("active")}})}}),h(c(".lazy")),q.bind("contextmenu",function(e){return!1}),q.on("touchend touchcancel",function(e){var t,o,i,a=c(e.target).closest("li");if(e.preventDefault(),a.hasClass("filter"))a.hasClass("active")?(f.hideFilter(),E.addClass("active"),a.removeClass("active")):(E=a.siblings(".active"),E.removeClass("active"),a.addClass("active"),f.showFilter());else{if(a.hasClass("today")?o="today":a.hasClass("week")?o="week":a.hasClass("sale")&&(o="sale"),t=T[o],!a.hasClass("active")){if(i=a.siblings(".active"),E=a,i.hasClass("filter"))f.hideFilter();else{switch(g.children(".container:not(.hide)").addClass("hide"),o){case"today":s.removeClass("hide");break;case"week":r.removeClass("hide");break;case"sale":l.removeClass("hide")}f.resetFilter(),b=c.extend({},C)}i.removeClass("active"),a.addClass("active")}t.reload&&n()}e.stopPropagation()}),c(window).scroll(function(){window.requestAnimationFrame(i)}),n(),q.on("touchstart","li",function(e){c(this).addClass("bytouch")}).on("touchend touchcancel",function(){q.find("li").removeClass("bytouch")})}),define("js/plugin/filter",["jquery","hammer"],function(e,t,o){function n(){h.addClass("hide")}function i(){h.removeClass("hide")}function a(){var e=g(".filter-body .classify");e.on("touchstart",".shower",function(){e.removeClass("highlight"),g(this).addClass("highlight")}).on("touchend touchcancel",".shower",function(){g(this).removeClass("highlight")})}function s(){var e=g(".filter-body .sub-item");e.on("touchstart",function(){e.removeClass("highlight"),g(this).addClass("highlight")}).on("touchend touchcancel",function(){g(this).removeClass("highlight")})}function r(e){e.hasClass("active")||(e.siblings(".active").removeClass("active"),e.addClass("active"))}function l(e){var t,o,n=e.closest(".sub-classify"),i=n.siblings(".shower");return e.hasClass("chosed")?n:(n.children(".chosed").removeClass("chosed"),e.addClass("chosed"),t=g.trim(e.html()),o=g.trim(i.html()),i.html(o.substring(0,o.indexOf("</span>")+7)+t.substring(0,t.indexOf("<i"))),0===e.index()?i.addClass("default"):i.removeClass("default"),n)}function d(e){var t,o=e.data("id");t=l(e),p&&p({type:t.data("type"),id:o}),n()}function c(e){var t;p=e.fCbFn,f=e.hCbFn,m=e.missStatus,a(),s(),h=g(".filter-mask"),t=new v(h[0]),t.on("tap",function(e){var t,o=g(e.target);e.preventDefault(),o.closest(".filter-body").length>0?(t=o.closest(".sub-item"),t.length>0?(t=o.closest("li"),d(t)):(t=o.closest(".classify-item"),e.srcEvent.stopPropagation(),r(t))):(n(),f&&f())})}function u(){"undefined"!=typeof h&&(g(".sub-classify").each(function(){l(g(this).children(":first-child"))}),r(g(".classify > :first-child")))}var h,p,f,m,g=e("jquery"),v=e("hammer");t.initFilter=c,t.showFilter=i,t.hideFilter=n,t.resetFilter=u}),define("js/product/query-param",["jquery"],function(e,t,o){var n=e("jquery"),i={};n(".query-param").each(function(){var e=n(this);i[e.data("attr")]=e.val()}),o.exports=i}),define("js/product/suspend-cart",["jquery"],function(e,t,o){var n=e("jquery"),i=n("#suspend-cart");n.ajax({type:"GET",url:"/cart/index/count",success:function(e){200===e.code&&i.find(".cart-count").html(e.data.cart_goods_count).removeClass("hide")}})}),define("js/product/newsale/discount",["jquery","swiper","lazyload","hammer","index"],function(e,t,o){function n(e){var t,o,n,i,a,l={};if(!s){if(e){for(o in j)j.hasOwnProperty(o)&&(j[o].reload=!0);switch(C.children(".active").removeClass("active"),x.addClass("active"),e.type){case"gender":t={gender:e.id};break;case"brand":t={brand:e.id};break;case"sort":t={sort:e.id};break;case"color":t={color:e.id};break;case"size":t={size:e.id};break;case"price":t={price:e.id};break;case"discount":t={discount:e.id}}r.extend(b,t)}if(x.hasClass("new")?i="newest":x.hasClass("price")?i="price":x.hasClass("discount")&&(i="discount"),n=j[i],a=n.page+1,n.reload)a=1;else if(n.end)return;r.extend(l,b,{type:i,order:n.order,page:a}),s=!0,h.showLoadingMask(),r.ajax({type:"GET",url:"/product/newsale/selectNewSale",data:l,success:function(e){var t,o;switch(i){case"newest":t=m;break;case"price":t=g;break;case"discount":t=v}" "===e?(n.end=!0,n.reload&&t.html(y)):n.reload?(t.html(e),d(t.find(".lazy"))):(o=t.find(".good-info").length,t.append(e),d(t.find(".good-info:gt("+(o-1)+") .lazy"))),n.reload=!1,n.page=a,s=!1,h.hideLoadingMask(),window.rePosFooter()},error:function(){c.show("网络断开连接了~"),s=!1,h.hideLoadingMask()}})}}function i(){r(window).scrollTop()+w>r(document).height()-.25*p.height()-50&&void 0!==x&&n()}var a,s,r=e("jquery"),l=e("swiper"),d=e("lazyload"),c=e("js/plugin/tip"),u=e("js/plugin/filter"),h=e("js/plugin/loading"),p=r("#goods-container"),f=p.children(),m=r(f.get(0)),g=r(f.get(1)),v=r(f.get(2)),w=r(window).height(),y='<p class="no-result">未找到相关搜索结果</p>',b=e("js/product/query-param"),C=r("#list-nav"),j={newest:{order:1,reload:!0,page:0,end:!1},price:{order:0,reload:!0,page:0,end:!1},discount:{order:0,reload:!0,page:0,end:!1}},x=C.find(".active");e("js/product/suspend-cart"),r(".swiper-container .swiper-slide").length>1&&(a=new l(".swiper-container",{lazyLoading:!0,lazyLoadingInPrevNext:!0,loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!0,paginationClickable:!0,pagination:".banner-top .pagination-inner"})),r.ajax({type:"GET",url:"/product/newsale/filter",data:b,success:function(e){p.append(e),u.initFilter({fCbFn:n,hCbFn:function(){x.addClass("active"),x.siblings(".filter").removeClass("active")},missStatus:!0})}}),d(r(".lazy")),C.bind("contextmenu",function(e){return!1}),C.on("touchend touchcancel",function(e){var t,o,i,a=r(e.target).closest("li");if(e.preventDefault(),"undefined"!=typeof a&&0!==a.length){if(a.hasClass("filter"))a.hasClass("active")?(u.hideFilter(),x.addClass("active"),a.removeClass("active")):(x=a.siblings(".active"),x.removeClass("active"),a.addClass("active"),u.showFilter());else{if(a.hasClass("new")?o="newest":a.hasClass("price")?o="price":a.hasClass("discount")&&(o="discount"),t=j[o],a.hasClass("active")){if(a.hasClass("new"))return;(a.hasClass("price")||a.hasClass("discount"))&&(a.find(".icon > .iconfont").toggleClass("cur"),x=a,t.reload=!0,t.order=0===t.order?1:0)}else{if(i=a.siblings(".active"),x=a,i.hasClass("filter"))u.hideFilter();else switch(p.children(".container:not(.hide)").addClass("hide"),o){case"newest":m.removeClass("hide");break;case"price":g.removeClass("hide");break;case"discount":v.removeClass("hide")}i.removeClass("active"),a.addClass("active")}t.reload&&n()}e.stopPropagation()}}),r(window).scroll(function(){window.requestAnimationFrame(i)}),n(),C.on("touchstart","li",function(e){r(this).addClass("bytouch")}).on("touchend touchcancel",function(){C.find("li").removeClass("bytouch")})}),define("js/product/list",["jquery","hammer","lazyload"],function(e,t,o){function n(e){var t,o,n,i,s,r={};if(!a){if(e){for(o in I)I.hasOwnProperty(o)&&(I[o].reload=!0);switch(E.children(".active").removeClass("active"),z.addClass("active"),e.type){case"gender":t={gender:e.id};break;case"brand":t={brand:e.id};break;case"sort":t={sort:e.id};break;case"color":t={color:e.id};break;case"size":t={size:e.id};break;case"price":t={price:e.id};break;case"discount":t={discount:e.id}}d.extend(T,t)}if(z.hasClass("new")?i="newest":z.hasClass("price")?i="price":z.hasClass("discount")&&(i="discount"),n=I[i],s=n.page+1,n.reload)s=1;else if(n.end)return;d.extend(r,T,{type:i,order:n.order,page:s}),a=!0,v.showLoadingMask(),d.ajax({type:"GET",url:"/index/search/search",data:r,success:function(e){var t,o,r='<p class="no-result">未找到相关搜索结果</p>';switch(i){case"newest":o=y;break;case"price":o=b;break;case"discount":o=C}if(" "===e?(n.end=!0,n.reload&&o.html(r)):n.reload?(o.html(e),u(o.find(".lazy"))):(t=o.find(".good-info").length,o.append(e),u(o.find(".good-info:gt("+(t-1)+") .lazy"))),n.reload=!1,n.page=s,a=!1,v.hideLoadingMask(),window.rePosFooter(),window._yas)switch(i){case"newest":window._yas(1*new Date,"1.0.13.6.3","yohobuy_m",window._ozuid,"",".new-goods .good-info .good-detail-img .good-thumb");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");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")}}})}}function i(){d(window).scrollTop()+j>d(document).height()-.25*w.height()&&n()}var a,s,r,l,d=e("jquery"),c=e("hammer"),u=e("lazyload"),h=d("#brand-header"),p=d("#intro-box"),f=e("js/plugin/filter"),m=e("js/index/write-search"),g=e("js/plugin/tip"),v=e("js/plugin/loading"),w=d("#goods-container"),y=w.children(".new-goods"),b=w.children(".price-goods"),C=w.children(".discount-goods"),j=d(window).height(),x=d("#search-input input"),k=d(".search-icon"),q=d("#search-input .clear-input"),T=e("js/product/query-param"),E=d("#list-nav"),I={newest:{order:1,reload:!0,page:0,end:!1},price:{order:0,reload:!0,page:0,end:!1},discount:{order:0,reload:!0,page:0,end:!1}},z=E.find(".active");x.on("input",function(){""===x.val()?(k.css("color","#b2b2b2"),q.addClass("hide")):(k.css("color","#666"),q.removeClass("hide"))}),q.on("touchend",function(){x.val("").trigger("input")}),d("#search").on("touchend",function(){return d(this).closest("form").submit(),!1}),e("js/product/suspend-cart"),d.ajax({type:"GET",url:"/search/filter",data:T,success:function(e){w.append(e),f.initFilter({fCbFn:n,hCbFn:function(){z.addClass("active"),z.siblings(".filter").removeClass("active")}})}}),u(d(".lazy")),m.bindWirteLocal(d("#search-form")),E.bind("contextmenu",function(e){return!1}),E.on("touchend touchcancel",function(e){var t,o,i,a=d(e.target).closest("li");if(a.hasClass("filter"))a.hasClass("active")?(f.hideFilter(),z.addClass("active"),a.removeClass("active")):(z=a.siblings(".active"),z.removeClass("active"),a.addClass("active"),f.showFilter());else{if(a.hasClass("new")?o="newest":a.hasClass("price")?o="price":a.hasClass("discount")&&(o="discount"),t=I[o],a.hasClass("active")){if(a.hasClass("new"))return;(a.hasClass("price")||a.hasClass("discount"))&&(a.find(".icon > .iconfont").toggleClass("cur"),z=a,t.reload=!0,t.order=0===t.order?1:0)}else{if(i=a.siblings(".active"),z=a,i.hasClass("filter"))f.hideFilter();else switch(w.children(".container:not(.hide)").addClass("hide"),o){case"newest":y.removeClass("hide");break;case"price":b.removeClass("hide");break;case"discount":C.removeClass("hide")}i.removeClass("active"),a.addClass("active")}t.reload&&n()}}),d(window).scroll(function(){window.requestAnimationFrame(i)}),h.length>0&&(s=new c(h.children(".btn-intro")[0]),s.on("tap",function(){p.removeClass("hide"),d("body").addClass("overflow-hidden")}),r=new c(document.getElementById("intro-box")),r.on("tap",function(e){var t=d(e.target);e.srcEvent.preventDefault(),(0===t.closest("#brand-intro").length||t.hasClass("close-intro"))&&(p.addClass("hide"),d("body").removeClass("overflow-hidden"))}),l=new c(h.children(".btn-col")[0]),l.on("tap",function(e){var t,o=d(e.target).closest(".btn-col"),n=h.data("id");t=o.hasClass("coled")?"cancel":"ok",d.ajax({type:"POST",url:"/product/opt/favoriteBrand",data:{id:n,opt:t},success:function(e){200===e.code?(o.toggleClass("coled"),"ok"===t?g.show("添加收藏成功"):g.show("取消收藏成功")):400===e.code?location.href=e.data:g.show(e.message)},error:function(){g.show("网络断开连接了~")}})})),n(),E.on("touchstart","li",function(){E.find("li").removeClass("bytouch"),d(this).addClass("bytouch")}).on("touchend touchcancel","li",function(){E.find("li").removeClass("bytouch")})}),define("js/product/detail/detail",["jquery","swiper","hammer","lazyload","index"],function(e,t,o){function n(){var e=a(".cart-bar"),t=setInterval(function(){e?(window.reMarginFooter(".cart-bar"),clearInterval(t)):e=a(".cart-bar")},200)}var i,a=e("jquery"),s=e("swiper"),r=e("hammer"),l=e("lazyload"),d=a(".goodsDiscount .discount-folder"),c=a(".goodsDiscount .first-item span"),u=document.getElementById("goodsDiscount"),h=u&&new r(u),p=a(u).find(".first-item"),f=a(".cart-bar");n(),l(a("img.lazy")),i=new s(".banner-swiper",{lazyLoading:!0,lazyLoadingInPrevNext:!0,paginationClickable:!0,pagination:".banner-top .pagination-inner",nextButton:".my-swiper-button-next",prevButton:".my-swiper-button-prev",spaceBetween:3}),0===d.children().length&&(d.css("display","none"),c.html("")),h&&d.children().length>0&&h.on("tap",function(e){d.is(":hidden")?(p.removeClass("short-text"),c.removeClass("icon-down").addClass("icon-up").html("&#xe608;"),d.slideDown()):(p.addClass("short-text"),c.removeClass("icon-up").addClass("icon-down").html("&#xe609;"),d.slideUp())}),e("js/product/detail/desc"),e("js/product/detail/comments-consults"),e("js/product/recommend-for-you-product-desc"),a.ajax({type:"GET",url:"/cart/index/count",success:function(e){200===e.code&&f.find(".num-tag").html(e.data.cart_goods_count).removeClass("hide")}}),a(".good-detail-page").length>0&&a("#yoho-footer").css("border-top","1px solid #e0e0e0"),e("js/product/detail/like")}),define("js/product/detail/desc",["jquery","lazyload","swiper","index"],function(e,t,o){function n(e){var t,o;e.length>0&&(t=e[0].getBoundingClientRect().right,o=e.find(".swiper-slide:last-child")[0].getBoundingClientRect().right,0>o-t?e.next(".tips").css("display","none"):e.next(".tips").css("display","block"))}function i(e,t){var o=null;c(e).each(function(n,i){o=c(e).slice(n,n+t),o.length===t&&n%t===0&&c(o).wrapAll(c('<div class="js-wraper"></div>'))})}function a(){v||w||(v=!0,p.showLoadingMask(),c.ajax({type:"GET",url:m,success:function(e){r=c("#productDesc"),r.append(e),window.rePosFooter(),u(r.find("img.lazy")),l=new h("#size-swiper-container",{slidesPerView:"auto"}),d=new h("#reference-swiper-container",{slidesPerView:"auto"}),n(c("#size-swiper-container")),n(c("#reference-swiper-container")),i(".detail .column",2),v=!1,w=!0,p.hideLoadingMask()},error:function(){f.show("网络断开连接了~"),v=!1,p.hideLoadingMask()}}))}function s(){(!w||c(window).scrollTop()+g>=c(document).height()-200)&&a()}var r,l,d,c=e("jquery"),u=e("lazyload"),h=e("swiper"),p=e("js/plugin/loading"),f=e("js/plugin/tip"),m=c("#introUrl").val(),g=c(window).height(),v=!1,w=!1;c(window).scroll(function(){window.requestAnimationFrame(s)})}),define("js/product/detail/comments-consults",["jquery","hammer"],function(e,t,o){var n,i,a=e("jquery"),s=e("js/plugin/tip"),r=e("hammer"),l=document.getElementById("nav-tab"),d=l&&new r(l),c=document.getElementById("goto-consult"),u=c&&new r(c);!function(){i=a("#nav-tab .consults-num").html()-0,n=a("#nav-tab .comments-num").html()-0,a("#nav-tab li").each(function(){a(this).removeClass("focus")}),a("#feedback-content .content").each(function(){a(this).addClass("hide")}),0!==n?(a("#nav-tab .comment-nav").addClass("focus"),a("#feedback-content .comment-content").removeClass("hide")):0!==i&&(a("#nav-tab .consult-nav").addClass("focus"),a("#feedback-content .consult-content").removeClass("hide"))}(),d&&d.on("tap",function(e){var t=a(e.target).closest("li"),o=t.index();t.hasClass("comment-nav")&&0===n?s.show("暂无商品评价"):t.hasClass("focus")||(a("#nav-tab li").each(function(){a(this).removeClass("focus")}),a("#feedback-content .content").each(function(){a(this).addClass("hide")}),t.addClass("focus"),a("#feedback-content .content:eq("+o+")").removeClass("hide"))}),u&&u.on("tap",function(){location.href=a(c).data("href")}),a(".goods-consults-page").length>0&&a("#yoho-header").css("position","fixed").css("top","0")}),define("js/product/recommend-for-you-product-desc",["swiper","jquery","index"],function(e,t,o){function n(){h||u||(h=!0,d&&r.get(d).then(function(e){e.length<5?l.css("display","none"):(l.html(e).show(),r("#swiper-recommend").length&&(a=new s("#swiper-recommend",{slidesPerView:"auto",grabCursor:!0,slideElement:"a",lazyLoading:!0,watchSlidesVisibility:!0}))),h=!1,u=!0}).fail(function(){l.hide()}))}function i(){(!u||r(window).scrollTop()+c>=r(document).height()-50)&&n()}var a,s=e("swiper"),r=e("jquery"),l=r(".recommend-for-you"),d=r("#preferenceUrl").val(),c=r(window).height(),u=!1,h=!1;r(window).scroll(function(){window.requestAnimationFrame(i)})}),define("js/product/detail/like",["jquery","hammer"],function(e,t,o){var n=e("jquery"),i=e("hammer"),a=e("js/plugin/tip"),s=e("js/shopping-cart/chose-panel"),r=document.getElementById("likeBtn"),l=r&&new i(r),d=document.getElementById("addtoCart"),c=d&&new i(d),u=n("#productId").val();l&&l.on("tap",function(e){var t,o,i=n(e.target);i.hasClass("liked")?(t="cancel",o=0):(t="ok",o=1),n.ajax({type:"POST",url:"/product/opt/favoriteProduct",data:{id:u,opt:t},success:function(e){200===e.code?(i.toggleClass("liked"),"cancel"===t?a.show("取消收藏成功"):"ok"===t&&a.show("收藏成功")):400===e.code?location.href=e.data:a.show(e.message)},error:function(){a.show("网络断开连接了~")}}),window._yas&&window._yas.sendCustomInfo({pd:u,fa:o},!0)}),c&&c.on("tap",function(e){s.show(),window._yas&&window._yas.sendCustomInfo({pd:u,by:1},!0)})}),define("js/shopping-cart/chose-panel",["jquery"],function(e,t,o){function n(){r(".chose-panel").show(),r("body").css("overflow","hidden"),a=r("#good-num")}function i(){r(".chose-panel").hide(),r("body").css("overflow","auto")}var a,s,r=e("jquery");r(".yoho-page").on("touchstart",".chose-panel",function(e){var t=r(e.target);t.closest(".main").length>0||i()}).on("touchstart","#chose-btn-sure",function(){}).on("touchstart",".block",function(e){var t,o,n,i=r(this),a=r(e.target).closest(".chose-items"),l=i.closest(".block-list").siblings(":first"),d=i.data("numstr").split("/");if(i.siblings(".chosed").removeClass("chosed"),i.toggleClass("chosed"),o=i.index(),s=r(".block-list>ul>li.chosed"),i.closest(".block-list").hasClass("color-list")&&r(".chose-panel").find(".thumb").addClass("hide").eq(o).removeClass("hide"),0===s.length)i.closest("ul>li").each(function(){r(this).removeClass("zero-stock"),0===r(this).data("num")-0&&r(this).addClass("zero-stock")}),l.find("ul>li").each(function(){r(this).removeClass("zero-stock"),0===r(this).data("num")-0&&r(this).addClass("zero-stock")});else if(1===s.length&&i.hasClass("chosed"))for(t=s.data("numstr").split("/"),l.find(".block").removeClass("zero-stock"),n=0;n<t.length;n++)0===t[n]-0&&l.find(".block").eq(n).addClass("zero-stock");else if(1!==s.length||i.hasClass("chosed")){if(2===s.length){for(l.find(".block").removeClass("zero-stock"),n=0;n<d.length;n++)0===d[n]-0&&l.find(".block").eq(n).addClass("zero-stock");t=l.find(".chosed").data("numstr").split("/"),a.find(".num .left-num").html("剩余"+t[o]+"件"),2===s.closest(".zero-stock").length&&(r("#chose-btn-sure").css("background-color","#c0c0c0"),r("#chose-btn-sure").html("已售罄"))}}else l.find("ul>li").each(function(){r(this).removeClass("zero-stock"),0===r(this).data("num")-0&&r(this).addClass("zero-stock")}),a.find(".num .left-num").html("")}).on("touchstart",".btn-minus",function(){var e=+a.val(),t=r(".block-list>ul>li.chosed");t.length<2||0!==e&&a.val(e-1)}).on("touchstart",".btn-plus",function(){var e=+a.val();r(".block-list>ul>li.chosed").length<2||a.val(e+1)}),t.show=n}),define("js/product/detail/consultform",["jquery"],function(e,t,o){var n,i=e("jquery"),a=e("js/plugin/tip"),s=e("js/plugin/loading"),r=i(".consult-form"),l=i("#submit"),d=i("#content"),c=i("#product_id").val();l.on("touchend",function(){return d.blur(),r.submit(),!1}).on("touchstart",function(){i(this).addClass("highlight")}).on("touchend touchcancel",function(){i(this).removeClass("highlight")}),d.on("focus",function(){"请输入咨询内容"===d.val()&&d.val("")}).on("blur",function(){""===d.val()&&d.val("请输入咨询内容")}),r.on("submit",function(){var e;return n?!1:(e=d.val(),e&&"请输入咨询内容"!==e?(n=!0,s.showLoadingMask(),i.ajax({method:"POST",url:"/product/detail/consultsubmit",data:{product_id:c,content:e}}).then(function(e){"object"!==i.type(e)&&(e={}),200!==e.code?(a.show(e.message||"网络出了点问题~"),n=!1,s.hideLoadingMask()):(a.show("提交成功~"),setTimeout(function(){window.history.go(-1)},3e3))}).fail(function(){a.show("网络出了点问题~"),n=!1}),!1):(a.show("咨询内容不能为空"),!1))})}),define("js/product/newsale/hot-rank",["jquery","swiper","lazyload","index"],function(e,t,o){function n(e,t,o,n){h.showLoadingMask(),d.ajax({type:"GET",url:"/product/newsale/selectHotrank?"+t,dataType:"html",data:{page:e,tab_id:o,notab:n},success:function(t){" "===t?d(".rank-main").length<1&&d(".goods-nav").length<1?d("#hotRank").html(v):1===e&&(l=d(".goods-nav").prop("outerHTML"),d("#hotRank").html(l+v)):(d(".no-result").remove(),1===e&&d(".rank-main").remove(),d("#hotRank").append(t)),u(d("img.lazy")),d(".rank-main ul li:gt(9)").find(".item-content i").removeClass("top"),a=d(window).height(),0!==d(".rank-main").length?(d("#yoho-footer").css("position","static"),s=d(".rank-main").find("ul").offset().top):d("#yoho-footer").css("position","fixed"),r=new c(".s-goods-nav",{grabCursor:!0,slidesPerView:"auto",slideElement:"li"}),h.hideLoadingMask()}})}function i(){2!==p&&(d(window).scrollTop()+a<s+d("#hotRank").height()-100||(p=2,f=1,n(p,m,g,f)))}var a,s,r,l,d=e("jquery"),c=e("swiper"),u=e("lazyload"),h=e("js/plugin/loading"),p=1,f=0,m="",g="",v='<p class="no-result">未找到相关搜索结果</p>';e("js/product/suspend-cart"),d(window).scroll(function(){window.requestAnimationFrame(i)}),n(p,m,g,f),d("#hotRank").on("touchend touchcancel",function(e){var t=t||window.event,o=t.target||t.srcElement;"span"===o.nodeName.toLowerCase()&&(d(".s-goods-nav .nav-item").removeClass("active"),o.parentNode.className="active "+o.parentNode.className,g=o.getAttribute("data-id")?o.getAttribute("data-id"):"",m=o.getAttribute("data-sort")?o.getAttribute("data-sort"):"",p=1,f=1,n(p,m,g,f))}),d("#hotRank").bind("contextmenu",function(e){return!1}),d("#hotRank").on("touchstart",function(e){var t=t||window.event,o=t.target||t.srcElement;"span"===o.nodeName.toLowerCase()&&(o.parentNode.className="bgActive "+o.parentNode.className)}).on("touchend touchcancel",function(){d(".s-goods-nav .nav-item").removeClass("bgActive")})}),define("js/me/entry",["jquery","hammer","lazyload","handlebars","source-map","swiper","mlellipsis","index"],function(e,t,o){e("js/me/order"),e("js/me/order-detail"),e("js/me/fav"),e("js/me/suggest"),e("js/me/index"),e("js/me/coupons"),e("js/me/online-service"),e("js/me/address"),e("js/me/suggest"),e("js/me/browse-record"),e("js/me/address-act"),e("js/me/logistic"),e("js/me/pay"),e("js/me/personal-details"),e("js/me/currency")}),define("js/me/order",["jquery","hammer","lazyload","handlebars","source-map"],function(e,t,o){function n(e){var t={type:p,page:f.page+1},o=e&&!e.noLoadingMask;m||(m=!0,o&&g.showLoadingMask(),s.ajax({type:"GET",url:"/home/getOrders",data:t,success:function(e){var n;" "!==e?(f.page=t.page,1===t.page?(u.html(e),l(u.find(".lazy"),{try_again_css:"order-failure"})):(n=u.children(".order").length,u.append(e),l(u.children(".order:gt("+(n-1)+")").find(".lazy"),{try_again_css:"order-failure"})),window.rePosFooter()):f.end=!0,m=!1,o&&g.hideLoadingMask()}}))}function i(){f.end===!1&&s(window).scrollTop()+h>s(document).height()-.25*c.height()&&n({noLoadingMask:!0})}var a,s=e("jquery"),r=e("hammer"),l=e("lazyload"),d=s("#order-nav > li"),c=s("#order-container"),u=c.children(".orders:not(.hide)"),h=s(window).height(),p=d.filter(".active").data("type"),f={page:0,end:!1},m=!1,g=e("js/plugin/loading"),v=e("js/me/dialog");l({try_again_css:"order-failure"}),function(){var e=d.length;4!==e&&d.width(100/e+"%")}(),g.init(s("body")),a=new r(document.getElementById("order-container")),a.on("tap",function(e){var t,o,n,i=s(e.target);i.closest(".locHref").length>0||(t=i.closest(".order"),o=t.data("id"),i.closest(".del").length>0?v.showDialog({
dialogText:"确定删除订单吗?",hasFooter:{leftBtnText:"取消",rightBtnText:"确定"}},function(){s.ajax({type:"GET",url:"/home/delOrder",data:{id:o},success:function(e){200===e.code&&(v.showDialog({dialogText:"删除订单成功",autoHide:!0,fast:!0}),history.go(0))},error:function(){v.showDialog({dialogText:"删除订单失败",autoHide:!0,fast:!0})}})}):i.closest(".cancel").length>0?v.showDialog({dialogText:"确定取消订单吗?",hasFooter:{leftBtnText:"取消",rightBtnText:"确定"}},function(){s.ajax({type:"GET",url:"/home/cancelOrder",data:{id:o},success:function(e){200===e.code&&(v.showDialog({dialogText:"取消订单成功",autoHide:!0,fast:!0}),history.go(0))},error:function(){v.showDialog({dialogText:"取消订单失败",autoHide:!0,fast:!0})}})}):i.closest(".order-goods").length>0&&(n=t.data("href"),location.href=n))}),s(window).scroll(function(){window.requestAnimationFrame(i)}),n()}),define("js/me/dialog",["jquery","handlebars","source-map","hammer"],function(e,t,o){var n,i,a,s=e("jquery"),r=e("handlebars"),l=e("hammer");i='<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>',a=r.compile(i),t.showDialog=function(e,t){var o,i,r,d=a(e);s(".dialog-wrapper").remove(),s("body").append(s(d)),o=s(".dialog-box"),n=s(".dialog-wrapper"),r=new l(document.getElementById("dialog-wrapper")),e.fast?n.css({display:"block"}):n.fadeIn(),o.css({top:"50%",marginTop:-(o.height()/2)}),e.autoHide&&(i=1e3,e.autoHide>1&&(i=e.autoHide),setTimeout(function(){n.fadeOut()},i)),r.on("tap",function(e){s(e.target).hasClass("dialog-left-btn")?n.fadeOut():s(e.target).hasClass("dialog-right-btn")&&t()})}}),define("js/me/order-detail",["jquery","lazyload","hammer","handlebars","source-map"],function(e,t,o){var n,i=e("jquery"),a=e("lazyload"),s=e("hammer"),r=e("js/me/dialog"),l=e("js/plugin/tip"),d=i("#order-detail").data("id");a({try_again_css:"order-failure"}),n=new s(document.getElementsByClassName("opt")[0]),n.on("tap",function(e){var t=i(e.target);t.hasClass("btn-del")?r.showDialog({dialogText:"确定删除订单吗?",hasFooter:{leftBtnText:"取消",rightBtnText:"确定"}},function(){i.ajax({type:"GET",url:"/home/delOrder",data:{id:d}}).then(function(e){i("#dialog-wrapper").hide(),e||l.show("网络错误"),200===e.code?l.show("删除成功"):l.show(e.message||"网络错误"),window.location.href="/home/orders"}).fail(function(){l.show("网络错误")})}):t.hasClass("btn-cancel")&&r.showDialog({dialogText:"确定取消订单吗?",hasFooter:{leftBtnText:"取消",rightBtnText:"确定"}},function(){i.ajax({type:"GET",url:"/home/cancelOrder",data:{id:d}}).then(function(e){i("#dialog-wrapper").hide(),e||l.show("网络错误"),200===e.code?l.show("取消成功"):l.show(e.message||"网络错误"),window.location.reload()}).fail(function(){l.show("网络错误")})})})}),define("js/me/fav",["jquery","hammer","swiper","handlebars","source-map","index"],function(e,t,o){function n(e){p.filter(".active").removeClass("active"),p.eq(e).addClass("active"),f.filter(".show").removeClass("show"),f.eq(e).addClass("show")}function i(e){var t,o,n=/container-(\d+)['"]{1}/gi,i=/\d+/,a=e.match(n),s=a.length;for(t=0;s>t;t++)o=a[t].match(i)[0],m[o]=new u("#swiper-container-"+o,{slidesPerView:"auto",grabCursor:!0,slideElement:"li",wrapperClass:"swiper-wrapper-"+o,lazyLoading:!0,watchSlidesVisibility:!0})}function a(e,t,o){"favBrand"===t?q=!0:k=!0,d.ajax({method:"post",url:"/home/"+t,data:{page:o},success:function(o){"favBrand"===t?v.addClass("hide"):g.addClass("hide")," "===o?(e.closest(".fav-type").find(".fav-content-loading").addClass("hide"),e.closest(".fav-type").find(".fav-null-box").removeClass("hide")):"end"===o?e.closest(".fav-type").find(".fav-load-background").removeClass("fav-load-background").html("没有更多了"):o.length>10&&(e.append(o),e.closest(".fav-type").find(".fav-content-loading").remove(),"favBrand"===t?(i(o),q=!1):k=!1),window.rePosFooter()}})}function s(){d(window).scrollTop()+w>=d(document).height()-.25*C.height()-y&&(T?(v.filter(".hide").removeClass("hide"),q||(x++,a(C,"favBrand",x))):(g.filter(".hide").removeClass("hide"),k||(j++,a(b,"favProduct",j))))}var r,l,d=e("jquery"),c=e("hammer"),u=e("swiper"),h=e("js/me/dialog"),p=d("#fav-tab > li"),f=d(".fav-content > .fav-type"),m={},g=d(".fav-load-more"),v=d(".fav-brand-load-more"),w=d(window).height(),y=d("#yoho-footer").height(),b=d(".fav-product-list"),C=d(".fav-brand-swiper-wrapper"),j=1,x=1,k=!0,q=!0,T=!1;d("#fav-tab").hasClass("brand-tab")?(n(1),a(C,"favBrand",1),T=!0,window.rePosFooter()):(n(0),a(b,"favProduct",1),T=!1,window.rePosFooter()),r=new c(document.getElementById("fav-tab")),r.on("tap",function(e){var t,o=d(e.target).closest("li");0===o.length||o.hasClass("active")||(t=o.index(),0===t?(T=!1,0===b.find("li").length&&b.closest(".fav-type").find(".fav-null-box").hasClass("hide")&&a(b,"favProduct",1)):(T=!0,0===C.find("div").length&&C.closest(".fav-type").find(".fav-null-box").hasClass("hide")&&a(C,"favBrand",1)),n(t),window.rePosFooter())}),l=new c(document.getElementById("fav-content")),l.on("tap",function(e){var t="";d(e.target).hasClass("del-fav")&&h.showDialog({dialogText:"您确定要取消收藏吗?",hasFooter:{leftBtnText:"取消",rightBtnText:"确定"}},function(){t=d(e.target).closest("li").attr("data-id"),d.ajax({method:"post",url:"/home/favoriteDel",data:{id:t}}).then(function(t){200===t.code?(h.showDialog({autoHide:!0,fast:!0,dialogText:"已经取消收藏"}),d(e.target).closest("li").remove()):400===t.code?h.showDialog({autoHide:!0,fast:!0,dialogText:t.message}):h.showDialog({autoHide:!0,fast:!0,dialogText:"取消收藏失败"})}).fail(function(){h.showDialog({autoHide:!0,dialogText:"网络错误~"})})})}),d(window).scroll(s),d(document).on("touchend",".swiper-header",function(){var e=d(this).find(".fav-more").attr("href");window.location.href=e})}),define("js/me/suggest",["jquery","hammer","lazyload","handlebars","source-map"],function(e,t,o){var n,i,a,s,r=e("jquery"),l=e("hammer"),d=e("lazyload"),c=e("handlebars"),u=e("js/me/dialog"),h=r(".upload-img-list"),p=r(".suggest-item .like-btn"),f=r(".suggest-item .dislike-btn"),m=r(".img-add"),g="",v=0;e("js/me/jquery.upload"),a='{{# imgList}}<li>{{# imgUrl}}<img src="{{.}}" /><span class="upload-img-remove"></span>{{/ imgUrl}}</li>{{/ imgList}}',s=c.compile(a),r("#upload-img").upload({auto:!0,fileType:"image/*",uploadScript:"/home/suggestimgUpload",fileObjName:"fileData",fileSizeLimit:300,height:"100%",width:"100%",multi:!1,onAddQueueItem:function(e){h.html(s({imgList:!0}))},onUploadComplete:function(e,t){h.html(""),g=JSON.parse(t).imgList[0].imgRelUrl,h.html(s(JSON.parse(t))),m.hide(),v++}}),d(),n=new l(document.getElementById("yoho-header")),n.on("tap",function(e){var t=r("#suggest-textarea").val(),o=/\S+/;if(r(e.target).hasClass("nav-btn")){if(!o.test(t))return void u.showDialog({autoHide:!0,dialogText:"意见不能为空"});r.ajax({method:"post",url:"/home/savesuggest",data:{content:t,image:g}}).then(function(e){200===e.code?(u.showDialog({autoHide:!0,dialogText:"提交成功"}),setTimeout(function(){location.pathname="home/suggest"},2e3)):u.showDialog({autoHide:!0,dialogText:"提交失败~"})}).fail(function(){u.showDialog({autoHide:!0,dialogText:"网络错误~"})})}}),null!==document.getElementById("img-form")&&(i=new l(document.getElementById("img-form")),i.on("tap",function(e){r(e.target).hasClass("upload-img-remove")&&(h.html(""),g="",v--,setTimeout(function(){m.show()},50))})),p.bind("click",function(){var e=r(this).closest(".suggest-item").attr("data-id"),t=r(this);r.ajax({method:"post",url:"/home/upAndDown",data:{suggest_id:e,reliable:1}}).then(function(e){200===e.code&&(t.closest(".suggest-type").removeClass("show"),t.closest(".suggest-item").find(".suggest-good").addClass("show"))}).fail(function(e){u.showDialog({autoHide:!0,dialogText:"网络错误~"})})}),f.bind("click",function(){var e=r(this).closest(".suggest-item").attr("data-id"),t=r(this);r.ajax({method:"post",url:"/home/upAndDown",data:{suggest_id:e,reliable:2}}).then(function(e){200===e.code&&(t.closest(".suggest-type").removeClass("show"),t.closest(".suggest-item").find(".suggest-bad").addClass("show"))}).fail(function(e){u.showDialog({autoHide:!0,dialogText:"网络错误~"})})})}),define("js/me/jquery.upload",["jquery"],function(e,t,o){var n=e("jquery");!function(e){var t={init:function(o){return this.each(function(){var n=e(this);n.data("uploadifive",{inputs:{},inputCount:0,fileID:0,queue:{count:0,selected:0,replaced:0,errors:0,queued:0,cancelled:0},uploads:{current:0,attempts:0,successful:0,errors:0,count:0}});var a=n.data("uploadifive"),s=a.settings=e.extend({auto:!0,buttonClass:!1,buttonText:"Select Files",checkScript:!1,dnd:!0,dropTarget:!1,fileObjName:"Filedata",fileSizeLimit:0,fileType:!1,formData:{},height:30,itemTemplate:!1,method:"post",multi:!0,overrideEvents:[],queueID:!1,queueSizeLimit:0,removeCompleted:!1,simUploadLimit:0,truncateLength:0,uploadLimit:0,uploadScript:"uploadifive.php",width:100},o);if(isNaN(s.fileSizeLimit)){var r=1.024*parseInt(s.fileSizeLimit);s.fileSizeLimit.indexOf("KB")>-1?s.fileSizeLimit=1e3*r:s.fileSizeLimit.indexOf("MB")>-1?s.fileSizeLimit=1e6*r:s.fileSizeLimit.indexOf("GB")>-1&&(s.fileSizeLimit=1e9*r)}else s.fileSizeLimit=1024*s.fileSizeLimit;if(a.inputTemplate=e('<input type="file">').css({"font-size":s.height+"px",opacity:0,position:"absolute",right:"-3px",top:"-3px","z-index":999}),a.createInput=function(){var o=a.inputTemplate.clone(),i=o.name="input"+a.inputCount++;s.multi&&o.attr("multiple",!0),s.fileType&&o.attr("accept",s.fileType),o.bind("change",function(){a.queue.selected=0,a.queue.replaced=0,a.queue.errors=0,a.queue.queued=0;var o=this.files.length;if(a.queue.selected=o,a.queue.count+o>s.queueSizeLimit&&0!==s.queueSizeLimit)e.inArray("onError",s.overrideEvents)<0&&alert("The maximum number of queue items has been reached ("+s.queueSizeLimit+"). Please select fewer files."),"function"==typeof s.onError&&s.onError.call(n,"QUEUE_LIMIT_EXCEEDED");else{for(var r=0;o>r;r++)file=this.files[r],a.addQueueItem(file);a.inputs[i]=this,a.createInput()}s.auto&&t.upload.call(n),"function"==typeof s.onSelect&&s.onSelect.call(n,a.queue)}),a.currentInput&&a.currentInput.hide(),a.button.append(o),a.currentInput=o},a.destroyInput=function(t){e(a.inputs[t]).remove(),delete a.inputs[t],a.inputCount--},a.drop=function(o){a.queue.selected=0,a.queue.replaced=0,a.queue.errors=0,a.queue.queued=0;var i=o.dataTransfer,r=i.name="input"+a.inputCount++,l=i.files.length;if(a.queue.selected=l,a.queue.count+l>s.queueSizeLimit&&0!==s.queueSizeLimit)e.inArray("onError",s.overrideEvents)<0&&alert("The maximum number of queue items has been reached ("+s.queueSizeLimit+"). Please select fewer files."),"function"==typeof s.onError&&s.onError.call(n,"QUEUE_LIMIT_EXCEEDED");else{for(var d=0;l>d;d++)file=i.files[d],a.addQueueItem(file);a.inputs[r]=i}s.auto&&t.upload.call(n),"function"==typeof s.onDrop&&s.onDrop.call(n,i.files,i.files.length),o.preventDefault(),o.stopPropagation()},a.fileExistsInQueue=function(e){for(var t in a.inputs){input=a.inputs[t],limit=input.files.length;for(var o=0;o<limit;o++)if(existingFile=input.files[o],existingFile.name==e.name&&!existingFile.complete)return!0}return!1},a.removeExistingFile=function(e){for(var o in a.inputs){input=a.inputs[o],limit=input.files.length;for(var i=0;i<limit;i++)existingFile=input.files[i],existingFile.name!=e.name||existingFile.complete||(a.queue.replaced++,t.cancel.call(n,existingFile,!0))}},0==s.itemTemplate?a.queueItem=e('<div class="uploadifive-queue-item"> <a class="close" href="#">X</a> <div><span class="filename"></span><span class="fileinfo"></span></div> <div class="progress"> <div class="progress-bar"></div> </div> </div>'):a.queueItem=e(s.itemTemplate),a.addQueueItem=function(o){if(e.inArray("onAddQueueItem",s.overrideEvents)<0){a.removeExistingFile(o),o.queueItem=a.queueItem.clone(),o.queueItem.attr("id",s.id+"-file-"+a.fileID++),o.queueItem.find(".close").bind("click",function(){return t.cancel.call(n,o),!1});var i=o.name;i.length>s.truncateLength&&0!=s.truncateLength&&(i=i.substring(0,s.truncateLength)+"..."),o.queueItem.find(".filename").html(i),o.queueItem.data("file",o),a.queueEl.append(o.queueItem)}"function"==typeof s.onAddQueueItem&&s.onAddQueueItem.call(n,o),o.size>s.fileSizeLimit&&0!=s.fileSizeLimit?a.error("FILE_SIZE_LIMIT_EXCEEDED",o):(a.queue.queued++,a.queue.count++)},a.removeQueueItem=function(t,o,n){n||(n=0);var i=o?0:500;t.queueItem&&(" - Completed"!=t.queueItem.find(".fileinfo").html()&&t.queueItem.find(".fileinfo").html(" - Cancelled"),t.queueItem.find(".progress-bar").width(0),t.queueItem.delay(n).fadeOut(i,function(){e(this).remove()}),delete t.queueItem,a.queue.count--)},a.filesToUpload=function(){var e=0;for(var t in a.inputs){input=a.inputs[t],limit=input.files.length;for(var o=0;o<limit;o++)file=input.files[o],file.skip||file.complete||e++}return e},a.checkExists=function(o){if(e.inArray("onCheck",s.overrideEvents)<0){e.ajaxSetup({async:!1});var i=e.extend(s.formData,{filename:o.name});if(e.post(s.checkScript,i,function(e){o.exists=parseInt(e)}),o.exists&&!confirm("A file named "+o.name+" already exists in the upload folder.\nWould you like to replace it?"))return t.cancel.call(n,o),!0}return"function"==typeof s.onCheck&&s.onCheck.call(n,o,o.exists),!1},a.uploadFile=function(t,o){if(!t.skip&&!t.complete&&!t.uploading)if(t.uploading=!0,a.uploads.current++,a.uploads.attempted++,xhr=t.xhr=new XMLHttpRequest,"function"==typeof FormData||"object"==typeof FormData){var r=new FormData;r.append(s.fileObjName,t);for(i in s.formData)r.append(i,s.formData[i]);xhr.open(s.method,s.uploadScript,!0),xhr.upload.addEventListener("progress",function(e){e.lengthComputable&&a.progress(e,t)},!1),xhr.addEventListener("load",function(e){4==this.readyState&&(t.uploading=!1,200==this.status?"Invalid file type."!==t.xhr.responseText?a.uploadComplete(e,t,o):a.error(t.xhr.responseText,t,o):404==this.status?a.error("404_FILE_NOT_FOUND",t,o):403==this.status?a.error("403_FORBIDDEN",t,o):a.error("Unknown Error",t,o))}),xhr.send(r)}else{var l=new FileReader;l.onload=function(i){var r="-------------------------"+(new Date).getTime(),l="--",d="\r\n",c="";c+=l+r+d,c+='Content-Disposition: form-data; name="'+s.fileObjName+'"',t.name&&(c+='; filename="'+t.name+'"'),c+=d,c+="Content-Type: application/octet-stream"+d+d,c+=i.target.result+d;for(key in s.formData)c+=l+r+d,c+='Content-Disposition: form-data; name="'+key+'"'+d+d,c+=s.formData[key]+d;c+=l+r+l+d,xhr.upload.addEventListener("progress",function(e){a.progress(e,t)},!1),xhr.addEventListener("load",function(e){t.uploading=!1;var n=this.status;404==n?a.error("404_FILE_NOT_FOUND",t,o):"Invalid file type."!=t.xhr.responseText?a.uploadComplete(e,t,o):a.error(t.xhr.responseText,t,o)},!1);var u=s.uploadScript;if("get"==s.method){var h=e(s.formData).param();u+=h}xhr.open(s.method,s.uploadScript,!0),xhr.setRequestHeader("Content-Type","multipart/form-data; boundary="+r),"function"==typeof s.onUploadFile&&s.onUploadFile.call(n,t),xhr.sendAsBinary(c)},l.readAsBinaryString(t)}},a.progress=function(t,o){if(e.inArray("onProgress",s.overrideEvents)<0){if(t.lengthComputable)var i=Math.round(t.loaded/t.total*100);o.queueItem.find(".fileinfo").html(" - "+i+"%"),o.queueItem.find(".progress-bar").css("width",i+"%")}"function"==typeof s.onProgress&&s.onProgress.call(n,o,t)},a.error=function(o,i,r){if(e.inArray("onError",s.overrideEvents)<0){switch(o){case"404_FILE_NOT_FOUND":errorMsg="404 Error";break;case"403_FORBIDDEN":errorMsg="403 Forbidden";break;case"FORBIDDEN_FILE_TYPE":errorMsg="Forbidden File Type";break;case"FILE_SIZE_LIMIT_EXCEEDED":errorMsg="File Too Large";break;default:errorMsg="Unknown Error"}i.queueItem.addClass("error").find(".fileinfo").html(" - "+errorMsg),i.queueItem.find(".progress").remove()}"function"==typeof s.onError&&s.onError.call(n,o,i),i.skip=!0,"404_FILE_NOT_FOUND"==o?a.uploads.errors++:a.queue.errors++,r&&t.upload.call(n,null,!0)},a.uploadComplete=function(o,i,r){e.inArray("onUploadComplete",s.overrideEvents)<0&&(i.queueItem.find(".progress-bar").css("width","100%"),i.queueItem.find(".fileinfo").html(" - Completed"),i.queueItem.find(".progress").slideUp(250),i.queueItem.addClass("complete")),"function"==typeof s.onUploadComplete&&s.onUploadComplete.call(n,i,i.xhr.responseText),s.removeCompleted&&setTimeout(function(){t.cancel.call(n,i)},3e3),i.complete=!0,a.uploads.successful++,a.uploads.count++,a.uploads.current--,delete i.xhr,r&&t.upload.call(n,null,!0)},a.queueComplete=function(){"function"==typeof s.onQueueComplete&&s.onQueueComplete.call(n,a.uploads)},!(window.File&&window.FileList&&window.Blob&&(window.FileReader||window.FormData)))return"function"==typeof s.onFallback&&s.onFallback.call(n),!1;if(s.id="uploadifive-"+n.attr("id"),a.button=e('<div id="'+s.id+'" class="uploadifive-button">'+s.buttonText+"</div>"),s.buttonClass&&a.button.addClass(s.buttonClass),a.button.css({height:s.height,"line-height":s.height+"px",overflow:"hidden",position:"relative","text-align":"center",width:s.width}),n.before(a.button).appendTo(a.button).hide(),a.createInput.call(n),s.queueID?a.queueEl=e("#"+s.queueID):(s.queueID=s.id+"-queue",a.queueEl=e('<div id="'+s.queueID+'" class="uploadifive-queue" />'),a.button.after(a.queueEl)),s.dnd){var l=s.dropTarget?e(s.dropTarget):a.queueEl.get(0);l.addEventListener("dragleave",function(e){e.preventDefault(),e.stopPropagation()},!1),l.addEventListener("dragenter",function(e){e.preventDefault(),e.stopPropagation()},!1),l.addEventListener("dragover",function(e){e.preventDefault(),e.stopPropagation()},!1),l.addEventListener("drop",a.drop,!1)}XMLHttpRequest.prototype.sendAsBinary||(XMLHttpRequest.prototype.sendAsBinary=function(e){function t(e){return 255&e.charCodeAt(0)}var o=Array.prototype.map.call(e,t),n=new Uint8Array(o);this.send(n.buffer)}),"function"==typeof s.onInit&&s.onInit.call(n)})},debug:function(){return this.each(function(){console.log(e(this).data("uploadifive"))})},clearQueue:function(){this.each(function(){var o=e(this),n=o.data("uploadifive"),a=n.settings;for(var s in n.inputs)for(input=n.inputs[s],limit=input.files.length,i=0;i<limit;i++)file=input.files[i],t.cancel.call(o,file);"function"==typeof a.onClearQueue&&a.onClearQueue.call(o,e("#"+n.settings.queueID))})},cancel:function(o,n){this.each(function(){var i=e(this),a=i.data("uploadifive"),s=a.settings;"string"==typeof o&&(isNaN(o)||(fileID="uploadifive-"+e(this).attr("id")+"-file-"+o),o=e("#"+fileID).data("file")),o.skip=!0,a.filesCancelled++,o.uploading&&(a.uploads.current--,o.uploading=!1,o.xhr.abort(),delete o.xhr,t.upload.call(i)),e.inArray("onCancel",s.overrideEvents)<0&&a.removeQueueItem(o,n),"function"==typeof s.onCancel&&s.onCancel.call(i,o)})},upload:function(t,o){this.each(function(){var n=e(this),i=n.data("uploadifive"),a=i.settings;if(t)i.uploadFile.call(n,t);else if(i.uploads.count+i.uploads.current<a.uploadLimit||0==a.uploadLimit){if(!o){i.uploads.attempted=0,i.uploads.successsful=0,i.uploads.errors=0;var s=i.filesToUpload();"function"==typeof a.onUpload&&a.onUpload.call(n,s)}e("#"+a.queueID).find(".uploadifive-queue-item").not(".error, .complete").each(function(){return _file=e(this).data("file"),i.uploads.current>=a.simUploadLimit&&0!==a.simUploadLimit||i.uploads.current>=a.uploadLimit&&0!==a.uploadLimit||i.uploads.count>=a.uploadLimit&&0!==a.uploadLimit?!1:void(a.checkScript?(_file.checking=!0,skipFile=i.checkExists(_file),_file.checking=!1,skipFile||i.uploadFile(_file,!0)):i.uploadFile(_file,!0))}),0==e("#"+a.queueID).find(".uploadifive-queue-item").not(".error, .complete").size()&&i.queueComplete()}else 0==i.uploads.current&&(e.inArray("onError",a.overrideEvents)<0&&i.filesToUpload()>0&&0!=a.uploadLimit&&alert("The maximum upload limit has been reached."),"function"==typeof a.onError&&a.onError.call(n,"UPLOAD_LIMIT_EXCEEDED",i.filesToUpload()))})},destroy:function(){this.each(function(){var o=e(this),n=o.data("uploadifive"),i=n.settings;t.clearQueue.call(o),i.queueID||e("#"+i.queueID).remove(),o.siblings("input").remove(),o.show().insertBefore(n.button),n.button.remove(),"function"==typeof i.onDestroy&&i.onDestroy.call(o)})}};e.fn.upload=function(o){return t[o]?t[o].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof o&&o?void e.error("The method "+o+" does not exist in $.uploadify"):t.init.apply(this,arguments)}}(n)}),define("js/me/index",["jquery","swiper","index"],function(e,t,o){var n,i=e("jquery"),a=i(".user-avatar"),s=i(".list-item"),r=new Image;e("js/product/recommend-for-you"),e("js/product/suspend-cart"),n=a.data("avatar"),r.src=n,r.onload=function(){a.css("background-image","url("+n+")")},i(".yoho-page").on("touchstart",".list-item, .type-item, .order-title",function(){s.removeClass("highlight"),i(this).addClass("highlight")}).on("touchend touchcancel",".list-item, .type-item, .order-title",function(){i(this).removeClass("highlight")})}),define("js/product/recommend-for-you",["swiper","jquery","index"],function(e,t,o){var n,i=e("swiper"),a=e("jquery"),s=a(".recommend-for-you");a.get("/home/preference").then(function(e){s.html(e).show(),a("#swiper-recommend").length&&(n=new i("#swiper-recommend",{slidesPerView:"auto",grabCursor:!0,slideElement:"a",lazyLoading:!0,watchSlidesVisibility:!0}))}).fail(function(){s.hide()})}),define("js/me/coupons",["jquery","hammer","mlellipsis"],function(e,t,o){function n(e,t){l.showLoadingMask(),a.ajax({type:"POST",url:"/home/couponData",dataType:"html",data:{status:e,page:t},success:function(e){a("#employ").append(e),window.rePosFooter(),l.hideLoadingMask()}})}var i,a=e("jquery"),s=e("hammer"),r=e("mlellipsis"),l=e("js/plugin/loading"),d=0,c=1;r.init(),a(".yoho-footer").css("border-top","1px solid #e0e0e0"),a(".employ span").each(function(e){i=new s(a(".employ span")[e]),i.on("tap",function(t){a(".employ span").removeClass("active").eq(e).addClass("active"),a("#employ").html(" "),d=e,c=1,n(d,c),window.rePosFooter()})}),a(window).scroll(function(){return a(window).scrollTop()+a(window).height()>a("body").height()-1?(c++,void n(d,c)):void 0}),n(d,c)}),define("js/me/online-service",["jquery"],function(e,t,o){var n=e("jquery"),i=n(".question-tab .tab-item");i.on("touchend",function(){var e=n(this).data("tab");e='[data-tab-name="'+e+'"]',i.removeClass("current"),n(this).addClass("current"),n(".question-list").removeClass("current"),n(e).addClass("current")}),n(".yoho-page").on("touchstart",".connect-item, .question-item",function(){n(this).siblings().removeClass("highlight"),n(this).addClass("highlight")}).on("touchend touchcancel",".connect-item, .question-item",function(){n(this).removeClass("highlight")})}),define("js/me/address",["jquery"],function(e,t,o){var n,i=e("jquery"),a=e("js/plugin/tip"),s=e("js/plugin/loading"),r=i(".action"),l=i(".add-address"),d=i("#yoho-footer"),c=i(".confim-mask"),u=i(".page-wrap"),h=i(".address-item");u.first().css("min-height",function(){return i(window).height()-i("#yoho-header").height()-d.height()}),window.rePosFooter(),c.on("touchend",".cancel",function(e){return n=null,c.fadeOut(),!1}).on("touchend",".confim",function(){return s.showLoadingMask(),c.fadeOut(),i.ajax({method:"POST",url:"/home/delAddress",data:{id:n}}).then(function(e){"object"!==i.type(e)&&(e={}),200!==e.code?(a.show(e.message||"网络出了点问题~"),s.hideLoadingMask()):window.location.reload()}).fail(function(){a.show("网络出了点问题~"),s.hideLoadingMask()}).always(function(){n=null}),!1}),h.length<5&&l.attr("href",l.data("href")),l.on("touchend",function(){return h.length>=5?(a.show("您最多添加5个收货地址"),!1):void 0}),r.on("touchend",".del",function(){return n=i(this).data("id"),c.fadeIn(),!1})}),define("js/me/browse-record",["jquery","lazyload","handlebars","source-map","hammer"],function(e,t,o){function n(e){var t=l.children(".browse-record-good").length;f||(1===h&&d.removeClass("hide"),f=!0,i.ajax({type:"GET",url:"/home/recordContent",data:{page:h+1},success:function(o){" "===o?(p=!0,c.addClass("hide"),u.removeClass("hide")):(0===t?(l.html(o),a()):(l.append(o),a(l.find(".browse-record-good:gt("+(t-1)+") .lazy"))),window.rePosFooter(),h++,e&&e())},complete:function(){f=!1}}))}var i=e("jquery"),a=e("lazyload"),s=e("js/plugin/loading"),r=e("js/me/dialog"),l=i(".records"),d=i(".load-more"),c=d.children(".more"),u=d.children(".no-more"),h=0,p=!1,f=!1,m=i(window).height();s.init(),s.showLoadingMask(),n(s.hideLoadingMask),i(window).scroll(function(){p||m+i(window).scrollTop()>i(document).height()-.25*l.height()&&n()}),l.on("touchstart",".del-icon",function(){var e=i(this).closest(".browse-record-good"),t=e.data("skn");r.showDialog({dialogText:"确定删除此条浏览记录吗?",hasFooter:{leftBtnText:"取消",rightBtnText:"确定"}},function(){i.ajax({type:"GET",url:"/home/delRecord",data:{skn:t},success:function(e){200===e.code&&(r.showDialog({dialogText:"删除浏览记录成功",autoHide:2e3,fast:!0}),setTimeout(function(){window.history.go(0)},1200))}})})})}),define("js/me/address-act",["jquery","hammer"],function(e,t,o){var n,i=e("jquery"),a=e("hammer"),s=e("js/plugin/tip"),r=e("js/plugin/security"),l=e("js/plugin/loading"),d=i(".edit-address"),c=i(".submit"),u=i(".my-edit-address-page"),h=i(".my-address-list-page"),p=i(".nav-back"),f=i(".nav-title"),m=i("input, textarea"),g=f.html(),v=i(".area"),w="edit",y=[],b=i.queryString();i(u,h).css("min-height",function(){return i(window).height()-i("#yoho-header").height()}),p.attr("href","javascript:void(0);"),p.on("touchend",function(e){"list"===w?(h.hide(),u.show(),e.preventDefault(),w="edit",f.html(g),h.hide(),h.find("ul").hide().find("li").removeClass("highlight"),h.children("ul").show().children("li").show(),y=[]):window.history.go(-1)}),d.on("submit",function(){return n?!1:r.hasDangerInput(!1)?!1:i(this).find('[name="consignee"]').val()?i(this).find('[name="mobile"]').val()?i(this).find('[name="area_code"]').val()&&i(this).find('[name="area"]').val()?i(this).find('[name="address"]').val()?(n=!0,l.showLoadingMask(),i.ajax({method:"POST",url:"/home/saveAddress",data:i(this).serialize()}).then(function(e){"object"!==i.type(e)&&(e={}),200!==e.code?(s.show(e.message||"网络出了点问题~"),n=!1,l.hideLoadingMask()):"shopping"===b.refer?window.location.href="/shoppingCart/selectAddress":window.location.href="/home/address"}).fail(function(){s.show("网络出了点问题~"),n=!1}),!1):(s.show("地址不能为空"),!1):(s.show("省市区不能为空"),!1):(s.show("手机号不能为空"),!1):(s.show("收件人不能为空"),!1)}),c.on("touchend",function(){return r.hasDangerInput(!1)?!1:(m.blur(),d.submit(),!1)}).on("touchstart",function(){i(this).addClass("highlight")}).on("touchend touchcancel",function(){i(this).removeClass("highlight")}),i.get("/home/locationList").then(function(e){h.html(e),v.on("touchend",function(){u.hide(),h.show(),w="list",f.html("地区选择")}),h.find(".address").each(function(e,t){var o=new a(t);o.on("tap",function(e){var t=i(e.target);"li"!==e.target.tagName.toLowerCase()&&(t=t.parent("li")),y.push(t.children(".caption").text()),t.siblings().hide(),t.children("ul").show().children("li").show(),e.srcEvent.preventDefault(),e.srcEvent.stopPropagation()})}),h.find(".address-last").each(function(e,t){var o=new a(t);o.on("tap",function(e){var t=i(e.target);y.push(t.children(".caption").text()),i('[name="area"]').val(y.join(" ")),i('[name="area_code"]').val(t.data("id")),u.show(),w="edit",f.html(g),h.hide(),h.find("ul").hide().find("li").removeClass("highlight"),h.children("ul").show().children("li").show(),y=[],e.srcEvent.preventDefault(),e.srcEvent.stopPropagation()})}),h.on("touchstart","li",function(){i(this).addClass("highlight")}).on("touchend touchcancel","li",function(){i(this).removeClass("highlight")})}).fail(function(){s.show("获取省市区列表失败")})}),define("js/me/logistic",["jquery"],function(e,t,o){function n(){l+r>s?window.rePosFooter():a.css("border-top","1px solid #f1f1f1")}var i=e("jquery"),a=i("#yoho-footer"),s=window.outerHeight,r=document.body.offsetHeight,l=a.height();i(document).ready(n)}),define("js/me/pay",["jquery","hammer"],function(e,t,o){function n(){document.addEventListener("WeixinJSBridgeReady",function(){window.WeixinJSBridge&&window.WeixinJSBridge.call("hideOptionMenu")})}function i(e,t){window.WeixinJSBridge&&window.WeixinJSBridge.invoke("getBrandWCPayRequest",t,function(t){window.location.href="/home/orders/detail?order_code="+e})}function a(e){var t;void 0===typeof WeixinJSBridge?document.addEventListener?document.addEventListener("WeixinJSBridgeReady",i,!1):document.attachEvent&&(document.attachEvent("WeixinJSBridgeReady",i),document.attachEvent("onWeixinJSBridgeReady",i)):p.ajax({type:"GET",url:"/shopping/pay/wechatwapapi?order_code="+e,dataType:"json",success:function(o){200===o.code?(t=o.data.jsApiParameters,i(e,t)):m.show("微信支付调取失败")},error:function(){m.show("请刷新本页面,完成微信支付")}})}function s(){var e=window.navigator.userAgent.toLowerCase();return e.indexOf("micromessenger")>0?!0:!1}function r(){var e=p(".app");e.each(function(e,t){return"weixin"===p(t).parent().attr("id")?(p(t).parent().css("display","none"),!1):void 0})}function l(){s()||r()}function d(e,t){p(e).css("background-position-y",t)}function c(){var e=p(".box"),t=null,o=null;e.each(function(e,n){t=p(n).find(".icon").find("div"),t.length>0&&(o=p(n).attr("id"),"alipay"!==o&&d(t,b[o]))})}function u(){var e=p(".payapp-list");e.css("visibility","visible")}function h(){l(),f.hideLoadingMask(),u(),c()}var p=e("jquery"),f=e("js/plugin/loading"),m=e("js/plugin/tip"),g=e("hammer"),v=document.getElementById("ordercode").value,w=document.getElementById("weixin"),y=w&&new g(w),b={baidu:"-2.7rem",weixin:"-1.2rem",QQ:"-5.4rem",bank:"-4rem"};window.wx&&wx.hideOptionMenu(),void 0===typeof WeixinJSBridge?(document.addEventListener?document.addEventListener("WeixinJSBridgeReady",n,!1):document.attachEvent&&(document.attachEvent("WeixinJSBridgeReady",n),document.attachEvent("onWeixinJSBridgeReady",n)),n()):n(),y&&y.on("tap",function(){a(v)}),f.showLoadingMask(),p(document).ready(h)}),define("js/me/personal-details",["jquery"],function(e,t,o){var n,i=e("jquery"),a=i(".user-avatar"),s=new Image;n=a.data("avatar"),s.src=n,s.onload=function(){a.css("background-image","url("+n+")")}}),define("js/me/currency",["jquery"],function(e,t,o){function n(e){i.ajax({type:"POST",url:"/home/ajaxCurrencyDetail",dataType:"html",data:{page:e},success:function(e){i(".coin-detail").append(e),window.rePosFooter()}})}var i=e("jquery"),a=1;i(window).scroll(function(){return i(window).scrollTop()+i(window).height()>i("body").height()-1?(a++,void n(a)):void 0}),n(a)});
\ No newline at end of file
... ...
This diff could not be displayed because it is too large.
... ... @@ -212,10 +212,10 @@ function getNamedCoupon(activityId, couponId, isApp, userIsLogged)
return;
}
if (data.code == 200) {
showTip('恭喜成功领取优惠券!<br><br>稍后即会到账,请耐心等待。');
showTip('恭喜成功领取优惠券!<br><br>稍后即会到账,请耐心等待。');
}
else if (data.code == 201) {
showTip('已领取过品牌优惠券<br><br>快去选购心仪的商品吧!');
showTip('已领取过品牌优惠券<br><br>快去选购心仪的商品吧!');
}
else if (data.code == 400) {
setCookie('_Coupon' + activityId, couponId, {
... ...
var $tip, tipItime;
/* 领指定券 */
var activityId = $('#coupon-container').attr('param');
var userIsLogged = $('#coupon-container').attr('isLogged') === 'Y';
var isApp;
$('.get-coupon').click(function () {
var couponId = $(this).attr('param');
isApp = $(this).attr('href') !== 'javascript:;';
if (!isNaN(activityId) && !isNaN(couponId)) {
getNamedCoupon(activityId, couponId, isApp, userIsLogged);
}
});
/* 领所有券 */
$('#get-all-coupon').click(function () {
var isApp = $(this).attr('href') !== 'javascript:;';
getAllCoupon(activityId, isApp);
});
/* 检查是否有在领取中的券,有则直接领取 */
if (userIsLogged) {
var cookieCouponId = cookie('_Coupon' + activityId);
if (cookieCouponId && !isNaN(cookieCouponId)) {
getNamedCoupon(activityId, cookieCouponId, isApp, userIsLogged);
}
}
/**
* 微信分享
*/
(function ($) {
if (typeof (wx) == "undefined") {
return;
}
var _weChatInterface = 'http://www.yohoshow.com/api/wechat/getSignPackage';
$.getJSON(_weChatInterface + '?pageurl=' +
encodeURIComponent(location.href.split('#')[0]) + '&callback=?', function (json) {
var _appId, _timestamp, _nonceStr, _signature;
if (json !== undefined && json !== '') {
_appId = json.appId.toString();
_timestamp = json.timestamp;
_nonceStr = json.nonceStr.toString();
_signature = json.signature.toString();
wx.config({
debug: false,
appId: _appId,
timestamp: _timestamp,
nonceStr: _nonceStr,
signature: _signature,
jsApiList: [
'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'hideMenuItems',
'showMenuItems',
'hideAllNonBaseMenuItem',
'showAllNonBaseMenuItem',
'translateVoice',
'startRecord',
'stopRecord',
'onRecordEnd',
'playVoice',
'pauseVoice',
'stopVoice',
'uploadVoice',
'downloadVoice',
'chooseImage',
'previewImage',
'uploadImage',
'downloadImage',
'getNetworkType',
'openLocation',
'getLocation',
'hideOptionMenu',
'showOptionMenu',
'closeWindow',
'scanQRCode',
'chooseWXPay',
'openProductSpecificView',
'addCard',
'chooseCard',
'openCard'
]
});
}
});
wx.ready(function () {
var shareTitle = $('#shareTitle').val();
var shareImg = $('#shareImg').val();
var shareDesc = $('#shareDesc').val();
var shareLink = $('#shareLink').val();
var shareData = {
title: shareTitle,
desc: shareDesc,
imgUrl: shareImg,
link: shareLink
};
wx.onMenuShareAppMessage(shareData);
wx.onMenuShareTimeline(shareData);
wx.onMenuShareQQ(shareData);
wx.onMenuShareWeibo(shareData);
});
}(jQuery));
/**
* 初始化提示框
*/
(function () {
var tipHtml = '<div id="yoho-tip" class="yoho-tip"></div>';
//插入提示HTML
$('#coupon-container').append(tipHtml);
$tip = $('#yoho-tip');
$tip.on('touchend', function () {
$tip.hide();
//清除Timeout
clearTimeout(tipItime);
});
}());
function cookie(name) {
var cookies = document.cookie,
cookieVal,
offset;
if (document.cookie && document.cookie !== '') {
offset = cookies.indexOf(name + '=');
if (offset > -1) {
offset += name.length + 1;
cookieVal = decodeURIComponent($.trim(cookies.substring(offset, cookies.indexOf(';', offset))));
}
}
return cookieVal;
}
function setCookie(name, value, options) {
var expires = '',
path,
domain,
secure,
date;
if (typeof value !== 'undefined') {
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
if (options.expires &&
(typeof options.expires === 'number' || options.expires.toUTCString)) {
if (typeof options.expires === 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString();
}
path = options.path ? '; path=' + options.path : '';
domain = options.domain ? '; domain=' + options.domain : '';
secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
}
}
/**
* 显示提示
*/
function showTip(con, dur) {
var content, duration;
if (typeof con === 'undefined') {
return;
}
content = con.toString();
duration = (dur && dur > 0) ? dur : 3000;
$tip.html(content).show();
tipItime = setTimeout(function () {
if ($tip.css('display') === 'block') {
$tip.hide();
}
}, duration);
}
/**
* 获取活动的指定优惠券
*/
function getNamedCoupon(activityId, couponId, isApp, userIsLogged)
{
$.ajax({
type: 'POST',
url: '/cuxiao/coupon/getnamed',
data: 'activityId=' + activityId + '&couponId=' + couponId,
success: function (data) {
setCookie('_Coupon' + activityId, null, {
expires: -2,
domain: '.m.yohobuy.com'
});
if (isApp && !userIsLogged) {
return;
}
if (data.code == 200) {
showTip('恭喜您成功领取优惠券!<br><br>稍后即会到账,请耐心等待。');
}
else if (data.code == 201) {
showTip('您已领取过品牌优惠券<br><br>快去选购心仪的商品吧!');
}
else if (data.code == 400) {
setCookie('_Coupon' + activityId, couponId, {
expires: 1,
domain: '.m.yohobuy.com'
});
if (isApp) {
//showTip('请先登录!');
} else {
location.href = decodeURIComponent(data.data);
}
}
else if (data.message) {
//showTip(data.message);
if (data.message == '新用户才可领取') {
showTip('Sorry,新客券只有新客才能领取呦!');
} else {
showTip('领取失败<br><br>请稍候再试');
}
setCookie('_Coupon' + activityId, null);
}
},
error: function () {
showTip('网络断开连接啦~');
}
});
}
/**
* 获取活动所有的优惠券
*/
function getAllCoupon(activityId, isApp)
{
$.ajax({
type: 'POST',
url: '/cuxiao/coupon/getall',
data: 'activityId=' + activityId,
dataType: 'json',
success: function (data) {
if (data.code == 200) {
showTip('恭喜您,成功领取');
}
else if (data.code == 201) {
showTip('对不起,您已经领取过');
}
else if (data.code == 400) {
if (isApp) {
showTip('请先登录!');
} else {
location.href = decodeURIComponent(data.data);
}
}
else if (data.message) {
//showTip(data.message);
showTip('系统繁忙,请稍候再试!');
}
},
error: function () {
showTip('网络断开连接啦~');
}
});
}
\ No newline at end of file
... ...
... ... @@ -199,9 +199,9 @@ $yohoPage.on('touchstart', '.tap-hightlight', function() {
$(this).removeClass('highlight');
});
$('.nav-home').on('touchstart', function() {
$('.homebuttom').toggleClass('none');
});
// $('.nav-home').on('touchstart', function() {
// $('.homebuttom').toggleClass('none');
// });
(function() {
var lastTime = 0,
... ...
/**
* 注册
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/8
*/
var $ = require('jquery');
var $phoneNum = $('#phone-num'),
$countrySelect = $('#country-select'),
$areaCode = $('#area-code'),
$openId = $('#openId'),
$nickname = $('#nickname'),
$sourceType = $('#sourceType'),
$btnNext = $('#btn-next');
var api = require('../api'),
tip = require('../../plugin/tip'),
dialog = require('../../me/dialog');
var trim = $.trim;
var showErrTip = tip.show;
function nextStep(url, mobileNo, areaCode) {
$.ajax({
type: 'POST',
url: '/passport/bind/sendBindMsg',
data: {
phoneNum: mobileNo,
areaCode: areaCode.replace('+', '')
},
success: function(res) {
console.log(res.data);
location.href = url;
},
error: function() {
tip.show('出错了,请重试!');
}
});
}
api.selectCssHack($('#country-select'));
api.bindClearEvt();
$phoneNum.bind('input', function() {
if (trim($phoneNum.val()) === '') {
$btnNext.addClass('disable');
} else {
$btnNext.removeClass('disable');
}
});
$countrySelect.change(function() {
$areaCode.text($countrySelect.val());
});
$btnNext.on('touchstart', function() {
var pn = trim($phoneNum.val()),
openId = trim($openId.val()),
nickname = trim($nickname.val()),
sourceType = trim($sourceType.val()),
areaCode = $countrySelect.val();
if ($btnNext.hasClass('disable')) {
return;
}
if (api.phoneRegx[areaCode].test(pn)) {
$.ajax({
url: '/passport/bind/bindCheck',
type: 'POST',
data: {
areaCode: areaCode.replace('+', ''),
phoneNum: pn,
openId: openId,
sourceType: sourceType,
nickname: nickname
},
success: function(res) {
console.log(res);
//res : {
// code: 'xxx',
// data: {
// isReg: 0,
// next: 'xxxx'
// },
// message: 'xxxx',
//}
if (res.code === 200) {
if (res.data.isReg === 1) {
dialog.showDialog({
dialogText: '该手机号已注册过有货\n' + pn + ',确定绑定吗?',
hasFooter: {
leftBtnText: '更换号码',
rightBtnText: '继续绑定'
}
}, function() {
nextStep(res.data.next, pn, areaCode);
});
} else {
nextStep(res.data.next, pn, areaCode);
}
} else {
showErrTip(res.message);
}
}
});
} else {
showErrTip('手机号格式不正确,请重新输入');
}
});
... ...
/**
* 注册-验证码
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/8
*/
require('../code')(true, true);
... ...
/**
* 注册-密码
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/8
*/
var $ = require('jquery');
var $pwd = $('#pwd'),
$btnSure = $('#btn-sure');
var api = require('../api');
var tip = require('../../plugin/tip');
var trim = $.trim;
var showErrTip = tip.show;
var nickname = $('#nickname').val(),
sourceType = $('#sourceType').val(),
openId = $('#openId').val(),
phoneNum = $('#phone-num').val(),
areaCode = $('#area-code').val().replace('+', '');
function startBind(password) {
$.ajax({
url: '/passport/bind/bindMobile',
type: 'post',
data: {
areaCode: areaCode.replace('+', ''),
phoneNum: phoneNum,
openId: openId,
sourceType: sourceType,
nickname: nickname,
password: password
},
success: function(res) {
if (res.code === 200) {
tip.show('登录成功');
setTimeout(function() {
location.href = res.data.refer;
}, 2000);
} else {
tip.show(res.message);
}
},
error: function(err) {
tip.show('登录失败,请重试!');
}
});
}
api.bindEyesEvt({
status: 'open' //默认眼睛打开
});
$pwd.bind('input', function() {
if (trim($pwd.val()) === '') {
$btnSure.addClass('disable');
} else {
$btnSure.removeClass('disable');
}
});
$btnSure.on('touchstart', function() {
var pwd = trim($pwd.val());
if ($btnSure.hasClass('disable')) {
return;
}
if (api.pwdValidate(pwd) === false) {
showErrTip('密码6-20位,请重新输入');
} else {
startBind(pwd);
}
});
... ...
... ... @@ -5,10 +5,14 @@
*/
var $ = require('jquery');
module.exports = function(useInRegister) {
module.exports = function(useInRegister, useForBind) {
var $captcha = $('#captcha'),
$btnNext = $('#btn-next'),
$captchaTip = $('#captcha-tip'),
isReg = parseInt($('#isReg').val()),
nickname = $('#nickname').val(),
sourceType = $('#sourceType').val(),
openId = $('#openId').val(),
phoneNum = $('#phone-num').val(),
areaCode = $('#area-code').val().replace('+', '');
... ... @@ -20,6 +24,34 @@ module.exports = function(useInRegister) {
var urlMid = useInRegister ? 'reg' : 'back';
function startBind() {
$.ajax({
url: '/passport/bind/bindMobile',
type: 'post',
data: {
areaCode: areaCode.replace('+', ''),
phoneNum: phoneNum,
openId: openId,
sourceType: sourceType,
nickname: nickname,
password: ''
},
success: function(res) {
if (res.code === 200) {
tip.show('登录成功');
setTimeout(function() {
location.href = res.data.refer;
}, 2000);
} else {
tip.show(res.message);
}
},
error: function(err) {
tip.show('登录失败,请重试!');
}
});
}
function countDown() {
var count = 59,
itime;
... ... @@ -52,7 +84,7 @@ module.exports = function(useInRegister) {
$.ajax({
type: 'POST',
url: '/passport/' + urlMid + '/sendcode',
url: useForBind ? '/passport/bind/sendBindMsg' : '/passport/' + urlMid + '/sendcode',
data: {
phoneNum: phoneNum,
areaCode: areaCode
... ... @@ -77,7 +109,7 @@ module.exports = function(useInRegister) {
$.ajax({
type: 'POST',
url: '/passport/' + urlMid + '/verifycode',
url: useForBind ? '/passport/bind/checkBindMsg' : '/passport/' + urlMid + '/verifycode',
data: {
phoneNum: phoneNum,
areaCode: areaCode,
... ... @@ -86,15 +118,26 @@ module.exports = function(useInRegister) {
},
success: function(data) {
if (data.code === 200) {
location.href = data.data;
if (useForBind) {
if (isReg) {
startBind();
} else {
location.href = '/passport/bind/password?phoneNum=' +
phoneNum + '&areaCode=' + areaCode + '&openId=' +
openId + '&sourceType=' + sourceType + '&nickname=' + nickname;
}
} else {
location.href = data.data;
}
} else {
//验证码不正确,显示提示
showErrTip(data.message);
}
}
});
});
countDown();
};
\ No newline at end of file
};
... ...
... ... @@ -44,18 +44,18 @@ $('.btn-balance').on('touchend', function() {
window.location.href = '/shoppingCart/orderEnsure?cartType=' + cartType;
});
$('.advance-buy').on('touchend', function() {
var $advanceBuy = $('#advanceBuy'),
$mainCart = $('#mainCart');
if ($advanceBuy.hasClass('hide')) {
$mainCart.removeClass('show').addClass('hide');
$advanceBuy.removeClass('hide').addClass('show');
} else {
$advanceBuy.removeClass('show').addClass('hide');
$mainCart.removeClass('hide').addClass('show');
}
});
//$('.advance-buy').on('touchend', function() {
// var $advanceBuy = $('#advanceBuy'),
// $mainCart = $('#mainCart');
//
// if ($advanceBuy.hasClass('hide')) {
// $mainCart.removeClass('show').addClass('hide');
// $advanceBuy.removeClass('hide').addClass('show');
// } else {
// $advanceBuy.removeClass('show').addClass('hide');
// $mainCart.removeClass('hide').addClass('show');
// }
//});
$('.chose').on('touchend', function() {
... ...
... ... @@ -6,6 +6,7 @@
var $ = require('jquery'),
ellipsis = require('mlellipsis'),
chosePanel = require('../shopping-cart/chose-panel'),
lazyLoad = require('yoho.lazyload');
var dialog = require('../me/dialog'),
... ... @@ -78,6 +79,24 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
});
}).on('touchstart', '.icon-edit', function() {
//var $this = $(this);
//
//var $cartgood = $this.closest('.shopping-cart-good');
//
////var id = $this.closest('.shopping-cart-good').data('id');
//
//var $viewGood = $cartgood.find('.deps');
// $editGoot = $cartgood.find('.calculate-num');
//
//if ($viewGood.hasClass('show')) {
// $viewGood.removeClass('show').addClass('hide');
// $editGoot.removeClass('hide').addClass('show');
//} else {
// $viewGood.removeClass('hide').addClass('show');
// $editGoot.removeClass('show').addClass('hide');
//}
}).on('touchstart', '.icon-del', function(e) {
var $this = $(this);
... ... @@ -149,3 +168,34 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
//})
$('.btn-balance').on('touchend', function() {
window.location.href = '/shoppingCart/orderEnsure?cartType=' + 'ordinary';
});
$('.down').on('touchend', function() {
chosePanel.show();
});
$('.cut').on('touchend', function() {
var id = $(this).closest('.shopping-cart-good').data('id');
$.ajax({
type: 'GET',
url: '/shoppingCart/modify',
data: {
old_product_sku: id,
new_product_sku: id,
buy_number: '0',
selected: 'Y'
},
success: function(data) {
if (data.code === 200) {
window.history.go(0);
}
},
error: function() {
tip.show('网络错误');
}
});
});
... ...
... ... @@ -64,7 +64,7 @@ $('.invoice').on('touchend', '.checkbox', function() {
function orderCompute() {
$.ajax({
method: 'POST',
url: '/shoppingCart/orderCompute',
url: '/cart/index/orderCompute',
data: {
cartType: orderInfo('cartType'),
deliveryId: orderInfo('deliveryId'),
... ... @@ -98,7 +98,7 @@ function submitOrder() {
loading.showLoadingMask();
$.ajax({
method: 'POST',
url: '/shoppingCart/orderSub',
url: '/cart/index/orderSub',
data: {
addressId: orderInfo('addressId'),
cartType: orderInfo('cartType'),
... ...
... ... @@ -24,7 +24,7 @@ ellipsis.init();
$newCoupon.on('submit', function() {
$.ajax({
method: 'POST',
url: '/shoppingCart/couponSearch',
url: '/cart/index/couponSearch',
data: $(this).serialize()
}).then(function(res) {
if (res.code === 200) {
... ... @@ -130,7 +130,7 @@ function getCouponDate() {
$.ajax({
type: 'POST',
url: '/shoppingCart/couponList',
url: '/cart/index/couponList',
dataType: 'json',
data: {
page: page
... ...
... ... @@ -88,7 +88,7 @@
}
.cost {
margin-bottom: 100rem / $pxConvertRem; /*排除被固定底部遮挡的影响*/
// margin-bottom: 100rem / $pxConvertRem; /*排除被固定底部遮挡的影响*/
li {
font-size: 28rem / $pxConvertRem;
... ... @@ -104,10 +104,11 @@
}
.opt {
position: fixed;
bottom: 0;
left: 0;
right: 0;
// 测试反馈 底部不需要固定
// position: fixed;
// bottom: 0;
// left: 0;
// right: 0;
text-align: right;
border-top: 1px solid #e0e0e0;
}
... ... @@ -130,4 +131,4 @@
background: #d0021b;
margin-left: 10rem / $pxConvertRem;
}
}
\ No newline at end of file
}
... ...
... ... @@ -3,3 +3,15 @@
color: #fff;
font-size: 15px;
}
#yohood {
background-image: image-url('yohood.png');
background-size: 40%;
background-repeat: no-repeat;
background-color: transparent;
background-position-x: 10%;
background-position-y: 40%;
border: none;
border-bottom: 4px solid #fff;
}
... ...
... ... @@ -151,44 +151,61 @@
}
}
}
.good-detail-img {
// position: relative;
//height: 368rem / $pxConvertRem;
//.good-islike {
// position: absolute;
// width: 60rem / $pxConvertRem;
// height: 60rem / $pxConvertRem;
// top: 0rem / $pxConvertRem;
// right: 0rem / $pxConvertRem;
// line-height: 60rem / $pxConvertRem;
// font-size: 30rem / $pxConvertRem;
// text-align: center;
// color: #b0b0b0;
// text-decoration: none;
//}
//
//.good-like {
// color: #d72928;
//}
//img {
// display: block;
// width: 100%;
// height: 368rem / $pxConvertRem;
//}
.few-tag {
.calculate-num{
float: right;
.calculate{
float: right;
border:1px solid #b0b0b0;
border-radius:.2rem;
p{
color: #444;
&:first-child{
height: 60rem / $pxConvertRem;
border-bottom:1px solid #b0b0b0;
span {
border-left:1px solid #b0b0b0;
border-right:1px solid #b0b0b0;
}
}
i{
width: 72rem / $pxConvertRem;
height: 60rem / $pxConvertRem;
float: left;
line-height: 60rem / $pxConvertRem;
text-align: center;
}
span{
width: 96rem / $pxConvertRem;
height: 60rem / $pxConvertRem;
float: left;
font-size: 40rem / $pxConvertRem;
line-height: 60rem / $pxConvertRem;
text-align: center;
}
&:last-child {
span{
width: 168rem / $pxConvertRem;
overflow: hidden;
font-size: 48em / $pxConvertRem;
text-overflow:ellipsis;
white-space:nowrap;
}
}
}
}
.price{
line-height: 60rem / $pxConvertRem;
font-size: 52em / $pxConvertRem;
font-weight: bold;
}
.count {
position: absolute;
bottom: 0;
width: 100%;
height: 28rem / $pxConvertRem;
background: #ffac5b;
font-size: 18rem / $pxConvertRem;
color: #fff;
line-height: 28rem / $pxConvertRem;
text-align: center;
right: 20rem / $pxConvertRem;;
top: 20rem / $pxConvertRem;;
font-size: 52em / $pxConvertRem;
}
}
}
... ...
... ... @@ -178,116 +178,6 @@
}
}
.gift-advance-good {
position: relative;
padding: 20rem / $pxConvertRem 0;
margin-left: 34rem / $pxConvertRem;
height: 160rem / $pxConvertRem;
border-bottom: 1px solid #e0e0e0;
&:last-child {
border-bottom: none;
}
}
.advance-block .gift-advance-good:last-child {
border-bottom: none;
}
.advance-block:last-child .gift-advance-good:last-child {
border-bottom: 1px solid #e0e0e0;
}
.thumb-wrap {
position: relative;
float: left;
width: 120rem / $pxConvertRem;
height: 160rem / $pxConvertRem;
.thumb {
width: 100%;
height: 100%;
}
}
.tag {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 25rem / $pxConvertRem;
color: #fff;
text-align: center;
background: #a1ce4e;
&:before {
content: '赠品';
}
}
.deps {
margin-left: 135rem / $pxConvertRem;
}
.name {
font-size: 28rem / $pxConvertRem;
}
.row:nth-child(2) {
font-size: 22rem / $pxConvertRem;
height: 45rem / $pxConvertRem;
line-height: 45rem / $pxConvertRem;
> span {
margin-right: 15rem / $pxConvertRem;
}
}
.row:nth-child(3) {
position: relative;
}
.color, .size {
color: #b6b6b6;
}
.price {
font-size: 24rem / $pxConvertRem;
color: #000;
}
.count {
font-size: 20rem / $pxConvertRem;
color: #999;
margin-left: 22rem / $pxConvertRem;
}
.chose {
position: absolute;
width: 88rem / $pxConvertRem;
height: 58rem / $pxConvertRem;
background: #f8f8f8;
border: 1px solid #ccc;
right: 20rem / $pxConvertRem;
top: 71rem / $pxConvertRem;
font-size: 26rem / $pxConvertRem;
}
.title {
height: 50rem / $pxConvertRem;
line-height: 50rem / $pxConvertRem;
padding-left: 20rem / $pxConvertRem;
font-size: 24rem / $pxConvertRem;
background: #f8f8f8;
}
.advance-block .tag {
background: #eb76aa;
&:before {
content: '加价购';
}
}
}
.shopping-cart-zero{
.cart-zero{
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{{staticTitle}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<style>
*{margin: 0;padding: 0;}
#coupon-container {width: 100%;}
#coupon-container img {width: 100%; height: auto; display: block;overflow: hidden;}
.img-box {width: 100%;position: relative;}
.img-box .href {width: 50%; height: 100%;position: absolute;top: 0;}
.img-box .href-left {left: 0}
.img-box .href-right {right: 0}
.img-box .href-center {width: 90%;height: 100%;position: absolute;top: 0;left: 5%;}
.show-more {height: 100%;width: 25%;position: absolute;top: 0;right: 10%;}
.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: #000;
opacity: 0.9;
color: #fff;
font-size: 18px;
border: none;
border-radius: 10px;
}
</style>
<link rel="dns-prefetch" href="//cdn.yoho.cn">
<link rel="dns-prefetch" href="//static.yohobuy.com">
</head>
<body>
<div class="coupon-container" id="coupon-container" param="{{activityId}}" isLogged="{{isLogged}}">
<img src="{{jsUrl}}/cuxiao/img/newuser2/01.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser2/02.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser2/03.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser2/line-1.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser2/04.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser2/05.jpg">
<a class="href href-right" href="{{url_yohope}}"></a>
</div>
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser2/06.jpg">
<a class="href href-center" href="{{url_mycoupon}}"></a>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser2/line-2.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser2/07.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser2/08.jpg">
<a class="href href-left" href="{{url_more}}"></a>
<a class="href href-right" href="{{url_more}}"></a>
</div>
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser2/09.jpg">
<span class="href href-left get-coupon" href="{{jumpUrl}}" param="12042"></span>
<span class="href href-right get-coupon" href="{{jumpUrl}}" param="12043"></span>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser2/line-1.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser2/10.jpg">
<a class="href href-left" href="{{url_4}}"></a>
<a class="href href-right" href="{{url_343}}"></a>
</div>
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser2/11.jpg">
<span class="href href-left get-coupon" href="{{jumpUrl}}" param="12044"></span>
<span class="href href-right get-coupon" href="{{jumpUrl}}" param="12045"></span>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser2/line-1.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser2/12.jpg">
<a class="href href-left" href="{{url_230}}"></a>
<a class="href href-right" href="{{url_536}}"></a>
</div>
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser2/13.jpg">
<span class="href href-left get-coupon" onclick="" href="{{jumpUrl}}" param="12046"></span>
<span class="href href-right get-coupon" onclick="" href="{{jumpUrl}}" param="12047"></span>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser2/line-1.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser2/14.jpg">
<a class="href href-left" href="{{url_847}}"></a>
<a class="href href-right" href="{{url_900}}"></a>
</div>
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser2/15.jpg">
<span class="href href-left get-coupon" onclick="" href="{{jumpUrl}}" param="12048"></span>
<span class="href href-right get-coupon" onclick="" href="{{jumpUrl}}" param="12049"></span>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser2/line-1.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser2/16.jpg">
<a class="href href-left" href="{{url_868}}"></a>
<a class="href href-right" href="{{url_1026}}"></a>
</div>
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser2/17.jpg">
<span class="href href-left get-coupon" href="{{jumpUrl}}" param="12050"></span>
<span class="href href-right get-coupon" href="{{jumpUrl}}" param="12051"></span>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser2/line-1.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser2/24-2.jpg">
<a class="show-more" href="{{url_help}}"></a>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser2/24-3.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser2/line-2.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser2/25.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser2/26.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser2/27.jpg">
</div>
<script type="text/javascript" src="{{jsUrl}}/cuxiao/js/jquery.min.js"></script>
<script type="text/javascript" src="{{jsUrl}}/cuxiao/js/newuser/coupon2.js"></script>
</body>
</html>
\ No newline at end of file
... ...
{{> layout/header}}
<div id="mainCart" class="shopping-cart-page yoho-page">
{{# shoppingCart}}
{{#if cartNav}}
<ul class="cart-nav clearfix">
... ... @@ -42,25 +41,9 @@
{{> shopping-cart/cart-content}}
</div>
{{/ preSellCart}}
{{/ shoppingCart}}
</div>
<div id="advanceBuy" class="shopping-cart-page yoho-page hide">
{{# shoppingCart}}
{{# commonCart}}
{{# advanceBuy}}
<span>
{{promotionTitle}}
</span>
{{# goods}}
{{> shopping-cart/gift-advance-good}}
{{/ goods}}
{{/ advanceBuy}}
{{/ commonCart}}
{{/ shoppingCart}}
</div>
<div class="shopping-cart-zero yoho-page hide">
<div class="cart-zero">
<i class="iconfont">&#xe62c</i>
... ... @@ -69,6 +52,5 @@
</div>
{{> product/recommend-for-you}}
</div>
{{> shopping-cart/chose-panel}}
{{> layout/footer}}
\ No newline at end of file
{{> shopping-cart/chose-panel}}
{{> layout/footer}}
... ...
{{> layout/header}}
<div class="order-ensure-page yoho-page">
{{# orderEnsure}}
<a class="address-wrap block" data-id="{{addressId}}" href="/shoppingCart/selectAddress">
<a class="address-wrap block" data-id="{{addressId}}" href="/cart/index/selectAddress">
<p class="infos">
收货地址
<span class="per-info">{{name}} {{phoneNum}}</span>
... ... @@ -43,7 +43,7 @@
<ul class="sale-invoice">
{{# coupon}}
<li class="coupon">
<a href="/shoppingCart/selectCoupon">
<a href="/cart/index/selectCoupon">
<span class="title">优惠券</span>
{{#if count}}
<span class="coupon-count">
... ...
... ... @@ -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="/shoppingCart/orderEnsure">
<a class="address-item" data-address-id="{{address_id}}" href="/cart/index/orderEnsure">
<span class="name">{{consignee}}</span>
<span class="tel">{{mobile}}</span>
<p class="address-info">{{area}} {{address}}</p>
... ...
... ... @@ -11,7 +11,7 @@
<script id="tmpl-coupon" type="text/tmpl">
\{{#coupons}}
\{{^ notAvailable}}
<a class="employ-main" data-coupon-code="\{{ couponCode}}" data-coupon-value="\{{ couponValue}}" href="/shoppingCart/orderEnsure">
<a class="employ-main" data-coupon-code="\{{ couponCode}}" data-coupon-value="\{{ couponValue}}" href="/cart/index/orderEnsure">
<span>\{{ couponValue}}</span>
<p class="coupon-name">\{{ couponDetailInfomation}}</p>
<p>有效期:\{{ couponValidity}}</p>
... ...
... ... @@ -29,7 +29,7 @@
<a class="logistics sub" href="{{logisticsUrl}}">
<span class="iconfont">&#xe630;</span>
<p class="beside-icon sub-content">
<span class="sub-title">物流信息</span>
<span class="sub-title">物流信息</span>
<span>物流公司:{{logisticsCompany}}</span>
<span>快递单号:{{logisticsNum}}</span>
</p>
... ... @@ -88,7 +88,7 @@
{{/if}}
{{/if}}
{{#if unreceived}}
{{#if logisticsUrl}}
<a href="{{logisticsUrl}}">
<span class="btn btn-check-logistics">查看物流</span>
</a>
... ... @@ -97,4 +97,4 @@
</div>
{{/ orderDetail}}
</div>
{{> layout/footer}}
\ No newline at end of file
{{> layout/footer}}
... ...
{{> layout/header}}
<div class="reg-code-page passport-page yoho-page">
<input type="hidden" id="isReg" value="{{isReg}}">
<input type="hidden" id="openId" value="{{openId}}">
<input type="hidden" id="sourceType" value="{{sourceType}}">
<input type="hidden" id="nickname" value="{{nickname}}">
{{> passport/code}}
</div>
{{> layout/footer}}
... ...
{{> layout/header}}
<div class="bind-page passport-page yoho-page">
<input type="hidden" id="openId" value="{{openId}}">
<input type="hidden" id="sourceType" value="{{sourceType}}">
<input type="hidden" id="nickname" value="{{nickname}}">
{{> passport/header}}
<div class="content">
{{> passport/country_list}}
... ... @@ -8,7 +11,7 @@
<input id="phone-num" class="input phone-num" type="text" placeholder="手机号">
</div>
<span id="btn-next" class="btn btn-next disable row">下一步</span>
<p class="bind-tip">YOHO!Family账号可登录Yoho!Buy有货、YOHO!Boys、YOHO!Girls及SHOW</p>
<p class="bind-tip">绑定手机号码后,可选择{{platform}}和手机号登录此帐号</p>
</div>
</div>
{{> layout/footer}}
... ...
{{> layout/header}}
<div class="bind-password-page passport-page yoho-page">
<input type="hidden" id="openId" value="{{openId}}">
<input type="hidden" id="sourceType" value="{{sourceType}}">
<input type="hidden" id="nickname" value="{{nickname}}">
{{> passport/header}}
<div class="content">
<div class="input-container row has-eye">
<input id="pwd" class="input pwd" type="text" placeholder="请输入密码" autocomplete="off" maxlength="20">
</div>
<span id="btn-sure" class="btn btn-sure disable row">确定</span>
</div>
<input id="phone-num" type="hidden" value={{phoneNum}}>
<input id="area-code" type="hidden" value={{areaCode}}>
<input id="token" type="hidden" value={{token}}>
</div>
{{> layout/footer}}
... ...
... ... @@ -4,14 +4,14 @@
<a href="{{#if backUrl}}{{backUrl}}{{^}}javascript:history.go(-1);{{/if}}" class="iconfont nav-back">&#xe610;</a>
{{/navBack}}
{{#navHome}}
<a class="iconfont nav-home">&#xe611;</a>
<a href="{{.}}" class="iconfont nav-home">&#xe611;</a>
{{/navHome}}
{{#navTitle}}
<p class="nav-title">{{.}}</p>
{{/navTitle}}
{{# navBtn}}
<!-- <span class="nav-btn">{{.}}</span> -->
<i class="iconfont nav-home">&#xe638;</i>
<!-- <i class="iconfont nav-home">&#xe638;</i> -->
{{/ navBtn}}
</header>
<div class="homebuttom none">
... ...
... ... @@ -52,6 +52,22 @@
seajs.use('js/passport/register/password');
</script>
{{/if}}
{{!-- 绑定手机号 --}}
{{#if bindIndex}}
<script>
seajs.use('js/passport/bind/bind');
</script>
{{/if}}
{{#if bindCode}}
<script>
seajs.use('js/passport/bind/code');
</script>
{{/if}}
{{#if bindPwd}}
<script>
seajs.use('js/passport/bind/password');
</script>
{{/if}}
{{!-- 登陆 --}}
{{#if loginIndex}}
<script>
... ...
... ... @@ -2,6 +2,11 @@
{{# goods}}
{{> shopping-cart/good}}
{{/ goods}}
{{# $notValidGoods}}
{{> shopping-cart/good}}
{{/ $notValidGoods}}
</div>
{{#if freebieOrAdvanceBuy}}
... ...
{{#cartInfo}}
<div class="chose-panel">
<div class="main">
<div class="infos">
... ... @@ -62,4 +62,3 @@
</div>
</div>
</div>
{{/cartInfo}}
\ No newline at end of file
... ...
<div class="shopping-cart-good clearfix" data-id={{id}}>
<span class="checkbox icon-cb-checked iconfont"></span>
<div class="info">
<!-- {{#if isSoldOut}}
<p class="">失效</p>
{{^}}
{{#if isGift}}
{{^}}
<span class="checkbox icon-cb-checked iconfont"></span>
{{/if}}
<div class="">
<a class="" href="{{url}}">
{{/if}}-->
<div class="info">
<img class="thumb lazy" data-original={{thumb}}>
<!--
<a class="" href="{{url}}">
<img class="thumb lazy" data-original="{{thumb}}">
</a>
{{#if isGift}}
<p class="few-tag">赠品</p>
{{/if}}
{{#if isAdvanceBuy}}
<p class="few-tag">加价购</p>
<p class="few-tag">加价购</p>
{{^}}
{{#if isGift}}
<p class="few-tag">赠品</p>
{{/if}}
{{/if}}
{{#if isSoldOut}}
<p class="few-tag">失效</p>
{{/if}}
</div>
<div class="deps">
-->
<div class="deps show">
<p class="name row">{{name}}</p>
<p class="row">
{{#if color}}
... ... @@ -47,7 +58,7 @@
{{/if}}
<span class="iconfont icon-edit">&#xe61e;</span>
<span class="iconfont icon-del">&#xe621;</span>
</p>
<p class="row">
... ... @@ -65,7 +76,16 @@
{{/if}}
</p>
</div>
</div>
<div class="calculate-num hide">
<div class="calculate">
<p><i class="iconfont cut">&#xe625;</i><span>{{count}}</span><i class="iconfont add">&#xe624;</i></p>
<p><span>颜色:{{color}}尺码:{{size}}{{name}}</span><i class="iconfont down">&#xe616;</i></p>
</div>
<p><span class="price"> ¥{{price}}</span></p>
<span class="count">
×{{count}}
</span>
</div>
<!--<div class="opt-panel hide">
<div class="put-in-favorite">
<span class="iconfont">&#xe622;</span>
... ... @@ -77,4 +97,5 @@
删除
</div>
</div>-->
</div>
... ...
... ... @@ -52,7 +52,7 @@ class CouponController extends HuodongAction
$urlGirls = Helpers::url('/cuxiao/coupon/girlsbrand');
$urlKids = Helpers::url('/cuxiao/coupon/kidsbrand');
$urlLifestyle = Helpers::url('/cuxiao/coupon/lifestylebrand');
$urlShare = Yohobuy::SERVICE_URL . '/operations/api/v5/webshare/getShare';
$urlShare = '\/operations\/api\/v5\/webshare\/getShare';
$urlEncode = strtr($urlBoys, array('/' => '\\/'));
$this->_view->display('boysbrand', array(
... ... @@ -67,10 +67,10 @@ class CouponController extends HuodongAction
'shareImg' => 'http://img12.static.yhbimg.com/couponImg/2015/11/26/09/0226ad7f8bcf5467a789e17b761c7557e0.jpg',
'shareDesc' => '2015感恩季!品牌专属优惠券限时送!先领券,再购物,让你乐享整个冬季!',
'url_boys' => $urlBoys . '?yohobuy={"action":"go.h5","params":{"id":"364","share":"' . $urlShare . '","shareparam":{"share_id":"406"},"islogin":"N","type":0,"url":"' . $urlBoys . '","param":{}}}',
'url_girls' => $urlGirls . '?yohobuy={"action":"go.h5","params":{"id":"366","share":"' . $urlShare . '","shareparam":{"share_id":"408"},"islogin":"N","type":0,"url":"' . $urlGirls . '","param":{}}}',
'url_kids' => $urlKids . '?yohobuy={"action":"go.h5","params":{"id":"368","share":"' . $urlShare . '","shareparam":{"share_id":"410"},"islogin":"N","type":0,"url":"' . $urlKids . '","param":{}}}',
'url_lifestyle' => $urlLifestyle . '?yohobuy={"action":"go.h5","params":{"id":"370","share":"' . $urlShare . '","shareparam":{"share_id":"412"},"islogin":"N","type":0,"url":"' . $urlLifestyle . '","param":{}}}',
'url_boys' => $urlBoys . '?yohobuy={"action":"go.h5","params":{"id":"364","share":"' . $urlShare . '","shareparam":{"share_id":"406"},"islogin":"Y","type":0,"url":"' . $urlBoys . '","param":{}}}',
'url_girls' => $urlGirls . '?yohobuy={"action":"go.h5","params":{"id":"366","share":"' . $urlShare . '","shareparam":{"share_id":"408"},"islogin":"Y","type":0,"url":"' . $urlGirls . '","param":{}}}',
'url_kids' => $urlKids . '?yohobuy={"action":"go.h5","params":{"id":"368","share":"' . $urlShare . '","shareparam":{"share_id":"410"},"islogin":"Y","type":0,"url":"' . $urlKids . '","param":{}}}',
'url_lifestyle' => $urlLifestyle . '?yohobuy={"action":"go.h5","params":{"id":"370","share":"' . $urlShare . '","shareparam":{"share_id":"412"},"islogin":"Y","type":0,"url":"' . $urlLifestyle . '","param":{}}}',
'url_350' => 'http://list.m.yohobuy.com/?gender=1,3&brand=350&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"350","title":"MACROPUS"}}',
'url_160' => 'http://list.m.yohobuy.com/?gender=1,3&brand=60&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"60","title":"izzue"}}',
... ... @@ -501,7 +501,53 @@ class CouponController extends HuodongAction
'url_517' => 'http://tuk.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"517"}}',
));
}
/**
* 新客领券2
*
*
*/
public function newuser2Action()
{
// 判断是否是应用访问, 拼接APP需要的URL参数
$isApp = null !== $this->get('app_version');
$isAppLogged = true;
if ($isApp) {
$isLogged = $this->get('uid') !== null;
$isAppLogged = $this->checkIsLogin();
} else {
$isLogged = $this->getUid();
}
$urlNewuser = Helpers::url('/cuxiao/coupon/newuser');
$urlYohope = Helpers::url('/cuxiao/coupon/yohope');
$urlHelp = Helpers::url('/cuxiao/coupon/help');
$urlMycoupon = Helpers::url('/home/coupons', null, 'default');
$urlEncode = strtr($urlNewuser, array('/' => '\\/'));
$gender = $this->get('gender', '1,3');
$channel = $this -> get('yh_channel','1');
$url = Helpers::url('/boys') . '?openbuy:yohobuy={"action":"go.home","params":{"gender":"' . $gender . '","channel":"' . $channel . '"}}';
$this->_view->display('newuser2', array(
'activityId' => 87, // 活动ID 444
'staticTitle' => '新人潮这看,超值惊喜等你领', // 标题
'jumpUrl' => $isAppLogged ? 'javascript:;' : $urlNewuser . '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' . $urlEncode . '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}',
'isLogged' => $isLogged ? 'Y' : 'N', // 标识是否登录
'url_mycoupon' => $urlMycoupon . '?openby:yohobuy={"action":"go.coupon"}',
'url_yohope' => $urlYohope . '?yohobuy={"action":"go.h5","params":{"islogin":"Y","type":0,"url":"' . $urlYohope . '","param":{}}}',
'url_help' => $urlHelp . '?yohobuy={"action":"go.h5","params":{"islogin":"Y","type":0,"url":"' . $urlHelp . '","param":{}}}',
'url_more' => $url,
'url_4' => 'http://list.m.yohobuy.com/?msort=365&openby:yohobuy={"action":"go.list","params":{"msort":"365","title":"童装"}}',
'url_343' => 'http://list.m.yohobuy.com/?msort=10&openby:yohobuy={"action":"go.list","params":{"misort":"10","title":"创意生活"}}',
'url_230' => 'http://list.m.yohobuy.com/?msort=1&misort=18,20,21,22,226&openby:yohobuy={"action":"go.list","params":{"msort":"1","misort":"18,20,21,22,226","title":"冬装"}}',
'url_536' => 'http://list.m.yohobuy.com/?msort=3&misort=26,27,345&openby:yohobuy={"action":"go.list","params":{"msort":"3","misort":"26,27,345","title":"裤装"}}',
'url_847' => 'http://list.m.yohobuy.com/?msort=7,8&openby:yohobuy={"action":"go.list","params":{"msort":"7,8","title":"包配"}}',
'url_900' => 'http://list.m.yohobuy.com/?msort=4&openby:yohobuy={"action":"go.list","params":{"msort":"4","title":"裙装"}}',
'url_868' => 'http://list.m.yohobuy.com/?msort=1&misort=11,12,257,16&openby:yohobuy={"action":"go.list","params":{"msort":"1","misort":"11,12,257,16","title":"内搭"}}',
'url_1026' =>'http://list.m.yohobuy.com/?msort=6&misort=45&openby:yohobuy={"action":"go.list","params":{"msort":"6","misort":"45","title":"冬靴"}}'
));
}
/**
* 新客领券YOHOPE
*
... ...
... ... @@ -41,11 +41,12 @@ class HomeController extends AbstractAction
{
// 设置网站标题
$this->setTitle('个人中心');
$this->setNavHeader('个人中心', SITE_MAIN . '/?go=1', '', true);
$this->setNavHeader('个人中心', SITE_MAIN . '/?go=1');
$data = array(
'myIndexPage' => true,
'showDownloadApp' => true,
'navHome' => true,
'pageFooter' => true,
'cartUrl' => Helpers::url('/cart/index/index', null),
'signinUrl' => Helpers::url('/signin.html', array('refer' => Helpers::url('/home'))),
... ... @@ -846,7 +847,7 @@ class HomeController extends AbstractAction
if (empty($orderDetail)) {
$this->error();
}
$this->setTitle('订单详情');
$this->setNavHeader('订单详情');
... ...
<?php
use Action\AbstractAction;
use Index\CartModel;
use Index\UserModel;
use Plugin\Helpers;
/**
* 购物车
*/
class ShoppingCartController extends AbstractAction
{
/*
* 购物车首页
*/
public function indexAction()
{
$this->setTitle('购物车');
$this->setNavHeader('购物车');
$shoppingKey = Helpers::getShoppingKeyByCookie();
$uid = $this->getUid(true);
$data = array(
'shoppingCartPage' => true,
'shoppingCart' => CartModel::getCartData($uid, $shoppingKey)
);
//print_r($data);
// 渲染模板
$this->_view->display('index', $data);
}
/*
* 异步获取购物车数据
*/
public function getCartDataAction()
{
$result = array();
if ($this->isAjax()) {
$shoppingKey = Helpers::getShoppingKeyByCookie();
$uid = $this->getUid(true);
$result = CartModel::getCartData($uid, $shoppingKey);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 购物车商品选择与取消
*/
public function selectAction()
{
$result = array();
if ($this->isAjax()) {
$productId = $this->post('id', 0);
$uid = $this->getUid(true);
$shoppingKey = $this->getSession('shoppingKey');
$result = CartModel::selectGoods($uid, $productId, $shoppingKey);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 移出购物车
*/
public function delAction()
{
$result = array();
if ($this->isAjax()) {
$productId = $this->post('id', 0);
$uid = $this->getUid(true);
$shoppingKey = $this->getSession('shoppingKey');
$result = CartModel::removeFromCart($uid, $productId, $shoppingKey);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 移入收藏夹
*/
public function colAction()
{
$result = array();
if ($this->isAjax()) {
$productId = $this->post('id', 0);
$uid = $this->getUid(true);
$result = CartModel::addToFav($uid, $productId);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/*
* 获取购物车商品数据
*/
public function goodinfoAction()
{
$result = array();
if ($this->isAjax()) {
$num = $this->get('buy_num', 1);
$skn = $this->get('id', 1);
$uid = $this->getUid(true);
$result = CartModel::cartProductData($uid, $skn, $num); // 测试skn的ID为51172055
$result['num'] = $num;
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/*
* 赠品页面
*/
public function giftAction()
{
$this->setTitle('赠品');
$this->setNavHeader('赠品');
$shoppingKey = Helpers::getShoppingKeyByCookie();
$uid = $this->getUid(true);
$data = array(
'shoppingCartPage' => true,
'shoppingCart' => CartModel::getCartData($uid, $shoppingKey, true)
);
// 渲染模板
$this->_view->display('gift-advance-good', $data);
}
/*
* 加价购页面
*/
public function advanceBuyAction()
{
$this->setTitle('加价购');
$this->setNavHeader('加价购');
$shoppingKey = Helpers::getShoppingKeyByCookie();
$uid = $this->getUid(true);
$data = array(
'shoppingCartPage' => true,
'shoppingCart' => CartModel::getCartData($uid, $shoppingKey, false, true)
);
print_r($data);
// 渲染模板
$this->_view->display('gift-advance-good', $data);
}
/*
* 获取购物车加价购商品数据
*/
public function giftinfoAction()
{
$result = array();
if ($this->isAjax()) {
$skn = $this->get('skn', null);
$promotionId = $this->get('promotionId', null);
$result = CartModel::giftProductData($skn, $promotionId);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 修改购物车商品数据
*/
public function modifyAction()
{
$result = array();
if ($this->isAjax()) {
$shoppingKey = $this->getSession('shoppingKey');
$uid = $this->getUid(true);
$params = array();
$params['old_product_sku']= $this->post('old_product_sku', 0);
$params['new_product_sku']= $this->post('new_product_sku', 0);
$params['buy_number']= $this->post('buy_number', 0);
$params['selected']= $this->post('selected', null);
$result = CartModel::modifyCartProduct($uid, $params, $shoppingKey);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 购物车结算请求
*/
public function orderEnsureAction()
{
$this->setTitle('购物车');
$this->setNavHeader('购物车');
$cartType = $this->post('cartType', 'ordinary');
$cookieData = $this->getCookie('order-info', null);
$uid = $this->getUid(true);
$data = array(
'orderEnsurePage' => true,
'orderEnsure' => CartModel::cartPay($uid, $cartType, $cookieData)
);
// var_dump($data);
$this->_view->display('order-ensure', $data);
}
/**
* 购物车选择改变字段,重新运算订单数据
*/
public function orderComputeAction()
{
$result = array();
if ($this->isAjax()) {
$cartType = $this->post('cartType', 'ordinary');
$deliveryWay = $this->post('deliveryId', 1);
$paymentType = $this->post('paymentTypeId', 1);
$couponCode = $this->post('couponCode', null);
$yohoCoin = $this->post('yohoCoin', null);
$uid = $this->getUid(true);
$result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 购物车输入优惠券码使用优惠券
*/
public function couponSearchAction()
{
$result = array();
if ($this->isAjax()) {
$couponCode = $this->get('couponCode', '');
$uid = $this->getUid(true);
$result = CartModel::searchCoupon($uid, $couponCode);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 购物车结算--获取优惠券列表
*/
public function couponListAction()
{
$result = array();
if ($this->isAjax()) {
$uid = $this->getUid(true);
$page = $this->get('page', 1);
$result = CartModel::getCouponList($uid);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 下单流程 选择地址
*/
public function selectAddressAction()
{
// 设置网站标题
$this->setTitle('选择地址');
$this->setNavHeader('选择地址', Helpers::url('/shoppingCart/orderEnsure'));
$uid = $this->getUid(true);
$address = UserModel::getAddressData($uid);
$this->_view->display('select-address', array(
'selectAddressPage' => true,
'pageFooter' => true,
'address' => $address
));
}
/**
* 下单流程 选择优惠券
*/
public function selectCouponAction()
{
// 设置网站标题
$this->setTitle('选择优惠券');
$this->setNavHeader('选择优惠券', Helpers::url('/shoppingCart/orderEnsure'));
$this->_view->display('select-coupon', array(
'selectCouponPage' => true,
'pageFooter' => true
));
}
/**
* 确认结算订单
*/
public function orderSubAction()
{
$result = array();
if ($this->isAjax()) {
$uid = $this->getUid(true);
$addressId = $this->post('addressId', null);
$cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车
$deliveryTime = $this->post('deliveryTimeId', 1); // 默认只工作日配送
$deliveryWay = $this->post('deliveryId', 1); // 默认普通快递
$invoiceTitle = $this->post('invoiceText', null);
$invoiceId = $this->post('invoiceType', null);
$paymentId = $this->post('paymentTypeId', 15);
$paymentType = $this->post('paymentType', 1); // 默认在线支付
$remark = $this->post('msg', null);
$couponCode = $this->post('couponCode', null);
$yohoCoin = $this->post('yohoCoin', 1);
$result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin);
}
if (empty($result)) {
echo ' ';
} else {
// 提交成功清除Cookie
$this->setCookie('order-info', null);
$this->echoJson($result);
}
}
}
... ... @@ -17,632 +17,705 @@ use Plugin\Images;
class CartModel
{
/**
* 加入购物车
*
* @param int $productSku 商品SKU
* @param int $buyNumber 购买数量
* @param int $goodsType 商品类型,0表示普通商品,1表示加价购商品
* @param int $isEdit 是否是编辑商品SKU,0表示不是编辑
* @param null|int $promotionId 促销id,默认null(加价购有关)
* @param null|int $uid 用户UID,可以不传
* @return array 加入购物车接口返回的数据
*/
public static function addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid)
{
$result = array('code' => 400, 'message' => '出错啦~~');
$addCart = CartData::addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid);
if ($addCart && isset($addCart['code'])) {
$result = $addCart;
}
return $result;
}
/**
* @param integer $uid 用户ID
* @param string $shoppingKey 未登录用户唯一识别码
* @param bool $onlyGift 只获取赠品的商品数据
* @param bool $onlyAdvanceBuy 只获取加价购的商品数据
* @return array|mixed 处理之后的购物车数据
*/
public static function getCartData($uid, $shoppingKey, $onlyGift = false, $onlyAdvanceBuy = false)
{
$result = array('cartNav' => true);
// 用户是否登录
if (empty($uid)) {
$result['showLoginInfo'] = true;
}
// 调用接口获取购物车的数据
$cartData = CartData::cartData($uid, $shoppingKey);
// 处理普通购物车和预售购物车的数据
if (isset($cartData['data']) && !empty($cartData['data'])) {
$cart = $cartData['data'];
/* 普通购物车 */
if(isset($cart['ordinary_cart_data'])) {
$result['commonGoodsCount'] = $cart['ordinary_cart_data']['shopping_cart_data']['goods_count'];
$result['commonCart'] = self::procCartData($cart['ordinary_cart_data'], $onlyGift, $onlyAdvanceBuy);
}
/* 预售购物车 */
if(isset($cart['advance_cart_data'])) {
$result['presellGoodsCount'] = $cart['advance_cart_data']['shopping_cart_data']['goods_count'];
$result['preSellCart'] = self::procCartData($cart['advance_cart_data'], $onlyGift, $onlyAdvanceBuy);
}
}
return $result;
}
/**
* 购物车商品选择与取消接口返回的数据处理
*
* @param int $uid 用户ID
* @param string $sku 商品sku列表
* @param string $shoppingKey 未登录用户唯一识别码
* @return array 处理之后的数据的数据
*/
public static function selectGoods($uid, $sku, $shoppingKey)
{
$result = array('code' => 400, 'message' => '出错啦~');
// 处理sku
$sku_list = json_encode(array($sku => 1));
$select = CartData::selectGoods($uid, $sku_list, $shoppingKey);
if ($select && isset($select['code'])) {
$result['code'] = $select['code'];
$result['message'] = $select['message'];
}
return $result;
}
/**
* 移出购物车
*
* @param int $uid 用户ID
* @param string $sku 商品sku列表
* @param string $shoppingKey 未登录用户唯一识别码
* @return array 接口返回的数据
*/
public static function removeFromCart($uid, $sku, $shoppingKey)
{
$result = array('code' => 400, 'message' => '出错啦~');
// 处理sku
$sku_list = json_encode(array($sku => 1));
$remove = CartData::removeFromCart($uid, $sku_list, $shoppingKey);
if ($remove && isset($remove['code'])) {
$result['code'] = $remove['code'];
$result['message'] = $remove['message'];
}
return $result;
}
/**
* 移入收藏夹
*
* @param int $uid 用户ID
* @param string $sku 商品sku列表
* @return array 接口返回的数据
*/
public static function addToFav($uid, $sku)
{
$result = array('code' => 400, 'message' => '出错啦~');
if (empty($uid)) {
$result['code'] = 300;
$reult['message'] = '请先登录';
$result['data'] = '/signin.html';
return $result;
}
// 处理sku
$sku_list = json_encode(array($sku => 1));
$add = CartData::addToFav($uid, $sku_list);
if ($add && isset($add['code'])) {
$result['code'] = $add['code'];
$result['message'] = $add['message'];
}
return $result;
}
/**
* 处理购物车商品数据
*
* @param int $uid 用户ID
* @param int $skn 商品skn
* @param int $num 购买数目
* @return array 接口返回的数据
*/
public static function cartProductData($uid, $skn, $num)
{
$result = array('code' => 400, 'message' => '出错啦~');
$product = CartData::cartProductData($uid, $skn);
if (isset($product['code']) && $product['code'] === 200) {
$result['code'] = 200;
$data = array();
$productData = $product['data'];
// 品牌信息
if (isset($productData['brand_info']) && !empty($productData['brand_info'])) {
$data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120);
}
$data['name'] = $productData['product_name'];
$data['price'] = $productData['market_price'];
$data['salePrice'] = $productData['sales_price'];
$data['storage'] = $productData['storage_sum'];
$data['num'] = $num;
// 商品选择
if (isset($productData['goods_list'])) {
$goodsList = $productData['goods_list'];
$colors = array();
$oneColor = array();
$sizes = array();
$oneSize = array();
foreach ($goodsList as $val) {
// 颜色
$oneColor = array();
$oneColor['id'] = $val['color_id'];
$oneColor['name'] = $val['color_name'];
// 尺码
foreach ($val['size_list'] as $one) {
$oneSize = array();
$oneSize['id'] = $one['size_id'];
$oneSize['name'] = $one['size_name'];
}
$sizes[] = $oneSize;
$oneColor['sizes'] = $sizes;
$colors[] = $oneColor;
}
$data['colors'] = $colors;
}
$result['data'] = $data;
}
return $result;
}
/**
* 处理加价购商品数据
*
* @param int $skn 商品skn
* @param int $promotionId 加价购商品促销ID
* @return array
*/
public static function giftProductData($skn, $promotionId)
{
$result = array();
$product = CartData::giftProductData($skn, $promotionId);
if (isset($product['code']) && $product['code'] === 200) {
$result['code'] = 200;
$data = array();
$productData = $product['data'];
// 品牌信息
if (isset($productData['brand_info']) && !empty($productData['brand_info'])) {
$data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120);
}
$data['name'] = $productData['product_name'];
$data['price'] = $productData['market_price'];
$data['salePrice'] = $productData['sales_price'];
$data['storage'] = $productData['storage_sum'];
// 商品选择
if (isset($productData['goods_list'])) {
$goodsList = $productData['goods_list'];
$colors = array();
$oneColor = array();
$sizes = array();
$oneSize = array();
foreach ($goodsList as $val) {
// 颜色
$oneColor = array();
$oneColor['id'] = $val['color_id'];
$oneColor['name'] = $val['color_name'];
// 尺码
foreach ($val['size_list'] as $one) {
$oneSize = array();
$oneSize['id'] = $one['size_id'];
$oneSize['name'] = $one['size_name'];
}
$sizes[] = $oneSize;
$oneColor['sizes'] = $sizes;
$colors[] = $oneColor;
}
$data['colors'] = $colors;
}
$result['data'] = $data;
}
return $result;
}
/**
* 修改购物车商品数据
*
* @param int $uid 用户ID
* @param string $param 要更改的数据
* @param string $shoppingKey 未登录用户唯一识别码
* @return array 接口返回的数据
*/
public static function modifyCartProduct($uid, $param, $shoppingKey)
{
$result = array('code' => 400, 'message' => '出错啦~');
// 处理要更改的数据
$swapData = json_encode(array($param));
$modify = CartData::modifyCartProduct($uid, $swapData, $shoppingKey);
if ($modify && isset($modify['code'])) {
$result['code'] = $modify['code'];
$result['message'] = $modify['message'];
}
return $result;
}
/**
* 调用购物车结算接口返回的数据处理
*
* @param int $uid 用户ID
* @param string $cartType 购物车类型,ordinary表示普通购物车
* @param null|string $cookieData cookie中记录的一些订单有关数据
* @return array 接口返回的数据
*/
public static function cartPay($uid, $cartType, $cookieData)
{
$result = array();
$pay = CartData::cartPay($uid, $cartType);
if ($pay && isset($pay['code']) && $pay['code'] === 200) {
$payReturn = $pay['data'];
$orderInfo = array();
$address = array();
$orderCompute = array();
// cookie保存的数据
if (!empty($cookieData)) {
$orderInfo = json_decode($cookieData, true);
$orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']);
}
// 根据地址id查询地址信息
if (isset($orderInfo['addressId'])) {
$address = UserModel::getAddressDataById($uid, $orderInfo['addressId']);
}
// 收货人有关信息
if (isset($payReturn['delivery_address']) && !empty($payReturn['delivery_address'])) {
$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'];
/**
* 加入购物车
*
* @param int $productSku 商品SKU
* @param int $buyNumber 购买数量
* @param int $goodsType 商品类型,0表示普通商品,1表示加价购商品
* @param int $isEdit 是否是编辑商品SKU,0表示不是编辑
* @param null|int $promotionId 促销id,默认null(加价购有关)
* @param null|int $uid 用户UID,可以不传
* @return array 加入购物车接口返回的数据
*/
public static function addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid)
{
$result = array('code' => 400, 'message' => '出错啦~~');
$addCart = CartData::addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid);
if ($addCart && isset($addCart['code'])) {
$result = $addCart;
}
return $result;
}
/**
* @param integer $uid 用户ID
* @param string $shoppingKey 未登录用户唯一识别码
* @param string $cartType 购物车类型
* @param bool $onlyGift 只获取赠品的商品数据
* @param bool $onlyAdvanceBuy 只获取加价购的商品数据
* @return array|mixed 处理之后的购物车数据
*/
public static function getCartData($uid, $shoppingKey, $cartType = 'all', $onlyGift = false, $onlyAdvanceBuy = false)
{
$result = array('cartNav' => true);
// 用户是否登录
if (empty($uid)) {
$result['showLoginInfo'] = true;
}
// 调用接口获取购物车的数据
$cartData = CartData::cartData($uid, $shoppingKey);
// 处理普通购物车和预售购物车的数据
do {
if (!isset($cartData['data']) || empty($cartData['data'])) {
break;
}
$cart = $cartData['data'];
if ($cartType !== 'all') { // 加价购或者赠品数据
$result = self::procCartData($cart['ordinary_cart_data'], $onlyGift, $onlyAdvanceBuy);
break;
}
$ordinaryCount = intval($cart['ordinary_cart_data']['shopping_cart_data']['goods_count']);
$advanceCount = intval($cart['advance_cart_data']['shopping_cart_data']['goods_count']);
// 普通购物车和预售购物车都为空
if ($ordinaryCount === 0 && $advanceCount === 0) {
$result['isEmptyCart'] = true;
break;
}
/* 普通购物车 */
$result['commonGoodsCount'] = $ordinaryCount;
$result['commonCart'] = self::procCartData($cart['ordinary_cart_data'], $onlyGift, $onlyAdvanceBuy);
/* 预售购物车 */
$result['presellGoodsCount'] = $advanceCount;
$result['preSellCart'] = self::procCartData($cart['advance_cart_data'], $onlyGift, $onlyAdvanceBuy);
}while(0);
return $result;
}
/**
* 购物车商品选择与取消接口返回的数据处理
*
* @param int $uid 用户ID
* @param string $skuList 商品sku列表
* @param string $shoppingKey 未登录用户唯一识别码
* @return array 处理之后的数据的数据
*/
public static function selectGoods($uid, $skuList, $shoppingKey)
{
$result = array('code' => 400, 'message' => '出错啦~');
do {
if (empty($skuList)) {
break;
}
$select = CartData::selectGoods($uid, $skuList, $shoppingKey);
if ($select && isset($select['code'])) {
$result['code'] = $select['code'];
$result['message'] = $select['message'];
}
}while(0);
return $result;
}
/**
* 移出购物车
*
* @param int $uid 用户ID
* @param string $sku 商品sku列表
* @param string $shoppingKey 未登录用户唯一识别码
* @return array 接口返回的数据
*/
public static function removeFromCart($uid, $sku, $shoppingKey)
{
$result = array('code' => 400, 'message' => '出错啦~');
// 处理sku
$sku_list = json_encode(array($sku => 1));
$remove = CartData::removeFromCart($uid, $sku_list, $shoppingKey);
if ($remove && isset($remove['code'])) {
$result['code'] = $remove['code'];
$result['message'] = $remove['message'];
}
return $result;
}
/**
* 移入收藏夹
*
* @param int $uid 用户ID
* @param string $sku 商品sku列表
* @return array 接口返回的数据
*/
public static function addToFav($uid, $sku)
{
$result = array('code' => 400, 'message' => '出错啦~');
if (empty($uid)) {
$result['code'] = 300;
$reult['message'] = '请先登录';
$result['data'] = '/signin.html';
return $result;
}
// 处理sku
$sku_list = json_encode(array($sku => 1));
$add = CartData::addToFav($uid, $sku_list);
if ($add && isset($add['code'])) {
$result['code'] = $add['code'];
$result['message'] = $add['message'];
}
return $result;
}
/**
* 处理购物车商品数据
*
* @param int $uid 用户ID
* @param int $skn 商品skn
* @param int $num 购买数目
* @return array 接口返回的数据
*/
public static function cartProductData($uid, $skn, $num)
{
$result = array('code' => 400, 'message' => '出错啦~');
$product = CartData::cartProductData($uid, $skn);
if (isset($product['code']) && $product['code'] === 200) {
$result['code'] = 200;
$data = array();
$productData = $product['data'];
// 品牌信息
if (isset($productData['brand_info']) && !empty($productData['brand_info'])) {
$data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120);
}
$data['name'] = $productData['product_name'];
$data['price'] = $productData['market_price'];
$data['salePrice'] = $productData['sales_price'];
$data['storage'] = $productData['storage_sum'];
$data['num'] = $num;
// 商品选择
if (isset($productData['goods_list'])) {
$goodsList = $productData['goods_list'];
$colors = array();
$oneColor = array();
$sizes = array();
$oneSize = array();
foreach ($goodsList as $val) {
// 颜色
$oneColor = array();
$oneColor['id'] = $val['color_id'];
$oneColor['name'] = $val['color_name'];
// 尺码
foreach ($val['size_list'] as $one) {
$oneSize = array();
$oneSize['id'] = $one['size_id'];
$oneSize['name'] = $one['size_name'];
}
$sizes[] = $oneSize;
$oneColor['sizes'] = $sizes;
$colors[] = $oneColor;
}
$data['colors'] = $colors;
}
$result['data'] = $data;
}
return $result;
}
/**
* 处理加价购商品数据
*
* @param int $skn 商品skn
* @param int $promotionId 加价购商品促销ID
* @return array
*/
public static function giftProductData($skn, $promotionId)
{
$result = array();
$product = CartData::giftProductData($skn, $promotionId);
if (isset($product['code']) && $product['code'] === 200) {
$result['code'] = 200;
$data = array();
$productData = $product['data'];
// 品牌信息
if (isset($productData['brand_info']) && !empty($productData['brand_info'])) {
$data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120);
}
$data['name'] = $productData['product_name'];
$data['price'] = $productData['market_price'];
$data['salePrice'] = $productData['sales_price'];
$data['storage'] = $productData['storage_sum'];
// 商品选择
if (isset($productData['goods_list'])) {
$goodsList = $productData['goods_list'];
$colors = array();
$oneColor = array();
$sizes = array();
$oneSize = array();
foreach ($goodsList as $val) {
// 颜色
$oneColor = array();
$oneColor['id'] = $val['color_id'];
$oneColor['name'] = $val['color_name'];
// 尺码
foreach ($val['size_list'] as $one) {
$oneSize = array();
$oneSize['id'] = $one['size_id'];
$oneSize['name'] = $one['size_name'];
}
$sizes[] = $oneSize;
$oneColor['sizes'] = $sizes;
$colors[] = $oneColor;
}
$data['colors'] = $colors;
}
$result['data'] = $data;
}
return $result;
}
/**
* 修改购物车商品数量
*
* @param int $uid 用户ID
* @param string $sku 商品SKU
* @param int $increaseNum 增加的数目
* @param int $decreaseNum 减少的数目
* @param string $shoppingKey 未登录用户唯一识别码
* @return array 接口返回的数据
*/
public static function modifyProductNum($uid, $sku, $increaseNum, $decreaseNum, $shoppingKey)
{
$result = array('code' => 400, 'message' => '出错啦~');
do {
if (empty($sku)) {
braek;
}
$modify = CartData::modifyProductNum($uid, $sku, $increaseNum, $decreaseNum, $shoppingKey);
if ($modify && isset($modify['code'])) {
$result['code'] = $modify['code'];
$result['message'] = $modify['message'];
}
}while(0);
return $result;
}
/**
* 修改购物车商品数据
*
* @param int $uid 用户ID
* @param string $param 要更改的数据
* @param string $shoppingKey 未登录用户唯一识别码
* @return array 接口返回的数据
*/
public static function modifyCartProduct($uid, $param, $shoppingKey)
{
$result = array('code' => 400, 'message' => '出错啦~');
do {
if (empty($param['old_product_sku']) || empty($param['new_product_sku'])) {
break;
}
// 处理要更改的数据
$swapData = json_encode(array($param));
$modify = CartData::modifyCartProduct($uid, $swapData, $shoppingKey);
if ($modify && isset($modify['code'])) {
$result['code'] = $modify['code'];
$result['message'] = $modify['message'];
}
}while(0);
return $result;
}
/**
* 调用购物车结算接口返回的数据处理
*
* @param int $uid 用户ID
* @param string $cartType 购物车类型,ordinary表示普通购物车
* @param null|string $cookieData cookie中记录的一些订单有关数据
* @return array 接口返回的数据
*/
public static function cartPay($uid, $cartType, $cookieData)
{
$result = array();
$pay = CartData::cartPay($uid, $cartType);
if ($pay && isset($pay['code']) && $pay['code'] === 200) {
$payReturn = $pay['data'];
$orderInfo = array();
$address = array();
$orderCompute = array();
// cookie保存的数据
if (!empty($cookieData)) {
$orderInfo = json_decode($cookieData, true);
$orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']);
}
// 根据地址id查询地址信息
if (isset($orderInfo['addressId'])) {
$address = UserModel::getAddressDataById($uid, $orderInfo['addressId']);
}
// 收货人有关信息
if (isset($payReturn['delivery_address']) && !empty($payReturn['delivery_address'])) {
$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['isSupport'] = ($payReturn['delivery_address']['is_support'] === 'Y');
}
// 配送方式
if (isset($payReturn['delivery_way'])) {
$idArr = array();
$defaultKey = 0;
$oneDeliv = array();
foreach ($payReturn['delivery_way'] as $key => $val) {
$oneDeliv = array();
$oneDeliv['id'] = $val['delivery_way_id'];
$oneDeliv['name'] = $val['delivery_way_name'];
($val['default'] === 'Y') && $defaultKey = $key;
$idArr[$key] = $oneDeliv['id'];
$result['dispatchMode'][$key] = $oneDeliv;
}
if (isset($orderInfo['deliveryId'])) {
$flag = array_search($orderInfo['deliveryId'], $idArr);
$flag !== false && $result['dispatchMode'][$flag]['isSelected'] = true;
} else {
$result['dispatchMode'][$defaultKey]['isSelected'] = true;
}
}
// 配送时间
if (isset($payReturn['delivery_time'])) {
$idArr = array();
$defaultKey = 0;
$oneDelivTime = array();
foreach ($payReturn['delivery_time'] as $key => $one) {
$oneDelivTime = array();
$oneDelivTime['id'] = $one['delivery_time_id'];
$oneDelivTime['name'] = $one['delivery_time_string'];
($one['default'] === 'Y') && $defaultKey = $key;
$idArr[$key] = $oneDelivTime['id'];
$result['dispatchTime'][] = $oneDelivTime;
}
if (isset($orderInfo['deliveryTimeId'])) {
$flag = array_search($orderInfo['deliveryTimeId'], $idArr);
$flag !== false && $result['dispatchTime'][$flag]['isSelected'] = true;
} else {
$result['dispatchTime'][$defaultKey]['isSelected'] = true;
}
}
// 订单商品
if (isset($payReturn['goods_list'])) {
$oneGoods = array();
foreach ($payReturn['goods_list'] as $single) {
$oneGoods = array();
$oneGoods['id'] = $single['product_sku']; // TODO 未确定用哪个
$oneGoods['thumb'] = Images::getImageUrl($single['goods_images'], 120, 120);
$oneGoods['name'] = $single['product_name'];
$oneGoods['color'] = $single['color_name'];
$oneGoods['size'] = $single['size_name'];
$oneGoods['price'] = Helpers::transPrice($single['sales_price']);
$oneGoods['count'] = $single['buy_number'];
$result['goods'][] = $oneGoods;
}
}
// 支付方式
if (isset($payReturn['payment_way'])) {
$onePay = array();
foreach ($payReturn['payment_way'] as $pay) {
$onePay = array();
$onePay['id'] = $pay['payment_id'];
$onePay['paymentType'] = $pay['payment_type'];
$onePay['name'] = $pay['payment_type_name'];
$onePay['default'] = ($pay['default'] === 'Y');
$result['paymentWay'][] = $onePay;
}
}
// 有货币
$result['yohoCoin'] = (isset($orderCompute['use_yoho_coin']) && !empty($orderCompute['use_yoho_coin'])) ? $orderCompute['use_yoho_coin'] : $payReturn['yoho_coin'];
// 订单数据
if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) {
$sumPrice = isset($orderCompute['order_amount']) ? $orderCompute['order_amount'] : $payReturn['shopping_cart_data']['order_amount'];
$freight = isset($orderCompute['promotion_formula_list']['promotion_amount']) ? $orderCompute['promotion_formula_list'][1]['promotion_amount'] : $payReturn['shopping_cart_data']['promotion_formula_list'][1]['promotion_amount'];
$couponPrice = isset($orderCompute['coupon_amount']) ? $orderCompute['coupon_amount'] : false;
$salePrice = isset($orderCompute['discount_amount']) ? $orderCompute['discount_amount'] : $payReturn['shopping_cart_data']['promotion_formula_list'][3]['promotion_amount'];
$price = isset($orderCompute['last_order_amount']) ? $orderCompute['last_order_amount'] : $payReturn['shopping_cart_data']['last_order_amount'];
$result['sumPrice'] = Helpers::transPrice($sumPrice);
$result['salePrice'] = Helpers::transPrice($salePrice);
$result['price'] = Helpers::transPrice($price);
$result['freight'] = $freight;
$result['couponPrice'] = $couponPrice;
}
// 发票有关数据
if (isset($payReturn['invoices']) && !empty($payReturn['invoices'])) {
$one = array();
foreach ($payReturn['invoices']['invoices_type_list'] as $inv) {
$one = array();
$one['id'] = $inv['invoices_type_id'];
$one['name'] = $inv['invoices_type_name'];
$result['isSupport'] = ($payReturn['delivery_address']['is_support'] === 'Y');
}
// 配送方式
if (isset($payReturn['delivery_way'])) {
$idArr = array();
$defaultKey = 0;
$oneDeliv = array();
foreach ($payReturn['delivery_way'] as $key => $val) {
$oneDeliv = array();
$oneDeliv['id'] = $val['delivery_way_id'];
$oneDeliv['name'] = $val['delivery_way_name'];
($val['default'] === 'Y') && $defaultKey = $key;
$idArr[$key] = $oneDeliv['id'];
$result['dispatchMode'][$key] = $oneDeliv;
}
if (isset($orderInfo['deliveryId'])) {
$flag = array_search($orderInfo['deliveryId'], $idArr);
$flag !== false && $result['dispatchMode'][$flag]['isSelected'] = true;
} else {
$result['dispatchMode'][$defaultKey]['isSelected'] = true;
}
}
// 配送时间
if (isset($payReturn['delivery_time'])) {
$idArr = array();
$defaultKey = 0;
$oneDelivTime = array();
foreach ($payReturn['delivery_time'] as $key => $one) {
$oneDelivTime = array();
$oneDelivTime['id'] = $one['delivery_time_id'];
$oneDelivTime['name'] = $one['delivery_time_string'];
($one['default'] === 'Y') && $defaultKey = $key;
$idArr[$key] = $oneDelivTime['id'];
$result['dispatchTime'][] = $oneDelivTime;
}
if (isset($orderInfo['deliveryTimeId'])) {
$flag = array_search($orderInfo['deliveryTimeId'], $idArr);
$flag !== false && $result['dispatchTime'][$flag]['isSelected'] = true;
} else {
$result['dispatchTime'][$defaultKey]['isSelected'] = true;
}
}
// 订单商品
if (isset($payReturn['goods_list'])) {
$oneGoods = array();
foreach ($payReturn['goods_list'] as $single) {
$oneGoods = array();
$oneGoods['id'] = $single['product_sku']; // TODO 未确定用哪个
$oneGoods['thumb'] = Images::getImageUrl($single['goods_images'], 120, 120);
$oneGoods['name'] = $single['product_name'];
$oneGoods['color'] = $single['color_name'];
$oneGoods['size'] = $single['size_name'];
$oneGoods['price'] = Helpers::transPrice($single['sales_price']);
$oneGoods['count'] = $single['buy_number'];
$result['goods'][] = $oneGoods;
}
}
// 支付方式
if (isset($payReturn['payment_way'])) {
$onePay = array();
foreach ($payReturn['payment_way'] as $pay) {
$onePay = array();
$onePay['id'] = $pay['payment_id'];
$onePay['paymentType'] = $pay['payment_type'];
$onePay['name'] = $pay['payment_type_name'];
$onePay['default'] = ($pay['default'] === 'Y');
$result['paymentWay'][] = $onePay;
}
}
// 有货币
$result['yohoCoin'] = (isset($orderCompute['use_yoho_coin']) && !empty($orderCompute['use_yoho_coin'])) ? $orderCompute['use_yoho_coin'] : $payReturn['yoho_coin'];
// 订单数据
if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) {
$sumPrice = isset($orderCompute['order_amount']) ? $orderCompute['order_amount'] : $payReturn['shopping_cart_data']['order_amount'];
$freight = '¥0';
if (isset($orderCompute['promotion_formula_list'][1]['promotion_amount'])) {
$freight = $orderCompute['promotion_formula_list'][1]['promotion_amount'];
} elseif(isset($payReturn['shopping_cart_data']['promotion_formula_list'][1]['promotion_amount'])) {
$freight = $payReturn['shopping_cart_data']['promotion_formula_list'][1]['promotion_amount'];
}
$couponPrice = isset($orderCompute['coupon_amount']) ? $orderCompute['coupon_amount'] : false;
$salePrice = isset($orderCompute['discount_amount']) ? $orderCompute['discount_amount'] : $payReturn['shopping_cart_data']['discount_amount'];
$price = isset($orderCompute['last_order_amount']) ? $orderCompute['last_order_amount'] : $payReturn['shopping_cart_data']['last_order_amount'];
$result['sumPrice'] = Helpers::transPrice($sumPrice);
$result['salePrice'] = Helpers::transPrice($salePrice);
$result['price'] = Helpers::transPrice($price);
$result['freight'] = $freight;
$result['couponPrice'] = $couponPrice;
}
// 发票有关数据
if (isset($payReturn['invoices']) && !empty($payReturn['invoices'])) {
$one = array();
foreach ($payReturn['invoices']['invoices_type_list'] as $inv) {
$one = array();
$one['id'] = $inv['invoices_type_id'];
$one['name'] = $inv['invoices_type_name'];
isset($orderInfo['invoiceType']) && $one['id'] == $orderInfo['invoiceType'] && $one['isSelected'] = true;
$result['invoice'][] = $one;
}
$result['invoice'][] = $one;
}
// 发票信息需要记录
if (isset($orderInfo['invoice'])) {
$result['needInvoice'] = $orderInfo['invoice'];
$result['invoiceText'] = $orderInfo['invoiceText'];
}
if (isset($orderInfo['invoice'])) {
$result['needInvoice'] = $orderInfo['invoice'];
$result['invoiceText'] = $orderInfo['invoiceText'];
}
}
}
// 留言
isset($orderInfo['msg']) && $result['msg'] = $orderInfo['msg'];
// 优惠券数据
$coupons = array();
!empty($orderCompute['coupon_amount']) && $coupons['value'] = $orderInfo['couponValue'];
$coupons += self::getCouponList($uid, true);
$result['coupon'] = $coupons;
}
return $result;
}
/**
* 购物车结算--支付方式和配送方式选择以及是否使用YOHO币接口返回的数据处理
*
* @param int $uid 用户ID
* @param string $cartType 购物车类型,ordinary表示普通购物车
* @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运
* @param int $paymentType 支付方式,1表示在线支付,2表示货到付款
* @param string $couponCode 优惠券码
* @param mixed $yohoCoin 使用的YOHO币数量
* @return array 接口返回的数据
*/
public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin)
{
$result = array();
$compute = CartData::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin);
if ($compute && isset($compute['code']) && $compute['code'] === 200) {
$result = $compute['data'];
}
return $result;
}
/**
* 购物车结算--输入优惠券代码返回的结果处理
*
* @param int $uid 用户ID
* @param string $couponCode 优惠券代码
* @return array 接口返回的数据
*/
public static function searchCoupon($uid, $couponCode)
{
$result = array('code' => 400, 'message' => '出错啦~');
$coupon = CartData::searchCoupon($uid, $couponCode);
if ($coupon && isset($coupon['code'])) {
$result = $coupon;
}
return $result;
}
/**
* 处理优惠券列表数据
*
* @param int $uid 用户ID
* @param boolean $onlyTotal 只返回总数
* @return array|mixed 处理之后的优惠券数据
*/
public static function getCouponList($uid, $onlyTotal = false)
{
$result = array();
// 调用接口获取优惠券数据
$coupons = CartData::getCouponList($uid);
// 处理优惠券数据
if (isset($coupons['data'])) {
if ($onlyTotal) {
$result['count'] = count($coupons['data']['couponList']);
} else {
$couponArr = array();
isset($coupons['data']['couponList']) && $couponArr = $coupons['data']['couponList'];
foreach ($couponArr as &$val) {
$notAvailableRes = self::searchCoupon($uid, $val['couponCode']);
// 处理可用的优惠券
if (isset($notAvailableRes['code']) && $notAvailableRes['code'] !== 200) {
$val['notAvailable'] = true;
}
}
!empty($couponArr) && $result = $couponArr;
}
}
return $result;
}
/**
* 购物车结算--提交结算信息
*
* @param int $uid 用户ID
* @param int $addressId 地址ID
* @param int $cartType 购物车类型ID
* @param int $deliveryTime 寄送时间ID
* @param int $deliveryWay 寄送方式ID
* @param string $invoiceTitle 发票说明
* @param int $invoiceId 发票类型ID
* @param int $paymentId 支付方式ID
* @param int $paymentType 支付类型ID
* @param string $remark 留言
* @param string $couponCode 优惠券码
* @param mixed $yohoCoin 使用的YOHO币数量或为空
* @return array 接口返回的数据
*/
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin)
{
$result = array('code' => 400, 'message' => '出错啦');
if (empty($addressId)) {
$result['code'] = 401;
$result['message'] = '配送地址不能为空';
} elseif (empty($deliveryTime)) {
$result['code'] = 402;
$result['message'] = '请选择配送时间';
} elseif (empty($deliveryWay)) {
$result['code'] = 403;
$result['message'] = '请选择配送方式';
} else {
$orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin);
// 优惠券数据
$coupons = array();
!empty($orderCompute['coupon_amount']) && $coupons['value'] = $orderInfo['couponValue'];
$coupons += self::getCouponList($uid, true);
$result['coupon'] = $coupons;
}
return $result;
}
/**
* 购物车结算--支付方式和配送方式选择以及是否使用YOHO币接口返回的数据处理
*
* @param int $uid 用户ID
* @param string $cartType 购物车类型,ordinary表示普通购物车
* @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运
* @param int $paymentType 支付方式,1表示在线支付,2表示货到付款
* @param string $couponCode 优惠券码
* @param mixed $yohoCoin 使用的YOHO币数量
* @return array 接口返回的数据
*/
public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin)
{
$result = array();
$compute = CartData::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin);
if ($compute && isset($compute['code']) && $compute['code'] === 200) {
$result = $compute['data'];
}
return $result;
}
/**
* 购物车结算--输入优惠券代码返回的结果处理
*
* @param int $uid 用户ID
* @param string $couponCode 优惠券代码
* @return array 接口返回的数据
*/
public static function searchCoupon($uid, $couponCode)
{
$result = array('code' => 400, 'message' => '出错啦~');
$coupon = CartData::searchCoupon($uid, $couponCode);
if ($coupon && isset($coupon['code'])) {
$result = $coupon;
}
return $result;
}
/**
* 处理优惠券列表数据
*
* @param int $uid 用户ID
* @param boolean $onlyTotal 只返回总数
* @return array|mixed 处理之后的优惠券数据
*/
public static function getCouponList($uid, $onlyTotal = false)
{
$result = array();
// 调用接口获取优惠券数据
$coupons = CartData::getCouponList($uid);
// 处理优惠券数据
if (isset($coupons['data'])) {
if ($onlyTotal) {
$result['count'] = count($coupons['data']['couponList']);
} else {
$couponArr = array();
isset($coupons['data']['couponList']) && $couponArr = $coupons['data']['couponList'];
foreach ($couponArr as &$val) {
$notAvailableRes = self::searchCoupon($uid, $val['couponCode']);
// 处理可用的优惠券
if (isset($notAvailableRes['code']) && $notAvailableRes['code'] !== 200) {
$val['notAvailable'] = true;
}
}
!empty($couponArr) && $result = $couponArr;
}
}
return $result;
}
/**
* 购物车结算--提交结算信息
*
* @param int $uid 用户ID
* @param int $addressId 地址ID
* @param int $cartType 购物车类型ID
* @param int $deliveryTime 寄送时间ID
* @param int $deliveryWay 寄送方式ID
* @param string $invoiceTitle 发票说明
* @param int $invoiceId 发票类型ID
* @param int $paymentId 支付方式ID
* @param int $paymentType 支付类型ID
* @param string $remark 留言
* @param string $couponCode 优惠券码
* @param mixed $yohoCoin 使用的YOHO币数量或为空
* @return array 接口返回的数据
*/
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin)
{
$result = array('code' => 400, 'message' => '出错啦');
if (empty($addressId)) {
$result['code'] = 401;
$result['message'] = '配送地址不能为空';
} elseif (empty($deliveryTime)) {
$result['code'] = 402;
$result['message'] = '请选择配送时间';
} elseif (empty($deliveryWay)) {
$result['code'] = 403;
$result['message'] = '请选择配送方式';
} else {
$orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin);
if ($orderSubRes && isset($orderSubRes['code'])) {
$result = $orderSubRes;
}
}
return $result;
}
/**
* 处理不同类型的购物车数据
*
* @param array $data 不同类型购物车数据
* @param bool $onlyGift 只获取赠品的商品数据
* @param bool $onlyAdvanceBuy 只获取加价购的商品数据
* @return array $result 处理之后的不同类型购物车数据
*/
private static function procCartData($data, $onlyGift = false, $onlyAdvanceBuy = false)
{
$result = array();
if (!$onlyAdvanceBuy) {
// 赠品
$result['giftCount'] = 0;
$result['freebie'] = Helpers::formatAdvanceGoods($data['gift_list'], $result['giftCount']);
}
if (!$onlyGift) {
// 加价购
$result['advanceBuyCount'] = 0;
$result['advanceBuy'] = Helpers::formatAdvanceGoods($data['price_gift'], $result['advanceBuyCount']);
}
if (!$onlyGift && !$onlyAdvanceBuy) {
// 购买的可用商品列表
$validGoods = Helpers::formatCartGoods($data['goods_list']);
!empty($validGoods) && $result['goods'] = $validGoods;
// 失效商品列表
$notValidGoods = Helpers::formatCartGoods($data['sold_out_goods_list']);
!empty($notValidGoods) && $result['$notValidGoods'] = $notValidGoods;
// 赠品和加价购商品
(count($data['gift_list']) || count($data['price_gift'])) && $result['freebieOrAdvanceBuy'] = true;
// 结算数据
$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']['goods_count'];
$result['sumPrice'] = Helpers::transPrice($data['shopping_cart_data']['order_amount']);
}
return $result;
}
$result = $orderSubRes;
}
}
return $result;
}
/**
* 处理不同类型的购物车数据
*
* @param array $data 不同类型购物车数据
* @param bool $onlyGift 只获取赠品的商品数据
* @param bool $onlyAdvanceBuy 只获取加价购的商品数据
* @return array $result 处理之后的不同类型购物车数据
*/
private static function procCartData($data, $onlyGift = false, $onlyAdvanceBuy = false)
{
$result = array();
do {
// 数据为空时返回空的标志
if (empty($data)) {
break;
}
if ($onlyAdvanceBuy) {
// 赠品
$result['freebie'] = Helpers::formatAdvanceGoods($data['gift_list']);
break;
}
if ($onlyGift) {
// 加价购
$result['advanceBuy'] = Helpers::formatAdvanceGoods($data['price_gift']);
break;
}
// 购买的可用商品列表
$validGoods = Helpers::formatCartGoods($data['goods_list']);
if (!empty($validGoods)) {
$result['goods'] = $validGoods;
}
// 失效商品列表
$notValidGoods = Helpers::formatCartGoods($data['sold_out_goods_list']);
if (!empty($notValidGoods)) {
$result['$notValidGoods'] = $notValidGoods;
}
// 赠品和加价购商品
if (count($data['gift_list']) || count($data['price_gift'])) {
$result['freebieOrAdvanceBuy'] = true;
// 赠品
$result['giftCount'] = 0;
$result['freebie'] = Helpers::formatAdvanceGoods($data['gift_list'], $result['giftCount']);
// 加价购
$result['advanceBuyCount'] = 0;
$result['advanceBuy'] = Helpers::formatAdvanceGoods($data['price_gift'], $result['advanceBuyCount']);
}
// 结算数据
$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']['goods_count'];
$result['sumPrice'] = Helpers::transPrice($data['shopping_cart_data']['order_amount']);
}while(0);
return $result;
}
}
... ...
... ... @@ -297,7 +297,7 @@ class UserModel
$records = UserData::browseRecord($uid, $udid, $page, $limit);
if (!$records) {
$result['walkwayUrl'] = '/product/new';
$result['walkwayUrl'] = Helpers::url('/product/new');
$result['noRecord'] = true;
return $result;
... ... @@ -308,7 +308,7 @@ class UserModel
// 不能再查到结果了
if ($page == 1 && $records['data']['total'] === 0) {
$result['walkwayUrl'] = '/product/new';
$result['walkwayUrl'] = Helpers::url('/product/new');
$result['noRecord'] = true;
} else {
$data = $records['data']['product_list'];
... ... @@ -385,7 +385,11 @@ class UserModel
// 处理YOHO币数据
if(isset($yohoCoin['data']) && !empty($yohoCoin['data'])){
$coinList = $yohoCoin['data']['coinlist'];
$data['money'] = $yohoCoin['data']['total'];
// 获取有货币总数
$total = self::getYohoCoinData($uid);
$data['money'] = !empty($total) ? $total['yohoCoin']['coinNum'] : 0;
foreach($coinList as $key => $val){
$result[$key]['title'] = $val['message'];
$result[$key]['time'] = $val['date'];
... ... @@ -781,15 +785,12 @@ class UserModel
$result = array();
$helpListData = UserData::helpListData();
if (isset($helpListData['data']) && !empty($helpListData['data'])) {
$help = $helpListData['data'];
$one = array();
foreach ($help as $val) {
foreach ($helpListData['data'] as $val) {
$one = array();
$one['name'] = $val['caption'];
$one['url'] = Helpers::url('/home/helpdetail/', array('code' => $val['code']));
$one['url'] = Helpers::url('/home/helpdetail', array('code' => $val['code']));
$result['iHelp'][] = $one;
}
... ... @@ -806,7 +807,13 @@ class UserModel
*/
public static function getHelpDetailData($code)
{
return UserData::helpDetailData($code);
$result = array();
if (isset($code)) {
$result = UserData::helpDetailData($code);
}
return $result;
}
}
... ...