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 { @@ -614,7 +614,7 @@ module.exports = class extends global.yoho.BaseModel {
614 dest = this._procShowStatus(dest, showStatus, isBeginSale); 614 dest = this._procShowStatus(dest, showStatus, isBeginSale);
615 615
616 dest.cartInfo.limitProductCode = origin.limitProductCode; 616 dest.cartInfo.limitProductCode = origin.limitProductCode;
617 - dest.cartInfo.limitCodeUrl = this._getLimitCodeUrl(origin.limitProductCode, origin.product_skn, ua); // eslint-disable-line 617 + dest.cartInfo.limitCodeUrl = this._getLimitCodeUrl(origin.limitProductCode, origin.product_skn, ua); // eslint-disable-line
618 dest.cartInfo.limitProductPay = helpers.urlFormat('/cart/index/orderEnsure'); 618 dest.cartInfo.limitProductPay = helpers.urlFormat('/cart/index/orderEnsure');
619 return resolve(dest); 619 return resolve(dest);
620 } else { 620 } else {
@@ -775,6 +775,11 @@ module.exports = class extends global.yoho.BaseModel { @@ -775,6 +775,11 @@ module.exports = class extends global.yoho.BaseModel {
775 }; 775 };
776 } 776 }
777 777
  778 + finalResult.promYohoCoinText =
  779 + productProcess.procPromYohoCoin(_.get(result,
  780 + 'vip_return_coin.max_return_coin_info', []),
  781 + params.current_vip_level);
  782 +
778 // 2017电子门票不显示区域 783 // 2017电子门票不显示区域
779 // let ticketsProps = finalResult.cartInfo.props; 784 // let ticketsProps = finalResult.cartInfo.props;
780 785
@@ -78,6 +78,8 @@ module.exports = class extends global.yoho.BaseModel { @@ -78,6 +78,8 @@ module.exports = class extends global.yoho.BaseModel {
78 }); 78 });
79 79
80 finalResult.recommendKeywords = recomdKeywords; 80 finalResult.recommendKeywords = recomdKeywords;
  81 + finalResult.vip_return_coin_info =
  82 + detailProcess.processPromYohoCoin(_.get(result, 'data.vip_return_coin.vip_return_coin_info', []));
