Authored by 陈峰

Merge branch 'master' into hotfix/rss-format

@@ -9,12 +9,13 @@ const crypto = global.yoho.crypto; @@ -9,12 +9,13 @@ const crypto = global.yoho.crypto;
9 const shopIndex = (req, res) => { 9 const shopIndex = (req, res) => {
10 let isApp = req.query.app_version || req.query.appVersion || false; 10 let isApp = req.query.app_version || req.query.appVersion || false;
11 let uid = req.user.uid || req.query.uid; 11 let uid = req.user.uid || req.query.uid;
  12 + let contentCode = req.query.code || 'ec9eb72eae121fcd6c1b7d1de75caff1';
12 let parameter = {}; 13 let parameter = {};
13 14
14 if (!isApp) { 15 if (!isApp) {
15 parameter = { 16 parameter = {
16 pageHeader: headerModel.setNav({ 17 pageHeader: headerModel.setNav({
17 - navTitle: '店铺收藏' 18 + navTitle: req.query.title || '店铺收藏'
18 }) 19 })
19 }; 20 };
20 } else { 21 } else {
@@ -32,13 +33,13 @@ const shopIndex = (req, res) => { @@ -32,13 +33,13 @@ const shopIndex = (req, res) => {
32 } 33 }
33 } 34 }
34 35
35 - shopModel.banner().then((result) => { 36 + shopModel.banner(contentCode).then((result) => {
36 res.render('shop-collect/index', Object.assign({ 37 res.render('shop-collect/index', Object.assign({
37 module: 'activity', 38 module: 'activity',
38 page: 'shop-collect', 39 page: 'shop-collect',
39 - wechatShare: true,  
40 - title: '店铺收藏', 40 + title: req.query.title || '店铺收藏',
41 width750: true, 41 width750: true,
  42 + showHeader: !req.yoho.isWechat,
42 shopCollect: { 43 shopCollect: {
43 bannerTop: result 44 bannerTop: result
44 } 45 }
@@ -47,27 +48,33 @@ const shopIndex = (req, res) => { @@ -47,27 +48,33 @@ const shopIndex = (req, res) => {
47 }; 48 };
48 49
49 const shopNav = (req, res, next) => { 50 const shopNav = (req, res, next) => {
  51 + let channelId = req.query.channelId || '';
50 52
51 - shopModel.shopNav().then((result) => { 53 + shopModel.shopNav(channelId).then((result) => {
52 res.json(result); 54 res.json(result);
53 }).catch(next); 55 }).catch(next);
54 }; 56 };
55 57
56 58
57 const shopList = (req, res, next) => { 59 const shopList = (req, res, next) => {
58 - let uid = _.trim(crypto.decrypt('', req.query.uid)) || req.user.uid; 60 + let uid = parseInt(crypto.decrypt('', req.query.uid), 10) || req.user.uid;
59 let tabName = req.query.tabName; 61 let tabName = req.query.tabName;
  62 + let channelId = req.query.channelId || '';
60 63
61 - shopModel.shopList(uid, tabName).then((result) => { 64 + shopModel.shopList(uid, tabName, channelId).then((result) => {
62 res.json(result); 65 res.json(result);
63 }).catch(next); 66 }).catch(next);
64 }; 67 };
65 68
66 -// 获取文章收藏状态 69 +// 获取店铺收藏状态
67 const shopFav = (req, res, next) => { 70 const shopFav = (req, res, next) => {
68 - let uid = req.query.uid ? _.trim(crypto.decrypt('', req.query.uid)) : req.user.uid; 71 + let uid = req.query.uid ? parseInt(crypto.decrypt('', req.query.uid), 10) : req.user.uid;
69 let shopIds = req.query.shopIds; 72 let shopIds = req.query.shopIds;
70 73
  74 + if (!uid) {
  75 + return;
  76 + }
  77 +
71 shopModel.shopFav(uid, shopIds).then((result) => { 78 shopModel.shopFav(uid, shopIds).then((result) => {
72 res.json(result); 79 res.json(result);
73 }).catch(next); 80 }).catch(next);
@@ -6,16 +6,20 @@ @@ -6,16 +6,20 @@
6 'use strict'; 6 'use strict';
7 const singleDayModel = require('../models/single-day'); 7 const singleDayModel = require('../models/single-day');
8 const headerModel = require('../../../doraemon/models/header'); // 头部model 8 const headerModel = require('../../../doraemon/models/header'); // 头部model
  9 +const _ = require('lodash');
9 10
10 const singleDay = (req, res) => { 11 const singleDay = (req, res) => {
  12 + let title = req.query.title;
  13 +
11 res.render('single-day/single-day', { 14 res.render('single-day/single-day', {
12 module: 'activity', 15 module: 'activity',
13 page: 'single-day', 16 page: 'single-day',
14 - title: '超级单品日', 17 + title: title || '超级单品日',
15 isApp: req.yoho.isApp, 18 isApp: req.yoho.isApp,
16 width750: true, 19 width750: true,
  20 + showHeader: !req.yoho.isWechat,
17 pageHeader: headerModel.setNav({ 21 pageHeader: headerModel.setNav({
18 - navTitle: '超级单品日', 22 + navTitle: title || '超级单品日',
19 navBtn: false 23 navBtn: false
20 }), 24 }),
21 pageFooter: false 25 pageFooter: false
@@ -23,13 +27,25 @@ const singleDay = (req, res) => { @@ -23,13 +27,25 @@ const singleDay = (req, res) => {
23 }; 27 };
24 28
25 const getSingleData = (req, res) => { 29 const getSingleData = (req, res) => {
26 - Promise.all([singleDayModel.getResourceData(), singleDayModel.getTabData()]).then((result) => { 30 + Promise.all([
  31 + singleDayModel.getResourceData(req.query.contCode),
  32 + singleDayModel.getTabData(req.query.channel_id)
  33 + ]).then((result) => {
  34 + _.forEach(result[0], (item) => {
  35 + if (item.focus) {
  36 + _.forEach(item.data, (banner) => {
  37 + banner.url = 'javascript:void(0)'; //eslint-disable-line
  38 + });
  39 + }
  40 + });
27 res.json(result); 41 res.json(result);
28 }); 42 });
29 }; 43 };
30 44
31 const getProductData = (req, res) => { 45 const getProductData = (req, res) => {
32 - singleDayModel.getProductData(req.query.tab_name).then(result => { 46 + let params = req.query || {};
  47 +
  48 + singleDayModel.getProductData(params).then(result => {
33 res.json(result); 49 res.json(result);
34 }); 50 });
35 }; 51 };
@@ -9,12 +9,24 @@ const _ = require('lodash'); @@ -9,12 +9,24 @@ const _ = require('lodash');
9 const logger = global.yoho.logger; 9 const logger = global.yoho.logger;
10 const service = global.yoho.ServiceAPI; 10 const service = global.yoho.ServiceAPI;
11 11
12 -const shopList = (uid, tabName) => {  
13 - return api.get('', {  
14 - method: 'app.shops.promote',  
15 - uid: uid,  
16 - tab_name: tabName  
17 - }, { 12 +const shopList = (uid, tabName, channelId) => {
  13 + let params = {
  14 + method: 'app.shops.promote'
  15 + };
  16 +
  17 + if (uid) {
  18 + params.uid = uid;
  19 + }
  20 +
  21 + if (tabName) {
  22 + params.tab_name = tabName;
  23 + }
  24 +
  25 + if (channelId) {
  26 + params.channel_id = channelId;
  27 + }
  28 +
  29 + return api.get('', params, {
18 code: 200 30 code: 200
19 }).then((result) => { 31 }).then((result) => {
20 if (result && result.code === 200) { 32 if (result && result.code === 200) {
@@ -38,15 +50,20 @@ const shopList = (uid, tabName) => { @@ -38,15 +50,20 @@ const shopList = (uid, tabName) => {
38 }); 50 });
39 }; 51 };
40 52
41 -const shopNav = () => {  
42 - return api.get('', { 53 +const shopNav = (channelId) => {
  54 + let params = {
43 method: 'app.shops.promoteTabNameList' 55 method: 'app.shops.promoteTabNameList'
44 - }, { 56 + };
  57 +
  58 + if (channelId) {
  59 + params.channel_id = channelId;
  60 + }
  61 + return api.get('', params, {
45 cache: true, 62 cache: true,
46 code: 200 63 code: 200
47 }).then((result) => { 64 }).then((result) => {
48 if (result.data) { 65 if (result.data) {
49 - if (result.data.length === 1 && result.data[0] === 'NULL') { 66 + if (result.data.length === 0 || (result.data.length === 1 && result.data[0] === 'NULL')) {
50 return false; 67 return false;
51 } else { 68 } else {
52 return result.data; 69 return result.data;
@@ -55,9 +72,9 @@ const shopNav = () => { @@ -55,9 +72,9 @@ const shopNav = () => {
55 }); 72 });
56 }; 73 };
57 74
58 -const banner = () => { 75 +const banner = (contentCode) => {
59 return service.get('operations/api/v5/resource/get', { 76 return service.get('operations/api/v5/resource/get', {
60 - content_code: 'ec9eb72eae121fcd6c1b7d1de75caff1', 77 + content_code: contentCode,
61 platform: 'iphone' 78 platform: 'iphone'
62 }, { 79 }, {
63 cache: true, 80 cache: true,
@@ -12,9 +12,9 @@ const helpers = global.yoho.helpers; @@ -12,9 +12,9 @@ const helpers = global.yoho.helpers;
12 const _ = require('lodash'); 12 const _ = require('lodash');
13 const resourcesProcess = require(`${utils}/resources-process`); 13 const resourcesProcess = require(`${utils}/resources-process`);
14 14
15 -const getResourceData = () => { 15 +const getResourceData = (contCode) => {
16 return serviceAPI.get('operations/api/v5/resource/get', { 16 return serviceAPI.get('operations/api/v5/resource/get', {
17 - content_code: 'c0acf0296a3c329678fb45da958d9951', 17 + content_code: contCode || 'c0acf0296a3c329678fb45da958d9951',
18 platform: 'iphone' 18 platform: 'iphone'
19 }, { 19 }, {
20 cache: true 20 cache: true
@@ -28,16 +28,19 @@ const getResourceData = () => { @@ -28,16 +28,19 @@ const getResourceData = () => {
28 }); 28 });
29 }; 29 };
30 30
31 -const getProductData = (tabName) => {  
32 - return api.get('', { 31 +const getProductData = (params) => {
  32 + return api.get('', _.assign({
33 method: 'app.product.singleDay', 33 method: 'app.product.singleDay',
34 - tab_name: tabName  
35 - }, { 34 + limit: '20'
  35 + }, params), {
36 cache: true 36 cache: true
37 }).then((result) => { 37 }).then((result) => {
38 if (result && result.code === 200) { 38 if (result && result.code === 200) {
39 result.data = result.data || []; 39 result.data = result.data || [];
40 40
  41 + if (result.data.length === 0) {
  42 + return '';
  43 + } else {
41 _.forEach(result.data, (item) => { 44 _.forEach(result.data, (item) => {
42 item.url = helpers.urlFormat(`/product/pro_${item.productId}_${item.goodsId}/${item.cnAlphabet}.html`); // eslint-disable-line 45 item.url = helpers.urlFormat(`/product/pro_${item.productId}_${item.goodsId}/${item.cnAlphabet}.html`); // eslint-disable-line
43 item.url = helpers.appUrlFormat(item.url, 'go.productDetail', { 46 item.url = helpers.appUrlFormat(item.url, 'go.productDetail', {
@@ -45,6 +48,7 @@ const getProductData = (tabName) => { @@ -45,6 +48,7 @@ const getProductData = (tabName) => {
45 }); 48 });
46 }); 49 });
47 return result.data; 50 return result.data;
  51 + }
48 } else { 52 } else {
49 logger.error('get product data code no 200'); 53 logger.error('get product data code no 200');
50 return []; 54 return [];
@@ -54,9 +58,10 @@ const getProductData = (tabName) => { @@ -54,9 +58,10 @@ const getProductData = (tabName) => {
54 58
55 59
56 // 获取活动tab标签 60 // 获取活动tab标签
57 -const getTabData = () => { 61 +const getTabData = (channelId) => {
58 return api.get('', { 62 return api.get('', {
59 - method: 'app.product.singleDayTabNameList' 63 + method: 'app.product.singleDayTabNameList',
  64 + channel_id: channelId
60 }, { 65 }, {
61 cache: true 66 cache: true
62 }).then((result) => { 67 }).then((result) => {
@@ -17,7 +17,6 @@ const live = require(`${cRoot}/live`); @@ -17,7 +17,6 @@ const live = require(`${cRoot}/live`);
17 const invite = require(`${cRoot}/invite`); 17 const invite = require(`${cRoot}/invite`);
18 18
19 const couponFloor = require(`${cRoot}/coupon-floor`); 19 const couponFloor = require(`${cRoot}/coupon-floor`);
20 -const auth = require('../../doraemon/middleware/auth');  
21 const vipDay = require(`${cRoot}/vipDay`); 20 const vipDay = require(`${cRoot}/vipDay`);
22 const vipDay1028 = require(`${cRoot}/vipDay10`); 21 const vipDay1028 = require(`${cRoot}/vipDay10`);
23 const market = require(`${cRoot}/market`); 22 const market = require(`${cRoot}/market`);
@@ -117,12 +116,4 @@ router.get('/vip-day1028/crazy-luck', vipDay1028.beforeIn, vipDay1028.crazyLuck) @@ -117,12 +116,4 @@ router.get('/vip-day1028/crazy-luck', vipDay1028.beforeIn, vipDay1028.crazyLuck)
117 router.post('/vip-day1028/signin.json', vipDay1028.beforeIn, vipDay1028.signin); 116 router.post('/vip-day1028/signin.json', vipDay1028.beforeIn, vipDay1028.signin);
118 router.post('/vip-day1028/isStudent', vipDay1028.beforeIn, vipDay1028.checkIsStudent); 117 router.post('/vip-day1028/isStudent', vipDay1028.beforeIn, vipDay1028.checkIsStudent);
119 118
120 -router.get('/coin/sendCoin', coin.sendCoin);  
121 -router.get('/shopCollect', shopCollect.shopIndex);// 店铺收藏  
122 -router.get('/shopList', shopCollect.shopList);// 店铺收藏列表  
123 -router.get('/shopNav', shopCollect.shopNav);// 店铺收藏导航  
124 -router.get('/shopfavStatus', shopCollect.shopFav);// 店铺收藏状态  
125 -  
126 -router.get('/share', share.getShareContent);  
127 -  
128 module.exports = router; 119 module.exports = router;
@@ -4,7 +4,9 @@ @@ -4,7 +4,9 @@
4 {{> resources/banner-top}} 4 {{> resources/banner-top}}
5 {{/ bannerTop}} 5 {{/ bannerTop}}
6 6
7 - <div class="shop-nav nav"></div> 7 + <div class="shop-nav nav">
  8 + <div class="shop-area"></div>
  9 + </div>
8 10
9 <div class="shop-list"></div> 11 <div class="shop-list"></div>
10 {{/ shopCollect}} 12 {{/ shopCollect}}
1 <div class="single-day-page yoho-page"> 1 <div class="single-day-page yoho-page">
2 <div class="banner"></div> 2 <div class="banner"></div>
  3 + <div class="tab-area">
3 <div class="swiper-tab"></div> 4 <div class="swiper-tab"></div>
4 - 5 + </div>
5 <div class="product-list"></div> 6 <div class="product-list"></div>
6 </div> 7 </div>
@@ -18,7 +18,7 @@ const hotfix = require(`${cRoot}/hotfix`); @@ -18,7 +18,7 @@ const hotfix = require(`${cRoot}/hotfix`);
18 18
19 // routers 19 // routers
20 20
21 -router.post('/upload/image', multipartMiddleware, uploadApi.uploadImg); 21 +router.post('/api/upload/image', multipartMiddleware, uploadApi.uploadImg);
22 router.post('/hf/v1', hotfix.v1); 22 router.post('/hf/v1', hotfix.v1);
23 23
24 module.exports = router; 24 module.exports = router;
@@ -85,6 +85,8 @@ const _genIntro = (id) => { @@ -85,6 +85,8 @@ const _genIntro = (id) => {
85 result += '<br/>'; 85 result += '<br/>';
86 } 86 }
87 }); 87 });
  88 +
  89 + result += `<a href="http://guang.m.yohobuy.com/info/index?id=${id}">查看原文</a>`;
88 return result; 90 return result;
89 } 91 }
90 }); 92 });
@@ -63,6 +63,8 @@ const common = { @@ -63,6 +63,8 @@ const common = {
63 if (!refer) { 63 if (!refer) {
64 refer = req.get('Referer'); 64 refer = req.get('Referer');
65 } 65 }
  66 +
  67 +
66 refer && !/signin|login|passport/.test(refer) && res.cookie('refer', encodeURI(refer), { 68 refer && !/signin|login|passport/.test(refer) && res.cookie('refer', encodeURI(refer), {
67 domain: 'yohobuy.com' 69 domain: 'yohobuy.com'
68 }); 70 });
@@ -28,18 +28,6 @@ class PhoneService { @@ -28,18 +28,6 @@ class PhoneService {
28 // 发送 验证码 28 // 发送 验证码
29 // http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/发送验证码.md 29 // http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/发送验证码.md
30 static sendSMS(mobile, area, type) { 30 static sendSMS(mobile, area, type) {
31 - if (process.env.NODE_ENV === 'development') {  
32 - return new Promise((resolve, reject) => {  
33 - return resolve({  
34 - alg: 'SALT_MD5',  
35 - code: 200,  
36 - data: {},  
37 - md5: '6d729d4b35f10fc73531210bd7ecff91',  
38 - message: '发送成功.'  
39 - });  
40 - });  
41 - }  
42 -  
43 return API.get('', { 31 return API.get('', {
44 method: 'app.message.sendSms', 32 method: 'app.message.sendSms',
45 mobile, 33 mobile,
@@ -51,20 +39,6 @@ class PhoneService { @@ -51,20 +39,6 @@ class PhoneService {
51 // 校验 验证码 39 // 校验 验证码
52 // http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/验证验证码.md 40 // http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/验证验证码.md
53 static verifySMS(mobile, area, code, type) { 41 static verifySMS(mobile, area, code, type) {
54 - if (process.env.NODE_ENV === 'development') {  
55 - return new Promise((resolve, reject) => {  
56 - return resolve({  
57 - alg: 'SALT_MD5',  
58 - code: 200,  
59 - data: {  
60 - is_pass: 'Y'  
61 - },  
62 - md5: '6d729d4b35f10fc73531210bd7ecff91',  
63 - message: '发送成功.'  
64 - });  
65 - });  
66 - }  
67 -  
68 return API.get('', { 42 return API.get('', {
69 method: 'app.message.verifySmsCode', 43 method: 'app.message.verifySmsCode',
70 mobile, 44 mobile,
@@ -36,15 +36,15 @@ router.get('/passport/international', login.common.beforeLogin, login.local.inte @@ -36,15 +36,15 @@ router.get('/passport/international', login.common.beforeLogin, login.local.inte
36 router.post('/passport/login/auth', login.local.login); 36 router.post('/passport/login/auth', login.local.login);
37 37
38 // SMS 短信 38 // SMS 短信
39 -router.use('/passport/sms_login', login.common.beforeLogin, smsLogin.beforeIn);  
40 -router.get('/passport/sms_login', smsLogin.loginPage);  
41 -router.get('/passport/sms_login/token.json',  
42 - smsLogin.tokenBefore,  
43 - smsLogin.token); // only ajax;  
44 -router.get('/passport/sms_login/check.json',  
45 - smsLogin.checkBefore,  
46 - smsLogin.check); // only ajax  
47 -router.post('/passport/sms_login/password.json', smsLogin.password); 39 +// router.use('/passport/sms_login', login.common.beforeLogin, smsLogin.beforeIn);
  40 +// router.get('/passport/sms_login', smsLogin.loginPage);
  41 +// router.get('/passport/sms_login/token.json',
  42 +// smsLogin.tokenBefore,
  43 +// smsLogin.token); // only ajax;
  44 +// router.get('/passport/sms_login/check.json',
  45 +// smsLogin.checkBefore,
  46 +// smsLogin.check); // only ajax
  47 +// router.post('/passport/sms_login/password.json', smsLogin.password);
48 48
49 // 微信登录 49 // 微信登录
50 router.get('/passport/login/wechat', login.common.beforeLogin, login.wechat.login); 50 router.get('/passport/login/wechat', login.common.beforeLogin, login.wechat.login);
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 </div> 10 </div>
11 <span id="btn-login" class="btn btn-login disable">登录</span> 11 <span id="btn-login" class="btn btn-login disable">登录</span>
12 <p class="op-container"> 12 <p class="op-container">
13 - <a class="sms-login" href={{smsLoginUrl}}>手机号码快捷登录</a> 13 + {{!--<a class="sms-login" href={{smsLoginUrl}}>手机号码快捷登录</a>--}}
14 <span id="forget-pwd" class="forget-pwd">忘记密码</span> 14 <span id="forget-pwd" class="forget-pwd">忘记密码</span>
15 </p> 15 </p>
16 <div class="third-party-login"> 16 <div class="third-party-login">
@@ -397,7 +397,7 @@ const favoriteBrand = (req, res, next) => { @@ -397,7 +397,7 @@ const favoriteBrand = (req, res, next) => {
397 let opt = req.query.opt || 'ok'; 397 let opt = req.query.opt || 'ok';
398 let type = req.query.type || 'product'; 398 let type = req.query.type || 'product';
399 let appVersion = req.query.appVersion || false; 399 let appVersion = req.query.appVersion || false;
400 - let refer = req.get('referer'); 400 + let refer = encodeURIComponent(req.get('referer'));
401 401
402 let url = helpers.urlFormat('/signin.html') + '?refer=' + refer; 402 let url = helpers.urlFormat('/signin.html') + '?refer=' + refer;
403 403
@@ -405,7 +405,7 @@ const favoriteBrand = (req, res, next) => { @@ -405,7 +405,7 @@ const favoriteBrand = (req, res, next) => {
405 405
406 if (appVersion && appVersion !== 'false') { 406 if (appVersion && appVersion !== 'false') {
407 uid = req.query.uid ? crypto.decrypt('', req.query.uid) : req.cookies.appUid; 407 uid = req.query.uid ? crypto.decrypt('', req.query.uid) : req.cookies.appUid;
408 - uid = _.trim(uid); 408 + uid = parseInt(uid, 10);
409 409
410 if (!uid || uid === 'undefined') { 410 if (!uid || uid === 'undefined') {
411 uid = _getUidFromUserAgent(req); 411 uid = _getUidFromUserAgent(req);
@@ -12,6 +12,11 @@ const mRoot = '../models'; @@ -12,6 +12,11 @@ const mRoot = '../models';
12 const headerModel = require('../../../doraemon/models/header'); 12 const headerModel = require('../../../doraemon/models/header');
13 const seckillModel = require(`${mRoot}/seckill`); 13 const seckillModel = require(`${mRoot}/seckill`);
14 14
  15 +let headerData = headerModel.setNav({
  16 + navTitle: '秒杀活动',
  17 + navBtn: true,
  18 +});
  19 +
15 /** 20 /**
16 * [时间缺0补0] 21 * [时间缺0补0]
17 */ 22 */
@@ -105,14 +110,7 @@ function fetchProductList(activityInfo, uid) { @@ -105,14 +110,7 @@ function fetchProductList(activityInfo, uid) {
105 /** 110 /**
106 * [秒杀列表页面] 111 * [秒杀列表页面]
107 */ 112 */
108 -const index = (req, res, next) => {  
109 - let focusTime = Number.parseInt(req.query.time, 10) || 0;  
110 - let headerData = headerModel.setNav({  
111 - navTitle: '秒杀活动',  
112 - navBtn: true,  
113 - });  
114 -  
115 - if (!req.xhr) { 113 +const index = (req, res) => {
116 return res.render('seckill', { 114 return res.render('seckill', {
117 title: '秒杀活动', 115 title: '秒杀活动',
118 pageHeader: headerData, 116 pageHeader: headerData,
@@ -120,14 +118,20 @@ const index = (req, res, next) => { @@ -120,14 +118,20 @@ const index = (req, res, next) => {
120 pageFooter: true, 118 pageFooter: true,
121 width750: true, 119 width750: true,
122 }); 120 });
123 - } 121 +};
124 122
  123 +/**
  124 + * [秒杀列表 页面 初始数据]
  125 + */
  126 +const indexData = (req, res, next) => {
  127 + let focusTime = Number.parseInt(req.query.time, 10) || 0;
125 let result = {}; 128 let result = {};
126 let uid = req.yoho.isApp && req.query.uid; 129 let uid = req.yoho.isApp && req.query.uid;
127 130
128 return seckillModel.queryActivity().then((resultActivity) => { 131 return seckillModel.queryActivity().then((resultActivity) => {
129 // console.log(resultActivity) 132 // console.log(resultActivity)
130 let focusIndex = false; 133 let focusIndex = false;
  134 +
131 // let nowTime = Date.now(); 135 // let nowTime = Date.now();
132 if (!resultActivity.data) { 136 if (!resultActivity.data) {
133 return next(); 137 return next();
@@ -226,6 +230,7 @@ const index = (req, res, next) => { @@ -226,6 +230,7 @@ const index = (req, res, next) => {
226 res.json(result); 230 res.json(result);
227 }); 231 });
228 }); 232 });
  233 +
229 }; 234 };
230 235
231 /** 236 /**
@@ -331,6 +336,7 @@ const checkAppVer = function(okVersion) { @@ -331,6 +336,7 @@ const checkAppVer = function(okVersion) {
331 336
332 module.exports = { 337 module.exports = {
333 index, 338 index,
  339 + indexData,
334 getProductList, 340 getProductList,
335 remind, 341 remind,
336 checkAppVer 342 checkAppVer
@@ -276,7 +276,7 @@ const searchKeyActivity = (params) => { @@ -276,7 +276,7 @@ const searchKeyActivity = (params) => {
276 cache: true, 276 cache: true,
277 code: 200 277 code: 200
278 }).then(result => { 278 }).then(result => {
279 - if (result.data) { 279 + if (result && result.data) {
280 return result.data; 280 return result.data;
281 } else { 281 } else {
282 return {}; 282 return {};
@@ -95,6 +95,7 @@ router.get('/recommend-for-you/cart', recommendForYou.cart); @@ -95,6 +95,7 @@ router.get('/recommend-for-you/cart', recommendForYou.cart);
95 95
96 96
97 router.get('/seckill', seckill.checkAppVer('5.1.0'), seckill.index); // 秒杀列表页 97 router.get('/seckill', seckill.checkAppVer('5.1.0'), seckill.index); // 秒杀列表页
  98 +router.get('/seckill/list', seckill.indexData);
98 99
99 router.post('/seckill/remind', seckill.remind); // only app; 秒杀提醒 100 router.post('/seckill/remind', seckill.remind); // only app; 秒杀提醒
100 router.get('/seckill/get-product-list', seckill.getProductList); // 秒杀列表根据活动id获取商品列表 101 router.get('/seckill/get-product-list', seckill.getProductList); // 秒杀列表根据活动id获取商品列表
@@ -32,7 +32,7 @@ const cachePage = { @@ -32,7 +32,7 @@ const cachePage = {
32 32
33 33
34 // 领券中心 34 // 领券中心
35 - '/activity/coupon/floor': 5 * MINUTE, 35 + '/activity/coupon/floor': 1 * MINUTE,
36 36
37 // 商品列表 37 // 商品列表
38 '/product/list/index': 1 * MINUTE, 38 '/product/list/index': 1 * MINUTE,
@@ -11,9 +11,9 @@ module.exports = app => { @@ -11,9 +11,9 @@ module.exports = app => {
11 // 四个频道页,频道选择页面 /boys,/girls,/,/kids,/lifestyle 等页面,就直接占用路由了 11 // 四个频道页,频道选择页面 /boys,/girls,/,/kids,/lifestyle 等页面,就直接占用路由了
12 app.use(require('./apps/channel')); 12 app.use(require('./apps/channel'));
13 app.use(require('./apps/passport')); 13 app.use(require('./apps/passport'));
  14 + app.use(require('./apps/api')); // 一些只返回json的通用api
14 15
15 // 业务模块 16 // 业务模块
16 - app.use('/api', require('./apps/api')); // 各模块公有 API  
17 app.use('/product', require('./apps/product')); 17 app.use('/product', require('./apps/product'));
18 app.use('/guang', require('./apps/guang')); 18 app.use('/guang', require('./apps/guang'));
19 app.use('/activity', require('./apps/activity')); 19 app.use('/activity', require('./apps/activity'));
@@ -21,7 +21,4 @@ module.exports = app => { @@ -21,7 +21,4 @@ module.exports = app => {
21 21
22 // 分期付款 22 // 分期付款
23 app.use('/home', require('./apps/home')); 23 app.use('/home', require('./apps/home'));
24 -  
25 - // 一些只返回json的通用api  
26 - app.use('/', require('./apps/api'));  
27 }; 24 };
@@ -33,6 +33,7 @@ module.exports = () => { @@ -33,6 +33,7 @@ module.exports = () => {
33 } 33 }
34 34
35 res.locals.cartUrl = helpers.urlFormat('/cart/index/index'); 35 res.locals.cartUrl = helpers.urlFormat('/cart/index/index');
  36 + res.locals.showHeader = true;
36 37
37 next(); 38 next();
38 }; 39 };
@@ -56,9 +56,11 @@ @@ -56,9 +56,11 @@
56 {{> updata}} 56 {{> updata}}
57 {{/if}} 57 {{/if}}
58 58
  59 + {{#if showHeader}}
59 {{#unless isApp}} 60 {{#unless isApp}}
60 {{> header}} 61 {{> header}}
61 {{/unless}} 62 {{/unless}}
  63 + {{/if}}
62 64
63 {{{body}}} 65 {{{body}}}
64 66
1 { 1 {
2 "name": "m-yohobuy-node", 2 "name": "m-yohobuy-node",
3 - "version": "5.1.3", 3 + "version": "5.1.6",
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": {
@@ -3,3 +3,4 @@ @@ -3,3 +3,4 @@
3 <li class="swiper-slide">{{.}}</li> 3 <li class="swiper-slide">{{.}}</li>
4 {{/each}} 4 {{/each}}
5 </ul> 5 </ul>
  6 +
1 -  
2 var $ = require('yoho-jquery'), 1 var $ = require('yoho-jquery'),
3 loading = require('../../plugin/loading'), 2 loading = require('../../plugin/loading'),
4 tip = require('../../plugin/tip'), 3 tip = require('../../plugin/tip'),
@@ -27,7 +26,9 @@ inviteObj = { @@ -27,7 +26,9 @@ inviteObj = {
27 nums: $('.invite-group input[name="nums"]').val() // 发送优惠券的次数 26 nums: $('.invite-group input[name="nums"]').val() // 发送优惠券的次数
28 }, 27 },
29 init: function() { 28 init: function() {
30 - var $el = this.el, that = this, isreceiveBtn = false; 29 + var $el = this.el,
  30 + that = this,
  31 + isreceiveBtn = false;
31 32
32 // 设置大背景,因为body只能后来设置,前期设置page里面 33 // 设置大背景,因为body只能后来设置,前期设置page里面
33 if ($('.invite-page').length > 0) { 34 if ($('.invite-page').length > 0) {
@@ -91,7 +92,7 @@ inviteObj = { @@ -91,7 +92,7 @@ inviteObj = {
91 92
92 // 下载app 93 // 下载app
93 $el.$downloadBtn.click(function() { 94 $el.$downloadBtn.click(function() {
94 - that.downLoadApp(); 95 + window.downLoadApp();
95 }); 96 });
96 97
97 // 领取福利 98 // 领取福利
@@ -109,7 +110,8 @@ inviteObj = { @@ -109,7 +110,8 @@ inviteObj = {
109 110
110 // 发送已注册用户参与活动的优惠券 111 // 发送已注册用户参与活动的优惠券
111 ischeckOldUserCoupon: function(mobile) { 112 ischeckOldUserCoupon: function(mobile) {
112 - var that = this, $el = this.el; 113 + var that = this,
  114 + $el = this.el;
113 115
114 $.ajax({ 116 $.ajax({
115 url: '/activity/invite/checkOldUserCoupon', 117 url: '/activity/invite/checkOldUserCoupon',
@@ -317,15 +319,6 @@ inviteObj = { @@ -317,15 +319,6 @@ inviteObj = {
317 $('.invite-dialog-bg').remove(); 319 $('.invite-dialog-bg').remove();
318 $el.$inviteDialog.hide(); 320 $el.$inviteDialog.hide();
319 that.clearGrayInfo(); 321 that.clearGrayInfo();
320 - },  
321 -  
322 - // 下载app  
323 - downLoadApp: function() {  
324 - var appUrl = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445';  
325 -  
326 - setTimeout(function() {  
327 - window.location = appUrl;  
328 - }, 200);  
329 } 322 }
330 }; 323 };
331 324
@@ -15,7 +15,8 @@ var searching, @@ -15,7 +15,8 @@ var searching,
15 navType, 15 navType,
16 appVersion = $('input[name="app_version"]').val(), 16 appVersion = $('input[name="app_version"]').val(),
17 uid = $('input[name="uid"]').val(), 17 uid = $('input[name="uid"]').val(),
18 - ids = []; 18 + ids = [],
  19 + channelId;
19 20
20 var shopNav = require('shopCollect/shop-nav.hbs'), 21 var shopNav = require('shopCollect/shop-nav.hbs'),
21 shopList = require('shopCollect/shop-list.hbs'); 22 shopList = require('shopCollect/shop-list.hbs');
@@ -24,6 +25,7 @@ require('../common'); @@ -24,6 +25,7 @@ require('../common');
24 require('../common/share'); 25 require('../common/share');
25 26
26 navType = window.queryString; 27 navType = window.queryString;
  28 +channelId = window.queryString.channel_id;
27 29
28 function shopFav(shopIds) { 30 function shopFav(shopIds) {
29 return $.ajax({ 31 return $.ajax({
@@ -67,7 +69,8 @@ function shopListData(tabName, stoping) { @@ -67,7 +69,8 @@ function shopListData(tabName, stoping) {
67 url: '/activity/shopList', 69 url: '/activity/shopList',
68 data: { 70 data: {
69 tabName: tabName, 71 tabName: tabName,
70 - uid: uid || '' 72 + uid: uid || '',
  73 + channelId: channelId
71 }, 74 },
72 success: function(data) { 75 success: function(data) {
73 76
@@ -177,34 +180,33 @@ function shopNavData() { @@ -177,34 +180,33 @@ function shopNavData() {
177 $.ajax({ 180 $.ajax({
178 method: 'get', 181 method: 'get',
179 url: '/activity/shopNav', 182 url: '/activity/shopNav',
180 - 183 + data: {
  184 + channelId: channelId
  185 + },
181 success: function(data) { 186 success: function(data) {
182 187
183 var navString = shopNav({ 188 var navString = shopNav({
184 navList: data 189 navList: data
185 }); 190 });
186 191
  192 + var tabNum;
  193 +
187 if (data === false) { 194 if (data === false) {
188 shopListData('null'); 195 shopListData('null');
189 $('.shop-nav').hide(); 196 $('.shop-nav').hide();
  197 +
190 return; 198 return;
191 } 199 }
192 200
193 - $('.shop-nav').html(navString);  
194 -  
195 - // 导航滑动效果  
196 - navSwiper = new Swiper('.shop-nav', {  
197 - grabCursor: true,  
198 - slidesPerView: 'auto',  
199 - slideElement: 'li'  
200 - }); 201 + $('.shop-area').html(navString);
201 202
202 // 加载第一页数据 203 // 加载第一页数据
203 - if (navType.id) { 204 + if (navType.tab_name) {
204 $('.shop-nav').find('li').each(function() { 205 $('.shop-nav').find('li').each(function() {
205 - if (decodeURI(navType.id) === $(this).data('type')) { 206 + if (decodeURI(navType.tab_name) === $(this).data('type')) {
206 $(this).addClass('active'); 207 $(this).addClass('active');
207 shopListData($(this).data('type')); 208 shopListData($(this).data('type'));
  209 + tabNum = $(this).index();
208 } 210 }
209 }); 211 });
210 } else { 212 } else {
@@ -212,10 +214,33 @@ function shopNavData() { @@ -212,10 +214,33 @@ function shopNavData() {
212 shopListData($('.shop-nav').find('li').eq(0).data('type')); 214 shopListData($('.shop-nav').find('li').eq(0).data('type'));
213 } 215 }
214 216
  217 + // 导航滑动效果
  218 + navSwiper = new Swiper('.shop-area', {
  219 + grabCursor: true,
  220 + slidesPerView: 'auto',
  221 + initialSlide: tabNum,
  222 + slideElement: 'li'
  223 + });
  224 +
  225 + if (tabNum < 3) {
  226 + $('.shop-area ul').css({
  227 + transform: 'translateX(0px)'
  228 + });
  229 + }
  230 +
  231 + $(window).on('scroll touchmove touchstart touchend', function() {
  232 + if ($(window).scrollTop() > $('.shop-nav')[0].offsetTop) {
  233 + $('.shop-area').addClass('fixer');
  234 + } else {
  235 + $('.shop-area').removeClass('fixer');
  236 + }
  237 + });
  238 +
215 // 导航点击事件 239 // 导航点击事件
216 $('.shop-nav').find('li').on('click', function() { 240 $('.shop-nav').find('li').on('click', function() {
217 var $this = $(this), 241 var $this = $(this),
218 - tabName = $this.data('type'); 242 + tabName = $this.data('type'),
  243 + $top = $('.shop-nav')[0].offsetTop;
219 244
220 if ($this.hasClass('active')) { 245 if ($this.hasClass('active')) {
221 stoping = true; 246 stoping = true;
@@ -226,6 +251,10 @@ function shopNavData() { @@ -226,6 +251,10 @@ function shopNavData() {
226 shopListData(tabName, stoping); 251 shopListData(tabName, stoping);
227 252
228 $this.addClass('active').siblings().removeClass('active'); 253 $this.addClass('active').siblings().removeClass('active');
  254 +
  255 + if ($('.shop-area').hasClass('fixer')) {
  256 + $(window).scrollTop($top);
  257 + }
229 }); 258 });
230 259
231 }, 260 },
@@ -8,57 +8,74 @@ var $ = require('yoho-jquery'), @@ -8,57 +8,74 @@ var $ = require('yoho-jquery'),
8 Swiper = require('yoho-swiper'), 8 Swiper = require('yoho-swiper'),
9 tip = require('../plugin/tip'), 9 tip = require('../plugin/tip'),
10 loading = require('../plugin/loading'), 10 loading = require('../plugin/loading'),
11 - lazyload = require('yoho-jquery-lazyload'),  
12 - banner = require('../../hbs/resources/banner-top.hbs'),  
13 - tab = require('../../hbs/activity/single-day/tab.hbs'),  
14 - product = require('../../hbs/activity/single-day/product-list.hbs');  
15 -  
16 -var $productList = $('.product-list');  
17 -var getFlag = false;  
18 -  
19 -var getProductData = function(index, tabName) {  
20 - if (getFlag) {  
21 - return;  
22 - }  
23 - getFlag = true;  
24 - loading.showLoadingMask();  
25 - $.ajax({  
26 - type: 'GET',  
27 - url: '/activity/single-day/getProductData',  
28 - data: {  
29 - tab_name: tabName 11 + banner = require('resources/banner-top.hbs'),
  12 + tab = require('activity/single-day/tab.hbs'),
  13 + product = require('activity/single-day/product-list.hbs');
  14 +
  15 +
  16 +var singleDay = {
  17 + initParams: function() {
  18 + var self = this,
  19 + opt = {
  20 + $productList: $('.product-list'),
  21 + $swiper: $('.swiper-tab'),
  22 + getFlag: false,
  23 + previousScrollTop: 0,
  24 + winH: $(window).height(),
  25 + noResult: '<p class="no-result">未找到相关商品</p>',
  26 + page: 0,
  27 + contCode: window.queryString.code || '',
  28 + channelId: window.queryString.channel_id
  29 + };
  30 +
  31 + self.swiperOTop = opt.$swiper[0].offsetTop;
  32 +
  33 + $.extend(self, opt);
30 }, 34 },
31 - success: function(data) {  
32 - var $productTab = $('.product-tab');  
33 -  
34 - if (data) {  
35 - $productTab.eq(index).append(product(data)); 35 + getInitData: function() {
  36 + var self = this;
  37 + var _scrollHandler;
  38 +
  39 + self.initParams();
  40 +
  41 + _scrollHandler = function() {
  42 + var curScrollTop = $(window).scrollTop(),
  43 + index = $('.swiper-tab .active').index(),
  44 + curHeight = self.$productList.find('ul').eq(index).height();
  45 +
  46 + // 当scroll到1/4$goodsContainer高度后继续请求下一页数据
  47 + if (curScrollTop > self.previousScrollTop &&
  48 + (curScrollTop + self.winH >
  49 + $(document).height() - 0.25 * curHeight - 50)) {
  50 + self.getProductData({
  51 + index: index,
  52 + tabName: self.tabName(index),
  53 + isScroll: true
  54 + });
36 } 55 }
37 56
38 - $productTab.hide().eq(index).show(); 57 + self.previousScrollTop = curScrollTop;
  58 + };
39 59
40 - lazyload($('img.lazy'));  
41 - getFlag = false;  
42 - loading.hideLoadingMask();  
43 - },  
44 - error: function() {  
45 - tip.show('网络断开连接了~');  
46 - loading.hideLoadingMask();  
47 - getFlag = false; 60 + $(window).on('scroll touchmove touchstart touchend', function() {
  61 + if ($(window).scrollTop() > self.swiperOTop) {
  62 + self.$swiper.addClass('fixer');
  63 + } else {
  64 + self.$swiper.removeClass('fixer');
48 } 65 }
49 - });  
50 -};  
51 66
52 -var tabName = function(index) {  
53 - return $('.swiper-tab li').eq(index).html();  
54 -}; 67 + window.requestAnimationFrame(_scrollHandler.bind(self));
  68 + });
55 69
56 -var getInitData = function() {  
57 $.ajax({ 70 $.ajax({
58 type: 'GET', 71 type: 'GET',
59 url: '/activity/single-day/getSingleData', 72 url: '/activity/single-day/getSingleData',
  73 + data: {
  74 + channel_id: self.channelId,
  75 + contCode: self.contCode
  76 + },
60 success: function(data) { 77 success: function(data) {
61 - var i = 0, $swiperTab, $productTab; 78 + var i = 0, $swiperTab;
62 var tabNum = window.queryString.tabNum ? window.queryString.tabNum - 1 : 0; 79 var tabNum = window.queryString.tabNum ? window.queryString.tabNum - 1 : 0;
63 80
64 if (data[0]) { 81 if (data[0]) {
@@ -84,16 +101,26 @@ var getInitData = function() { @@ -84,16 +101,26 @@ var getInitData = function() {
84 $swiperTab = $('.swiper-tab li'); 101 $swiperTab = $('.swiper-tab li');
85 102
86 new Swiper('.swiper-tab', { 103 new Swiper('.swiper-tab', {
  104 + initialSlide: tabNum,
87 slidesPerView: 'auto' 105 slidesPerView: 'auto'
88 }); 106 });
89 107
  108 + if (tabNum < 3) {
  109 + $('.swiper-tab ul').css({
  110 + transform: 'translateX(0px)'
  111 + });
  112 + }
  113 +
90 for (i; i < data[1].length; i++) { 114 for (i; i < data[1].length; i++) {
91 - $productList.append('<ul class="product-tab"></ul>'); 115 + self.$productList.append('<ul class="product-tab" data-page="0"></ul>');
92 } 116 }
93 117
94 - $productTab = $('.product-tab'); 118 + self.$productTab = $('.product-tab');
95 119
96 - getProductData(tabNum, tabName(tabNum)); 120 + self.getProductData({
  121 + index: tabNum,
  122 + tabName: self.tabName(tabNum)
  123 + });
97 $swiperTab.eq(tabNum).addClass('active'); 124 $swiperTab.eq(tabNum).addClass('active');
98 125
99 $swiperTab.on('click', function() { 126 $swiperTab.on('click', function() {
@@ -101,26 +128,88 @@ var getInitData = function() { @@ -101,26 +128,88 @@ var getInitData = function() {
101 128
102 $swiperTab.removeClass('active').eq(index).addClass('active'); 129 $swiperTab.removeClass('active').eq(index).addClass('active');
103 130
104 - if ($productTab.eq(index).find('li').length > 0) {  
105 - $productTab.hide().eq(index).show(); 131 + if (self.$productTab.eq(index).find('li').length > 0) {
  132 + self.$productTab.hide().eq(index).fadeIn();
106 } else { 133 } else {
107 - getProductData(index, tabName(index)); 134 + self.getProductData({
  135 + index: index,
  136 + tabName: self.tabName(index)
  137 + });
  138 + }
  139 + });
  140 + }
  141 +
  142 + loading.hideLoadingMask();
  143 + },
  144 + error: function() {
  145 + tip.show('网络断开连接了~');
108 } 146 }
109 }); 147 });
  148 + },
  149 + tabName: function(index) {
  150 + return $('.swiper-tab li').eq(index).html();
  151 + },
  152 + getProductData: function(params) {
  153 + var self = this;
  154 + var page;
  155 + var curProductTab = self.$productTab.eq(params.index);
  156 +
  157 + if (self.getFlag) {
  158 + return false;
110 } 159 }
111 160
  161 + page = +curProductTab.attr('data-page') + 1;
  162 + self.getFlag = true;
  163 + loading.showLoadingMask();
  164 +
  165 + $.ajax({
  166 + type: 'GET',
  167 + url: '/activity/single-day/getProductData',
  168 + data: {
  169 + tab_name: params.tabName || '',
  170 + channel_id: self.channelId,
  171 + page: page
  172 + },
  173 + success: function(data) {
  174 + if (data) {
  175 + curProductTab.find('.no-result').hide();
  176 + curProductTab.append(product(data));
  177 + curProductTab.attr('data-page', page);
  178 + self.getFlag = false;
  179 + } else {
  180 + if (page === 1) {
  181 + if (curProductTab.find('.no-result').length === 0) {
  182 + curProductTab.append(self.noResult);
  183 + }
  184 + self.getFlag = false;
  185 + } else {
  186 + self.getFlag = true;
  187 + }
  188 + }
  189 +
  190 + if (!params.isScroll) {
  191 + self.$productTab.hide().eq(params.index).fadeIn();
  192 + }
  193 +
  194 + $('img.lazy').lazyload({
  195 + effect: 'fadeIn'
  196 + });
112 loading.hideLoadingMask(); 197 loading.hideLoadingMask();
113 }, 198 },
114 error: function() { 199 error: function() {
115 tip.show('网络断开连接了~'); 200 tip.show('网络断开连接了~');
  201 + loading.hideLoadingMask();
  202 + self.getFlag = false;
116 } 203 }
117 }); 204 });
  205 + }
118 }; 206 };
119 207
120 require('../common'); 208 require('../common');
121 require('../common/share'); 209 require('../common/share');
  210 +require('yoho-jquery-lazyload');
122 211
123 $(function() { 212 $(function() {
124 loading.showLoadingMask(); 213 loading.showLoadingMask();
125 - getInitData(); 214 + singleDay.getInitData();
126 }); 215 });
@@ -203,8 +203,8 @@ $.extend({ @@ -203,8 +203,8 @@ $.extend({
203 $footer.removeClass('hide'); 203 $footer.removeClass('hide');
204 204
205 // 单击下载按钮 - 接受微信商城或者第三方来源的数据埋点信息 205 // 单击下载按钮 - 接受微信商城或者第三方来源的数据埋点信息
206 - if (queryString().mkt_code) {  
207 - setCookie('unionType', queryString().mkt_code); 206 + if (queryString().union_type) {
  207 + setCookie('unionTypeYas', queryString().union_type, {path: '/'});
208 } 208 }
209 209
210 }()); 210 }());
@@ -307,6 +307,31 @@ if ($footer.find('.user-name').text().length === 11) { @@ -307,6 +307,31 @@ if ($footer.find('.user-name').text().length === 11) {
307 $footer.find('.user-name').html(phoneHidden($footer.find('.user-name').text())); 307 $footer.find('.user-name').html(phoneHidden($footer.find('.user-name').text()));
308 } 308 }
309 309
  310 +// 浮层下载APP
  311 +function downLoadApp() {
  312 + var appUrl = 'http://union.yoho.cn/union/downapp.html';
  313 + var clickedAt = new Date();
  314 +
  315 + setTimeout(function() {
  316 + var mkt = queryString().union_type || cookie('unionTypeYas') || false;
  317 +
  318 + if ((new Date()) - clickedAt < 2000) {
  319 + if (mkt) {
  320 + appUrl += '?union_type=' + mkt;
  321 + }
  322 +
  323 + if (window._yas && window._yas.sendCustomInfo) {
  324 + window._yas.sendCustomInfo({
  325 + op: 'YB_DOWNLOAD_C',
  326 + param: JSON.stringify({C_ID: _ChannelVary[cookie('_Channel')] || 1, TO_URL: appUrl})
  327 + }, true);
  328 + }
  329 +
  330 + window.location = appUrl;
  331 + }
  332 + }, 500);
  333 +}
  334 +
310 // 为您优选埋点 http://redmine.yoho.cn/issues/10117 335 // 为您优选埋点 http://redmine.yoho.cn/issues/10117
311 function givePoint(parameter) { 336 function givePoint(parameter) {
312 var CID = 1; 337 var CID = 1;
@@ -398,3 +423,5 @@ window.queryString = queryString(); @@ -398,3 +423,5 @@ window.queryString = queryString();
398 window.givePoint = givePoint; 423 window.givePoint = givePoint;
399 424
400 window._ChannelVary = _ChannelVary; 425 window._ChannelVary = _ChannelVary;
  426 +
  427 +window.downLoadApp = downLoadApp;
@@ -78,7 +78,11 @@ function render(data) { @@ -78,7 +78,11 @@ function render(data) {
78 $chosePanel.find('.text-info>.name').text(cartInfo.name); 78 $chosePanel.find('.text-info>.name').text(cartInfo.name);
79 $chosePanel.find('.sale-price').text(cartInfo.salePrice); 79 $chosePanel.find('.sale-price').text(cartInfo.salePrice);
80 if (!cartInfo.price) { 80 if (!cartInfo.price) {
  81 + if (data.isSecKill === 'Y') {
  82 + $('.price').append('<span class="market-price">' + cartInfo.salePrice + '</span>');
  83 + } else {
81 $chosePanel.find('.sale-price').addClass('no-price'); 84 $chosePanel.find('.sale-price').addClass('no-price');
  85 + }
82 } else { 86 } else {
83 $chosePanel.find('.market-price').text(cartInfo.price).removeClass(dbClass); 87 $chosePanel.find('.market-price').text(cartInfo.price).removeClass(dbClass);
84 } 88 }
@@ -7,37 +7,10 @@ @@ -7,37 +7,10 @@
7 var $ = require('yoho-jquery'), 7 var $ = require('yoho-jquery'),
8 Hammer = require('yoho-hammer'); 8 Hammer = require('yoho-hammer');
9 9
10 -var floatLayerBtnHammer,  
11 - C_ID; 10 +var floatLayerBtnHammer;
12 11
13 require('../common'); 12 require('../common');
14 13
15 -C_ID = window._ChannelVary[window.cookie('_Channel')] || 1;  
16 -  
17 -function downLoadApp() {  
18 - var appUrl = 'http://union.yoho.cn/union/downapp.html';  
19 - var clickedAt = new Date();  
20 -  
21 - setTimeout(function() {  
22 - var mkt = window.queryString.mkt_code || window.cookie('mkt_code') || false;  
23 -  
24 - if ((new Date()) - clickedAt < 2000) {  
25 - if (mkt) {  
26 - appUrl += '?union_type=' + mkt;  
27 - }  
28 -  
29 - if (window._yas && window._yas.sendCustomInfo) {  
30 - window._yas.sendCustomInfo({  
31 - op: 'YB_DOWNLOAD_C',  
32 - param: JSON.stringify({C_ID: C_ID, TO_URL: appUrl})  
33 - }, true);  
34 - }  
35 -  
36 - window.location = appUrl;  
37 - }  
38 - }, 500);  
39 -}  
40 -  
41 $('#float-layer-close').on('touchend', function() { 14 $('#float-layer-close').on('touchend', function() {
42 $('#float-layer-app').hide(); 15 $('#float-layer-app').hide();
43 window.setCookie('_float-layer-app', 'id490655927', 16 window.setCookie('_float-layer-app', 'id490655927',
@@ -55,7 +28,7 @@ $('#float-layer-close').on('touchend', function() { @@ -55,7 +28,7 @@ $('#float-layer-close').on('touchend', function() {
55 if ($('#float-layer-btn') && $('#float-layer-btn')[0]) { 28 if ($('#float-layer-btn') && $('#float-layer-btn')[0]) {
56 floatLayerBtnHammer = new Hammer($('#float-layer-btn')[0]); 29 floatLayerBtnHammer = new Hammer($('#float-layer-btn')[0]);
57 floatLayerBtnHammer.on('tap', function(e) { 30 floatLayerBtnHammer.on('tap', function(e) {
58 - downLoadApp('bottom'); 31 + window.downLoadApp('bottom');
59 e.srcEvent.stopPropagation(); 32 e.srcEvent.stopPropagation();
60 }); 33 });
61 34
@@ -24,30 +24,6 @@ function getQueryString(name) { @@ -24,30 +24,6 @@ function getQueryString(name) {
24 return null; 24 return null;
25 } 25 }
26 26
27 -function downLoadApp() {  
28 - var appUrl = 'http://union.yoho.cn/union/downapp.html';  
29 - var clickedAt = new Date();  
30 -  
31 - setTimeout(function() {  
32 - var mkt = window.queryString.mkt_code || window.cookie('unionType') || false;  
33 -  
34 - if ((new Date()) - clickedAt < 2000) {  
35 - if (mkt) {  
36 - appUrl += '?union_type=' + mkt;  
37 - }  
38 -  
39 - if (window._yas && window._yas.sendCustomInfo) {  
40 - window._yas.sendCustomInfo({  
41 - op: 'YB_DOWNLOAD_C',  
42 - param: JSON.stringify({C_ID: window._ChannelVary[window.cookie('_Channel')] || 1, TO_URL: appUrl})  
43 - }, true);  
44 - }  
45 -  
46 - window.location = appUrl;  
47 - }  
48 - }, 500);  
49 -}  
50 -  
51 $('#float-layer-close').on('touchend', function(e) { 27 $('#float-layer-close').on('touchend', function(e) {
52 $('#float-layer-app').hide(); 28 $('#float-layer-app').hide();
53 window.setCookie('_float-layer-app', 'id490655927', 29 window.setCookie('_float-layer-app', 'id490655927',
@@ -65,7 +41,7 @@ $('#float-layer-close').on('touchend', function(e) { @@ -65,7 +41,7 @@ $('#float-layer-close').on('touchend', function(e) {
65 if ($('#float-layer-btn') && $('#float-layer-btn')[0]) { 41 if ($('#float-layer-btn') && $('#float-layer-btn')[0]) {
66 floatLayerBtnHammer = new Hammer($('#float-layer-btn')[0]); 42 floatLayerBtnHammer = new Hammer($('#float-layer-btn')[0]);
67 floatLayerBtnHammer.on('tap', function(e) { 43 floatLayerBtnHammer.on('tap', function(e) {
68 - downLoadApp('bottom'); 44 + window.downLoadApp('bottom');
69 e.srcEvent.stopPropagation(); 45 e.srcEvent.stopPropagation();
70 }); 46 });
71 47
@@ -18,6 +18,7 @@ module.exports = function(callback) { @@ -18,6 +18,7 @@ module.exports = function(callback) {
18 productSkn: productSkn 18 productSkn: productSkn
19 }, 19 },
20 success: function(data) { 20 success: function(data) {
  21 +
21 // 如果当前是秒杀商品,且不在秒杀路径下,跳到该商品的秒杀详情页 22 // 如果当前是秒杀商品,且不在秒杀路径下,跳到该商品的秒杀详情页
22 var reg = /\/product\/show_([\d]+)/; 23 var reg = /\/product\/show_([\d]+)/;
23 var regPro = /\/product\/pro_([\d]+)_([\d]+)/; 24 var regPro = /\/product\/pro_([\d]+)_([\d]+)/;
@@ -27,9 +28,12 @@ module.exports = function(callback) { @@ -27,9 +28,12 @@ module.exports = function(callback) {
27 var thisHref = window.location.href; 28 var thisHref = window.location.href;
28 var thisRefer = document.referrer; 29 var thisRefer = document.referrer;
29 30
30 - if (regSeckill.test(thisRefer)) { 31 + // 如果秒杀商品没有吊牌价,显示原销售价
  32 + if (data.isSecKill === 'Y' && !data.cartInfo.price) {
  33 + $('.previous-price').text(data.cartInfo.salePrice);
  34 + }
31 35
32 - } else { 36 + if (!regSeckill.test(thisRefer)) {
33 if (data.isSecKill === 'Y' && (reg.test(thisHref) || regPro.test(thisHref))) { 37 if (data.isSecKill === 'Y' && (reg.test(thisHref) || regPro.test(thisHref))) {
34 window.location.replace('/product/seckill/show_' + $('#productSkn').val() + '.html'); 38 window.location.replace('/product/seckill/show_' + $('#productSkn').val() + '.html');
35 } 39 }
@@ -397,8 +397,7 @@ seckillObj = { @@ -397,8 +397,7 @@ seckillObj = {
397 397
398 loading.show(); 398 loading.show();
399 $xhr = $.ajax({ 399 $xhr = $.ajax({
400 - url: location.href,  
401 - cache: false 400 + url: '/product/seckill/list' + location.search,
402 }) 401 })
403 .done(function(result) { 402 .done(function(result) {
404 self.$container.replaceWith( 403 self.$container.replaceWith(
@@ -417,6 +416,12 @@ seckillObj = { @@ -417,6 +416,12 @@ seckillObj = {
417 416
418 }) 417 })
419 .error(function() { 418 .error(function() {
  419 + self.$container.replaceWith(
  420 + self.pageTemplate({
  421 + error: '系统繁忙.....',
  422 + isApp: yoho.isApp
  423 + })
  424 + );
420 }) 425 })
421 .always(function() { 426 .always(function() {
422 loading.hide(); 427 loading.hide();
@@ -74,6 +74,7 @@ seckillObj = { @@ -74,6 +74,7 @@ seckillObj = {
74 74
75 $( 75 $(
76 function() { 76 function() {
  77 + $('#goodsDiscount').hide();// 隐藏折扣楼层
77 $('.cart-bar').hide(); 78 $('.cart-bar').hide();
78 $('.current-price').hide(); 79 $('.current-price').hide();
79 var ajaxUrl = '/product/seckillDetail/seckillData/' + $('#productSkn').val(); 80 var ajaxUrl = '/product/seckillDetail/seckillData/' + $('#productSkn').val();
@@ -94,7 +95,6 @@ $( @@ -94,7 +95,6 @@ $(
94 // $('.current-price').show(); 95 // $('.current-price').show();
95 } else { 96 } else {
96 97
97 - getMarketPrice();// 获取市场价  
98 // 秒杀开始前 98 // 秒杀开始前
99 if (data.status === 1) { 99 if (data.status === 1) {
100 $('.cart-bar').before( 100 $('.cart-bar').before(
@@ -207,6 +207,9 @@ $( @@ -207,6 +207,9 @@ $(
207 newDay = newDate.getDate(); 207 newDay = newDate.getDate();
208 newHour = newDate.getHours(); 208 newHour = newDate.getHours();
209 newMinus = newDate.getMinutes(); 209 newMinus = newDate.getMinutes();
  210 + if (newMinus === 0) {
  211 + newMinus = '00';
  212 + }
210 $('.notStart').find('.seckill-time-c').text(newMonth + '月' + newDay + '日' + newHour + ':' + newMinus); 213 $('.notStart').find('.seckill-time-c').text(newMonth + '月' + newDay + '日' + newHour + ':' + newMinus);
211 seckillObj.startTick(timeObj, offsetTime); 214 seckillObj.startTick(timeObj, offsetTime);
212 } 215 }
@@ -263,32 +266,6 @@ function seckHide() { @@ -263,32 +266,6 @@ function seckHide() {
263 ); 266 );
264 } 267 }
265 268
266 -function getMarketPrice() {  
267 - var productId = $('#productId').val();  
268 - var goodsId = $('#goodsId').val();  
269 - var productSkn = $('#productSkn').val();  
270 -  
271 - if (productId && (goodsId || productSkn)) {  
272 - $.ajax({  
273 - type: 'POST',  
274 - url: '/product/detail/info',  
275 - data: {  
276 - id: productId,  
277 - goodsId: goodsId,  
278 - productSkn: productSkn  
279 - },  
280 - success: function(data) {  
281 - if (data.goodsPrice.previousPrice) {  
282 - $('.previous-price').text(data.goodsPrice.previousPrice);  
283 - } else {  
284 - $('.previous-price').text(data.goodsPrice.currentPrice);  
285 - }  
286 -  
287 - }  
288 - });  
289 - }  
290 -}  
291 -  
292 function addTimeout(obj) { 269 function addTimeout(obj) {
293 obj.append( 270 obj.append(
294 '<div class="seckill-time seckill-time-border">' + 271 '<div class="seckill-time seckill-time-border">' +
@@ -38,13 +38,13 @@ @@ -38,13 +38,13 @@
38 38
39 .main-left { 39 .main-left {
40 float: left; 40 float: left;
41 - width: 450px; 41 + width: 78%;
42 height: 160px; 42 height: 160px;
43 } 43 }
44 44
45 .main-right-receive, .main-right-use, .main-right-go { 45 .main-right-receive, .main-right-use, .main-right-go {
46 float: right; 46 float: right;
47 - width: 113px; 47 + width: 18%;
48 height: 160px; 48 height: 160px;
49 position: relative; 49 position: relative;
50 50
@@ -68,7 +68,7 @@ @@ -68,7 +68,7 @@
68 } 68 }
69 69
70 &.received { 70 &.received {
71 - width: 113px; 71 + width: 100%;
72 height: 132px; 72 height: 132px;
73 background-image: resolve('activity/received.png'); 73 background-image: resolve('activity/received.png');
74 position: absolute; 74 position: absolute;
@@ -77,7 +77,7 @@ @@ -77,7 +77,7 @@
77 } 77 }
78 78
79 &.zero { 79 &.zero {
80 - width: 111px; 80 + width: 100%;
81 height: 132px; 81 height: 132px;
82 background-image: resolve('activity/zero.png'); 82 background-image: resolve('activity/zero.png');
83 position: absolute; 83 position: absolute;
@@ -10,28 +10,50 @@ @@ -10,28 +10,50 @@
10 } 10 }
11 } 11 }
12 12
13 - .swiper-tab { 13 + .fixer {
  14 + position: fixed;
  15 + top: 0;
  16 + z-index: 2;
  17 + }
  18 +
  19 + .tab-area {
  20 + width: 100%;
14 height: 86px; 21 height: 86px;
  22 + background: #fff;
15 border-bottom: 1px solid #e0e0e0; 23 border-bottom: 1px solid #e0e0e0;
16 border-top: 1px solid #e0e0e0; 24 border-top: 1px solid #e0e0e0;
17 -  
18 - ul {  
19 - margin-top: 28px;  
20 } 25 }
21 26
  27 + .swiper-tab {
  28 + width: 100%;
  29 + height: 80px;
  30 + //border-bottom: 1px solid #e0e0e0;
  31 + //border-top: 1px solid #e0e0e0;
  32 + //background: #fff;
  33 +
22 li { 34 li {
23 float: left; 35 float: left;
24 padding: 0 50px; 36 padding: 0 50px;
25 - border-right: 1px solid #e0e0e0;  
26 - height: 30px;  
27 - line-height: 30px; 37 + height: 80px;
  38 + line-height: 80px;
28 color: #b0b0b0; 39 color: #b0b0b0;
29 width: auto; 40 width: auto;
30 font-size: 28px; 41 font-size: 28px;
  42 + background: #fff;
  43 + }
  44 +
  45 + li:after {
  46 + content: "";
  47 + height: 30px;
  48 + width: 2px;
  49 + border-left: 1px solid #e0e0e0;
  50 + position: absolute;
  51 + right: 0;
  52 + top: 28px;
31 } 53 }
32 54
33 - li:last-child {  
34 - border-right: none; 55 + li:last-child:after {
  56 + border-left: none;
35 } 57 }
36 58
37 .active { 59 .active {
@@ -64,17 +86,30 @@ @@ -64,17 +86,30 @@
64 .product-info { 86 .product-info {
65 width: 370px; 87 width: 370px;
66 height: 445px; 88 height: 445px;
67 - float: left; 89 + float: right;
68 position: relative; 90 position: relative;
69 border-bottom: 1px solid #e8e8e8; 91 border-bottom: 1px solid #e8e8e8;
70 padding-right: 30px; 92 padding-right: 30px;
71 box-sizing: border-box; 93 box-sizing: border-box;
72 } 94 }
73 95
  96 + li:last-child .product-info {
  97 + border-bottom: none;
  98 + }
  99 +
74 p { 100 p {
75 width: 340px; 101 width: 340px;
76 } 102 }
77 103
  104 + .no-result {
  105 + width: 100%;
  106 + text-align: center;
  107 + vertical-align: middle;
  108 + color: #ccc;
  109 + font-size: 1.2em;
  110 + margin-top: 320px;
  111 + }
  112 +
78 h3 { 113 h3 {
79 margin-top: 50px; 114 margin-top: 50px;
80 font-size: 28px; 115 font-size: 28px;
@@ -100,7 +135,7 @@ @@ -100,7 +135,7 @@
100 } 135 }
101 136
102 .sale-price { 137 .sale-price {
103 - font-size: 30px; 138 + font-size: 34px;
104 color: #cf031e; 139 color: #cf031e;
105 } 140 }
106 141
@@ -118,7 +153,7 @@ @@ -118,7 +153,7 @@
118 .info-txt { 153 .info-txt {
119 position: absolute; 154 position: absolute;
120 bottom: 62px; 155 bottom: 62px;
121 - font-size: 22px; 156 + font-size: 26px;
122 display: -webkit-box; 157 display: -webkit-box;
123 -webkit-box-orient: vertical; 158 -webkit-box-orient: vertical;
124 -webkit-line-clamp: 2; 159 -webkit-line-clamp: 2;
@@ -6,8 +6,6 @@ @@ -6,8 +6,6 @@
6 background: #fff; 6 background: #fff;
7 box-sizing: border-box; 7 box-sizing: border-box;
8 overflow: hidden; 8 overflow: hidden;
9 - background: #fff;  
10 - border-bottom: 1px solid #e0e0e0;  
11 margin-bottom: 30px; 9 margin-bottom: 30px;
12 10
13 li { 11 li {
@@ -30,11 +28,16 @@ @@ -30,11 +28,16 @@
30 .active { 28 .active {
31 color: #000; 29 color: #000;
32 } 30 }
  31 +
  32 + .shop-area {
  33 + background: #fff;
  34 + border-bottom: 1px solid #e0e0e0;
  35 + min-width: 750px;
  36 + }
33 } 37 }
34 38
35 .shop-list { 39 .shop-list {
36 width: 100%; 40 width: 100%;
37 -/* padding-top: 30px;*/  
38 41
39 .shop-info { 42 .shop-info {
40 background: #fff; 43 background: #fff;
@@ -124,8 +127,15 @@ @@ -124,8 +127,15 @@
124 127
125 .content { 128 .content {
126 width: 750px; 129 width: 750px;
127 - height: 330px; 130 + height: 329px;
128 } 131 }
129 } 132 }
130 } 133 }
  134 +
  135 + .fixer {
  136 + position: fixed;
  137 + top: 0;
  138 + left: 0;
  139 + z-index: 2;
  140 + }
131 } 141 }