Authored by 沈志敏

Merge branch 'master' of git.yoho.cn:fe/yohobuywap-node into release/couponcenter

@@ -19,7 +19,7 @@ router.get('/girls', channel.switchChannel, channel.girls); @@ -19,7 +19,7 @@ router.get('/girls', channel.switchChannel, channel.girls);
19 router.get('/kids', channel.switchChannel, channel.kids); 19 router.get('/kids', channel.switchChannel, channel.kids);
20 router.get('/lifestyle', channel.switchChannel, channel.lifestyle); 20 router.get('/lifestyle', channel.switchChannel, channel.lifestyle);
21 21
22 -router.get('/channel/bottomBanner', channel.bottomBanner); 22 +router.get('/(:channel)/bottomBanner', channel.bottomBanner);
23 23
24 router.get('/cate', cate.index); 24 router.get('/cate', cate.index);
25 25
@@ -192,7 +192,7 @@ const brand = (req, res, next) => { @@ -192,7 +192,7 @@ const brand = (req, res, next) => {
192 return; 192 return;
193 } 193 }
194 194
195 - listModel.getBrandLogoByDomain(domain).then((result) => { 195 + listModel.getBrandLogoByDomain(domain).then(result => {
196 brandLogo = result; 196 brandLogo = result;
197 197
198 title = brandLogo.name; 198 title = brandLogo.name;
@@ -209,20 +209,20 @@ const brand = (req, res, next) => { @@ -209,20 +209,20 @@ const brand = (req, res, next) => {
209 if (brandLogo.type === '2' && brandLogo.shopId) { 209 if (brandLogo.type === '2' && brandLogo.shopId) {
210 _shop(req, res, brandLogo.shopId); 210 _shop(req, res, brandLogo.shopId);
211 } else { // 获取品牌店铺信息 211 } else { // 获取品牌店铺信息
212 - listModel.getBrandShops(brandId).then((brandShop) => { 212 + listModel.getBrandShops(brandId).then(brandShop => {
213 if (brandId === 0) { 213 if (brandId === 0) {
214 params.query = domain; 214 params.query = domain;
215 } 215 }
216 216
217 // 从搜索页过来的,显示搜索框, 和进入品牌引导信息 或者品牌关联多店铺 217 // 从搜索页过来的,显示搜索框, 和进入品牌引导信息 或者品牌关联多店铺
218 if (req.query.from === 'search' || brandShop.length > 0) { 218 if (req.query.from === 'search' || brandShop.length > 0) {
219 - params = {  
220 - brandWay: brandShop ? brandShop : brandLogo, 219 + params = _.assign({
  220 + brandWay: _.isEmpty(brandShop) ? brandLogo : brandShop,
221 search: { 221 search: {
222 default: req.query.query, 222 default: req.query.query,
223 url: helpers.urlFormat('', null, 'search') 223 url: helpers.urlFormat('', null, 'search')
224 } 224 }
225 - }; 225 + }, params);
226 } else if (brandId !== 0) { // 品牌一览过来的展示品牌介绍和LOGO 226 } else if (brandId !== 0) { // 品牌一览过来的展示品牌介绍和LOGO
227 return Promise.all([listModel.getBrandIntro(brandId, uid), listModel.getBrandBanner(brandId)]).then((resData) => { //eslint-disable-line 227 return Promise.all([listModel.getBrandIntro(brandId, uid), listModel.getBrandBanner(brandId)]).then((resData) => { //eslint-disable-line
228 title = resData[0].title; 228 title = resData[0].title;
@@ -281,7 +281,7 @@ const shopIntro = (req, res, next) => { @@ -281,7 +281,7 @@ const shopIntro = (req, res, next) => {
281 let params = {}; 281 let params = {};
282 282
283 if (shopId) { 283 if (shopId) {
284 - listModel.getShopIntro(shopId).then((result) => { 284 + listModel.getShopIntro(shopId).then(result => {
285 if (appVersion) { 285 if (appVersion) {
286 params = { 286 params = {
287 title: '店铺简介' 287 title: '店铺简介'
@@ -294,7 +294,10 @@ const shopIntro = (req, res, next) => { @@ -294,7 +294,10 @@ const shopIntro = (req, res, next) => {
294 }; 294 };
295 } 295 }
296 296
297 - res.render('shop/intro', _.assign(params, result)); 297 + res.render('shop/intro', _.assign(params, result, {
  298 + module: 'product',
  299 + page: 'intro'
  300 + }));
298 }).catch(next); 301 }).catch(next);
299 } else { 302 } else {
300 res.redirect('/?go=1'); 303 res.redirect('/?go=1');
@@ -431,8 +434,6 @@ module.exports = { @@ -431,8 +434,6 @@ module.exports = {
431 brand, 434 brand,
432 favoriteBrand, 435 favoriteBrand,
433 shopIntro, 436 shopIntro,
434 -  
435 - // pagecache新增  
436 brandFav, 437 brandFav,
437 shopAppCookie, 438 shopAppCookie,
438 shopFav, 439 shopFav,
@@ -25,21 +25,34 @@ const list = (req, res, next) => { @@ -25,21 +25,34 @@ const list = (req, res, next) => {
25 let isQuerySecondClass = false; // 标识用户搜的是不是二级品类 25 let isQuerySecondClass = false; // 标识用户搜的是不是二级品类
26 let domain = null; 26 let domain = null;
27 27
  28 + if (params.query) {
  29 + let activity = _.get(searchModel.searchKeyActivity(params.query), 'data.urlobj.appUrl', '');
  30 +
  31 + if (activity) {
  32 + res.redirect(activity);
  33 + }
  34 + }
  35 +
28 if (params.shop_id) { 36 if (params.shop_id) {
29 params.shopId = params.shop_id; 37 params.shopId = params.shop_id;
30 } 38 }
31 39
32 /* 判断是不是品牌, 是品牌跳到品牌列表页(显示搜索框),判断是不是品类, 是品类加导航标题(不显示搜索框) */ 40 /* 判断是不是品牌, 是品牌跳到品牌列表页(显示搜索框),判断是不是品类, 是品类加导航标题(不显示搜索框) */
33 - Promise.all([searchModel.getAllBrandNames(), searchModel.getClassNames()]).then((result) => { 41 + Promise.all([
  42 + searchModel.getAllBrandNames(),
  43 + searchModel.getClassNames()
  44 + ]).then(result => {
34 if (query) { 45 if (query) {
35 - _.forEach(result[0], function(obj) { 46 + query = query.toLowerCase();
  47 + _.forEach(result[0], obj => {
36 48
37 if (query === obj.brandDomain && /^[a-z0-9]+$/i.test(obj.brandName)) { // 精确查品牌域名 49 if (query === obj.brandDomain && /^[a-z0-9]+$/i.test(obj.brandName)) { // 精确查品牌域名
38 domain = query; 50 domain = query;
39 return false; 51 return false;
40 } 52 }
41 - if (query === obj.brandName || query.toUpperCase() === obj.brandName || query.toLowerCase() === obj.brandName && /^[a-z0-9]+$/i.test(obj.brandName)) { // 精确查品牌名称  
42 - domain = obj.brandName; 53 +
  54 + if (query === obj.brandName || query === obj.brandName || query === obj.brandName && /^[a-z0-9]+$/i.test(obj.brandName)) { // 精确查品牌名称
  55 + domain = obj.brandDomain;
43 return false; 56 return false;
44 } 57 }
45 58
@@ -158,13 +171,6 @@ const search = (req, res, next) => { @@ -158,13 +171,6 @@ const search = (req, res, next) => {
158 171
159 let params = Object.assign({}, req.query); 172 let params = Object.assign({}, req.query);
160 173
161 - if (params.query) {  
162 - let activity = _.get(searchModel.searchKeyActivity(params.query), 'data.urlobj.appUrl', '');  
163 -  
164 - if (activity) {  
165 - res.redirect(activity);  
166 - }  
167 - }  
168 searchModel.getSearchData(params).then((result) => { 174 searchModel.getSearchData(params).then((result) => {
169 res.render('search/page', { 175 res.render('search/page', {
170 layout: false, 176 layout: false,
@@ -90,7 +90,7 @@ const _procShowStatus = (data, showStatus, isBeginSale) => { @@ -90,7 +90,7 @@ const _procShowStatus = (data, showStatus, isBeginSale) => {
90 break; 90 break;
91 case 4: // 开售后,立即购买(用户已领取限购码) 91 case 4: // 开售后,立即购买(用户已领取限购码)
92 data.gotCode = true; 92 data.gotCode = true;
93 - data.cartInfo.canBuyLimit = true; 93 + data.cartInfo.canNotBuy = true;
94 break; 94 break;
95 case 5: // 开售前,限购码已被抢光(用户未领取限购码) 95 case 5: // 开售前,限购码已被抢光(用户未领取限购码)
96 data.codeEmpty = true; 96 data.codeEmpty = true;
@@ -7,7 +7,6 @@ @@ -7,7 +7,6 @@
7 const utils = '../../../utils'; 7 const utils = '../../../utils';
8 const logger = global.yoho.logger; 8 const logger = global.yoho.logger;
9 const crypto = global.yoho.crypto; 9 const crypto = global.yoho.crypto;
10 -const camelCase = global.yoho.camelCase;  
11 const _ = require('lodash'); 10 const _ = require('lodash');
12 const helpers = global.yoho.helpers; 11 const helpers = global.yoho.helpers;
13 const api = global.yoho.API; 12 const api = global.yoho.API;
@@ -27,16 +26,13 @@ const yhChannel = { @@ -27,16 +26,13 @@ const yhChannel = {
27 26
28 /* 多品牌店铺列表数据信息处理*/ 27 /* 多品牌店铺列表数据信息处理*/
29 const _processBrandShops = (list) => { 28 const _processBrandShops = (list) => {
30 - const formatDat = []; 29 + let formatDat = [];
31 30
32 - list = list || [];  
33 - list = camelCase(list);  
34 -  
35 - _.forEach(list, (item) => {  
36 - if (item.shopId) { 31 + _.forEach(list, item => {
  32 + if (item.shop_id) {
37 formatDat.push({ 33 formatDat.push({
38 url: helpers.urlFormat('/product/index/brand/', { 34 url: helpers.urlFormat('/product/index/brand/', {
39 - shop_id: item.brandId 35 + shop_id: item.shop_id
40 }), 36 }),
41 thumb: helpers.image(item.brandIco, 75, 40), 37 thumb: helpers.image(item.brandIco, 75, 40),
42 name: item.brandName 38 name: item.brandName
@@ -98,11 +94,7 @@ const _getShopDecorator = (shopId) => { @@ -98,11 +94,7 @@ const _getShopDecorator = (shopId) => {
98 cache: true, 94 cache: true,
99 code: 200 95 code: 200
100 }).then((result) => { 96 }).then((result) => {
101 - if (result.data) {  
102 - return camelCase(result.data);  
103 - } else {  
104 - return '';  
105 - } 97 + return result.data;
106 }); 98 });
107 }; 99 };
108 100
@@ -118,11 +110,7 @@ const _getShopInfo = (shopId, uid) => { @@ -118,11 +110,7 @@ const _getShopInfo = (shopId, uid) => {
118 shop_id: shopId, 110 shop_id: shopId,
119 uid: uid || 0 111 uid: uid || 0
120 }, {code: 200}).then((result) => { 112 }, {code: 200}).then((result) => {
121 - if (result.data) {  
122 - return camelCase(result.data);  
123 - } else {  
124 - return {};  
125 - } 113 + return result.data;
126 }); 114 });
127 }; 115 };
128 116
@@ -139,11 +127,7 @@ const _getShopCategory = (shopId, channel, gender) => { @@ -139,11 +127,7 @@ const _getShopCategory = (shopId, channel, gender) => {
139 gender: gender || '1,3', 127 gender: gender || '1,3',
140 shop_id: shopId 128 shop_id: shopId
141 }, {code: 200}).then(result => { 129 }, {code: 200}).then(result => {
142 - if (result && result.code === 200) {  
143 - return camelCase(result.data);  
144 - } else {  
145 - return {};  
146 - } 130 + return result.data;
147 }); 131 });
148 }; 132 };
149 133
@@ -212,11 +196,8 @@ const getShopBrands = (shopId) => { @@ -212,11 +196,8 @@ const getShopBrands = (shopId) => {
212 method: 'app.shops.getShopsBrands', 196 method: 'app.shops.getShopsBrands',
213 shop_id: shopId 197 shop_id: shopId
214 }, {code: 200}).then((result) => { 198 }, {code: 200}).then((result) => {
215 - if (result && result.code === 200) {  
216 - result = camelCase(result.data);  
217 - return result[0].brandId;  
218 - } else {  
219 - return {}; 199 + if (result[0]) {
  200 + return result[0].brand_id;
220 } 201 }
221 }); 202 });
222 }; 203 };
@@ -256,10 +237,10 @@ const _formShopData = (data, shopId, isApp) => { @@ -256,10 +237,10 @@ const _formShopData = (data, shopId, isApp) => {
256 if (data.decorator) { 237 if (data.decorator) {
257 238
258 _.forEach(data.decorator.list, floor => { 239 _.forEach(data.decorator.list, floor => {
259 - let resData = JSON.parse(floor.resourceData); 240 + let resData = JSON.parse(floor.resource_data);
260 241
261 - if (floor.resourceName) {  
262 - floor[_.camelCase(floor.resourceName)] = true; 242 + if (floor.resource_name) {
  243 + floor[_.camelCase(floor.resource_name)] = true;
263 } 244 }
264 245
265 // 店铺banner 246 // 店铺banner
@@ -382,10 +363,11 @@ const _formShopData = (data, shopId, isApp) => { @@ -382,10 +363,11 @@ const _formShopData = (data, shopId, isApp) => {
382 }; 363 };
383 364
384 formatData = _.assign({ 365 formatData = _.assign({
385 - shopIntro: data.shopInfo.shopIntro,  
386 - logoImg: data.shopInfo.shopLogo,  
387 - storeName: (data.shopInfo.isShowShopName === 'Y') ? data.shopInfo.shopName : '',  
388 - collect: data.shopInfo.isFavorite === 'Y', 366 + shopIntro: _.get(data, 'shopInfo.shop_intro', ''),
  367 + logoImg: _.get(data, 'shopInfo.shop_logo', ''),
  368 + storeName: (_.get(data, 'shopInfo.is_show_shop_name', '') === 'Y') ?
  369 + _.get(data, 'shopInfo.shop_name', '') : '',
  370 + collect: _.get(data, 'shopInfo.is_favorite', '') === 'Y',
389 url: helpers.urlFormat('', { 371 url: helpers.urlFormat('', {
390 shop_id: shopId 372 shop_id: shopId
391 }, 'search'), // 搜索链接 373 }, 'search'), // 搜索链接
@@ -434,14 +416,14 @@ const _formShopData = (data, shopId, isApp) => { @@ -434,14 +416,14 @@ const _formShopData = (data, shopId, isApp) => {
434 shop_id: shopId 416 shop_id: shopId
435 }); 417 });
436 } else { 418 } else {
437 - _.forEach(data.shopCategory, (item) => { 419 + _.forEach(data.shopCategory, item => {
438 shopCategory.list.push({ 420 shopCategory.list.push({
439 url: helpers.urlFormat('', { 421 url: helpers.urlFormat('', {
440 shop_id: shopId, 422 shop_id: shopId,
441 - sort: item.relationParameter.sort 423 + sort: item.relation_parameter.sort
442 }, 'search'), 424 }, 'search'),
443 - categoryId: item.categoryId,  
444 - name: item.categoryName 425 + categoryId: item.category_id,
  426 + name: item.category_name
445 }); 427 });
446 }); 428 });
447 } 429 }
@@ -477,8 +459,8 @@ const getBaseShopData = (params, shopInfo) => { @@ -477,8 +459,8 @@ const getBaseShopData = (params, shopInfo) => {
477 459
478 if (result[0] && _.has(result[0], 'list')) { 460 if (result[0] && _.has(result[0], 'list')) {
479 _.forEach(result[0].list, item => { 461 _.forEach(result[0].list, item => {
480 - if (item.resourceName === 'shopTopBanner_base') {  
481 - let banner = JSON.parse(item.resourceData); 462 + if (item.resource_name === 'shopTopBanner_base') {
  463 + let banner = JSON.parse(item.resource_data);
482 464
483 finalResult = _.assign(finalResult, { 465 finalResult = _.assign(finalResult, {
484 baseShopHome: { 466 baseShopHome: {
@@ -515,13 +497,10 @@ const getShopData = (req, shopId, uid, isApp) => { @@ -515,13 +497,10 @@ const getShopData = (req, shopId, uid, isApp) => {
515 let shopData = {}; 497 let shopData = {};
516 let channel = req.yoho.channel; 498 let channel = req.yoho.channel;
517 499
518 - /* 变量污染临时处理 */  
519 - // shopId = shopId.replace(/\//, '');  
520 -  
521 return _getShopInfo(shopId, uid).then(shopInfoResult => { 500 return _getShopInfo(shopId, uid).then(shopInfoResult => {
522 501
523 /* 基础店铺返回程序内的跳转信号,跳转到基础店铺 */ 502 /* 基础店铺返回程序内的跳转信号,跳转到基础店铺 */
524 - if (shopInfoResult.shopTemplateType && parseInt(shopInfoResult.shopTemplateType, 10) === 1) { 503 + if (shopInfoResult.shop_template_type && parseInt(shopInfoResult.shop_template_type, 10) === 1) {
525 return { 504 return {
526 goBrand: shopInfoResult 505 goBrand: shopInfoResult
527 }; 506 };
@@ -556,7 +535,8 @@ const getShopData = (req, shopId, uid, isApp) => { @@ -556,7 +535,8 @@ const getShopData = (req, shopId, uid, isApp) => {
556 let shopCoupons = result[2] || []; 535 let shopCoupons = result[2] || [];
557 536
558 // 店铺分类 537 // 店铺分类
559 - return _getShopCategory(shopId, channel).then((shopCategory) => { 538 + return _getShopCategory(shopId, channel).then(shopCategory => {
  539 +
560 shopData = _.assign({ 540 shopData = _.assign({
561 shopCategory: shopCategory 541 shopCategory: shopCategory
562 }, shopData); 542 }, shopData);
@@ -597,31 +577,27 @@ const getShopFav = (req, shopId, uid) => { @@ -597,31 +577,27 @@ const getShopFav = (req, shopId, uid) => {
597 * @return array banner数据 577 * @return array banner数据
598 */ 578 */
599 const getBrandIntro = (brandId, uid) => { 579 const getBrandIntro = (brandId, uid) => {
600 - let param = {};  
601 -  
602 - param = {  
603 - uid: uid, 580 + let param = {
  581 + uid: uid
604 }; 582 };
605 583
606 return api.get('', _.assign({ 584 return api.get('', _.assign({
607 method: 'app.brand.getBrandIntro', 585 method: 'app.brand.getBrandIntro',
608 brand_id: brandId 586 brand_id: brandId
609 }, param), { 587 }, param), {
  588 + code: 200,
610 cache: true 589 cache: true
611 - }).then((result) => {  
612 - if (result && result.code === 200) {  
613 - let list = camelCase(result.data) || {}; 590 + }).then(result => {
  591 +
  592 + let list = result.data;
  593 +
  594 + return {
  595 + id: list.brand_id,
  596 + intro: list.brand_intro,
  597 + collected: list.is_favorite && list.is_favorite === 'Y',
  598 + title: list.brand_name ? list.brand_name : ''
  599 + };
614 600
615 - return {  
616 - id: list.brandId,  
617 - intro: list.brandIntro,  
618 - collected: (list.isFavorite && list.isFavorite === 'Y') ? true : false,  
619 - title: list.brandName ? list.brandName : ''  
620 - };  
621 - } else {  
622 - logger.error('get brand introduction api return code is not 200');  
623 - return {};  
624 - }  
625 }); 601 });
626 }; 602 };
627 603
@@ -660,26 +636,22 @@ const getBrandLogoByDomain = (domain) => { @@ -660,26 +636,22 @@ const getBrandLogoByDomain = (domain) => {
660 method: 'web.brand.byDomain', 636 method: 'web.brand.byDomain',
661 domain: domain 637 domain: domain
662 }, { 638 }, {
  639 + code: 200,
663 cache: true 640 cache: true
664 - }).then((result) => {  
665 - if (result && result.code === 200) {  
666 - if (result.data) {  
667 - let formatData = camelCase(result.data);  
668 -  
669 - return {  
670 - id: formatData.id,  
671 - url: helpers.urlFormat('', null, formatData.brandDomain),  
672 - thumb: helpers.image(formatData.brandIco, 75, 40),  
673 - name: formatData.brandName,  
674 - shopId: formatData.shopId ? formatData.shopId : 0, // 店铺id  
675 - type: formatData.type ? formatData.type : 0  
676 - };  
677 - } else {  
678 - return false;  
679 - } 641 + }).then(result => {
  642 + if (result.data) {
  643 + let formatData = result.data;
  644 +
  645 + return {
  646 + id: formatData.id,
  647 + url: helpers.urlFormat('', null, formatData.brand_domain),
  648 + thumb: helpers.image(formatData.brand_ico, 75, 40),
  649 + name: formatData.brand_name,
  650 + shopId: formatData.shop_id ? formatData.shop_id : 0, // 店铺id
  651 + type: formatData.type ? formatData.type : 0
  652 + };
680 } else { 653 } else {
681 - logger.error('get brand logo by domain api return code is not 200');  
682 - return {}; 654 + return false;
683 } 655 }
684 }); 656 });
685 }; 657 };
@@ -694,13 +666,13 @@ const getBrandShops = (brandId) => { @@ -694,13 +666,13 @@ const getBrandShops = (brandId) => {
694 method: 'app.shop.queryShopsByBrandId', 666 method: 'app.shop.queryShopsByBrandId',
695 brand_id: brandId 667 brand_id: brandId
696 }, { 668 }, {
  669 + code: 200,
697 cache: true 670 cache: true
698 - }).then((result) => {  
699 - if (result && result.code === 200) { 671 + }).then(result => {
  672 + if (_.isArray(result.data)) {
700 return _processBrandShops(result.data); 673 return _processBrandShops(result.data);
701 } else { 674 } else {
702 - logger.error('get shop list by brandId api return code is not 200');  
703 - return {}; 675 + return [];
704 } 676 }
705 }); 677 });
706 }; 678 };
@@ -748,13 +720,8 @@ const getShopIntro = (shopId) => { @@ -748,13 +720,8 @@ const getShopIntro = (shopId) => {
748 return api.get('', { 720 return api.get('', {
749 method: 'app.shops.getIntro', 721 method: 'app.shops.getIntro',
750 shop_id: shopId 722 shop_id: shopId
751 - }).then((result) => {  
752 - if (result && result.code === 200) {  
753 - return camelCase(result.data);  
754 - } else {  
755 - logger.error('get shop intro api return code is not 200');  
756 - return {};  
757 - } 723 + }, {code: 200, cache: true}).then(result => {
  724 + return result.data;
758 }); 725 });
759 }; 726 };
760 727
@@ -779,7 +746,7 @@ const getShopCategory = (params) => { @@ -779,7 +746,7 @@ const getShopCategory = (params) => {
779 _.forEach(value.sub, (subValue, subKey) => { 746 _.forEach(value.sub, (subValue, subKey) => {
780 value.sub[subKey].url = helpers.urlFormat('/product/search/list', { 747 value.sub[subKey].url = helpers.urlFormat('/product/search/list', {
781 shop_id: params.shopId, 748 shop_id: params.shopId,
782 - sort: _.get(value, 'relationParameter.sort', ''), 749 + sort: _.get(value, 'relation_parameter.sort', ''),
783 title: subValue.categoryName, 750 title: subValue.categoryName,
784 query: subValue.categoryName 751 query: subValue.categoryName
785 }); 752 });
@@ -26,8 +26,8 @@ const _processBrandNames = (list) => { @@ -26,8 +26,8 @@ const _processBrandNames = (list) => {
26 _.forEach(list, (item) => { 26 _.forEach(list, (item) => {
27 _.forEach(item, (obj) => { 27 _.forEach(item, (obj) => {
28 formatData.push({ 28 formatData.push({
29 - brandDomain: obj.brandDomain,  
30 - brandName: obj.brandName 29 + brandDomain: obj.brandDomain.toLowerCase(),
  30 + brandName: obj.brandName.toLowerCase()
31 }); 31 });
32 }); 32 });
33 }); 33 });
@@ -179,8 +179,8 @@ @@ -179,8 +179,8 @@
179 <a href="javascript:;" class="sold-out limit">即将发售</a> 179 <a href="javascript:;" class="sold-out limit">即将发售</a>
180 {{/if}} 180 {{/if}}
181 181
182 - {{#if canBuyLimit}}  
183 - <a href="javascript:;" id="addtoCart" class="addto-cart">立即购买</a> 182 + {{#if canNotBuy}}
  183 + <a href="javascript:;" class="addto-cart can-not-buy">立即购买</a>
184 {{/if}} 184 {{/if}}
185 185
186 {{#if noLimitCode}} 186 {{#if noLimitCode}}
1 <div class="shop-introduce-page"> 1 <div class="shop-introduce-page">
2 <a class="banner"> 2 <a class="banner">
3 - <img src="{{image shopLogo 640 480}}"> 3 + <img src="{{image shop_logo 640 480}}">
4 </a> 4 </a>
5 5
6 <div class="descripition"> 6 <div class="descripition">
7 - {{shopIntro}} 7 + {{shop_intro}}
8 </div> 8 </div>
9 9
10 <p class="sign-icon"> 10 <p class="sign-icon">
@@ -16,15 +16,15 @@ module.exports = { @@ -16,15 +16,15 @@ module.exports = {
16 siteUrl: '//m.yohobuy.com', 16 siteUrl: '//m.yohobuy.com',
17 assetUrl: '//localhost:5001', 17 assetUrl: '//localhost:5001',
18 domains: { 18 domains: {
19 - api: 'http://api.yoho.cn/',  
20 - service: 'http://service.yoho.cn/',  
21 - liveApi: 'http://api.live.yoho.cn/',  
22 - singleApi: 'http://single.yoho.cn/' 19 + // api: 'http://api.yoho.cn/',
  20 + // service: 'http://service.yoho.cn/',
  21 + // liveApi: 'http://api.live.yoho.cn/',
  22 + // singleApi: 'http://single.yoho.cn/',
23 23
24 - // api: 'http://api-test1.yohops.com:9999/',  
25 - // service: 'http://service-test1.yohops.com:9999/',  
26 - // liveApi: 'http://testapi.live.yohops.com:9999/',  
27 - // singleApi: 'http://api-test1.yohops.com:9999/' 24 + api: 'http://api-test1.yohops.com:9999/',
  25 + service: 'http://service-test1.yohops.com:9999/',
  26 + liveApi: 'http://testapi.live.yohops.com:9999/',
  27 + singleApi: 'http://api-test1.yohops.com:9999/',
28 }, 28 },
29 subDomains: { 29 subDomains: {
30 host: '.m.yohobuy.com', 30 host: '.m.yohobuy.com',
@@ -125,15 +125,16 @@ module.exports = function(specificGender) { @@ -125,15 +125,16 @@ module.exports = function(specificGender) {
125 page: page + 1 125 page: page + 1
126 }, 126 },
127 success: function(data) { 127 success: function(data) {
128 - // console.log(data) 128 +
129 var PRDID = []; 129 var PRDID = [];
130 - if (data === ' ') {  
131 - console.log(data); 130 + if (data === ' ' || data === '') {
132 searching = false; 131 searching = false;
133 loading.hideLoadingMask(); 132 loading.hideLoadingMask();
134 133
135 // 有货币页面不加载底部 134 // 有货币页面不加载底部
136 if (gender && !specificGender) { 135 if (gender && !specificGender) {
  136 + gender = gender.substr(0, 3);
  137 +
137 if (gender === '1,3') { 138 if (gender === '1,3') {
138 url = '/boys/bottomBanner'; 139 url = '/boys/bottomBanner';
139 } else { 140 } else {
  1 +/**
  2 + * Created by yoho on 2016/10/9.
  3 + */
  4 +require('../common');
1 -/*  
2 - * @Description: dialog  
3 - */  
4 -  
5 -var $ = require('yoho-jquery'),  
6 - Handlebars = require('yoho-handlebars'),  
7 - Hammer = require('yoho-hammer');  
8 -  
9 -var $dialogWrapper,  
10 - dialogTpl,  
11 - dialogTemplate;  
12 -  
13 -function getInstance() {  
14 - if (dialogTpl === undefined) {  
15 - dialogTpl = '<div id="dialog-wrapper" class="dialog-wrapper">' +  
16 - '<div class="dialog-box">' +  
17 - '{{# hasHeader}}' +  
18 - '{{/ hasHeader}}' +  
19 - '<div class="dialog-content">{{dialogText}}</div>' +  
20 - '{{# hasFooter}}' +  
21 - '<div class="dialog-footer">' +  
22 - '{{# leftBtnText}}' +  
23 - '<span class="dialog-left-btn tap-hightlight">{{.}}</span>' +  
24 - '{{/ leftBtnText}}' +  
25 - '{{# rightBtnText}}' +  
26 - '<span class="dialog-right-btn tap-hightlight">{{.}}</span>' +  
27 - '{{/ rightBtnText}}' +  
28 - '</div>' +  
29 - '{{/ hasFooter}}' +  
30 - '</div>' +  
31 - '</div>';  
32 -  
33 - dialogTemplate = Handlebars.compile(dialogTpl);  
34 - }  
35 - return dialogTemplate;  
36 -}  
37 -  
38 -// fullWithBtn是供详情页获取限购码使用的特殊参数  
39 -exports.showDialog = function(data, callback, callbackForLeft, fullWithBtn) {  
40 -  
41 - var dialogStr = dialogTemplate(data),  
42 - $dialogBox,  
43 - defaultHideDuraton,  
44 - dialogWrapperHammer;  
45 -  
46 - dialogTemplate = getInstance();  
47 -  
48 - $('.dialog-wrapper').remove();  
49 -  
50 - $('body').append($(dialogStr));  
51 -  
52 - $dialogBox = $('.dialog-box');  
53 - $dialogWrapper = $('.dialog-wrapper');  
54 -  
55 -  
56 - dialogWrapperHammer = new Hammer(document.getElementById('dialog-wrapper'));  
57 -  
58 - // 显示  
59 - if (data.fast) {  
60 - $dialogWrapper.css({  
61 - display: 'block'  
62 - });  
63 - } else {  
64 - $dialogWrapper.fadeIn();  
65 - }  
66 -  
67 - if (fullWithBtn) {  
68 - $('.dialog-wrapper .dialog-footer > span').css('width', '100%');  
69 - $('.dialog-wrapper .dialog-content').css({  
70 - 'padding-left': '1.85rem',  
71 - 'padding-right': '1.85rem'  
72 - });  
73 - $dialogWrapper.css('z-index', '10');  
74 - }  
75 -  
76 - $dialogBox.css({  
77 - top: '50%',  
78 - marginTop: -($dialogBox.height() / 2)  
79 - });  
80 -  
81 - // 隐藏  
82 - if (data.autoHide) {  
83 - defaultHideDuraton = 1000;  
84 - if (data.autoHide > 1) {  
85 - defaultHideDuraton = data.autoHide;  
86 - }  
87 - setTimeout(function() {  
88 - $dialogWrapper.fadeOut();  
89 - }, defaultHideDuraton);  
90 - }  
91 -  
92 - // 禁止在dialog上可以上下滚动  
93 - $dialogWrapper.on('touchmove', function() {  
94 - return false;  
95 - });  
96 -  
97 - dialogWrapperHammer.on('tap', function(event) {  
98 -  
99 - if ($(event.target).hasClass('dialog-left-btn')) {  
100 - if (typeof callbackForLeft === 'function') {  
101 - callbackForLeft();  
102 - }  
103 - $dialogWrapper.fadeOut();  
104 - } else if ($(event.target).hasClass('dialog-right-btn')) {  
105 - callback();  
106 - }  
107 -  
108 - // 防止出现点透问题  
109 - event.preventDefault();  
110 - event.srcEvent.stopPropagation();  
111 - });  
112 -};  
113 -  
114 -exports.hideDialog = function() {  
115 - $('.dialog-wrapper').remove();  
116 -};  
@@ -8,7 +8,7 @@ var $ = require('yoho-jquery'), @@ -8,7 +8,7 @@ var $ = require('yoho-jquery'),
8 security = require('../../plugin/security'), 8 security = require('../../plugin/security'),
9 tip = require('../../plugin/tip'), 9 tip = require('../../plugin/tip'),
10 Hammer = require('yoho-hammer'), 10 Hammer = require('yoho-hammer'),
11 - dialog = require('../search/dialog'); 11 + dialog = require('../../plugin/dialog');
12 12
13 var $input = $('#search-input input'); 13 var $input = $('#search-input input');
14 14
@@ -89,7 +89,7 @@ ellipsis.init(); @@ -89,7 +89,7 @@ ellipsis.init();
89 tip.show('网络断开连接了~'); 89 tip.show('网络断开连接了~');
90 } 90 }
91 }); 91 });
92 - } else { 92 + } else if ($('.shopId').val().length > 0){
93 $.ajax({ 93 $.ajax({
94 url: '/product/index/baseShopFav', 94 url: '/product/index/baseShopFav',
95 data: { 95 data: {
@@ -768,6 +768,10 @@ $basicBtnC: #eb0313; @@ -768,6 +768,10 @@ $basicBtnC: #eb0313;
768 line-height: 80px; 768 line-height: 80px;
769 } 769 }
770 770
  771 + .can-not-buy {
  772 + background-color: #ccc;
  773 + }
  774 +
771 .sold-out { 775 .sold-out {
772 background-color: #ccc; 776 background-color: #ccc;
773 } 777 }