Authored by 郭成尧

shop-union

@@ -226,90 +226,99 @@ const shop = { @@ -226,90 +226,99 @@ const shop = {
226 } 226 }
227 227
228 /* 基础店铺返回程序内的跳转信号,跳转到基础店铺 */ 228 /* 基础店铺返回程序内的跳转信号,跳转到基础店铺 */
229 - if (shopInfoResult && shopInfoResult.shop_template_type &&  
230 - parseInt(shopInfoResult.shop_template_type, 10) === 1) {  
231 - return Promise.all([  
232 - listModel.getBaseShopData(req.query, shopInfo),  
233 - searchModel.getSearchData(searchParam)  
234 - ]).then(fResult => {  
235 - let baseShop = fResult[0];  
236 - let newGoods = fResult[1];  
237 -  
238 - baseShop.newGoods = newGoods.list;  
239 - if (baseShop && baseShop.baseShopHome && baseShop.baseShopHome.banner) {  
240 - if (baseShop.baseShopHome.banner.indexOf('?') < 0) {  
241 - baseShop.baseShopHome.banner += '?imageMogr2/auto-orient/strip/thumbnail/x150/crop/640x150'; 229 + if (shopInfoResult && shopInfoResult.shop_template_type) {
  230 +
  231 + if (parseInt(shopInfoResult.shop_template_type, 10) === 1) {
  232 + return Promise.all([
  233 + listModel.getBaseShopData(req.query, shopInfo),
  234 + searchModel.getSearchData(searchParam)
  235 + ]).then(fResult => {
  236 + let baseShop = fResult[0];
  237 + let newGoods = fResult[1];
  238 +
  239 + baseShop.newGoods = newGoods.list;
  240 + if (baseShop && baseShop.baseShopHome && baseShop.baseShopHome.banner) {
  241 + if (baseShop.baseShopHome.banner.indexOf('?') < 0) {
  242 + baseShop.baseShopHome.banner +=
  243 + '?imageMogr2/auto-orient/strip/thumbnail/x150/crop/640x150';
  244 + }
242 } 245 }
243 - }  
244 246
245 - let appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.shop","params":{"shop_template_type":"1","shop_id":"' +  
246 - shopId + '","shop_name":"' + baseShop.shopName + '"}}'; 247 + let appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.shop","params":{"shop_template_type":"1","shop_id":"' +
  248 + shopId + '","shop_name":"' + baseShop.shopName + '"}}';
247 249
248 - if (shopInfoResult.is_red_shop === 1) {  
249 - appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.shop","params":{"shop_template_type":"1","is_red_shop":"1","shop_id":"' +  
250 - shopId + '","shop_name":"' + baseShop.shopName + '"}}';  
251 - } 250 + if (shopInfoResult.is_red_shop === 1) {
  251 + appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.shop","params":{"shop_template_type":"1","is_red_shop":"1","shop_id":"' +
  252 + shopId + '","shop_name":"' + baseShop.shopName + '"}}';
  253 + }
252 254
253 - res.render('newshop/shop-base', {  
254 - module: 'product',  
255 - page: 'shop.base',  
256 - pageHeader: headerModel.setNav({  
257 - navTitle: shopInfo.shop_name  
258 - }),  
259 - goodList: baseShop,  
260 - showDownloadApp: true,  
261 - pageFooter: true,  
262 - title: shopInfo.shop_name + '|' + shopInfo.shop_name + '潮流服装服饰-Yoho!Buy有货',  
263 - keywords: shopInfo.shop_name + ',' + shopInfo.shop_name + '服装服饰,' +  
264 - shopInfo.shop_name + '潮流服装服饰',  
265 - description: shopInfo.shop_name + '|Yoho!Buy有货' + shopInfo.shop_name +  
266 - '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。',  
267 - shopId: shopId,  
268 - shopPage: true,  
269 - _noLazy: true,  
270 - appPath: appPath,  
271 - localCss: true  
272 - });  
273 - });  
274 - } else {  
275 - // 经典装修店铺  
276 - return Promise.all([  
277 - listModel.getShopDecorator(shopId).then(),  
278 - listModel.getShopCategoryApi(shopId, channel)  
279 - ]).then(fResult => {  
280 -  
281 - let shopDeco = fResult[0];  
282 - let shopCategory = fResult[1];  
283 -  
284 - let shopData = {  
285 - decorator: shopDeco, // 店铺装修资源数据  
286 - shopInfo: shopInfo, // 店铺信息  
287 - shopCategory: shopCategory  
288 - };  
289 -  
290 - let result = listModel.formShopData(shopData, shopId, isApp);  
291 -  
292 - result = _.assign(result, pageHeader,  
293 - {shopId: shopId, coverChannel: channel, seoResult: seoResult});  
294 -  
295 - res.render('newshop/shop-classics', {  
296 - module: 'product',  
297 - page: 'shop.classics',  
298 - shopIndex: result,  
299 - shopHeadHide: true,  
300 - gender: req.query.gender,  
301 - channel: req.query.channel,  
302 - title: result.seoTitle + '|' + result.seoTitle + '潮流服装服饰-Yoho!Buy有货',  
303 - keywords: result.seoTitle + ',' + result.seoTitle + '服装服饰,' + result.seoTitle + '潮流服装服饰',  
304 - description: result.seoTitle + '|Yoho!Buy有货' + result.seoTitle + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。',  
305 - shopId: shopId,  
306 - shopPage: true,  
307 - appPath: 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.shop","params":{"shop_template_type":"2","shop_id":"' +  
308 - shopId + '","shop_name":"' + result.seoTitle + '"}}',  
309 - localCss: true 255 + res.render('newshop/shop-base', {
  256 + module: 'product',
  257 + page: 'shop.base',
  258 + pageHeader: headerModel.setNav({
  259 + navTitle: shopInfo.shop_name
  260 + }),
  261 + goodList: baseShop,
  262 + showDownloadApp: true,
  263 + pageFooter: true,
  264 + title: shopInfo.shop_name + '|' + shopInfo.shop_name + '潮流服装服饰-Yoho!Buy有货',
  265 + keywords: shopInfo.shop_name + ',' + shopInfo.shop_name + '服装服饰,' +
  266 + shopInfo.shop_name + '潮流服装服饰',
  267 + description: shopInfo.shop_name + '|Yoho!Buy有货' + shopInfo.shop_name +
  268 + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。',
  269 + shopId: shopId,
  270 + shopPage: true,
  271 + _noLazy: true,
  272 + appPath: appPath,
  273 + localCss: true
  274 + });
310 }); 275 });
311 276
312 - }); 277 + } else if (parseInt(shopInfoResult.shop_template_type, 10) === 2) {
  278 + // 经典装修店铺
  279 + return Promise.all([
  280 + listModel.getShopDecorator(shopId).then(),
  281 + listModel.getShopCategoryApi(shopId, channel)
  282 + ]).then(fResult => {
  283 +
  284 + let shopDeco = fResult[0];
  285 + let shopCategory = fResult[1];
  286 +
  287 + let shopData = {
  288 + decorator: shopDeco, // 店铺装修资源数据
  289 + shopInfo: shopInfo, // 店铺信息
  290 + shopCategory: shopCategory
  291 + };
  292 +
  293 + let result = listModel.formShopData(shopData, shopId, isApp);
  294 +
  295 + result = _.assign(result, pageHeader,
  296 + {shopId: shopId, coverChannel: channel, seoResult: seoResult});
  297 +
  298 + res.render('newshop/shop-classics', {
  299 + module: 'product',
  300 + page: 'shop.classics',
  301 + shopIndex: result,
  302 + shopHeadHide: true,
  303 + gender: req.query.gender,
  304 + channel: req.query.channel,
  305 + title: result.seoTitle + '|' + result.seoTitle + '潮流服装服饰-Yoho!Buy有货',
  306 + keywords: result.seoTitle + ',' + result.seoTitle + '服装服饰,' + result.seoTitle + '潮流服装服饰',
  307 + description: result.seoTitle + '|Yoho!Buy有货' + result.seoTitle +
  308 + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。',
  309 + shopId: shopId,
  310 + shopPage: true,
  311 + appPath: 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.shop","params":{"shop_template_type":"2","shop_id":"' +
  312 + shopId + '","shop_name":"' + result.seoTitle + '"}}',
  313 + localCss: true
  314 + });
  315 +
  316 + });
  317 + } else {
  318 + shop.redShop(req, res, next);
  319 + }
  320 + } else {
  321 + shop.redShop(req, res, next);
313 } 322 }
314 }).catch(next); 323 }).catch(next);
315 }, 324 },