Merge branch 'release/4.4' of http://git.dev.yoho.cn/web/yohobuy into release/4.4
Showing
7 changed files
with
16 additions
and
5 deletions
@@ -266,11 +266,12 @@ class CartData | @@ -266,11 +266,12 @@ class CartData | ||
266 | * @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运 | 266 | * @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运 |
267 | * @param int $paymentType 支付方式,1表示在线支付,2表示货到付款 | 267 | * @param int $paymentType 支付方式,1表示在线支付,2表示货到付款 |
268 | * @param string $couponCode 优惠券码 | 268 | * @param string $couponCode 优惠券码 |
269 | + * @param string $promotionCode 优惠码 | ||
269 | * @param mixed $yohoCoin 使用的YOHO币数量 | 270 | * @param mixed $yohoCoin 使用的YOHO币数量 |
270 | * @param int $redEnvelopes 红包 | 271 | * @param int $redEnvelopes 红包 |
271 | * @return array 接口返回的数据 | 272 | * @return array 接口返回的数据 |
272 | */ | 273 | */ |
273 | - public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin, $redEnvelopes) | 274 | + public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode,$promotionCode,$yohoCoin, $redEnvelopes) |
274 | { | 275 | { |
275 | $param = Yohobuy::param(); | 276 | $param = Yohobuy::param(); |
276 | $param['method'] = 'app.Shopping.compute'; | 277 | $param['method'] = 'app.Shopping.compute'; |
@@ -280,6 +281,9 @@ class CartData | @@ -280,6 +281,9 @@ class CartData | ||
280 | if (!empty($couponCode)) { | 281 | if (!empty($couponCode)) { |
281 | $param['coupon_code'] = $couponCode; | 282 | $param['coupon_code'] = $couponCode; |
282 | } | 283 | } |
284 | + if (!empty($promotionCode)) { | ||
285 | + $param['promotion_code'] = $promotionCode; | ||
286 | + } | ||
283 | if (!empty($yohoCoin)) { | 287 | if (!empty($yohoCoin)) { |
284 | $param['use_yoho_coin'] = $yohoCoin; | 288 | $param['use_yoho_coin'] = $yohoCoin; |
285 | } | 289 | } |
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.
@@ -370,16 +370,19 @@ var Order = { | @@ -370,16 +370,19 @@ var Order = { | ||
370 | var expressVal = $('.express-list input[name="carriagegroup"]:checked').val(); | 370 | var expressVal = $('.express-list input[name="carriagegroup"]:checked').val(); |
371 | var biVal = $('#biprice.is-select').val(); | 371 | var biVal = $('#biprice.is-select').val(); |
372 | var codeVal = $juangroupInput.val(); | 372 | var codeVal = $juangroupInput.val(); |
373 | + var promotionVal = $juangroupInput.closest('li').find('#juancode').val(); | ||
373 | var cartType = $('.address-manage').attr('cart-type'); | 374 | var cartType = $('.address-manage').attr('cart-type'); |
374 | var redEnvelopes = $('.use-envelopes input:checked').attr('data-use'); | 375 | var redEnvelopes = $('.use-envelopes input:checked').attr('data-use'); |
375 | var resultData; | 376 | var resultData; |
376 | 377 | ||
377 | - codeVal = !!codeVal ? codeVal : $juangroupInput.closest('li').find('#juancode').val(); | 378 | + codeVal = codeVal ? codeVal : $juangroupInput.closest('li').find('#juancode').val(); |
379 | + | ||
378 | 380 | ||
379 | resultData = { | 381 | resultData = { |
380 | cartType: cartType, | 382 | cartType: cartType, |
381 | deliveryWay: expressVal, | 383 | deliveryWay: expressVal, |
382 | couponCode: codeVal, | 384 | couponCode: codeVal, |
385 | + promotionCode: promotionVal, | ||
383 | yohoCoin: biVal | 386 | yohoCoin: biVal |
384 | 387 | ||
385 | //redEnvelopes: e.$useEnvelopesInput.length > 0 ? ~~e.$hasEnvelopes.text().substring(1) : '0' | 388 | //redEnvelopes: e.$useEnvelopesInput.length > 0 ? ~~e.$hasEnvelopes.text().substring(1) : '0' |
@@ -803,11 +803,12 @@ class CartModel | @@ -803,11 +803,12 @@ class CartModel | ||
803 | * @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运 | 803 | * @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运 |
804 | * @param int $paymentType 支付方式,1表示在线支付,2表示货到付款 | 804 | * @param int $paymentType 支付方式,1表示在线支付,2表示货到付款 |
805 | * @param string $couponCode 优惠券码 | 805 | * @param string $couponCode 优惠券码 |
806 | + * @param string $promotionCode 优惠码 | ||
806 | * @param mixed $yohoCoin 使用的YOHO币数量 | 807 | * @param mixed $yohoCoin 使用的YOHO币数量 |
807 | * @param int $redEnvelopes 红包 | 808 | * @param int $redEnvelopes 红包 |
808 | * @return array 接口返回的数据 | 809 | * @return array 接口返回的数据 |
809 | */ | 810 | */ |
810 | - public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin, $redEnvelopes) | 811 | + public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode,$promotionCode,$yohoCoin, $redEnvelopes) |
811 | { | 812 | { |
812 | $result = array('code' => 400, 'message' => self::ERROR_400_MESSAGE, 'data' => array()); | 813 | $result = array('code' => 400, 'message' => self::ERROR_400_MESSAGE, 'data' => array()); |
813 | 814 | ||
@@ -815,7 +816,7 @@ class CartModel | @@ -815,7 +816,7 @@ class CartModel | ||
815 | if (!empty($yohoCoin)) { | 816 | if (!empty($yohoCoin)) { |
816 | $yohoCoin = intval($yohoCoin) / 100; | 817 | $yohoCoin = intval($yohoCoin) / 100; |
817 | } | 818 | } |
818 | - $compute = CartData::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin, $redEnvelopes); | 819 | + $compute = CartData::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode,$promotionCode,$yohoCoin, $redEnvelopes); |
819 | if ($compute && isset($compute['code'])) { | 820 | if ($compute && isset($compute['code'])) { |
820 | /* 商品价格明细 */ | 821 | /* 商品价格明细 */ |
821 | if (!empty($compute['data']['promotion_formula_list'])) { | 822 | if (!empty($compute['data']['promotion_formula_list'])) { |
@@ -388,10 +388,13 @@ class IndexController extends WebAction | @@ -388,10 +388,13 @@ class IndexController extends WebAction | ||
388 | $deliveryWay = $this->post('deliveryWay', 1); | 388 | $deliveryWay = $this->post('deliveryWay', 1); |
389 | $paymentType = $this->post('paymentType', 1); | 389 | $paymentType = $this->post('paymentType', 1); |
390 | $couponCode = $this->post('couponCode', null); | 390 | $couponCode = $this->post('couponCode', null); |
391 | + $promotionCode = $this->post('promotionCode', null); | ||
391 | $yohoCoin = $this->post('yohoCoin', null); | 392 | $yohoCoin = $this->post('yohoCoin', null); |
392 | $redEnvelopes = $this->post('redEnvelopes', null); | 393 | $redEnvelopes = $this->post('redEnvelopes', null); |
393 | $uid = $this->getUid(false); | 394 | $uid = $this->getUid(false); |
394 | - $result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin, $redEnvelopes); | 395 | + //优先取优惠码 |
396 | + $couponCode = $promotionCode ? null : $couponCode; | ||
397 | + $result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $promotionCode, $yohoCoin, $redEnvelopes); | ||
395 | } | 398 | } |
396 | 399 | ||
397 | $this->echoJson($result); | 400 | $this->echoJson($result); |
-
Please register or login to post a comment