Authored by 郭成尧

discount-add-to-cart

@@ -9,7 +9,7 @@ const utils = '../../../utils'; @@ -9,7 +9,7 @@ const utils = '../../../utils';
9 const _ = require('lodash'); 9 const _ = require('lodash');
10 const comment = require('./consult-comment'); 10 const comment = require('./consult-comment');
11 const bundle = require('./bundle'); 11 const bundle = require('./bundle');
12 - 12 +``
13 const api = global.yoho.API; 13 const api = global.yoho.API;
14 const singleAPI = global.yoho.SingleAPI; 14 const singleAPI = global.yoho.SingleAPI;
15 const helpers = global.yoho.helpers; 15 const helpers = global.yoho.helpers;
@@ -232,8 +232,6 @@ let getProductData = (data) => { @@ -232,8 +232,6 @@ let getProductData = (data) => {
232 232
233 let bundleData = _.get(info[4], 'data', null); 233 let bundleData = _.get(info[4], 'data', null);
234 234
235 - console.log(bundleData);  
236 -  
237 /* 套装 */ 235 /* 套装 */
238 if (bundleData && _.get(bundleData, 'bundleInfo.discountType', null) === 1) { 236 if (bundleData && _.get(bundleData, 'bundleInfo.discountType', null) === 1) {
239 finalResult.bundleData = { 237 finalResult.bundleData = {
@@ -123,7 +123,7 @@ @@ -123,7 +123,7 @@
123 {{/ bundleData}} 123 {{/ bundleData}}
124 {{# discountBuy}} 124 {{# discountBuy}}
125 <input type="hidden" id="discount-buy" value="{{num}}"> 125 <input type="hidden" id="discount-buy" value="{{num}}">
126 - <input type="hidden" id="promption-phrase" value="{{promotionPhrase}}"> 126 + <input type="hidden" id="promotion-phrase" value="{{promotionPhrase}}">
127 {{/ discountBuy}} 127 {{/ discountBuy}}
128 <div id="productDesc" {{#if limit}}class="limit"{{/if}}> </div> 128 <div id="productDesc" {{#if limit}}class="limit"{{/if}}> </div>
129 {{> detail/recommend-for-you}} 129 {{> detail/recommend-for-you}}
@@ -60,7 +60,7 @@ var limitProductCode, @@ -60,7 +60,7 @@ var limitProductCode,
60 60
61 // 量贩商品 61 // 量贩商品
62 var discountNum = $('#discount-buy').val() - 0, 62 var discountNum = $('#discount-buy').val() - 0,
63 - promptionPhrase = $('#promption-phrase').val(); 63 + $promotionPhrase = $('#promotion-phrase');
64 64
65 // 禁用数字编辑 65 // 禁用数字编辑
66 function disableNumEdit() { 66 function disableNumEdit() {
@@ -248,8 +248,9 @@ function updateConformButtonClassAndText() { @@ -248,8 +248,9 @@ function updateConformButtonClassAndText() {
248 function displayGoodNum(curGoodNum) { 248 function displayGoodNum(curGoodNum) {
249 249
250 // 量贩促销 250 // 量贩促销
251 - if (promptionPhrase) {  
252 - $allChoseItems.find('.num .left-num').html('<span style="color: #e10">' + promptionPhrase + '</span>'); 251 + if ($promotionPhrase.length > 0) {
  252 + $allChoseItems.find('.num .left-num').html('<span style="color: #e10">' + $promotionPhrase.val() + '</span>');
  253 + $leftNum.val(curGoodNum);
253 return; 254 return;
254 } 255 }
255 256
@@ -156,8 +156,17 @@ function render(data) { @@ -156,8 +156,17 @@ function render(data) {
156 } 156 }
157 157
158 /* tar modified 161205 量贩商品数量限制 */ 158 /* tar modified 161205 量贩商品数量限制 */
159 - $('#good-num').val($('#discount-buy').val());  
160 - $('.left-num').html('<span style="color: #e10">' + $('#promption-phrase').val() + '</span>'); 159 + var $discountBuy = $('#discount-buy'),
  160 + $promotionPhrase = $('#promotion-phrase');
  161 +
  162 + if ($discountBuy.length > 0) {
  163 + $('#good-num').val($discountBuy.val());
  164 + }
  165 +
  166 + if ($promotionPhrase.length > 0) {
  167 + $('.left-num').html('<span style="color: #e10">' + $promotionPhrase.val() + '</span>');
  168 + }
  169 +
161 $('#limitNum').val(data.limit); 170 $('#limitNum').val(data.limit);
162 $('#promotionId').val(data.cartInfo.promotionId); 171 $('#promotionId').val(data.cartInfo.promotionId);
163 $('#single').val(data.single); 172 $('#single').val(data.single);