Authored by Rock Zhang

Merge branch 'hotfix/yohocoinuse' into beta

Conflicts:
	library/Api/Yohobuy.php
	static/js/cart/good.js
	static/js/cart/order-ensure.js
framework @ e9d066dd
1 -Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2 1 +Subproject commit e9d066dd88a8e7e37103021c427a205a5cfcdcec
@@ -248,13 +248,15 @@ class CartData @@ -248,13 +248,15 @@ class CartData
248 * 248 *
249 * @param int $uid 用户ID 249 * @param int $uid 用户ID
250 * @param string $cartType 购物车类型,ordinary表示普通购物车 250 * @param string $cartType 购物车类型,ordinary表示普通购物车
  251 + * @param int $isUseYohoCoin 是否使用有货币,默认0不使用, 1使用
251 * @return array 接口返回的数据 252 * @return array 接口返回的数据
252 */ 253 */
253 - public static function cartPay($uid, $cartType) 254 + public static function cartPay($uid, $cartType, $isUseYohoCoin = 0)
254 { 255 {
255 $param = Yohobuy::param(); 256 $param = Yohobuy::param();
256 $param['method'] = 'app.Shopping.payment'; 257 $param['method'] = 'app.Shopping.payment';
257 $param['cart_type'] = $cartType; 258 $param['cart_type'] = $cartType;
  259 + $param['yoho_coin_mode'] = $isUseYohoCoin;
258 $param['uid'] = $uid; 260 $param['uid'] = $uid;
259 $param['client_secret'] = Sign::getSign($param); 261 $param['client_secret'] = Sign::getSign($param);
260 262
@@ -12,8 +12,6 @@ var $ = require('jquery'), @@ -12,8 +12,6 @@ var $ = require('jquery'),
12 var dialog = require('../me/dialog'), 12 var dialog = require('../me/dialog'),
13 tip = require('../plugin/tip'); 13 tip = require('../plugin/tip');
14 14
15 -// orderInfo = require('./order-info').orderInfo;  
16 -  
17 var $selectAllBtn = $('.balance .checkbox'), 15 var $selectAllBtn = $('.balance .checkbox'),
18 requesting = false; 16 requesting = false;
19 17
@@ -107,9 +105,7 @@ $('.icon-del').on('touchstart', function(e) { @@ -107,9 +105,7 @@ $('.icon-del').on('touchstart', function(e) {
107 autoHide: true, 105 autoHide: true,
108 fast: true 106 fast: true
109 }); 107 });
110 -  
111 - // orderInfo('couponCode', null);  
112 - // orderInfo('couponName', null); 108 + window.setCookie('order-info', '');
113 window.setCookie('_yoho-cart-refreshByDelete', true); 109 window.setCookie('_yoho-cart-refreshByDelete', true);
114 window.location.href = '/cart/index/index?cartType=' + $('#cartType').val(); 110 window.location.href = '/cart/index/index?cartType=' + $('#cartType').val();
115 } else { 111 } else {
@@ -88,7 +88,11 @@ $('.invoice').on('touchend', '.checkbox', function() { @@ -88,7 +88,11 @@ $('.invoice').on('touchend', '.checkbox', function() {
88 } 88 }
89 }); 89 });
90 90
91 -function orderCompute() { 91 +function orderCompute(firstEnter) {
  92 + var yohoCoin = orderInfo('yohoCoin');
  93 + if (firstEnter) {
  94 + yohoCoin = 0;
  95 + }
92 $.ajax({ 96 $.ajax({
93 method: 'POST', 97 method: 'POST',
94 url: '/cart/index/orderCompute', 98 url: '/cart/index/orderCompute',
@@ -97,7 +101,7 @@ function orderCompute() { @@ -97,7 +101,7 @@ function orderCompute() {
97 deliveryId: orderInfo('deliveryId'), 101 deliveryId: orderInfo('deliveryId'),
98 paymentTypeId: orderInfo('paymentTypeId'), 102 paymentTypeId: orderInfo('paymentTypeId'),
99 couponCode: orderInfo('couponCode'), 103 couponCode: orderInfo('couponCode'),
100 - yohoCoin: orderInfo('yohoCoin') 104 + yohoCoin: yohoCoin
101 } 105 }
102 }).then(function(res) { 106 }).then(function(res) {
103 var priceHtml; 107 var priceHtml;
@@ -127,7 +131,7 @@ function orderCompute() { @@ -127,7 +131,7 @@ function orderCompute() {
127 } 131 }
128 132
129 // 进入页面计算一次价格 133 // 进入页面计算一次价格
130 -orderCompute(); 134 +//orderCompute(1);
131 135
132 function submitOrder() { 136 function submitOrder() {
133 var invoiceText = $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'), 137 var invoiceText = $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'),
@@ -69,7 +69,7 @@ @@ -69,7 +69,7 @@
69 <span class="title">YOHO币</span> 69 <span class="title">YOHO币</span>
70 70
71 {{#if yohoCoin}} 71 {{#if yohoCoin}}
72 - <span class="desc used {{#unless useYohoCoin}}hide{{/if}}">已抵¥{{useYohoCoin}}</span> 72 + <span class="desc used {{#unless useYohoCoin}}hide{{/unless}}">已抵¥{{useYohoCoin}}</span>
73 <span class="desc can-use {{#if useYohoCoin}}hide{{/if}}">可抵¥{{yohoCoin}}</span> 73 <span class="desc can-use {{#if useYohoCoin}}hide{{/if}}">可抵¥{{yohoCoin}}</span>
74 74
75 {{#if useYohoCoin}} 75 {{#if useYohoCoin}}
@@ -449,7 +449,11 @@ class CartModel @@ -449,7 +449,11 @@ class CartModel
449 449
450 // 有货币 450 // 有货币
451 $result['yohoCoin'] = $payReturn['yoho_coin']; 451 $result['yohoCoin'] = $payReturn['yoho_coin'];
452 - $result['useYohoCoin'] = isset($orderCompute['use_yoho_coin']) ? $orderCompute['use_yoho_coin'] : $payReturn['use_yoho_coin']; 452 + /*
  453 + * 默认使用有货币
  454 + * $result['useYohoCoin'] = isset($orderCompute['use_yoho_coin']) ? $orderCompute['use_yoho_coin'] : $payReturn['use_yoho_coin'];
  455 + */
  456 + $result['useYohoCoin'] = isset($orderCompute['use_yoho_coin']) ? $orderCompute['use_yoho_coin'] : false;
453 457
454 // 订单数据 458 // 订单数据
455 if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) { 459 if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) {