Showing
5 changed files
with
86 additions
and
28 deletions
@@ -259,7 +259,7 @@ class CartData | @@ -259,7 +259,7 @@ class CartData | ||
259 | $param['uid'] = $uid; | 259 | $param['uid'] = $uid; |
260 | $param['client_secret'] = Sign::getSign($param); | 260 | $param['client_secret'] = Sign::getSign($param); |
261 | 261 | ||
262 | - return Yohobuy::get(API_URL, $param); | 262 | + return Yohobuy::get('http://192.168.102.205:8080/gateway/', $param); |
263 | } | 263 | } |
264 | 264 | ||
265 | /** | 265 | /** |
@@ -303,7 +303,7 @@ class CartData | @@ -303,7 +303,7 @@ class CartData | ||
303 | $param['uid'] = $uid; | 303 | $param['uid'] = $uid; |
304 | $param['client_secret'] = Sign::getSign($param); | 304 | $param['client_secret'] = Sign::getSign($param); |
305 | 305 | ||
306 | - return Yohobuy::get(API_URL, $param); | 306 | + return Yohobuy::get('http://192.168.102.205:8080/gateway/', $param); |
307 | } | 307 | } |
308 | 308 | ||
309 | /** | 309 | /** |
@@ -368,31 +368,32 @@ | @@ -368,31 +368,32 @@ | ||
368 | <dl class="play-bi-pan pan"> | 368 | <dl class="play-bi-pan pan"> |
369 | <dt>使用有货币支付</dt> | 369 | <dt>使用有货币支付</dt> |
370 | <dd> | 370 | <dd> |
371 | - <ul class="play-pan"> | 371 | + <ul class="play-pan" id="biprice" data-yoho-coin-num={{yohoCoinCompute.yohoCoinNum}} data-yoho-coin-click={{yohoCoinCompute.yohoCoinClick}}> |
372 | <li> | 372 | <li> |
373 | <div class="float-left"> | 373 | <div class="float-left"> |
374 | - 有货币满<span class="sign-amount">100</span>个即可使用,每次使用有货币为<span class="sign-amount">10</span>个 | 374 | + 有货币满<span class="sign-amount num-limit-coin">{{yohoCoinCompute.yoho_coin_pay_rule.num_limit}}</span>个即可使用,每次使用有货币为<span class="sign-amount num-limit-coin">{{yohoCoinCompute.yoho_coin_pay_rule.num_limit}}</span>的整数陪 |
375 | </div> | 375 | </div> |
376 | <div class="float-right yoho-coin-help">? | 376 | <div class="float-right yoho-coin-help">? |
377 | - <div class="yoho-coin-help-dialog"> | 377 | + <div class="yoho-coin-help-dialog hide"> |
378 | <span class="arrow-up"></span> | 378 | <span class="arrow-up"></span> |
379 | <div class="yoho-coin-help-dialog-title">有货币使用条件:</div> | 379 | <div class="yoho-coin-help-dialog-title">有货币使用条件:</div> |
380 | <div class="yoho-coin-help-dialog-content"> | 380 | <div class="yoho-coin-help-dialog-content"> |
381 | <ul> | 381 | <ul> |
382 | <li>(1)订单金额大于20元(含)</li> | 382 | <li>(1)订单金额大于20元(含)</li> |
383 | - <li>(2)有货币数量大于100个含)</li> | ||
384 | - <li>(3)有货币支付不得超过每笔订单应付金额50%</li> | ||
385 | - <li>备注:使用有货币数量为100的整数倍,100有货币抵1元。</li> | 383 | + <li>(2)有货币数量大于<span class="num-limit-coin">{{yohoCoinCompute.yoho_coin_pay_rule.num_limit}}</span>个含)</li> |
384 | + <li>(3)有货币支付不得超过每笔订单应付金额{{yohoCoinCompute.yoho_coin_pay_rule.max_pay_rate_desc}}</li> | ||
385 | + <li>备注:使用有货币数量为<span class="num-limit-coin">{{yohoCoinCompute.yoho_coin_pay_rule.num_limit}}</span>的整数倍,100有货币抵1元。</li> | ||
386 | </ul> | 386 | </ul> |
387 | </div> | 387 | </div> |
388 | </div> | 388 | </div> |
389 | </div> | 389 | </div> |
390 | </li> | 390 | </li> |
391 | <li> | 391 | <li> |
392 | - 您当前共有有货币<span class="sign-amount">450</span>个,可用<span class="sign-amount">300</span> 个 | 392 | + 您当前共有有货币<span class="sign-amount totalYohoCoinNum">{{yohoCoinCompute.totalYohoCoinNum}}</span>个, |
393 | + 可用<span class="sign-amount yohoCoinNum">{{yohoCoinCompute.yohoCoinNum}}</span> 个 | ||
393 | </li> | 394 | </li> |
394 | <li> | 395 | <li> |
395 | - 本次使用有货币 <span class="sign-amount">450</span>个 抵扣<span class="sign-amount">¥3.00</span> | 396 | + 本次使用有货币<span class="sign-amount yohoCoinNum">{{yohoCoinCompute.yohoCoinNum}}</span>个 抵扣<span class="sign-amount yohoCoin">¥{{yohoCoinCompute.yohoCoin}}</span> |
396 | </li> | 397 | </li> |
397 | <li> | 398 | <li> |
398 | <div class="float-left btn-group clearfix"> | 399 | <div class="float-left btn-group clearfix"> |
@@ -9,7 +9,8 @@ var $ = require('yoho.jquery'), | @@ -9,7 +9,8 @@ var $ = require('yoho.jquery'), | ||
9 | $receiptInfoSaveBtn = $('.receipt-info .save-receipt'), | 9 | $receiptInfoSaveBtn = $('.receipt-info .save-receipt'), |
10 | $receiptInfoCancelBtn = $('.receipt-info .cancel-receipt'), | 10 | $receiptInfoCancelBtn = $('.receipt-info .cancel-receipt'), |
11 | $eReceiptBtn = $('.receipt-type .e-receipt'), | 11 | $eReceiptBtn = $('.receipt-type .e-receipt'), |
12 | - $paperReceiptBtn = $('.receipt-type .paper-receipt'); | 12 | + $paperReceiptBtn = $('.receipt-type .paper-receipt'), |
13 | + $yohoCoinHelp = $('.yoho-coin-help'); | ||
13 | 14 | ||
14 | 15 | ||
15 | var address = require('./address'), | 16 | var address = require('./address'), |
@@ -272,13 +273,14 @@ var Order = { | @@ -272,13 +273,14 @@ var Order = { | ||
272 | e.$toPay.html((data.last_order_amount).toFixed(2)); | 273 | e.$toPay.html((data.last_order_amount).toFixed(2)); |
273 | 274 | ||
274 | //有货币清零状态更新 | 275 | //有货币清零状态更新 |
275 | - $('#biprice').val(accMul(100, data.use_yoho_coin)); | ||
276 | - if (~~data.use_yoho_coin === 0) { | 276 | + $('#biprice').val(accMul(100, data.yohoCoinCompute.useYohoCoin)); |
277 | + if (~~data.yohoCoinCompute.useYohoCoin === 0) { | ||
277 | $('.errbitip').text(''); | 278 | $('.errbitip').text(''); |
278 | } else { | 279 | } else { |
279 | - $('.errbitip').text('抵扣' + data.use_yoho_coin.toFixed(2) + '元'); | 280 | + $('.errbitip').text('抵扣' + data.yohoCoinCompute.useYohoCoin.toFixed(2) + '元'); |
280 | } | 281 | } |
281 | 282 | ||
283 | + //使用的红包 | ||
282 | envelopesVal = e.$useEnvelopesInput.data('all') - data.use_red_envelopes; | 284 | envelopesVal = e.$useEnvelopesInput.data('all') - data.use_red_envelopes; |
283 | 285 | ||
284 | if (~~data.use_red_envelopes > 0) { | 286 | if (~~data.use_red_envelopes > 0) { |
@@ -462,9 +464,11 @@ var Order = { | @@ -462,9 +464,11 @@ var Order = { | ||
462 | 464 | ||
463 | e.$loading.show(); | 465 | e.$loading.show(); |
464 | 466 | ||
467 | + | ||
465 | options = { | 468 | options = { |
466 | type: 'POST', | 469 | type: 'POST', |
467 | url: '/cart/index/orderCompute', | 470 | url: '/cart/index/orderCompute', |
471 | + | ||
468 | data: d, | 472 | data: d, |
469 | success: function(data) { | 473 | success: function(data) { |
470 | 474 | ||
@@ -566,20 +570,21 @@ var Order = { | @@ -566,20 +570,21 @@ var Order = { | ||
566 | 570 | ||
567 | c.winShow($pan); | 571 | c.winShow($pan); |
568 | }); | 572 | }); |
573 | + //不须要手动输入有货币了。 | ||
574 | + // e.$bp.keyup(function() { | ||
569 | 575 | ||
570 | - e.$bp.keyup(function() { | ||
571 | 576 | ||
572 | - var val = $(this).val(); | 577 | + // var val = $(this).val(); |
573 | 578 | ||
574 | - //if (val * 1 < 0 || val.indexOf('.') > 0) { | ||
575 | - if (!/^\d+$/.test(val + '')) { | ||
576 | - e.$errorTip.html('请输入一个正整数'); | ||
577 | - } else if (val * 1 > $(this).data('bi') * 1) { | ||
578 | - e.$errorTip.html('您的有货币不足'); | ||
579 | - } else { | ||
580 | - e.$errorTip.html('抵扣' + (val / 100).toFixed(2) + '元'); | ||
581 | - } | ||
582 | - }); | 579 | + // //if (val * 1 < 0 || val.indexOf('.') > 0) { |
580 | + // if (!/^\d+$/.test(val + '')) { | ||
581 | + // e.$errorTip.html('请输入一个正整数'); | ||
582 | + // } else if (val * 1 > $(this).data('bi') * 1) { | ||
583 | + // e.$errorTip.html('您的有货币不足'); | ||
584 | + // } else { | ||
585 | + // e.$errorTip.html('抵扣' + (val / 100).toFixed(2) + '元'); | ||
586 | + // } | ||
587 | + // }); | ||
583 | 588 | ||
584 | // 取消yoho 币 | 589 | // 取消yoho 币 |
585 | $('.cancel-bi').click(function() { | 590 | $('.cancel-bi').click(function() { |
@@ -788,6 +793,7 @@ $('.why').click(function() { | @@ -788,6 +793,7 @@ $('.why').click(function() { | ||
788 | $('#differentBag').click(function() { | 793 | $('#differentBag').click(function() { |
789 | return false; | 794 | return false; |
790 | }); | 795 | }); |
796 | + | ||
791 | $(document).click(function() { | 797 | $(document).click(function() { |
792 | $('#differentBag').hide(); | 798 | $('#differentBag').hide(); |
793 | }); | 799 | }); |
@@ -1049,3 +1055,10 @@ $('#input-mobile').bind('input propertychange', function() { | @@ -1049,3 +1055,10 @@ $('#input-mobile').bind('input propertychange', function() { | ||
1049 | $('.invoice-phone .enpty-input').addClass('hide'); | 1055 | $('.invoice-phone .enpty-input').addClass('hide'); |
1050 | } | 1056 | } |
1051 | }); | 1057 | }); |
1058 | + | ||
1059 | +//有货币帮助弹框 | ||
1060 | +$yohoCoinHelp.hover(function() { | ||
1061 | + $(this).find('.yoho-coin-help-dialog').removeClass('hide'); | ||
1062 | +}, function() { | ||
1063 | + $(this).find('.yoho-coin-help-dialog').addClass('hide'); | ||
1064 | +}); |
@@ -354,8 +354,12 @@ | @@ -354,8 +354,12 @@ | ||
354 | } | 354 | } |
355 | 355 | ||
356 | li { | 356 | li { |
357 | - margin-bottom: 10px; | 357 | + margin-top: 18px; |
358 | overflow: hidden; | 358 | overflow: hidden; |
359 | + | ||
360 | + &:last-child { | ||
361 | + margin-top: 28px; | ||
362 | + } | ||
359 | } | 363 | } |
360 | 364 | ||
361 | .yoho-coin-help { | 365 | .yoho-coin-help { |
@@ -368,6 +372,7 @@ | @@ -368,6 +372,7 @@ | ||
368 | text-align: center; | 372 | text-align: center; |
369 | color: #fff; | 373 | color: #fff; |
370 | font-size: 14px; | 374 | font-size: 14px; |
375 | + cursor: pointer; | ||
371 | } | 376 | } |
372 | 377 | ||
373 | .yoho-coin-help-dialog { | 378 | .yoho-coin-help-dialog { |
@@ -381,6 +386,11 @@ | @@ -381,6 +386,11 @@ | ||
381 | height: 140px; | 386 | height: 140px; |
382 | padding: 15px; | 387 | padding: 15px; |
383 | text-align: left; | 388 | text-align: left; |
389 | + cursor: auto; | ||
390 | + | ||
391 | + li { | ||
392 | + margin-top: 10px; | ||
393 | + } | ||
384 | } | 394 | } |
385 | 395 | ||
386 | .yoho-coin-help-dialog-title { | 396 | .yoho-coin-help-dialog-title { |
@@ -55,7 +55,6 @@ class CartModel | @@ -55,7 +55,6 @@ class CartModel | ||
55 | // 调用接口,获取购物车数据 | 55 | // 调用接口,获取购物车数据 |
56 | $cartData = CartData::cartData($uid, $shoppingKey); | 56 | $cartData = CartData::cartData($uid, $shoppingKey); |
57 | 57 | ||
58 | -// print_r($cartData); exit; | ||
59 | // 接口异常时,购物车置为空 | 58 | // 接口异常时,购物车置为空 |
60 | if (empty($cartData['data'])) { | 59 | if (empty($cartData['data'])) { |
61 | $result['isEmpty'] = true; | 60 | $result['isEmpty'] = true; |
@@ -694,7 +693,6 @@ class CartModel | @@ -694,7 +693,6 @@ class CartModel | ||
694 | { | 693 | { |
695 | /* 调接口订单确认接口 */ | 694 | /* 调接口订单确认接口 */ |
696 | $pay = CartData::cartPay($uid, $cartType); | 695 | $pay = CartData::cartPay($uid, $cartType); |
697 | - | ||
698 | return self::filterCartPay($pay, $cartType, $isAdvanceCart, $uid); | 696 | return self::filterCartPay($pay, $cartType, $isAdvanceCart, $uid); |
699 | } | 697 | } |
700 | /** | 698 | /** |
@@ -909,6 +907,8 @@ class CartModel | @@ -909,6 +907,8 @@ class CartModel | ||
909 | } | 907 | } |
910 | $result['isNewUser'] = $isNewUser ? true : false; | 908 | $result['isNewUser'] = $isNewUser ? true : false; |
911 | 909 | ||
910 | + //有货币 | ||
911 | + $result['yohoCoinCompute'] = self::yohoCoinCompute($pay['data']); | ||
912 | //JIT拆单需求 package | 912 | //JIT拆单需求 package |
913 | $result['packages'] = self::getPackageInfo($pay['data']['shopping_cart_data']); | 913 | $result['packages'] = self::getPackageInfo($pay['data']['shopping_cart_data']); |
914 | } while (false); | 914 | } while (false); |
@@ -1002,6 +1002,8 @@ class CartModel | @@ -1002,6 +1002,8 @@ class CartModel | ||
1002 | $compute['data']['promotion_formula_list'] = $promotionFormulaList; | 1002 | $compute['data']['promotion_formula_list'] = $promotionFormulaList; |
1003 | //JIT拆单 | 1003 | //JIT拆单 |
1004 | $compute['packages'] = self::getPackageInfo($compute['data']); | 1004 | $compute['packages'] = self::getPackageInfo($compute['data']); |
1005 | + //有货币 | ||
1006 | + $compute['data']['yohoCoinCompute'] = self::yohoCoinCompute($compute['data']); | ||
1005 | } | 1007 | } |
1006 | $result = $compute; | 1008 | $result = $compute; |
1007 | } | 1009 | } |
@@ -1580,4 +1582,36 @@ class CartModel | @@ -1580,4 +1582,36 @@ class CartModel | ||
1580 | { | 1582 | { |
1581 | return CartData::submitTicket($uid, $productSku, $buyNumber, $mobile, $yohoCoin); | 1583 | return CartData::submitTicket($uid, $productSku, $buyNumber, $mobile, $yohoCoin); |
1582 | } | 1584 | } |
1585 | + | ||
1586 | + /** | ||
1587 | + *有货币使用前端方案显示及是否可单击判断 | ||
1588 | + */ | ||
1589 | + public static function yohoCoinCompute($orderCompute) { | ||
1590 | + $yohoCoinData = ['totalYohoCoinNum' => 0, 'yohoCoin' => 0, 'yohoCoinNum' =>0, 'useYohoCoin' => 0, 'yohoCoinClick' => 0, 'yohoCoinMsg' => '']; | ||
1591 | + | ||
1592 | + if (empty($orderCompute)) { | ||
1593 | + return $yohoCoinData; | ||
1594 | + } | ||
1595 | + | ||
1596 | + $yohoCoinData = [ | ||
1597 | + 'totalYohoCoinNum' => isset($orderCompute['total_yoho_coin_num']) ? intval($orderCompute['total_yoho_coin_num']) : 0, | ||
1598 | + 'yohoCoin' => isset($orderCompute['yoho_coin']) ? Helpers::transPrice($orderCompute['yoho_coin']) : 0, | ||
1599 | + 'yohoCoinNum' => isset($orderCompute['yoho_coin']) ? $orderCompute['yoho_coin'] * 100 : 0, | ||
1600 | + 'useYohoCoin' => isset($orderCompute['use_yoho_coin']) ? Helpers::transPrice($orderCompute['use_yoho_coin']) : 0, | ||
1601 | + 'yohoCoinClick' => 0, | ||
1602 | + 'yohoCoinMsg' => '', | ||
1603 | + 'yoho_coin_pay_rule' => $orderCompute['yoho_coin_pay_rule'] | ||
1604 | + ]; | ||
1605 | + | ||
1606 | + if ($yohoCoinData['totalYohoCoinNum'] < 100) { | ||
1607 | + $yohoCoinData['yohoCoinMsg'] = "共{$yohoCoinData['totalYohoCoinNum']}有货币,满{$orderCompute['yoho_coin_pay_rule']['num_limit']}可用"; | ||
1608 | + } else if ($yohoCoinData['useYohoCoin'] > 0 || $yohoCoinData['yohoCoin'] > 0) { | ||
1609 | + $yohoCoinData['yohoCoinMsg'] = '可抵¥' . ($yohoCoinData['useYohoCoin'] > 0 ? $yohoCoinData['useYohoCoin'] : $yohoCoinData['yohoCoin']); | ||
1610 | + $yohoCoinData['yohoCoinClick'] = 1; | ||
1611 | + $yohoCoinData['yohoCoinNum'] = ($yohoCoinData['useYohoCoin'] > 0 ? $yohoCoinData['useYohoCoin'] : $yohoCoinData['yohoCoin']) * 100; | ||
1612 | + } else { | ||
1613 | + $yohoCoinData['yohoCoinMsg'] = "不满足有货币使用条件"; | ||
1614 | + } | ||
1615 | + return $yohoCoinData; | ||
1616 | + } | ||
1583 | } | 1617 | } |
-
Please register or login to post a comment