Authored by 陈轩

vip-day goods

/* eslint no-unused-vars: ["error", { "args": "none" }]*/
/* eslint-disable no-shadow, camelcase */
'use strict';
const url = require('url');
const _ = require('lodash');
const camelCase = global.yoho.camelCase;
const helpers = global.yoho.helpers;
const vipDayModel = require('../models/vipDay');
const auth = require('../../passport/models/auth-helper');
const co = require('bluebird').coroutine;
const util = require(global.utils + '/product-process');
... ... @@ -38,49 +40,28 @@ exports.index = (req, res, next) => {
res.locals.page = 'vipday_entry';
res.locals.width750 = true;
let cate = {
goods1: [51203592, 51228151, 51315660],
goods2: [51338322, 51299644, 51344316],
goods3: [51374524, 51333192, 51311138]
};
res.render('vip_day/index', {
pageStyle: 'vip-day entry',
goods1: [{
skn: 51281322,
link: 'http://item.yohobuy.com/product/pro_479436_600840/MADNESSNAPOXFORDSHIRTOSD006_NV.html?from=search-s-51281322_1_1&openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"51281322"}}',
label: '余文乐同款MADNESS NAPOXFORD'
}, {
skn: 51228151,
link: 'http://item.yohobuy.com/product/pro_416307_697688/SMGOBLIQUEZIPPERJACKETJ1609Hei.html?from=search-s-51228151_1_1&openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"51228151"}}',
label: '林俊杰同款SMG Oblique Zipper Jacket 斜拉链丹宁夹克'
}, {
skn: 51315660,
link: 'http://item.yohobuy.com/product/pro_513734_640162/AKOPChangXiuTXuAKOPA603LT03.html?from=search-s-51315660_1_1&openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"51315660"}}',
label: '韩火火同款AKOP. 插肩长袖T恤',
}],
goods2: [{
skn: 51338322,
link: 'http://item.yohobuy.com/product/pro_536266_665692/IZZUEIZXJKJ7501F67WOMENJACKETS.html?from=sale-s-7_1_12&openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"51338322"}}',
label: 'izzue 磨毛短款牛仔夹克'
}, {
skn: 51299644,
link: 'http://item.yohobuy.com/product/pro_497636_622252/ONITSUKATIGERMEXICO66XiuXianYunDongXieDL4081659.html?from=sale-s-7_1_29&openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"51299644"}}',
label: 'Onitsuka Tiger MEXICO 66 女 休闲运动鞋'
}, {
skn: 51344316,
link: 'http://item.yohobuy.com/product/pro_530006_658340/LEVIQuanS519LINE8WuDaiKuanNiuZaiKu187200012HeiSe.html?from=sale-s-7_1_8&openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"51344316"}}',
label: 'Levi’s Line8系列 519 女士窄脚修身牛仔裤'
}],
goods3: [{
skn: 51374524,
link: 'http://item.yohobuy.com/product/pro_570070_704384/STAYREALShuGeZiLianMaoChenShanUS16010K1.html?from=sale-s-7_1_3&openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"51374524"}}',
label: 'STAYREAL 数格子连帽衬衫',
}, {
skn: 51333192,
link: 'http://item.yohobuy.com/product/pro_531262_660006/PHANTACIChenShanPH16PS28G.html?from=search-s-51333192_1_1&openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"51333192"}}',
label: 'PHANTACi FANTASY LONG SHIRT-Green'
}, {
skn: 51311138,
link: 'http://item.yohobuy.com/product/pro_509230_635258/OVKLABBangQiuMaoOVKA6FWBP88BKX.html?from=sale-s-7_1_1&openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"51311138"}}',
label: 'OVKLAB 图案字母刺绣棒球帽'
}]
});
vipDayModel.getGoods(cate)
.then(result => {
// console.log(result.data)
if (result.code !== 200) {
return Promise.reject('error');
}
res.render('vip_day/index', {
title: '会员日活动',
pageStyle: 'vip-day entry',
goods1: result.data.goods1,
goods2: result.data.goods2,
goods3: result.data.goods3
});
return;
}).catch(next);
};
exports.crazyWheel = (req, res, next) => {
... ... @@ -94,6 +75,7 @@ exports.crazyWheel = (req, res, next) => {
vipDayModel.getJoinNum(1).then(result => {
res.render('vip_day/crazy_wheel', {
title: '会员日-疯狂大转盘',
pageStyle: 'vip-day game',
isWheel: true,
joinNum: result && result.data || 0,
... ... @@ -113,6 +95,7 @@ exports.crazyLuck = (req, res, next) => {
let joinNum = yield vipDayModel.getJoinNum(2);
res.render('vip_day/crazy_luck', {
title: '拼手气',
pageStyle: 'vip-day game',
isLuck: true,
coin: coins && coins.data && (coins.data.total > 9999 ? (coins.data.total / 10000).toFixed(2) + '万' : coins.data.total),
... ... @@ -202,7 +185,7 @@ exports.luckResult = (req, res, next) => {
let coin = r1.data.total;
console.log(coin);
// console.log(coin);
if (coin < 20) {
return { code: 400, message: '有货币不够...' };
}
... ...
/* eslint-disable camelcase */
'use strict';
const _ = require('lodash');
const API = global.yoho.API;
const serviceAPI = global.yoho.ServiceAPI;
const utils = require(global.utils + '/product-process');
const helpers = global.yoho.helpers;
// 签到
// doc: http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/%E4%BC%9A%E5%91%98%E6%97%A5%E6%B4%BB%E5%8A%A8/%E4%BC%9A%E5%91%98%E6%97%A5%E7%AD%BE%E5%88%B0.md
... ... @@ -61,12 +64,69 @@ exports.getCoins = uid => {
});
};
//获取抽奖人数
//doc: http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/%E4%BC%9A%E5%91%98%E6%97%A5%E6%B4%BB%E5%8A%A8/%E6%9F%A5%E8%AF%A2%E5%8F%82%E4%B8%8E%E6%8A%BD%E5%A5%96%E4%BA%BA%E6%95%B0.md
// 获取抽奖人数
// doc: http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/%E4%BC%9A%E5%91%98%E6%97%A5%E6%B4%BB%E5%8A%A8/%E6%9F%A5%E8%AF%A2%E5%8F%82%E4%B8%8E%E6%8A%BD%E5%A5%96%E4%BA%BA%E6%95%B0.md
exports.getJoinNum = prize_type => {
const url = '/activity/UserdayPrizeLogController/queryPrizeLogNum';
return serviceAPI.get(url, {
prize_type,
});
}
\ No newline at end of file
};
/**
* cate [object Object]
*/
exports.getGoods = cate => {
let skns = '';
let cates = Object.keys(cate);
_.forEach(cate, function(val, key) {
skns = skns.concat(',').concat(val.join(','));
});
skns = skns.slice(1);
return API.get('', {
method: 'h5.product.batch',
productSkn: skns
}).then(result => {
if (result.code !== 200) {
return {
code: result.code,
message: result.message
};
}
let productList = utils.processProductList(result.data.product_list);
let data = {};
productList.forEach(product=> {
let skn = product.productSkn;
product.url = helpers.appUrlFormat(product.url, 'go.productDetail', {
product_skn: skn
});
for (let c of cates) {
let index = cate[c].indexOf(skn);
if (index !== -1) {
cate[c].splice(index, 1);
data[c] || (data[c] = []);
data[c].push(product);
break;
}
}
});
// console.log(data.goods1.length)
// console.log(data.goods2.length)
// console.log(data.goods3.length)
return {
code: 200,
data
};
});
};
... ...
... ... @@ -43,6 +43,7 @@
<i class="title-pic"></i>
</header>
<div class="content text-center" data-toggle="ymodal" data-target="#vip-privilege">
<i class="vip-rocket-point"></i>
</div>
</section>
... ... @@ -57,75 +58,21 @@
<h5 class="vip-goods-sec-label">潮牌尖货</h5>
<ul class="vip-goods-list clearfix">
{{#each goods1}}
<li class="vip-good">
<img class="vip-good-show" src="" alt="">
<div class="vip-good-price">
{{!--
<div class="text-right">
<sup>¥</sup><span>539</span>
</div>
<div class="text-left">
<span class="disable-price">¥539</span>
</div>
--}}
<sup>¥</sup><span>539</span><span class="disable-price">¥539</span>
</div>
<div class="vip-good-bottom">
<h6 class="vip-good-name">The Hundreds</h6>
<button class="vip-good-fav" type="button">马上购买</button>
</div>
<a class="vip-good-link" href="{{link}}"></a>
</li>
{{> vip_day/vip-good}}
{{/each}}
</ul>
<!-- good class 2-->
<h5 class="vip-goods-sec-label">新品示出</h5>
<ul class="vip-goods-list clearfix">
{{#each goods2}}
<li class="vip-good">
<img class="vip-good-show" src="" alt="">
<div class="vip-good-price">
{{!--
<div class="text-right">
<sup>¥</sup><span>539</span>
</div>
<div class="text-left">
<span class="disable-price">¥539</span>
</div>
--}}
<sup>¥</sup><span>539</span><span class="disable-price">¥539</span>
</div>
<div class="vip-good-bottom">
<h6 class="vip-good-name">The Hundreds</h6>
<button class="vip-good-fav" type="button">马上购买</button>
</div>
<a class="vip-good-link" href="{{link}}"></a>
</li>
{{> vip_day/vip-good}}
{{/each}}
</ul>
<!-- good class 3-->
<h5 class="vip-goods-sec-label">VIP独享</h5>
<ul class="vip-goods-list clearfix">
{{#each goods3}}
<li class="vip-good">
<img class="vip-good-show" src="" alt="">
<div class="vip-good-price">
{{!--
<div class="text-right">
<sup>¥</sup><span>539</span>
</div>
<div class="text-left">
<span class="disable-price">¥539</span>
</div>
--}}
<sup>¥</sup><span>539</span><span class="disable-price">¥539</span>
</div>
<div class="vip-good-bottom">
<h6 class="vip-good-name">The Hundreds</h6>
<button class="vip-good-fav" type="button">马上购买</button>
</div>
<a class="vip-good-link" href="{{link}}"></a>
</li>
{{> vip_day/vip-good}}
{{/each}}
</ul>
<div class="text-center">
... ...
<li class="vip-good">
<img class="vip-good-show" src="{{image defaultImages 220 115}}" alt="">
<div class="vip-good-price">
{{!--
<div class="text-right">
<sup>¥</sup><span>539</span>
</div>
<div class="text-left">
<span class="disable-price">¥539</span>
</div>
--}}
{{#if marketPrice}}
<sup>¥</sup><span>{{salesPrice}}</span><span class="disable-price">¥{{marketPrice}}</span>
{{else}}
<sup>¥</sup><span>{{salesPrice}}</span>
{{/if}}
</div>
<div class="vip-good-bottom">
<h6 class="vip-good-name line-clamp-2">{{productName}}</h6>
<button class="vip-good-fav" type="button">马上购买</button>
</div>
<a class="vip-good-link" href="{{url}}"></a>
</li>
\ No newline at end of file
... ...
... ... @@ -163,16 +163,14 @@
}
.vip-rocket-privilege {
margin-bottom: 20px;
background-color: #000;
color: #fff;
}
.vip-rocket-buynow {
margin-bottom: 40px;
border: 2PX solid #000;
background-color: #fff;
.vip-rocket-point {
position: absolute;
left: 50%;
bottom: -50px;
margin-left: -38px;
width: 76px;
height: 107px;
background: no-repeat center center url('/activity/vip_day/point.png');
}
/* 福利 会员日专享商品 */
... ... @@ -295,6 +293,7 @@
.vip-good-name {
font-size: 20px;
color: #fff;
height: 53px;
}
.vip-good-fav {
... ... @@ -363,6 +362,7 @@
strong {
font-size: 27px;
color: #e95d3f;
}
}
}
... ...
... ... @@ -36,6 +36,14 @@
text-overflow: ellipsis;
}
.line-clamp-2 {
display: -webkit-box;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical
}
.vh-center {
text-align: center;
... ...