Authored by huangyCode

修改商品详情

@@ -102,7 +102,8 @@ function goodsDetail(req, res, next) { @@ -102,7 +102,8 @@ function goodsDetail(req, res, next) {
102 } 102 }
103 let finalResult = detailProcess.prodessDetailData(result); 103 let finalResult = detailProcess.prodessDetailData(result);
104 104
105 - console.log(result); 105 + finalResult.activityGroupDetailList = result.activityGroupDetailList;
  106 + finalResult.activityIdDetail = result.activityIdDetail;
106 return res.render('group/goodsDetail', { 107 return res.render('group/goodsDetail', {
107 page: 'group-goodsDetail', 108 page: 'group-goodsDetail',
108 nodownload: true, 109 nodownload: true,
@@ -116,7 +117,7 @@ function goodsDetail(req, res, next) { @@ -116,7 +117,7 @@ function goodsDetail(req, res, next) {
116 canonical: { 117 canonical: {
117 currentHref: result.canonical 118 currentHref: result.canonical
118 }, 119 },
119 - result: finalResult 120 + result: finalResult,
120 }); 121 });
121 }).catch(next); 122 }).catch(next);
122 } 123 }
@@ -230,7 +230,7 @@ class GroupApi extends global.yoho.BaseModel { @@ -230,7 +230,7 @@ class GroupApi extends global.yoho.BaseModel {
230 activityId: obj.activityId 230 activityId: obj.activityId
231 }; 231 };
232 232
233 - this.get({data: param}) 233 + return this.get({data: param})
234 .then(data => { 234 .then(data => {
235 return data.data; 235 return data.data;
236 }) 236 })
@@ -247,12 +247,11 @@ class GroupApi extends global.yoho.BaseModel { @@ -247,12 +247,11 @@ class GroupApi extends global.yoho.BaseModel {
247 productSkn: obj.productSkn 247 productSkn: obj.productSkn
248 }; 248 };
249 249
250 - this.get({data: param}) 250 + return this.get({data: param})
251 .then(function(data) { 251 .then(function(data) {
252 - if (!data || !data.data) {  
253 - return;  
254 - }  
255 return data.data; 252 return data.data;
  253 + }).catch(function(error) {
  254 + console.log(error);
256 }); 255 });
257 } 256 }
258 } 257 }
@@ -179,10 +179,16 @@ class GroupService extends global.yoho.BaseModel { @@ -179,10 +179,16 @@ class GroupService extends global.yoho.BaseModel {
179 async goodsDetail(params) { 179 async goodsDetail(params) {
180 let result = await this.api.getProductData(params); 180 let result = await this.api.getProductData(params);
181 181
  182 + result.activityIdDetail = await this.api.getCollageProductInfo(params);
  183 + result.activityGroupDetailList = await this.api.fetchActivityGroups(params);
182 result.introUrl = '/product/detail/intro/' + params.productSkn; 184 result.introUrl = '/product/detail/intro/' + params.productSkn;
183 return result; 185 return result;
184 } 186 }
185 187
  188 + getJoinList(params) {
  189 + return this.api.fetchActivityGroups(params);
  190 + }
  191 +
186 async order({ 192 async order({
187 type, 193 type,
188 page, 194 page,
@@ -34,18 +34,37 @@ @@ -34,18 +34,37 @@
34 <h2 class="goods-name"><span>{{.}}</span></h2> 34 <h2 class="goods-name"><span>{{.}}</span></h2>
35 {{/ goodsName}} 35 {{/ goodsName}}
36 36
37 - {{# goodsSubtitle}}  
38 - <h1 class="goods-subtitle"><span>{{.}}</span></h1>  
39 - {{/ goodsSubtitle}}  
40 -  
41 <div class="price-date"> 37 <div class="price-date">
42 - <div class="goods-price data-bind">  
43 - <h1 class="current-price"></h1>  
44 - <h1 class="previous-price"></h1> 38 + <div class="goods-price">
  39 + <h1 class="current-price">{{activityIdDetail.formatCollagePrice}}</h1>
  40 + <h1 class="previous-price">{{goodsPrice.previousPrice}}</h1>
  41 + {{#if activityIdDetail.joinPeopleNum}}
  42 + <div class="join-num">已有{{activityIdDetail.joinPeopleNum}}人拼团</div>
  43 + {{/if}}
45 </div> 44 </div>
46 - <button class="limit-sale data-can-get-limit-code data-bind" id='limit-sale'>获取限购码</button>  
47 - <button class="got-limit-sale data-code-empty data-bind">限购码已被抢光</button>  
48 - <button class="got-limit-sale data-got-code data-bind">已获取限购码</button> 45 + </div>
  46 +
  47 + <div class="goods-join">
  48 + <div class="title">选择下面小伙伴,快速加入</div>
  49 + {{#each activityGroupDetailList}}
  50 + <div class="content">
  51 + <img class="avatar" src="{{founderHeadUrl}}"/>
  52 + <span class="nick-name">{{founderNickName}}</span>
  53 + <div class="middle">
  54 + <div class="top" >
  55 + <span class="text">还差</span>
  56 + <span class="text" style='color:red'>{{lackNum}}</span>
  57 + <span class="text">人成功</span>
  58 + </div>
  59 +
  60 + <span class="text">剩余{{formatLeftTime}}</span>
  61 + </div>
  62 +
  63 + <div class='ibutton'>
  64 + 立即参团
  65 + </div>
  66 + </div>
  67 + {{/each}}
49 </div> 68 </div>
50 {{#if periodOfMarket}} 69 {{#if periodOfMarket}}
51 <div class="period-of-market"> 70 <div class="period-of-market">
  1 +.good-detail-page {
  2 + .goods-price {
  3 + float: none;
  4 +
  5 + h1 {
  6 + display: inline-block;
  7 + line-height: 2.2rem;
  8 + }
  9 +
  10 + .join-num {
  11 + line-height: 2.2rem;
  12 + float: right;
  13 + font-size: 14px;
  14 + }
  15 + }
  16 +
  17 + .goods-join {
  18 + background: #fff;
  19 + margin-top: 14px;
  20 +
  21 + .title {
  22 + color: #b0b0b0;
  23 + height: 76px;
  24 + line-height: 76px;
  25 + padding-left: 30px;
  26 + }
  27 +
  28 + .content {
  29 + width: 100%;
  30 + height: 100px;
  31 + display: flex;
  32 + flex-direction: row;
  33 + align-items: center;
  34 +
  35 + .ibutton {
  36 + width: 160px;
  37 + height: 60px;
  38 + display: flex;
  39 + align-items: center;
  40 + justify-content: center;
  41 + margin-right: 30px;
  42 + font-size: 24px;
  43 + color: white;
  44 + text-align: center;
  45 + background: #000;
  46 + line-height: 60px;
  47 + border-radius: 35px;
  48 + }
  49 +
  50 + .avatar {
  51 + width: 60px;
  52 + height: 60px;
  53 + border-radius: 30px;
  54 + margin-left: 30px;
  55 + border: 1px solid #e0e0e0;
  56 + margin-right: 0;
  57 + }
  58 +
  59 + .nick-name {
  60 + font-size: 24px;
  61 + width: 280px;
  62 + color: #444;
  63 + margin-left: 20px;
  64 + }
  65 +
  66 + .middle {
  67 + width: 150px;
  68 + height: 100px;
  69 + display: flex;
  70 + align-items: flex-start;
  71 + flex-direction: column;
  72 + justify-content: center;
  73 + margin-right: 20px;
  74 +
  75 + .top {
  76 + display: flex;
  77 + flex-direction: row;
  78 + align-items: center;
  79 + }
  80 +
  81 + .text {
  82 + font-size: 20px;
  83 + color: #b0b0b0;
  84 + }
  85 + }
  86 + }
  87 + }
  88 +}
1 @import "../../../scss/product/detail/detail"; 1 @import "../../../scss/product/detail/detail";
2 @import "../../../scss/layout/swiper"; 2 @import "../../../scss/layout/swiper";
3 @import "../../../scss/product/detail/product-description"; 3 @import "../../../scss/product/detail/product-description";
  4 +@import "./group-detail";