81 83
82 return finalResult; 84 return finalResult;
83 }); 85 });
@@ -114,7 +116,6 @@ module.exports = class extends global.yoho.BaseModel { @@ -114,7 +116,6 @@ module.exports = class extends global.yoho.BaseModel {
114 } 116 }
115 117
116 return Promise.all(apiArray).then(info => { 118 return Promise.all(apiArray).then(info => {
117 - // console.log(info);  
118 let finalResult = { 119 let finalResult = {
119 promotion: null, 120 promotion: null,
120 enterStore: null, 121 enterStore: null,
@@ -168,14 +169,12 @@ module.exports = class extends global.yoho.BaseModel { @@ -168,14 +169,12 @@ module.exports = class extends global.yoho.BaseModel {
168 return this.get({ 169 return this.get({
169 data: params, 170 data: params,
170 param: cacheConf 171 param: cacheConf
171 - })  
172 - .then(result => {  
173 - // console.log(result);  
174 - if (result && result.code === 200) {  
175 - return detailProcess.processShopsInfo(result.data);  
176 - }  
177 - return [];  
178 - }, () => []); 172 + }).then(result => {
  173 + if (result && result.code === 200) {
  174 + return detailProcess.processShopsInfo(result.data);
  175 + }
  176 + return [];
  177 + }, () => []);
179 } 178 }
180 179
181 /** 180 /**
@@ -194,14 +193,12 @@ module.exports = class extends global.yoho.BaseModel { @@ -194,14 +193,12 @@ module.exports = class extends global.yoho.BaseModel {
194 return this.get({ 193 return this.get({
195 data: params, 194 data: params,
196 param: cacheConf 195 param: cacheConf
197 - })  
198 - .then(result => {  
199 - // console.log(result);  
200 - if (result && result.code === 200) {  
201 - return result.data;  
202 - } 196 + }).then(result => {
  197 + if (result && result.code === 200) {
  198 + return result.data;
  199 + }
203 200
204 - return {};  
205 - }); 201 + return {};
  202 + });
206 } 203 }
207 }; 204 };
@@ -74,6 +74,9 @@ @@ -74,6 +74,9 @@
74 <div id="placeholder-promotion" style="height:100px;background-color:#fff;"> 74 <div id="placeholder-promotion" style="height:100px;background-color:#fff;">
75 </div> 75 </div>
76 76
  77 + {{!--占位: 有货币促销--}}
  78 + <div id="placeholder-promotion-yohocoin"></div>
  79 +
77 {{!-- 占位: 用户反馈, 店铺入口 --}} 80 {{!-- 占位: 用户反馈, 店铺入口 --}}
78 <div id="placeholder-feedback-store"></div> 81 <div id="placeholder-feedback-store"></div>
79 82
@@ -139,4 +142,17 @@ @@ -139,4 +142,17 @@
139 142
140 {{> common/suspend-home}} 143 {{> common/suspend-home}}
141 </div> 144 </div>
  145 +{{#if vip_return_coin_info}}
  146 +<div class="coin-intro-box hide">
  147 + <div class="coin-intro">
  148 + <ul class="coin-ul">
  149 + {{#vip_return_coin_info}}
  150 + <li class="coin-li"><span class="vip-img">
  151 + </span>{{{title}}}</li>
  152 + {{/vip_return_coin_info}}
  153 + </ul>
  154 + <div class="tip">页面展示有货币为预计结果,因为页面缓存等原因可能有出入,最终返还结果以结算提示为准</div>
  155 + </div>
  156 +</div>
  157 +{{/if}}
142 {{/ result}} 158 {{/ result}}
@@ -19,8 +19,9 @@ const domains = { @@ -19,8 +19,9 @@ const domains = {
19 // singleApi: 'http://api-test3.yohops.com:9999/', 19 // singleApi: 'http://api-test3.yohops.com:9999/',
20 20
21 // gray 21 // gray
22 - // api: 'http://apigray.yoho.cn/',  
23 - // service: 'http://apigray.yoho.cn/', 22 + api: 'http://apigray.yoho.cn/',
  23 + service: 'http://apigray.yoho.cn/',
  24 +
24 // platformApi: 'http://172.16.6.210:8088/', 25 // platformApi: 'http://172.16.6.210:8088/',
25 26
26 27
  1 +{{#if promYohoCoinText}}
  2 +<div class="goods-discount" id="goodsDiscountYohoCoin">
  3 + <h2 class="coin-item short-text tap-hightlight">
  4 + <span class="promotion-icon"></span>{{promYohoCoinText}}
  5 + <span class="icon-down iconfont">&#xe609;</span>
  6 + </h2>
  7 +</div>
  8 +{{/if}}
@@ -11,4 +11,4 @@ @@ -11,4 +11,4 @@
11 {{/if}} 11 {{/if}}
12 {{/each}} 12 {{/each}}
13 </div> 13 </div>
14 -{{/if}}  
  14 +{{/if}}
@@ -122,6 +122,9 @@ setTimeout(() => { @@ -122,6 +122,9 @@ setTimeout(() => {
122 } 122 }
123 123
124 if (productId && (goodsId || productSkn)) { 124 if (productId && (goodsId || productSkn)) {
  125 + let $promotionYohoCoin = $('#placeholder-promotion-yohocoin');
  126 + let promotionYohoCoinT = require('product/detail/promotion-yoho-coin.hbs');
  127 +
125 setTimeout(() => { 128 setTimeout(() => {
126 $.ajax({ 129 $.ajax({
127 type: 'GET', 130 type: 'GET',
@@ -140,6 +143,23 @@ setTimeout(() => { @@ -140,6 +143,23 @@ setTimeout(() => {
140 let regPro = /\/product\/pro_([\d]+)_([\d]+)/; 143 let regPro = /\/product\/pro_([\d]+)_([\d]+)/;
141 let regSeckill = /\/product\/seckill/; 144 let regSeckill = /\/product\/seckill/;
142 145
  146 + $promotionYohoCoin.replaceWith(promotionYohoCoinT({
  147 + promYohoCoinText: data.promYohoCoinText
  148 + }));
  149 +
  150 + let $coinItem = $('#goodsDiscountYohoCoin');
  151 + let $coinIntroBox = $('.coin-intro-box');
  152 +
  153 + // 返有货币促销模块点击事件
  154 + $coinItem.on('click', function() {
  155 + $coinIntroBox.removeClass('hide');
  156 + });
  157 +
  158 + // 关闭有货币促销展示面板
  159 + $coinIntroBox.on('click', function() {
  160 + $coinIntroBox.addClass('hide');
  161 + });
  162 +
143 // let regProSeckill = /\/product\/seckill\/pro_([\d]+)_([\d]+)/; 163 // let regProSeckill = /\/product\/seckill\/pro_([\d]+)_([\d]+)/;
144 let thisHref = window.location.href; 164 let thisHref = window.location.href;
145 let thisRefer = document.referrer; 165 let thisRefer = document.referrer;
@@ -295,7 +315,7 @@ setTimeout(() => { @@ -295,7 +315,7 @@ setTimeout(() => {
295 /* 315 /*
296 * 获取商品 相关数据: 1. 促销 2. feedback 3. 店铺, 并初始化 316 * 获取商品 相关数据: 1. 促销 2. feedback 3. 店铺, 并初始化
297 */ 317 */
298 -+ (function(skn, productId, brandId) { // eslint-disable-line 318 +(function(skn, productId, brandId) { // eslint-disable-line
299 // 模版: 促销, feedback, 店铺 319 // 模版: 促销, feedback, 店铺
300 let promotionT = require('product/detail/promotion.hbs'); 320 let promotionT = require('product/detail/promotion.hbs');
301 let feedbackT = require('product/detail/feedbacks.hbs'); 321 let feedbackT = require('product/detail/feedbacks.hbs');
@@ -356,7 +376,7 @@ setTimeout(() => { @@ -356,7 +376,7 @@ setTimeout(() => {
356 376
357 // goods-discount下拉按钮点击事件 377 // goods-discount下拉按钮点击事件
358 if ($goodsDiscount.length && $discountFolder.children().length > 0) { 378 if ($goodsDiscount.length && $discountFolder.children().length > 0) {
359 - $goodsDiscount.on('click', function() { 379 + $discountFirstItem.on('click', function() {
360 if ($discountFolder.is(':hidden')) { 380 if ($discountFolder.is(':hidden')) {
361 $discountFirstItem.removeClass('short-text'); 381 $discountFirstItem.removeClass('short-text');
362 $discountArrow.removeClass('icon-down').addClass('icon-up').html('&#xe608;'); 382 $discountArrow.removeClass('icon-down').addClass('icon-up').html('&#xe608;');
  1 +.coin-intro-box {
  2 + position: fixed;
  3 + z-index: 100;
  4 + top: 0;
  5 + bottom: 0;
  6 + left: 0;
  7 + right: 0;
  8 + background-color: rgba(0, 0, 0, 0.6);
  9 +}
  10 +
  11 +.coin-intro {
  12 + position: absolute;
  13 + height: 600px;
  14 + background-color: #fff;
  15 + padding: 30px;
  16 + bottom: 0;
  17 + left: 0;
  18 + right: 0;
  19 +
  20 + .coin-li {
  21 + line-height: 120px;
  22 + border-bottom: 1px solid #ccc;
  23 + height: 120px;
  24 +
  25 + .vip-img {
  26 + width: 53px;
  27 + height: 32px;
  28 + margin-right: 40px;
  29 + display: inline-block;
  30 + padding-left: 8px;
  31 + padding-top: 5px;
  32 + vertical-align: middle;
  33 + line-height: 88px;
  34 + }
  35 +
  36 + &:nth-child(1) {
  37 + .vip-img {
  38 + background: url("/product/silver.png") no-repeat;
  39 + }
  40 + }
  41 +
  42 + &:nth-child(2) {
  43 + .vip-img {
  44 + background: url("/product/golden.png") no-repeat;
  45 + }
  46 + }
  47 +
  48 + &:nth-child(3) {
  49 + .vip-img {
  50 + background: url("/product/platinum.png") no-repeat;
  51 + }
  52 + }
  53 +
  54 + .return-coin-num {
  55 + color: #d0021b;
  56 + margin: auto 10px;
  57 + }
  58 + }
  59 +
  60 + .tip {
  61 + position: absolute;
  62 + bottom: 30px;
  63 + text-align: center;
  64 + margin-right: 30px;
  65 + font-size: 22px;
  66 + color: #ccc;
  67 + }
  68 +}
  69 +
  70 +.hide {
  71 + display: none;
  72 +}
@@ -715,7 +715,6 @@ $basicBtnC: #eb0313; @@ -715,7 +715,6 @@ $basicBtnC: #eb0313;
715 } 715 }
716 716
717 .goods-discount { 717 .goods-discount {
718 - margin-bottom: 20px;  
719 padding-top: 0; 718 padding-top: 0;
720 display: block; 719 display: block;
721 width: 100%; 720 width: 100%;
@@ -731,6 +730,7 @@ $basicBtnC: #eb0313; @@ -731,6 +730,7 @@ $basicBtnC: #eb0313;
731 line-height: 36px; 730 line-height: 36px;
732 } 731 }
733 732
  733 + .coin-item > .promotion-icon,
734 .first-item > .promotion-icon, 734 .first-item > .promotion-icon,
735 .folder-item > .promotion-icon { 735 .folder-item > .promotion-icon {
736 background-color: #d0021b; 736 background-color: #d0021b;
@@ -814,6 +814,7 @@ $basicBtnC: #eb0313; @@ -814,6 +814,7 @@ $basicBtnC: #eb0313;
814 } 814 }
815 815
816 .feedback-list { 816 .feedback-list {
  817 + margin-top: 20px;
817 margin-bottom: 20px; 818 margin-bottom: 20px;
818 background-color: #f0f0f0; 819 background-color: #f0f0f0;
819 820
@@ -9,3 +9,4 @@ @@ -9,3 +9,4 @@
9 @import "cart/chose-panel"; 9 @import "cart/chose-panel";
10 @import "common/suspend-home"; 10 @import "common/suspend-home";
11 @import "bundle"; 11 @import "bundle";
  12 +@import "coin-intro";
@@ -264,6 +264,18 @@ class DetailProcess { @@ -264,6 +264,18 @@ class DetailProcess {
264 finalResult.promotion.push(value); 264 finalResult.promotion.push(value);
265 }); 265 });
266 } 266 }
  267 +
  268 + /**
  269 + * 处理有货币的促销数据
  270 + */
  271 + static processPromYohoCoin(promYohoCoinInfo) {
  272 + promYohoCoinInfo = _.map(promYohoCoinInfo, info => {
  273 + info.title = _.replace(info.title, /\d+/, `<span class="return-coin-num">${info.return_coin_num}</span>`);
  274 +
  275 + return info;
  276 + });
  277 + return promYohoCoinInfo;
  278 + }
267 } 279 }
268 280
269 module.exports = DetailProcess; 281 module.exports = DetailProcess;
@@ -654,3 +654,19 @@ exports.processSizeInfo = (origin) => { @@ -654,3 +654,19 @@ exports.processSizeInfo = (origin) => {
654 } 654 }
655 return cartInfo; 655 return cartInfo;
656 }; 656 };
  657 +
  658 +/**
  659 + * 处理有货币的促销信息
  660 + */
  661 +exports.procPromYohoCoin = (promotionYohoCoinData, vipLevel) => {
  662 + let showText = '';
  663 +
  664 + _.forEach(promotionYohoCoinData, levelInfo => {
  665 + if (_.get(levelInfo, 'vip_level', -1) === vipLevel) {
  666 + showText = levelInfo.title;
  667 + return;
  668 + }
  669 + });
  670 +
  671 + return showText;
  672 +};