Authored by 郭成尧

Merge branch 'release/5.2' of git.yoho.cn:fe/YOHOBUYWAP into release/5.2

@@ -267,14 +267,12 @@ class CartData @@ -267,14 +267,12 @@ class CartData
267 } 267 }
268 268
269 $param['client_secret'] = Sign::getSign($param); 269 $param['client_secret'] = Sign::getSign($param);
270 - // print_r(Yohobuy::get(API_URL, $param));  
271 -  
272 return Yohobuy::get(API_URL, $param); 270 return Yohobuy::get(API_URL, $param);
273 } 271 }
274 272
275 /** 273 /**
276 * 购物车结算--支付方式和配送方式选择 274 * 购物车结算--支付方式和配送方式选择
277 - * 275 + *http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/%E8%AE%A2%E5%8D%95/shopping.md
278 * @param int $uid 用户ID 276 * @param int $uid 用户ID
279 * @param string $cartType 购物车类型,ordinary表示普通购物车 277 * @param string $cartType 购物车类型,ordinary表示普通购物车
280 * @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运 278 * @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运
@@ -1706,7 +1706,7 @@ var $tip, tipItime; @@ -1706,7 +1706,7 @@ var $tip, tipItime;
1706 function show(con, dur) { 1706 function show(con, dur) {
1707 var content, duration; 1707 var content, duration;
1708 1708
1709 - if (typeof con === 'undefined') { 1709 + if (typeof con === 'undefined' || con === '') {
1710 return; 1710 return;
1711 } 1711 }
1712 1712
@@ -14347,7 +14347,7 @@ var $invoice = $('.invoice'), @@ -14347,7 +14347,7 @@ var $invoice = $('.invoice'),
14347 $couponUse = $('.coupon-use.used'), 14347 $couponUse = $('.coupon-use.used'),
14348 $addressWrap = $('.address-wrap'), 14348 $addressWrap = $('.address-wrap'),
14349 $coinCheck = $('.coin-check'), 14349 $coinCheck = $('.coin-check'),
14350 - $coinUsed = $('.coin .used'), 14350 + $coinLi = $('li.coin'),
14351 $subBlock = $('.sub-block'), 14351 $subBlock = $('.sub-block'),
14352 $ticketsMobile = $('#mobile'), 14352 $ticketsMobile = $('#mobile'),
14353 payType, 14353 payType,
@@ -14360,6 +14360,7 @@ var $invoice = $('.invoice'), @@ -14360,6 +14360,7 @@ var $invoice = $('.invoice'),
14360 productSku = $('#productSku').val(), 14360 productSku = $('#productSku').val(),
14361 buyNumber = $('#buyNumber').val(), 14361 buyNumber = $('#buyNumber').val(),
14362 headerTop = $("#yoho-header").outerHeight(), 14362 headerTop = $("#yoho-header").outerHeight(),
  14363 + isYohoCoinClick = $coinLi.data('yoho-coin-click') * 1,//判断有货币是否可以单击
14363 addressTop = $(".address-wrap").outerHeight(); 14364 addressTop = $(".address-wrap").outerHeight();
14364 14365
14365 var orderCont = window.cookie('order-info') && JSON.parse(window.cookie('order-info')); 14366 var orderCont = window.cookie('order-info') && JSON.parse(window.cookie('order-info'));
@@ -14454,13 +14455,18 @@ if (queryString.cartType || queryString.carttype || !orderInfo('cartType')) { @@ -14454,13 +14455,18 @@ if (queryString.cartType || queryString.carttype || !orderInfo('cartType')) {
14454 // $cur.addClass('chosed'); 14455 // $cur.addClass('chosed');
14455 // } 14456 // }
14456 14457
14457 -$('.checkbox').on('touchstart', function() { 14458 +$('.checkbox').on('touchstart', function(e) {
14458 var $this = $(this); 14459 var $this = $(this);
14459 14460
  14461 + if ($(e.target).closest('.coin-check').length && !isYohoCoinClick) {
  14462 + return true;
  14463 + }
  14464 +
14460 if ($this.hasClass('icon-cb-radio')) { 14465 if ($this.hasClass('icon-cb-radio')) {
14461 $this.removeClass('icon-cb-radio').addClass('icon-radio'); 14466 $this.removeClass('icon-cb-radio').addClass('icon-radio');
14462 return; 14467 return;
14463 } 14468 }
  14469 +
14464 if ($this.hasClass('icon-radio')) { 14470 if ($this.hasClass('icon-radio')) {
14465 $this.removeClass('icon-radio').addClass('icon-cb-radio'); 14471 $this.removeClass('icon-radio').addClass('icon-cb-radio');
14466 } 14472 }
@@ -14542,12 +14548,14 @@ function orderCompute() { @@ -14542,12 +14548,14 @@ function orderCompute() {
14542 if (typeof res.last_order_amount !== undefined) { 14548 if (typeof res.last_order_amount !== undefined) {
14543 res.last_order_amount = (+res.last_order_amount).toFixed(2); 14549 res.last_order_amount = (+res.last_order_amount).toFixed(2);
14544 } 14550 }
  14551 +
14545 if (res.use_yoho_coin) { 14552 if (res.use_yoho_coin) {
14546 $coinCheck.find('em').html('- ¥ ' + res.use_yoho_coin); 14553 $coinCheck.find('em').html('- ¥ ' + res.use_yoho_coin);
14547 - $coinUsed.html('已抵¥' + res.use_yoho_coin);  
14548 $coinCheck.find('em').show(); 14554 $coinCheck.find('em').show();
14549 - $coinUsed.show();  
14550 } 14555 }
  14556 + $coinLi.find('.msg').html(res.yohoCoinCompute.yohoCoinMsg);
  14557 + isYohoCoinClick = res.yohoCoinCompute.yohoCoinClick * 1;
  14558 +
14551 total = ''; 14559 total = '';
14552 if (res.promotion_formula_list) { 14560 if (res.promotion_formula_list) {
14553 $.each(res.promotion_formula_list, function(index, value) { 14561 $.each(res.promotion_formula_list, function(index, value) {
@@ -14651,6 +14659,11 @@ if (!orderInfo('addressId')) { @@ -14651,6 +14659,11 @@ if (!orderInfo('addressId')) {
14651 14659
14652 $('.delivery-id').on('touchend', 'li', function() { 14660 $('.delivery-id').on('touchend', 'li', function() {
14653 orderInfo('deliveryId', $(this).data('id')); 14661 orderInfo('deliveryId', $(this).data('id'));
  14662 +
  14663 + //实付金额发生变化,使用有货币为0
  14664 + orderInfo('yohoCoin', 0);
  14665 + $('.coin').find('.checkbox').removeClass('icon-cb-radio').addClass('icon-radio');
  14666 +
14654 orderCompute(); 14667 orderCompute();
14655 }); 14668 });
14656 14669
@@ -14662,9 +14675,29 @@ $('.dispatch-time').on('touchend', 'li', function() { @@ -14662,9 +14675,29 @@ $('.dispatch-time').on('touchend', 'li', function() {
14662 orderInfo('deliveryTimeId', $(this).data('id')); 14675 orderInfo('deliveryTimeId', $(this).data('id'));
14663 }); 14676 });
14664 14677
14665 -$('.coin').on('touchend', function() { 14678 +$('.yoho-coin-help-dialog-bg, .yoho-coin-footer').on('touchend', function(e) {
  14679 + e.preventDefault();
  14680 + $('.yoho-coin-help-dialog-bg').addClass('hide');
  14681 + $('.yoho-coin-help-dialog').addClass('hide');
  14682 +});
  14683 +
  14684 +$('.coin').on('touchend', function(e) {
14666 var $this = $(this); 14685 var $this = $(this);
14667 14686
  14687 + if ($(e.target).closest('.yoho-coin-help').length) {
  14688 + $('.yoho-coin-help-dialog-bg').removeClass('hide');
  14689 + $('.yoho-coin-help-dialog').removeClass('hide');
  14690 + return true;
  14691 + }
  14692 +
  14693 + if ($(e.target).closest('.coin-check').length <= 0) {
  14694 + return false;
  14695 + }
  14696 +
  14697 + if (!isYohoCoinClick) {
  14698 + return true;
  14699 + }
  14700 +
14668 if ($this.find('.checkbox').hasClass('icon-cb-radio')) { 14701 if ($this.find('.checkbox').hasClass('icon-cb-radio')) {
14669 orderInfo('yohoCoin', $this.data('yoho-coin')); 14702 orderInfo('yohoCoin', $this.data('yoho-coin'));
14670 $this.find('.can-use').hide(); 14703 $this.find('.can-use').hide();
@@ -15119,6 +15152,8 @@ $newCoupon.on('submit', function() { @@ -15119,6 +15152,8 @@ $newCoupon.on('submit', function() {
15119 } 15152 }
15120 if (res.code === 200) { 15153 if (res.code === 200) {
15121 tip.show('优惠券可用'); 15154 tip.show('优惠券可用');
  15155 + //实付金额发生变化,使用有货币为0
  15156 + orderInfo('yohoCoin', 0);
15122 orderInfo('couponCode', res.data.coupon_code); 15157 orderInfo('couponCode', res.data.coupon_code);
15123 orderInfo('couponName', res.data.coupon_title); 15158 orderInfo('couponName', res.data.coupon_title);
15124 window.location.href = '/cart/index/orderEnsure'; 15159 window.location.href = '/cart/index/orderEnsure';
@@ -15144,6 +15179,8 @@ $couponList.on('touchstart', '.employ-main', function() { @@ -15144,6 +15179,8 @@ $couponList.on('touchstart', '.employ-main', function() {
15144 $('body').on('touchend', '.not-use', function() { 15179 $('body').on('touchend', '.not-use', function() {
15145 orderInfo('couponCode', null); 15180 orderInfo('couponCode', null);
15146 orderInfo('couponName', null); 15181 orderInfo('couponName', null);
  15182 + //实付金额发生变化,使用有货币为0
  15183 + orderInfo('yohoCoin', 0);
15147 location.href = '/cart/index/orderEnsure'; 15184 location.href = '/cart/index/orderEnsure';
15148 }); 15185 });
15149 15186
@@ -15201,6 +15238,8 @@ function getCouponHandle(allCoupons) { @@ -15201,6 +15238,8 @@ function getCouponHandle(allCoupons) {
15201 //tip.show('优惠券可用'); 15238 //tip.show('优惠券可用');
15202 orderInfo('couponCode', res.data.coupon_code); 15239 orderInfo('couponCode', res.data.coupon_code);
15203 orderInfo('couponName', res.data.coupon_title); 15240 orderInfo('couponName', res.data.coupon_title);
  15241 + //实付金额发生变化,使用有货币为0
  15242 + orderInfo('yohoCoin', 0);
15204 window.location.href = '/cart/index/orderEnsure'; 15243 window.location.href = '/cart/index/orderEnsure';
15205 } else if (res.message) { 15244 } else if (res.message) {
15206 tip.show(res.message); 15245 tip.show(res.message);
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
@@ -14,7 +14,7 @@ var $invoice = $('.invoice'), @@ -14,7 +14,7 @@ var $invoice = $('.invoice'),
14 $couponUse = $('.coupon-use.used'), 14 $couponUse = $('.coupon-use.used'),
15 $addressWrap = $('.address-wrap'), 15 $addressWrap = $('.address-wrap'),
16 $coinCheck = $('.coin-check'), 16 $coinCheck = $('.coin-check'),
17 - $coinUsed = $('.coin .used'), 17 + $coinLi = $('li.coin'),
18 $subBlock = $('.sub-block'), 18 $subBlock = $('.sub-block'),
19 $ticketsMobile = $('#mobile'), 19 $ticketsMobile = $('#mobile'),
20 payType, 20 payType,
@@ -27,6 +27,7 @@ var $invoice = $('.invoice'), @@ -27,6 +27,7 @@ var $invoice = $('.invoice'),
27 productSku = $('#productSku').val(), 27 productSku = $('#productSku').val(),
28 buyNumber = $('#buyNumber').val(), 28 buyNumber = $('#buyNumber').val(),
29 headerTop = $("#yoho-header").outerHeight(), 29 headerTop = $("#yoho-header").outerHeight(),
  30 + isYohoCoinClick = $coinLi.data('yoho-coin-click') * 1,//判断有货币是否可以单击
30 addressTop = $(".address-wrap").outerHeight(); 31 addressTop = $(".address-wrap").outerHeight();
31 32
32 var orderCont = window.cookie('order-info') && JSON.parse(window.cookie('order-info')); 33 var orderCont = window.cookie('order-info') && JSON.parse(window.cookie('order-info'));
@@ -121,13 +122,18 @@ if (queryString.cartType || queryString.carttype || !orderInfo('cartType')) { @@ -121,13 +122,18 @@ if (queryString.cartType || queryString.carttype || !orderInfo('cartType')) {
121 // $cur.addClass('chosed'); 122 // $cur.addClass('chosed');
122 // } 123 // }
123 124
124 -$('.checkbox').on('touchstart', function() { 125 +$('.checkbox').on('touchstart', function(e) {
125 var $this = $(this); 126 var $this = $(this);
126 127
  128 + if ($(e.target).closest('.coin-check').length && !isYohoCoinClick) {
  129 + return true;
  130 + }
  131 +
127 if ($this.hasClass('icon-cb-radio')) { 132 if ($this.hasClass('icon-cb-radio')) {
128 $this.removeClass('icon-cb-radio').addClass('icon-radio'); 133 $this.removeClass('icon-cb-radio').addClass('icon-radio');
129 return; 134 return;
130 } 135 }
  136 +
131 if ($this.hasClass('icon-radio')) { 137 if ($this.hasClass('icon-radio')) {
132 $this.removeClass('icon-radio').addClass('icon-cb-radio'); 138 $this.removeClass('icon-radio').addClass('icon-cb-radio');
133 } 139 }
@@ -209,12 +215,14 @@ function orderCompute() { @@ -209,12 +215,14 @@ function orderCompute() {
209 if (typeof res.last_order_amount !== undefined) { 215 if (typeof res.last_order_amount !== undefined) {
210 res.last_order_amount = (+res.last_order_amount).toFixed(2); 216 res.last_order_amount = (+res.last_order_amount).toFixed(2);
211 } 217 }
  218 +
212 if (res.use_yoho_coin) { 219 if (res.use_yoho_coin) {
213 $coinCheck.find('em').html('- ¥ ' + res.use_yoho_coin); 220 $coinCheck.find('em').html('- ¥ ' + res.use_yoho_coin);
214 - $coinUsed.html('已抵¥' + res.use_yoho_coin);  
215 $coinCheck.find('em').show(); 221 $coinCheck.find('em').show();
216 - $coinUsed.show();  
217 } 222 }
  223 + $coinLi.find('.msg').html(res.yohoCoinCompute.yohoCoinMsg);
  224 + isYohoCoinClick = res.yohoCoinCompute.yohoCoinClick * 1;
  225 +
218 total = ''; 226 total = '';
219 if (res.promotion_formula_list) { 227 if (res.promotion_formula_list) {
220 $.each(res.promotion_formula_list, function(index, value) { 228 $.each(res.promotion_formula_list, function(index, value) {
@@ -318,6 +326,11 @@ if (!orderInfo('addressId')) { @@ -318,6 +326,11 @@ if (!orderInfo('addressId')) {
318 326
319 $('.delivery-id').on('touchend', 'li', function() { 327 $('.delivery-id').on('touchend', 'li', function() {
320 orderInfo('deliveryId', $(this).data('id')); 328 orderInfo('deliveryId', $(this).data('id'));
  329 +
  330 + //实付金额发生变化,使用有货币为0
  331 + orderInfo('yohoCoin', 0);
  332 + $('.coin').find('.checkbox').removeClass('icon-cb-radio').addClass('icon-radio');
  333 +
321 orderCompute(); 334 orderCompute();
322 }); 335 });
323 336
@@ -329,9 +342,29 @@ $('.dispatch-time').on('touchend', 'li', function() { @@ -329,9 +342,29 @@ $('.dispatch-time').on('touchend', 'li', function() {
329 orderInfo('deliveryTimeId', $(this).data('id')); 342 orderInfo('deliveryTimeId', $(this).data('id'));
330 }); 343 });
331 344
332 -$('.coin').on('touchend', function() { 345 +$('.yoho-coin-help-dialog-bg, .yoho-coin-footer').on('touchend', function(e) {
  346 + e.preventDefault();
  347 + $('.yoho-coin-help-dialog-bg').addClass('hide');
  348 + $('.yoho-coin-help-dialog').addClass('hide');
  349 +});
  350 +
  351 +$('.coin').on('touchend', function(e) {
333 var $this = $(this); 352 var $this = $(this);
334 353
  354 + if ($(e.target).closest('.yoho-coin-help').length) {
  355 + $('.yoho-coin-help-dialog-bg').removeClass('hide');
  356 + $('.yoho-coin-help-dialog').removeClass('hide');
  357 + return true;
  358 + }
  359 +
  360 + if ($(e.target).closest('.coin-check').length <= 0) {
  361 + return false;
  362 + }
  363 +
  364 + if (!isYohoCoinClick) {
  365 + return true;
  366 + }
  367 +
335 if ($this.find('.checkbox').hasClass('icon-cb-radio')) { 368 if ($this.find('.checkbox').hasClass('icon-cb-radio')) {
336 orderInfo('yohoCoin', $this.data('yoho-coin')); 369 orderInfo('yohoCoin', $this.data('yoho-coin'));
337 $this.find('.can-use').hide(); 370 $this.find('.can-use').hide();
@@ -56,6 +56,8 @@ $newCoupon.on('submit', function() { @@ -56,6 +56,8 @@ $newCoupon.on('submit', function() {
56 } 56 }
57 if (res.code === 200) { 57 if (res.code === 200) {
58 tip.show('优惠券可用'); 58 tip.show('优惠券可用');
  59 + //实付金额发生变化,使用有货币为0
  60 + orderInfo('yohoCoin', 0);
59 orderInfo('couponCode', res.data.coupon_code); 61 orderInfo('couponCode', res.data.coupon_code);
60 orderInfo('couponName', res.data.coupon_title); 62 orderInfo('couponName', res.data.coupon_title);
61 window.location.href = '/cart/index/orderEnsure'; 63 window.location.href = '/cart/index/orderEnsure';
@@ -81,6 +83,8 @@ $couponList.on('touchstart', '.employ-main', function() { @@ -81,6 +83,8 @@ $couponList.on('touchstart', '.employ-main', function() {
81 $('body').on('touchend', '.not-use', function() { 83 $('body').on('touchend', '.not-use', function() {
82 orderInfo('couponCode', null); 84 orderInfo('couponCode', null);
83 orderInfo('couponName', null); 85 orderInfo('couponName', null);
  86 + //实付金额发生变化,使用有货币为0
  87 + orderInfo('yohoCoin', 0);
84 location.href = '/cart/index/orderEnsure'; 88 location.href = '/cart/index/orderEnsure';
85 }); 89 });
86 90
@@ -138,6 +142,8 @@ function getCouponHandle(allCoupons) { @@ -138,6 +142,8 @@ function getCouponHandle(allCoupons) {
138 //tip.show('优惠券可用'); 142 //tip.show('优惠券可用');
139 orderInfo('couponCode', res.data.coupon_code); 143 orderInfo('couponCode', res.data.coupon_code);
140 orderInfo('couponName', res.data.coupon_title); 144 orderInfo('couponName', res.data.coupon_title);
  145 + //实付金额发生变化,使用有货币为0
  146 + orderInfo('yohoCoin', 0);
141 window.location.href = '/cart/index/orderEnsure'; 147 window.location.href = '/cart/index/orderEnsure';
142 } else if (res.message) { 148 } else if (res.message) {
143 tip.show(res.message); 149 tip.show(res.message);
@@ -31,7 +31,7 @@ var $tip, tipItime; @@ -31,7 +31,7 @@ var $tip, tipItime;
31 function show(con, dur) { 31 function show(con, dur) {
32 var content, duration; 32 var content, duration;
33 33
34 - if (typeof con === 'undefined') { 34 + if (typeof con === 'undefined' || con === '') {
35 return; 35 return;
36 } 36 }
37 37
@@ -294,114 +294,114 @@ @@ -294,114 +294,114 @@
294 } 294 }
295 295
296 296
297 -.order-good {  
298 - position: relative;  
299 - padding: 20px 0;  
300 - margin-left: 34px;  
301 - height: 160px;  
302 - border-bottom: 1px solid #e0e0e0;  
303 - font-size: 26px;  
304 -  
305 - &:last-child {  
306 - border-bottom: none;  
307 - }  
308 -  
309 - .thumb-wrap { 297 + .order-good {
310 position: relative; 298 position: relative;
311 - float: left;  
312 - width: 120px; 299 + padding: 20px 0;
  300 + margin-left: 34px;
313 height: 160px; 301 height: 160px;
314 - } 302 + border-bottom: 1px solid #e0e0e0;
  303 + font-size: 26px;
315 304
316 - .thumb {  
317 - width: 100%;  
318 - height: 100%;  
319 - } 305 + &:last-child {
  306 + border-bottom: none;
  307 + }
320 308
321 - .tag {  
322 - position: absolute;  
323 - bottom: 0;  
324 - left: 0;  
325 - right: 0;  
326 - color: #fff;  
327 - text-align: center;  
328 - font-size: 12px; 309 + .thumb-wrap {
  310 + position: relative;
  311 + float: left;
  312 + width: 120px;
  313 + height: 160px;
  314 + }
329 315
330 - &:before {  
331 - display: block;  
332 - line-height: 1;  
333 - transform:scale(0.833); 316 + .thumb {
  317 + width: 100%;
  318 + height: 100%;
334 } 319 }
335 - }  
336 320
337 - .gift-tag {  
338 - height: 25px;  
339 - background: #a1ce4e; 321 + .tag {
  322 + position: absolute;
  323 + bottom: 0;
  324 + left: 0;
  325 + right: 0;
  326 + color: #fff;
  327 + text-align: center;
  328 + font-size: 12px;
340 329
341 - &:before {  
342 - content: '赠品'; 330 + &:before {
  331 + display: block;
  332 + line-height: 1;
  333 + transform:scale(0.833);
  334 + }
343 } 335 }
344 - }  
345 336
346 - .advance-buy-tag {  
347 - height: 25px;  
348 - background: #eb76aa; 337 + .gift-tag {
  338 + height: 25px;
  339 + background: #a1ce4e;
349 340
350 - &:before {  
351 - content: '加价购'; 341 + &:before {
  342 + content: '赠品';
  343 + }
352 } 344 }
353 - }  
354 345
355 - .deps {  
356 - margin-left: 135px;  
357 - } 346 + .advance-buy-tag {
  347 + height: 25px;
  348 + background: #eb76aa;
358 349
359 - .name {  
360 - font-size: 28px;  
361 - max-width: 70%;  
362 - text-overflow: -o-ellipsis-lastline;  
363 - overflow: hidden;  
364 - text-overflow: ellipsis;  
365 - display: -webkit-box;  
366 - -webkit-line-clamp: 2;  
367 - -webkit-box-orient: vertical;  
368 - } 350 + &:before {
  351 + content: '加价购';
  352 + }
  353 + }
369 354
370 - .row:nth-child(2) {  
371 - height: 45px;  
372 - line-height: 45px; 355 + .deps {
  356 + margin-left: 135px;
  357 + }
373 358
374 - > span {  
375 - margin-right: 15px; 359 + .name {
  360 + font-size: 28px;
  361 + max-width: 70%;
  362 + text-overflow: -o-ellipsis-lastline;
  363 + overflow: hidden;
  364 + text-overflow: ellipsis;
  365 + display: -webkit-box;
  366 + -webkit-line-clamp: 2;
  367 + -webkit-box-orient: vertical;
376 } 368 }
377 - }  
378 369
379 - .color, .size {  
380 - color: #b6b6b6;  
381 - } 370 + .row:nth-child(2) {
  371 + height: 45px;
  372 + line-height: 45px;
382 373
383 - .price-wrap {  
384 - position: absolute;  
385 - top: 20px;  
386 - right: 30px;  
387 - text-align: right;  
388 - } 374 + > span {
  375 + margin-right: 15px;
  376 + }
  377 + }
389 378
390 - .price {  
391 - color: #e01;  
392 - } 379 + .color, .size {
  380 + color: #b6b6b6;
  381 + }
393 382
394 - .count {  
395 - display: block;  
396 - color: #999;  
397 - text-align: right;  
398 - line-height: 45px;  
399 - } 383 + .price-wrap {
  384 + position: absolute;
  385 + top: 20px;
  386 + right: 30px;
  387 + text-align: right;
  388 + }
  389 +
  390 + .price {
  391 + color: #e01;
  392 + }
400 393
401 - .appear-date {  
402 - color: #f00; 394 + .count {
  395 + display: block;
  396 + color: #999;
  397 + text-align: right;
  398 + line-height: 45px;
  399 + }
  400 +
  401 + .appear-date {
  402 + color: #f00;
  403 + }
403 } 404 }
404 -}  
405 .sale-invoice { 405 .sale-invoice {
406 margin-top: -20px; 406 margin-top: -20px;
407 font-size: 24px; 407 font-size: 24px;
@@ -488,6 +488,19 @@ @@ -488,6 +488,19 @@
488 .desc { 488 .desc {
489 color: #999; 489 color: #999;
490 } 490 }
  491 +
  492 + .yoho-coin-help {
  493 + display: inline-block;
  494 + background-color: #b0b0b0;
  495 + border-radius: 28px;
  496 + width: 28px;
  497 + height: 28px;
  498 + line-height: 28px;
  499 + text-align: center;
  500 + color: #fff;
  501 + font-size: 22px;
  502 + margin-left: 10px;
  503 + }
491 } 504 }
492 505
493 .block { 506 .block {
@@ -569,7 +582,6 @@ @@ -569,7 +582,6 @@
569 input { 582 input {
570 margin: 0; 583 margin: 0;
571 } 584 }
572 -  
573 } 585 }
574 586
575 .total { 587 .total {
@@ -617,6 +629,59 @@ @@ -617,6 +629,59 @@
617 font-size: 32px; 629 font-size: 32px;
618 } 630 }
619 } 631 }
  632 +
  633 + .yoho-coin-help-dialog-bg {
  634 + background-color: #000;
  635 + width: 100%;
  636 + height: 100%;
  637 + position: fixed;
  638 + z-index: 1;
  639 + left: 0;
  640 + top: 0;
  641 + opacity: 0.3;
  642 + }
  643 +
  644 + .yoho-coin-help-dialog {
  645 + position: fixed;
  646 + width: 450px;
  647 + height: 510px;
  648 + background-color: #fff;
  649 + z-index: 2;
  650 + margin: auto;
  651 + left: 0;
  652 + right: 0;
  653 + top: 0;
  654 + bottom: 0;
  655 + border-radius: 10px;
  656 +
  657 + .yoho-coin-title {
  658 + font-size: 34px;
  659 + text-align: center;
  660 + height: 110px;
  661 + line-height: 140px;
  662 + color: #000;
  663 + }
  664 +
  665 + .yoho-coin-content {
  666 + height: 320px;
  667 + overflow: auto;
  668 + font-size: 28px;
  669 + padding: 0 35px;
  670 + color: #444;
  671 + p {
  672 + margin-top: 15px;
  673 + }
  674 + }
  675 +
  676 + .yoho-coin-footer {
  677 + border-top: 1px solid #e0e0e0;
  678 + color: #d0021b;
  679 + font-size: 34px;
  680 + height: 80px;
  681 + line-height: 80px;
  682 + text-align: center;
  683 + }
  684 + }
620 } 685 }
621 686
622 .tickets-confirm-page { 687 .tickets-confirm-page {
@@ -112,28 +112,18 @@ @@ -112,28 +112,18 @@
112 </a> 112 </a>
113 </li> 113 </li>
114 {{/if}} 114 {{/if}}
115 - <li class="coin" data-yoho-coin="{{yohoCoin}}"> 115 + <li class="coin" data-yoho-coin="{{yohoCoinCompute.yohoCoin}}" data-yoho-coin-click={{yohoCoinCompute.yohoCoinClick}}>
116 <span class="title">有货币</span> 116 <span class="title">有货币</span>
117 -  
118 - {{#if yohoCoin}}  
119 - <span class="desc used {{#unless useYohoCoin}}hide{{/unless}}">已抵¥{{useYohoCoin}}</span>  
120 - <span class="desc can-use {{#if useYohoCoin}}hide{{/if}}">可抵¥{{yohoCoin}}</span>  
121 -  
122 - {{#if useYohoCoin}}  
123 - <span class="coin-check">  
124 - <!-- <em>- ¥ {{useYohoCoin}}</em> -->  
125 - <i class="iconfont checkbox icon-cb-radio"></i>  
126 - </span> 117 + <span class="desc msg">{{yohoCoinCompute.yohoCoinMsg}}</span>
  118 + <span class="yoho-coin-help">?</span>
  119 + {{#if yohoCoinCompute.useYohoCoin}}
  120 + <span class="coin-check">
  121 + <i class="iconfont checkbox icon-cb-radio"></i>
  122 + </span>
127 {{else}} 123 {{else}}
128 - <span class="coin-check">  
129 - <!-- <em style="display: none;">- ¥ {{useYohoCoin}}</em> -->  
130 - <i class="iconfont checkbox icon-radio"></i>  
131 - </span>  
132 - {{/if}}  
133 - {{^}}  
134 - <span class="not-used coin-check">  
135 - 无有货币可用  
136 - </span> 124 + <span class="coin-check">
  125 + <i class="iconfont checkbox icon-radio"></i>
  126 + </span>
137 {{/if}} 127 {{/if}}
138 </li> 128 </li>
139 129
@@ -146,17 +136,6 @@ @@ -146,17 +136,6 @@
146 <span class="title">发票信息</span> 136 <span class="title">发票信息</span>
147 <span class="invoice-type"><i class="iconfont">&#xe614;</i></span> 137 <span class="invoice-type"><i class="iconfont">&#xe614;</i></span>
148 </a> 138 </a>
149 - <!-- <form id="invoice">  
150 - <input type="text" name="invoice-title" value="{{invoiceText}}" maxlength="30" placeholder="发票抬头">  
151 - <label>  
152 - 发票类型  
153 - <select class="invoice-type" name="invoice-type">  
154 - {{# invoice}}  
155 - <option value="{{id}}" {{#if isSelected}}selected{{/if}}>{{name}}</option>  
156 - {{/ invoice}}  
157 - </select>  
158 - </label>  
159 - </form> -->  
160 </li> 139 </li>
161 {{/if}} 140 {{/if}}
162 </ul> 141 </ul>
@@ -197,7 +176,17 @@ @@ -197,7 +176,17 @@
197 <a href="javascript:;">提交订单</a> 176 <a href="javascript:;">提交订单</a>
198 </div> 177 </div>
199 178
200 - 179 + <div class="yoho-coin-help-dialog-bg hide"></div>
  180 + <div class="yoho-coin-help-dialog hide">
  181 + <div class="yoho-coin-title">有货币使用条件:</div>
  182 + <div class="yoho-coin-content">
  183 + <p>1.订单金额大于20元(含)</p>
  184 + <p>2.有货币数量大于{{yohoCoinCompute.yoho_coin_pay_rule.num_limit}}个(含)</p>
  185 + <p>3.有货币支付不得超过每笔订单应付金额的{{yohoCoinCompute.yoho_coin_pay_rule.max_pay_rate_desc}}</p>
  186 + <p>备注:使用有货币数量为{{yohoCoinCompute.yoho_coin_pay_rule.num_limit}}的整数倍,100有货币抵1元。</p>
  187 + </div>
  188 + <div class="yoho-coin-footer">知道了</div>
  189 + </div>
201 {{/ orderEnsure}} 190 {{/ orderEnsure}}
202 </div> 191 </div>
203 {{> layout/footer}} 192 {{> layout/footer}}
@@ -33,30 +33,20 @@ @@ -33,30 +33,20 @@
33 <section class="block dispatch"> 33 <section class="block dispatch">
34 <div class="yoho-coin"> 34 <div class="yoho-coin">
35 <ul class="sale-invoice"> 35 <ul class="sale-invoice">
36 - <li class="coin" data-yoho-coin="{{yohoCoin}}"> 36 + <li class="coin" data-yoho-coin="{{yohoCoinCompute.yohoCoin}}" data-yoho-coin-click={{yohoCoinCompute.yohoCoinClick}}>
37 <span class="title">有货币</span> 37 <span class="title">有货币</span>
38 -  
39 - {{#if yohoCoin}}  
40 - <span class="desc used {{#unless useYohoCoin}}hide{{/unless}}">已抵¥{{useYohoCoin}}</span>  
41 - <span class="desc can-use {{#if useYohoCoin}}hide{{/if}}">可抵¥{{yohoCoin}}</span>  
42 -  
43 - {{#if useYohoCoin}}  
44 - <span class="coin-check">  
45 - <!-- <em>- ¥ {{useYohoCoin}}</em> -->  
46 - <i class="iconfont checkbox icon-cb-radio"></i>  
47 - </span> 38 + <span class="desc msg">{{yohoCoinCompute.yohoCoinMsg}}</span>
  39 + <span class="yoho-coin-help">?</span>
  40 + {{#if yohoCoinCompute.useYohoCoin}}
  41 + <span class="coin-check">
  42 + <i class="iconfont checkbox icon-cb-radio"></i>
  43 + </span>
48 {{else}} 44 {{else}}
49 - <span class="coin-check">  
50 - <!-- <em style="display: none;">- ¥ {{useYohoCoin}}</em> -->  
51 - <i class="iconfont checkbox icon-radio"></i>  
52 - </span>  
53 - {{/if}}  
54 - {{^}}  
55 - <span class="not-used coin-check">  
56 - 无有货币可用  
57 - </span> 45 + <span class="coin-check">
  46 + <i class="iconfont checkbox icon-radio"></i>
  47 + </span>
58 {{/if}} 48 {{/if}}
59 - </li> 49 + </li>
60 </ul> 50 </ul>
61 </div> 51 </div>
62 <div class="sub-block delivery-id"> 52 <div class="sub-block delivery-id">
@@ -88,6 +78,19 @@ @@ -88,6 +78,19 @@
88 您需要支付:<span>¥{{price}}</span> 78 您需要支付:<span>¥{{price}}</span>
89 <a href="javascript:;" id="ticketsConfirm">确认</a> 79 <a href="javascript:;" id="ticketsConfirm">确认</a>
90 </div> 80 </div>
  81 + <!--有货币使用弹框提示-->
  82 + <div class="yoho-coin-help-dialog-bg hide"></div>
  83 + <div class="yoho-coin-help-dialog hide">
  84 + <div class="yoho-coin-title">有货币使用条件:</div>
  85 + <div class="yoho-coin-content">
  86 + <p>1.订单金额大于20元(含)</p>
  87 + <p>2.有货币数量大于{{yohoCoinCompute.yoho_coin_pay_rule.num_limit}}个(含)</p>
  88 + <p>3.有货币支付不得超过每笔订单应付金额的{{yohoCoinCompute.yoho_coin_pay_rule.max_pay_rate_desc}}</p>
  89 + <p>备注:使用有货币数量为{{yohoCoinCompute.yoho_coin_pay_rule.num_limit}}的整数倍,100有货币抵1元。</p>
  90 + </div>
  91 + <div class="yoho-coin-footer">知道了</div>
  92 + </div>
  93 +
91 <input type="hidden" name="ticketsPage" id="ticketsPage" value="1"> 94 <input type="hidden" name="ticketsPage" id="ticketsPage" value="1">
92 <input type="hidden" name="productSku" id="productSku" value="{{productSku}}"> 95 <input type="hidden" name="productSku" id="productSku" value="{{productSku}}">
93 <input type="hidden" name="buyNumber" id="buyNumber" value="{{buyNumber}}"> 96 <input type="hidden" name="buyNumber" id="buyNumber" value="{{buyNumber}}">
@@ -398,7 +398,13 @@ class CartModel @@ -398,7 +398,13 @@ class CartModel
398 if (!empty($orderInfo)) { 398 if (!empty($orderInfo)) {
399 $orderInfo['paymentType'] = isset($orderInfo['paymentType']) ? $orderInfo['paymentType'] : ''; 399 $orderInfo['paymentType'] = isset($orderInfo['paymentType']) ? $orderInfo['paymentType'] : '';
400 $orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentType'], $orderInfo['couponCode'], $orderInfo['yohoCoin'], $skuList); 400 $orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentType'], $orderInfo['couponCode'], $orderInfo['yohoCoin'], $skuList);
  401 + // 有货币
  402 + $result['yohoCoinCompute'] = $orderCompute['yohoCoinCompute'];
  403 + } else {
  404 + // 有货币
  405 + $result['yohoCoinCompute'] = self::yohoCoinCompute($pay['data']);
401 } 406 }
  407 +
402 // 根据地址id查询地址信息 408 // 根据地址id查询地址信息
403 if (isset($orderInfo['address'])) { 409 if (isset($orderInfo['address'])) {
404 $address = $orderInfo['address']; 410 $address = $orderInfo['address'];
@@ -525,17 +531,17 @@ class CartModel @@ -525,17 +531,17 @@ class CartModel
525 if (isset($payReturn['payment_way'])) { 531 if (isset($payReturn['payment_way'])) {
526 $onePay = array(); 532 $onePay = array();
527 $isPaymentType = true; 533 $isPaymentType = true;
528 - foreach ($payReturn['payment_way'] as $pay) {  
529 - if ($pay['is_support'] !== 'Y') { 534 + foreach ($payReturn['payment_way'] as $val) {
  535 + if ($val['is_support'] !== 'Y') {
530 continue; 536 continue;
531 } 537 }
532 538
533 $onePay = array(); 539 $onePay = array();
534 - $onePay['id'] = $pay['payment_id'];  
535 - $onePay['paymentType'] = $pay['payment_type'];  
536 - $onePay['name'] = $pay['payment_type_name'];  
537 - $onePay['isSupport'] = $pay['is_support'] === 'Y';  
538 -// $onePay['default'] = ($pay['default'] === 'Y'); 540 + $onePay['id'] = $val['payment_id'];
  541 + $onePay['paymentType'] = $val['payment_type'];
  542 + $onePay['name'] = $val['payment_type_name'];
  543 + $onePay['isSupport'] = $val['is_support'] === 'Y';
  544 +// $onePay['default'] = ($val['default'] === 'Y');
539 if (isset($orderInfo['paymentType']) && $onePay['paymentType'] === $orderInfo['paymentType']) { 545 if (isset($orderInfo['paymentType']) && $onePay['paymentType'] === $orderInfo['paymentType']) {
540 $onePay['recommend'] = true; 546 $onePay['recommend'] = true;
541 $isPaymentType = false; 547 $isPaymentType = false;
@@ -550,14 +556,6 @@ class CartModel @@ -550,14 +556,6 @@ class CartModel
550 } 556 }
551 } 557 }
552 558
553 - // 有货币  
554 - $result['yohoCoin'] = Helpers::transPrice($payReturn['yoho_coin']);  
555 - /*  
556 - * 默认使用有货币  
557 - * $result['useYohoCoin'] = isset($orderCompute['use_yoho_coin']) ? $orderCompute['use_yoho_coin'] : $payReturn['use_yoho_coin'];  
558 - */  
559 - $result['useYohoCoin'] = isset($orderCompute['use_yoho_coin']) ? $orderCompute['use_yoho_coin'] : false;  
560 -  
561 // 订单数据 559 // 订单数据
562 if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) { 560 if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) {
563 //判断是否为JIT商品 561 //判断是否为JIT商品
@@ -579,8 +577,6 @@ class CartModel @@ -579,8 +577,6 @@ class CartModel
579 // 商品金额 577 // 商品金额
580 $result['goodsPrice'] = $payReturn['shopping_cart_data']['str_order_amount']; 578 $result['goodsPrice'] = $payReturn['shopping_cart_data']['str_order_amount'];
581 579
582 - //print_r($payReturn['shopping_cart_data']['gain_yoho_coin']);  
583 -  
584 //有货币 580 //有货币
585 if((int)$payReturn['shopping_cart_data']['gain_yoho_coin'] > 0) { 581 if((int)$payReturn['shopping_cart_data']['gain_yoho_coin'] > 0) {
586 582
@@ -630,6 +626,36 @@ class CartModel @@ -630,6 +626,36 @@ class CartModel
630 } 626 }
631 627
632 /** 628 /**
  629 + *有货币使用前端方案显示及是否可单击判断
  630 + */
  631 + public static function yohoCoinCompute($orderCompute) {
  632 + $yohoCoinData = ['totalYohoCoinNum' => 0, 'yohoCoin' => 0, 'useYohoCoin' => 0, 'yohoCoinClick' => 0, 'yohoCoinMsg' => '', 'yoho_coin_pay_rule' => []];
  633 +
  634 + if (empty($orderCompute) || empty($orderCompute['yoho_coin_pay_rule'])) {
  635 + return $yohoCoinData;
  636 + }
  637 +
  638 + $yohoCoinData = [
  639 + 'totalYohoCoinNum' => isset($orderCompute['total_yoho_coin_num']) ? intval($orderCompute['total_yoho_coin_num']) : 0,
  640 + 'yohoCoin' => isset($orderCompute['yoho_coin']) ? Helpers::transPrice($orderCompute['yoho_coin']) : 0,
  641 + 'useYohoCoin' => isset($orderCompute['use_yoho_coin']) ? Helpers::transPrice($orderCompute['use_yoho_coin']) : 0,
  642 + 'yohoCoinClick' => 0,
  643 + 'yohoCoinMsg' => '',
  644 + 'yoho_coin_pay_rule' => $orderCompute['yoho_coin_pay_rule']
  645 + ];
  646 +
  647 + if ($yohoCoinData['totalYohoCoinNum'] < 100) {
  648 + $yohoCoinData['yohoCoinMsg'] = "共{$yohoCoinData['totalYohoCoinNum']}有货币,满{$orderCompute['yoho_coin_pay_rule']['num_limit']}可用";
  649 + } else if ($yohoCoinData['useYohoCoin'] > 0 || $yohoCoinData['yohoCoin'] > 0) {
  650 + $yohoCoinData['yohoCoinMsg'] = '可抵¥' . ($yohoCoinData['useYohoCoin'] > 0 ? $yohoCoinData['useYohoCoin'] : $yohoCoinData['yohoCoin']);
  651 + $yohoCoinData['yohoCoinClick'] = 1;
  652 + } else {
  653 + $yohoCoinData['yohoCoinMsg'] = "不满足有货币使用条件";
  654 + }
  655 +
  656 + return $yohoCoinData;
  657 + }
  658 + /**
633 * 购物车结算--获取可用的优惠券数目 659 * 购物车结算--获取可用的优惠券数目
634 * 660 *
635 * @param int $uid 用户ID 661 * @param int $uid 用户ID
@@ -668,6 +694,7 @@ class CartModel @@ -668,6 +694,7 @@ class CartModel
668 // 有货币添加.00后缀 694 // 有货币添加.00后缀
669 $compute['data']['use_yoho_coin'] = Helpers::transPrice($compute['data']['use_yoho_coin']); 695 $compute['data']['use_yoho_coin'] = Helpers::transPrice($compute['data']['use_yoho_coin']);
670 $result = $compute['data']; 696 $result = $compute['data'];
  697 + $result['yohoCoinCompute'] = self::yohoCoinCompute($compute['data']);
671 } 698 }
672 699
673 return $result; 700 return $result;
@@ -1162,8 +1189,7 @@ class CartModel @@ -1162,8 +1189,7 @@ class CartModel
1162 $price = $data['data']['shopping_cart_data']['last_order_amount']; 1189 $price = $data['data']['shopping_cart_data']['last_order_amount'];
1163 $result['price'] = Helpers::transPrice($price, true); 1190 $result['price'] = Helpers::transPrice($price, true);
1164 // 有货币 1191 // 有货币
1165 - $result['yohoCoin'] = Helpers::transPrice($data['data']['yoho_coin']);  
1166 - $result['useYohoCoin'] = isset($data['data']['shopping_cart_data']['use_yoho_coin']) ? $data['data']['shopping_cart_data']['use_yoho_coin'] : false; 1192 + $result['yohoCoinCompute'] = self::yohoCoinCompute($data['data']['shopping_cart_data']);
1167 return $result; 1193 return $result;
1168 } 1194 }
1169 1195
@@ -1176,6 +1202,7 @@ class CartModel @@ -1176,6 +1202,7 @@ class CartModel
1176 // 有货币添加.00后缀 1202 // 有货币添加.00后缀
1177 $compute['data']['shopping_cart_data']['use_yoho_coin'] = Helpers::transPrice($compute['data']['shopping_cart_data']['use_yoho_coin']); 1203 $compute['data']['shopping_cart_data']['use_yoho_coin'] = Helpers::transPrice($compute['data']['shopping_cart_data']['use_yoho_coin']);
1178 $result = $compute['data']['shopping_cart_data']; 1204 $result = $compute['data']['shopping_cart_data'];
  1205 + $result['yohoCoinCompute'] = self::yohoCoinCompute($compute['data']['shopping_cart_data']);
1179 } 1206 }
1180 return $result; 1207 return $result;
1181 } 1208 }
@@ -20,7 +20,7 @@ define('USE_INTER_FACE_SHUNT', false);//分流开关 @@ -20,7 +20,7 @@ define('USE_INTER_FACE_SHUNT', false);//分流开关
20 define('API_URL', 'http://api-test3.yohops.com:9999/'); 20 define('API_URL', 'http://api-test3.yohops.com:9999/');
21 define('SERVICE_URL', 'http://service-test3.yohops.com:9999/'); 21 define('SERVICE_URL', 'http://service-test3.yohops.com:9999/');
22 define('YOHOBUY_URL', 'http://www.yohobuy.com/'); 22 define('YOHOBUY_URL', 'http://www.yohobuy.com/');
23 -define('SERVICE_NOTIFY', 'http://service-test1.yohops.com:9999/'); 23 +define('SERVICE_NOTIFY', 'http://service-test3.yohops.com:9999/');
24 24
25 $application = new Application(APPLICATION_PATH . '/configs/application.developer.ini'); 25 $application = new Application(APPLICATION_PATH . '/configs/application.developer.ini');
26 $application->bootstrap()->run(); 26 $application->bootstrap()->run();