Authored by 郭成尧

Merge branch 'feature/vip2' into 'release/6.6'

Feature/vip2



See merge request !1359
... ... @@ -614,7 +614,7 @@ module.exports = class extends global.yoho.BaseModel {
dest = this._procShowStatus(dest, showStatus, isBeginSale);
dest.cartInfo.limitProductCode = origin.limitProductCode;
dest.cartInfo.limitCodeUrl = this._getLimitCodeUrl(origin.limitProductCode, origin.product_skn, ua); // eslint-disable-line
dest.cartInfo.limitCodeUrl = this._getLimitCodeUrl(origin.limitProductCode, origin.product_skn, ua); // eslint-disable-line
dest.cartInfo.limitProductPay = helpers.urlFormat('/cart/index/orderEnsure');
return resolve(dest);
} else {
... ... @@ -775,6 +775,11 @@ module.exports = class extends global.yoho.BaseModel {
};
}
finalResult.promYohoCoinText =
productProcess.procPromYohoCoin(_.get(result,
'vip_return_coin.max_return_coin_info', []),
params.current_vip_level);
// 2017电子门票不显示区域
// let ticketsProps = finalResult.cartInfo.props;
... ...
... ... @@ -78,6 +78,8 @@ module.exports = class extends global.yoho.BaseModel {
});
finalResult.recommendKeywords = recomdKeywords;
finalResult.vip_return_coin_info =
detailProcess.processPromYohoCoin(_.get(result, 'data.vip_return_coin.vip_return_coin_info', []));
return finalResult;
});
... ... @@ -114,7 +116,6 @@ module.exports = class extends global.yoho.BaseModel {
}
return Promise.all(apiArray).then(info => {
// console.log(info);
let finalResult = {
promotion: null,
enterStore: null,
... ... @@ -168,14 +169,12 @@ module.exports = class extends global.yoho.BaseModel {
return this.get({
data: params,
param: cacheConf
})
.then(result => {
// console.log(result);
if (result && result.code === 200) {
return detailProcess.processShopsInfo(result.data);
}
return [];
}, () => []);
}).then(result => {
if (result && result.code === 200) {
return detailProcess.processShopsInfo(result.data);
}
return [];
}, () => []);
}
/**
... ... @@ -194,14 +193,12 @@ module.exports = class extends global.yoho.BaseModel {
return this.get({
data: params,
param: cacheConf
})
.then(result => {
// console.log(result);
if (result && result.code === 200) {
return result.data;
}
}).then(result => {
if (result && result.code === 200) {
return result.data;
}
return {};
});
return {};
});
}
};
... ...
... ... @@ -74,6 +74,9 @@
<div id="placeholder-promotion" style="height:100px;background-color:#fff;">
</div>
{{!--占位: 有货币促销--}}
<div id="placeholder-promotion-yohocoin"></div>
{{!-- 占位: 用户反馈, 店铺入口 --}}
<div id="placeholder-feedback-store"></div>
... ... @@ -139,4 +142,17 @@
{{> common/suspend-home}}
</div>
{{#if vip_return_coin_info}}
<div class="coin-intro-box hide">
<div class="coin-intro">
<ul class="coin-ul">
{{#vip_return_coin_info}}
<li class="coin-li"><span class="vip-img">
</span>{{{title}}}</li>
{{/vip_return_coin_info}}
</ul>
<div class="tip">页面展示有货币为预计结果,因为页面缓存等原因可能有出入,最终返还结果以结算提示为准</div>
</div>
</div>
{{/if}}
{{/ result}}
... ...
... ... @@ -19,8 +19,9 @@ const domains = {
// singleApi: 'http://api-test3.yohops.com:9999/',
// gray
// api: 'http://apigray.yoho.cn/',
// service: 'http://apigray.yoho.cn/',
api: 'http://apigray.yoho.cn/',
service: 'http://apigray.yoho.cn/',
// platformApi: 'http://172.16.6.210:8088/',
... ...
{{#if promYohoCoinText}}
<div class="goods-discount" id="goodsDiscountYohoCoin">
<h2 class="coin-item short-text tap-hightlight">
<span class="promotion-icon"></span>{{promYohoCoinText}}
<span class="icon-down iconfont">&#xe609;</span>
</h2>
</div>
{{/if}}
... ...
... ... @@ -11,4 +11,4 @@
{{/if}}
{{/each}}
</div>
{{/if}}
\ No newline at end of file
{{/if}}
... ...
... ... @@ -122,6 +122,9 @@ setTimeout(() => {
}
if (productId && (goodsId || productSkn)) {
let $promotionYohoCoin = $('#placeholder-promotion-yohocoin');
let promotionYohoCoinT = require('product/detail/promotion-yoho-coin.hbs');
setTimeout(() => {
$.ajax({
type: 'GET',
... ... @@ -140,6 +143,23 @@ setTimeout(() => {
let regPro = /\/product\/pro_([\d]+)_([\d]+)/;
let regSeckill = /\/product\/seckill/;
$promotionYohoCoin.replaceWith(promotionYohoCoinT({
promYohoCoinText: data.promYohoCoinText
}));
let $coinItem = $('#goodsDiscountYohoCoin');
let $coinIntroBox = $('.coin-intro-box');
// 返有货币促销模块点击事件
$coinItem.on('click', function() {
$coinIntroBox.removeClass('hide');
});
// 关闭有货币促销展示面板
$coinIntroBox.on('click', function() {
$coinIntroBox.addClass('hide');
});
// let regProSeckill = /\/product\/seckill\/pro_([\d]+)_([\d]+)/;
let thisHref = window.location.href;
let thisRefer = document.referrer;
... ... @@ -295,7 +315,7 @@ setTimeout(() => {
/*
* 获取商品 相关数据: 1. 促销 2. feedback 3. 店铺, 并初始化
*/
+ (function(skn, productId, brandId) { // eslint-disable-line
(function(skn, productId, brandId) { // eslint-disable-line
// 模版: 促销, feedback, 店铺
let promotionT = require('product/detail/promotion.hbs');
let feedbackT = require('product/detail/feedbacks.hbs');
... ... @@ -356,7 +376,7 @@ setTimeout(() => {
// goods-discount下拉按钮点击事件
if ($goodsDiscount.length && $discountFolder.children().length > 0) {
$goodsDiscount.on('click', function() {
$discountFirstItem.on('click', function() {
if ($discountFolder.is(':hidden')) {
$discountFirstItem.removeClass('short-text');
$discountArrow.removeClass('icon-down').addClass('icon-up').html('&#xe608;');
... ...
.coin-intro-box {
position: fixed;
z-index: 100;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.6);
}
.coin-intro {
position: absolute;
height: 600px;
background-color: #fff;
padding: 30px;
bottom: 0;
left: 0;
right: 0;
.coin-li {
line-height: 120px;
border-bottom: 1px solid #ccc;
height: 120px;
.vip-img {
width: 53px;
height: 32px;
margin-right: 40px;
display: inline-block;
padding-left: 8px;
padding-top: 5px;
vertical-align: middle;
line-height: 88px;
}
&:nth-child(1) {
.vip-img {
background: url("/product/silver.png") no-repeat;
}
}
&:nth-child(2) {
.vip-img {
background: url("/product/golden.png") no-repeat;
}
}
&:nth-child(3) {
.vip-img {
background: url("/product/platinum.png") no-repeat;
}
}
.return-coin-num {
color: #d0021b;
margin: auto 10px;
}
}
.tip {
position: absolute;
bottom: 30px;
text-align: center;
margin-right: 30px;
font-size: 22px;
color: #ccc;
}
}
.hide {
display: none;
}
... ...
... ... @@ -715,7 +715,6 @@ $basicBtnC: #eb0313;
}
.goods-discount {
margin-bottom: 20px;
padding-top: 0;
display: block;
width: 100%;
... ... @@ -731,6 +730,7 @@ $basicBtnC: #eb0313;
line-height: 36px;
}
.coin-item > .promotion-icon,
.first-item > .promotion-icon,
.folder-item > .promotion-icon {
background-color: #d0021b;
... ... @@ -814,6 +814,7 @@ $basicBtnC: #eb0313;
}
.feedback-list {
margin-top: 20px;
margin-bottom: 20px;
background-color: #f0f0f0;
... ...
... ... @@ -9,3 +9,4 @@
@import "cart/chose-panel";
@import "common/suspend-home";
@import "bundle";
@import "coin-intro";
... ...
... ... @@ -264,6 +264,18 @@ class DetailProcess {
finalResult.promotion.push(value);
});
}
/**
* 处理有货币的促销数据
*/
static processPromYohoCoin(promYohoCoinInfo) {
promYohoCoinInfo = _.map(promYohoCoinInfo, info => {
info.title = _.replace(info.title, /\d+/, `<span class="return-coin-num">${info.return_coin_num}</span>`);
return info;
});
return promYohoCoinInfo;
}
}
module.exports = DetailProcess;
... ...
... ... @@ -654,3 +654,19 @@ exports.processSizeInfo = (origin) => {
}
return cartInfo;
};
/**
* 处理有货币的促销信息
*/
exports.procPromYohoCoin = (promotionYohoCoinData, vipLevel) => {
let showText = '';
_.forEach(promotionYohoCoinData, levelInfo => {
if (_.get(levelInfo, 'vip_level', -1) === vipLevel) {
showText = levelInfo.title;
return;
}
});
return showText;
};
... ...