Authored by 李奇

Merge branch 'gray' into feature/cps-optimize

@@ -59,50 +59,22 @@ const index = (req, res, next) => { @@ -59,50 +59,22 @@ const index = (req, res, next) => {
59 59
60 logger.info(`installment index info: client_type=${req.query.client_type},req.user.uid=${req.user.uid},req.query.uid=${req.query.uid},cookies=${JSON.stringify(req.cookies)}`); // eslint-disable-line 60 logger.info(`installment index info: client_type=${req.query.client_type},req.user.uid=${req.user.uid},req.query.uid=${req.query.uid},cookies=${JSON.stringify(req.cookies)}`); // eslint-disable-line
61 Promise.all([ 61 Promise.all([
62 - req.ctx(installmentModel).getStauts(uid),  
63 - req.ctx(installmentModel).getSearchIntallment({  
64 - uid: uid  
65 - }) 62 + req.ctx(installmentModel).getStauts(uid)
66 ]).then((result) => { 63 ]).then((result) => {
67 -  
68 - if (req.yoho.isApp) {  
69 - _.forEach(result[1], goods => {  
70 - goods.url = yasProcess.addParamsToGoodsHref({  
71 - href: goods.url,  
72 - fromPageName: yasProcess.getPname(req),  
73 - fromPageParam: req.originalUrl  
74 - });  
75 - });  
76 - }  
77 -  
78 // openStatus:0 未申请 1审核中 2已开通 3 审核未通过 64 // openStatus:0 未申请 1审核中 2已开通 3 审核未通过
79 let openStatus = result[0]; 65 let openStatus = result[0];
80 - let installmentOnly = {  
81 - title: {  
82 - title: '分期专享',  
83 - more_url: helpers.appUrlFormat(req.originalUrl, 'go.instalmentlist', {  
84 - title: '分期专享'  
85 - })  
86 - },  
87 - goods: result[1]  
88 - };  
89 66
90 if (openStatus === '0') { 67 if (openStatus === '0') {
91 return Promise.all([ 68 return Promise.all([
92 req.ctx(installmentModel).getResources('openN'), 69 req.ctx(installmentModel).getResources('openN'),
93 req.ctx(installmentModel).getNotices() 70 req.ctx(installmentModel).getNotices()
94 ]).then(data => { 71 ]).then(data => {
95 - _.forEach(data[0], (item) => {  
96 - if (item.singleOne) {  
97 - item.data[0].url = 'javascript:void(0)'; //eslint-disable-line  
98 - }  
99 - });  
100 72
101 return { 73 return {
102 content: data[0], 74 content: data[0],
103 notice: data[1], 75 notice: data[1],
104 notOpen: true, 76 notOpen: true,
105 - installmentOnly: installmentOnly 77 + goHomePath: req.yoho.isApp ? 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.home","params":{"channel":"1"}}' : '//m.yohobuy.com/boys'
106 }; 78 };
107 }); 79 });
108 } else if (openStatus === '2') { 80 } else if (openStatus === '2') {
@@ -114,17 +86,10 @@ const index = (req, res, next) => { @@ -114,17 +86,10 @@ const index = (req, res, next) => {
114 ]).then((data) => { 86 ]).then((data) => {
115 let params = _.assign({ 87 let params = _.assign({
116 isOverdue: false, 88 isOverdue: false,
117 - installmentOnly: installmentOnly,  
118 content: data[2], 89 content: data[2],
119 notice: data[3] 90 notice: data[3]
120 }, data[0], data[1]); 91 }, data[0], data[1]);
121 92
122 - if (installmentOnly.goods.length > 0) {  
123 - params.installmentOnly = _.assign({  
124 - showMore: true  
125 - }, installmentOnly);  
126 - }  
127 -  
128 // status: 1 正常 2 逾期 3 不可用 4 未开通 93 // status: 1 正常 2 逾期 3 不可用 4 未开通
129 if (data[0].status === '2') { 94 if (data[0].status === '2') {
130 params.replayStatus = '逾期'; 95 params.replayStatus = '逾期';
@@ -14,7 +14,7 @@ const logger = global.yoho.logger; @@ -14,7 +14,7 @@ const logger = global.yoho.logger;
14 const stringProcess = require(`${global.utils}/string-process`); 14 const stringProcess = require(`${global.utils}/string-process`);
15 const API_TIMEOUT = 10000; 15 const API_TIMEOUT = 10000;
16 const codeContent = { 16 const codeContent = {
17 - openN: '0876085ff46bed27f1a1eb6ee8b68987', 17 + openN: 'f53b7228f38994200491692b1f4ac54c',
18 openY: 'c233ad4ca91fef45ed7d0b26d9953e61', 18 openY: 'c233ad4ca91fef45ed7d0b26d9953e61',
19 advertisement: 'f3fe0793a7d59479542a14b15359c47d' 19 advertisement: 'f3fe0793a7d59479542a14b15359c47d'
20 }; 20 };
1 <div class="installment-page installment-bg yoho-page"> 1 <div class="installment-page installment-bg yoho-page">
2 - <div class="loading-tip">下拉刷新</div> 2 + {{#unless notOpen}}
  3 + <div class="loading-tip">下拉刷新</div>
  4 + {{/unless}}
3 <div class="installment-main"> 5 <div class="installment-main">
4 <div class="main-content"> 6 <div class="main-content">
5 {{#if notOpen}} 7 {{#if notOpen}}
6 <input type="hidden" value="false" class="is-open"> 8 <input type="hidden" value="false" class="is-open">
7 - {{# content}}  
8 - {{#if singleImage}}  
9 - {{> resources/banner}}  
10 - {{/if}}  
11 - {{/ content}}  
12 {{#notice}} 9 {{#notice}}
13 {{> installment/installment-notice}} 10 {{> installment/installment-notice}}
14 {{/notice}} 11 {{/notice}}
15 - <div class="open-index">  
16 - <ul class="open-info">  
17 - <li>  
18 - <span class="open-icon-1"></span>  
19 - <span>先消费<br>后还款</span>  
20 - </li>  
21 - <li>  
22 - <span class="open-icon-2"></span>  
23 - <span> 0元首付<br>随心分期</span>  
24 - </li>  
25 - <li>  
26 - <span class="open-icon-3"></span>  
27 - <span>指定商品<br>立享优惠</span>  
28 - </li>  
29 - </ul>  
30 -  
31 - <a href="/home/installment/starting-service" class="open-btn">立即开通</a> 12 + <div class="close-pic"></div>
  13 + <p class="close-installment-desc">很抱歉,来晚了<br>有货分期申请服务已暂停</p>
  14 + <a href="{{goHomePath}}" class="go-yoho-index">去逛逛</a>
  15 + <div class="installment-banner">
  16 + {{# content}}
  17 + {{#if newSingleImage}}
  18 + {{> resources/new-single-image}}
  19 + {{/if}}
  20 + {{/ content}}
32 </div> 21 </div>
33 {{else}} 22 {{else}}
34 <input type="hidden" value="true" class="is-open"> 23 <input type="hidden" value="true" class="is-open">
35 - <div class="detail-tab">  
36 - <span class="on is-repay">待还款金额</span>  
37 - <span class="is-usable">可用额度</span>  
38 - </div>  
39 <div class="repay installment-cont"> 24 <div class="repay installment-cont">
40 <div class="repay-area detail-bg"> 25 <div class="repay-area detail-bg">
41 <p class="detail-txt1">近7日待还款</p> 26 <p class="detail-txt1">近7日待还款</p>
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 <div data-userverify="{{captchaShow}}" data-geetest="{{useGeetest}}" id="js-img-check" {{#unless useGeetest}} class="full-img-verify" {{/unless}}></div> 21 <div data-userverify="{{captchaShow}}" data-geetest="{{useGeetest}}" id="js-img-check" {{#unless useGeetest}} class="full-img-verify" {{/unless}}></div>
22 <button id="loginBtn" class="login-btn disable" type="button">登录</button> 22 <button id="loginBtn" class="login-btn disable" type="button">登录</button>
23 <div class="other-info"> 23 <div class="other-info">
24 - <a href="{{internationalUrl}}">海外账号登录</a> 24 + {{!-- <a href="{{internationalUrl}}">海外账号登录</a> --}}
25 <a href="{{smsLoginUrl}}">手机验证码登录</a> 25 <a href="{{smsLoginUrl}}">手机验证码登录</a>
26 <a id="getPswrdBtn" href="javascript:void(0);">忘记密码?</a> 26 <a id="getPswrdBtn" href="javascript:void(0);">忘记密码?</a>
27 </div> 27 </div>
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 <button id="smsLoginBtn" class="sms-login-btn" type="button">登录</button> 29 <button id="smsLoginBtn" class="sms-login-btn" type="button">登录</button>
30 <div class="other-info"> 30 <div class="other-info">
31 {{#if openPassword}} 31 {{#if openPassword}}
32 - <a href="{{internationalUrl}}">海外账号登录</a> 32 + {{!-- <a href="{{internationalUrl}}">海外账号登录</a> --}}
33 <a href="{{loginUrl}}">账号密码登录</a> 33 <a href="{{loginUrl}}">账号密码登录</a>
34 {{/if}} 34 {{/if}}
35 <a id="getPswrdBtn" href="javascript:void(0);">忘记密码?</a> 35 <a id="getPswrdBtn" href="javascript:void(0);">忘记密码?</a>
@@ -97,7 +97,7 @@ @@ -97,7 +97,7 @@
97 <link rel="apple-touch-startup-image" href="https://cdn.yoho.cn/h5/forios/startup/startup-orange-6.png" media="screen and (min-device-width: 641px) and (max-device-width: 750px)"> 97 <link rel="apple-touch-startup-image" href="https://cdn.yoho.cn/h5/forios/startup/startup-orange-6.png" media="screen and (min-device-width: 641px) and (max-device-width: 750px)">
98 <link rel="apple-touch-startup-image" href="https://cdn.yoho.cn/h5/forios/startup/startup-orange-5.png" media="screen and (max-device-width: 640px)"> 98 <link rel="apple-touch-startup-image" href="https://cdn.yoho.cn/h5/forios/startup/startup-orange-5.png" media="screen and (max-device-width: 640px)">
99 </head> 99 </head>
100 - <body class="{{pageStyle}}{{#if isWechat}} wechat-body{{/if}}{{#if width750}} width750{{/if}}{{#if isPassportPage}} passport-body{{/if}}{{#if isStarIndexPage}} star-index-bg{{/if}}{{#if isStarDetailPage}} star-class-body{{/if}}{{#if isInstallmentPage}} installment-body{{/if}}{{#if @root.isMarsApp}} is-mars-app{{/if}}{{#if @root.isNowApp}} is-now-app{{/if}}"> 100 + <body class="{{pageStyle}}{{#if isWechat}} wechat-body{{/if}}{{#if width750}} width750{{/if}}{{#if isPassportPage}} passport-body{{/if}}{{#if isStarIndexPage}} star-index-bg{{/if}}{{#if isStarDetailPage}} star-class-body{{/if}}{{#if isInstallmentPage}}{{#unless notOpen}} installment-body{{/unless}}{{/if}}{{#if @root.isMarsApp}} is-mars-app{{/if}}{{#if @root.isNowApp}} is-now-app{{/if}}">
101 <div class="main-wrap" id="main-wrap" {{#if appPath}}data-apppath='{{{appPath}}}'{{/if}} {{#if miniPath}}data-miniPath='{{{miniPath}}}'{{/if}} {{#if @root.wap.wechat.backDownload}}data-backDownload='{{@root.wap.wechat.backDownload}}'{{/if}}> 101 <div class="main-wrap" id="main-wrap" {{#if appPath}}data-apppath='{{{appPath}}}'{{/if}} {{#if miniPath}}data-miniPath='{{{miniPath}}}'{{/if}} {{#if @root.wap.wechat.backDownload}}data-backDownload='{{@root.wap.wechat.backDownload}}'{{/if}}>
102 {{#if systemUpdate}} 102 {{#if systemUpdate}}
103 {{> updata}} 103 {{> updata}}
  1 +{{#if singleOne}}
  2 +{{#data}}
  3 + <div class="banner-list">
  4 + <a href="{{url}}" id="{{../template_id}}" name="{{../template_intro}}" rel="nofollow">
  5 + <img src="{{image2 src w=imageWidth h=imageHeight q=60 mode=3}}" alt="活动图片">
  6 + </a>
  7 + </div>
  8 +{{/data}}
  9 +{{else}}
  10 +{{#data}}
  11 +<div class="banner-center banner-center-swiper">
  12 + <ul class="banner-list swiper-wrapper clearfix">
  13 + {{#list}}
  14 + <li class="swiper-slide">
  15 + <a href="{{url}}" id="{{../../template_id}}" name="{{../../template_intro}}" rel="nofollow">111
  16 + <img src="{{image2 src w=../imageWidth h=../imageWidth q=60 mode=3}}" alt="活动图片">
  17 + </a>
  18 + </li>
  19 + {{/list}}
  20 + </ul>
  21 + <div class="swiper-pagination" {{#unless singleOne}}style="display:block"{{/unless}}>
  22 + <div class="pagination-inner">
  23 + </div>
  24 + </div>
  25 +</div>
  26 +{{/data}}
  27 +{{/if}}
1 { 1 {
2 "name": "yohobuywap-node", 2 "name": "yohobuywap-node",
3 - "version": "6.6.23", 3 + "version": "6.6.24",
4 "private": true, 4 "private": true,
5 "description": "A New Yohobuy Project With Express", 5 "description": "A New Yohobuy Project With Express",
6 "repository": { 6 "repository": {
@@ -237,11 +237,10 @@ function loadMore($container, opt, url) { @@ -237,11 +237,10 @@ function loadMore($container, opt, url) {
237 237
238 if (opt.page === 1) { 238 if (opt.page === 1) {
239 loading.hideLoadingMask(); 239 loading.hideLoadingMask();
240 -  
241 - getDynamicData.getDynamicData();  
242 window.rePosFooter();// 插入内容后重新计算底部位置 240 window.rePosFooter();// 插入内容后重新计算底部位置
243 } 241 }
244 242
  243 + getDynamicData.getDynamicData();
245 opt.page++; 244 opt.page++;
246 245
247 searching = false; 246 searching = false;
@@ -3,7 +3,7 @@ let Repayment = require('./repayment'); @@ -3,7 +3,7 @@ let Repayment = require('./repayment');
3 let CHECKBOX_SELECTOR = 'input.installment-term'; 3 let CHECKBOX_SELECTOR = 'input.installment-term';
4 let tip = require('plugin/tip'); 4 let tip = require('plugin/tip');
5 let bp = require('./burying-point'); 5 let bp = require('./burying-point');
6 -let orderCode = $('.info-box h4').html().replace('订单编号: ', ''); 6 +let orderCode = ($('.info-box h4').html() || '').replace('订单编号: ', '');
7 let repayment = new Repayment({ 7 let repayment = new Repayment({
8 onGetSelection: function() { 8 onGetSelection: function() {
9 let ret = []; 9 let ret = [];
@@ -98,6 +98,22 @@ let installment = { @@ -98,6 +98,22 @@ let installment = {
98 } 98 }
99 99
100 self.setCookies(); 100 self.setCookies();
  101 +
  102 + $('.banner-center-swiper').each(function() {
  103 + if ($(this).find('li').length > 1) {
  104 + new Swiper(this, {
  105 + preloadImages: false,
  106 + lazyLoading: true,
  107 + lazyLoadingInPrevNext: true,
  108 + lazyLoadingOnTransitionStart: true,
  109 + loop: true,
  110 + autoplay: 3000,
  111 + autoplayDisableOnInteraction: false,
  112 + slideElement: 'li',
  113 + paginationHide: true
  114 + });
  115 + }
  116 + });
101 }, 117 },
102 noticeScroll: function(selecter, time) { 118 noticeScroll: function(selecter, time) {
103 new Swiper(selecter, { 119 new Swiper(selecter, {
@@ -71,6 +71,12 @@ exports.showDialog = function(data, callback, callbackForLeft, fullWithBtn) { @@ -71,6 +71,12 @@ exports.showDialog = function(data, callback, callbackForLeft, fullWithBtn) {
71 $dialogWrapper.fadeOut(); 71 $dialogWrapper.fadeOut();
72 } else if ($(event.target).hasClass('dialog-right-btn')) { 72 } else if ($(event.target).hasClass('dialog-right-btn')) {
73 return callback(); 73 return callback();
  74 + } else if ($(event.target).hasClass('dialog-center-btn')) {
  75 + $('.dialog-wrapper').remove();
  76 + $('body').css({
  77 + overflow: '',
  78 + position: '',
  79 + });
74 } else if ($(event.target).closest('.dialog-box').length) { 80 } else if ($(event.target).closest('.dialog-box').length) {
75 return true; 81 return true;
76 } else { 82 } else {
@@ -168,10 +168,16 @@ require('./detail/page-render')(function() { @@ -168,10 +168,16 @@ require('./detail/page-render')(function() {
168 $(document).scroll(function() { 168 $(document).scroll(function() {
169 if ($(document).scrollTop() >= $(document).height() - $(window).height() - 20) { 169 if ($(document).scrollTop() >= $(document).height() - $(window).height() - 20) {
170 if (!$('.float-top').hasClass('animation')) { 170 if (!$('.float-top').hasClass('animation')) {
171 - let top = $('.back-to-top').offset().top - 171 + let offset = $('.back-to-top').offset();
  172 +
  173 + if (!offset) {
  174 + return;
  175 + }
  176 +
  177 + let top = offset.top -
172 $('.float-top').offset().top + 178 $('.float-top').offset().top +
173 ($('.back-to-top').height() - $('.float-top').height()) / 2; 179 ($('.back-to-top').height() - $('.float-top').height()) / 2;
174 - let left = $('.back-to-top').offset().left - $('.float-top').offset().left; 180 + let left = offset.left - $('.float-top').offset().left;
175 181
176 $('.float-top').addClass('animation').css({ 182 $('.float-top').addClass('animation').css({
177 transform: 'translate(' + left + 'px, ' + top + 'px) scale(0, 0)', 183 transform: 'translate(' + left + 'px, ' + top + 'px) scale(0, 0)',
@@ -23,6 +23,37 @@ @@ -23,6 +23,37 @@
23 height: calc(100vh); 23 height: calc(100vh);
24 } 24 }
25 25
  26 + .close-pic {
  27 + width: 360px;
  28 + height: 359px;
  29 + background: resolve("home/installment-close.png") no-repeat;
  30 + background-size: contain;
  31 + margin: 128px auto 0;
  32 + }
  33 +
  34 + .go-yoho-index {
  35 + width: 410px;
  36 + height: 69px;
  37 + background: #444;
  38 + border-radius: 6px;
  39 + color: #fff;
  40 + text-align: center;
  41 + line-height: 69px;
  42 + display: block;
  43 + margin: 0 auto;
  44 + }
  45 +
  46 + .close-installment-desc {
  47 + line-height: 46px;
  48 + text-align: center;
  49 + font-size: 24px;
  50 + margin: 40px 0;
  51 + }
  52 +
  53 + .installment-banner {
  54 + margin-top: 110px;
  55 + }
  56 +
26 .loading-tip { 57 .loading-tip {
27 position: absolute; 58 position: absolute;
28 width: 100%; 59 width: 100%;
@@ -75,6 +75,16 @@ module.exports = (list) => { @@ -75,6 +75,16 @@ module.exports = (list) => {
75 floor.data.length === 1 && 75 floor.data.length === 1 &&
76 (floor.singleOne = true); 76 (floor.singleOne = true);
77 77
  78 + if (floor.newSingleImage && floor.data.list.length === 1) {
  79 + floor.singleOne = true;
  80 + floor.data = {
  81 + imageWidth: floor.data.imageWidth,
  82 + imageHeight: floor.data.imageHeight,
  83 + src: floor.data.list[0].src,
  84 + url: floor.data.list[0].url
  85 + };
  86 + }
  87 +
78 // 处理价格两位小数 88 // 处理价格两位小数
79 if ((floor.vipUse || floor.popularSingleProduct || floor.newUserFloor) && floor.data) { 89 if ((floor.vipUse || floor.popularSingleProduct || floor.newUserFloor) && floor.data) {
80 for (let item of floor.data.list) { 90 for (let item of floor.data.list) {