Showing
6 changed files
with
63 additions
and
23 deletions
@@ -469,7 +469,7 @@ class CartData | @@ -469,7 +469,7 @@ class CartData | ||
469 | } | 469 | } |
470 | 470 | ||
471 | /** | 471 | /** |
472 | - * 添加电子票 | 472 | + * 校验电子票 |
473 | * @param int $uid | 473 | * @param int $uid |
474 | * @param int $productSku | 474 | * @param int $productSku |
475 | * @param int $buyNumber | 475 | * @param int $buyNumber |
@@ -477,7 +477,7 @@ class CartData | @@ -477,7 +477,7 @@ class CartData | ||
477 | * @author sefon 2016-7-2 18:12:30 | 477 | * @author sefon 2016-7-2 18:12:30 |
478 | * @return array | 478 | * @return array |
479 | */ | 479 | */ |
480 | - public static function addTickets ($uid, $productSku, $buyNumber, $useYohoCoin = 0) | 480 | + public static function checkickets ($uid, $productSku, $buyNumber, $useYohoCoin = 0) |
481 | { | 481 | { |
482 | $param = Yohobuy::param(); | 482 | $param = Yohobuy::param(); |
483 | $param['method'] = 'app.shopping.ticket'; | 483 | $param['method'] = 'app.shopping.ticket'; |
@@ -39,7 +39,10 @@ var $chosePanel = $('#chose-panel'), | @@ -39,7 +39,10 @@ var $chosePanel = $('#chose-panel'), | ||
39 | $soonSoldOut = $('.soonSoldOut-tag'), | 39 | $soonSoldOut = $('.soonSoldOut-tag'), |
40 | $yohoPage = $('.yoho-page'), | 40 | $yohoPage = $('.yoho-page'), |
41 | //门票 限购数量 | 41 | //门票 限购数量 |
42 | - ticketsLimit = $('#limitNum').val(); | 42 | + ticketsLimit = $('#limitNum').val(), |
43 | + $productSku = $('#productSku'), | ||
44 | + $buyNumber = $('#buyNumber'), | ||
45 | + $buyNowForm = $('#buyNowForm'); | ||
43 | 46 | ||
44 | // 购物车编辑标相关变量 | 47 | // 购物车编辑标相关变量 |
45 | var isEdit, | 48 | var isEdit, |
@@ -261,17 +264,22 @@ function addTickets(productSku, buyNumber) { | @@ -261,17 +264,22 @@ function addTickets(productSku, buyNumber) { | ||
261 | var data = { | 264 | var data = { |
262 | productSku: productSku, | 265 | productSku: productSku, |
263 | buyNumber: buyNumber | 266 | buyNumber: buyNumber |
264 | - } | 267 | + }; |
265 | 268 | ||
266 | - //添加电子票 | 269 | + //校验电子票 |
267 | $.ajax({ | 270 | $.ajax({ |
268 | - url: '/cart/index/cart', | 271 | + url: '/cart/index/checkTickets', |
269 | dataType: 'json', | 272 | dataType: 'json', |
270 | data: data, | 273 | data: data, |
271 | type: 'post', | 274 | type: 'post', |
272 | success: function (addRestult) { | 275 | success: function (addRestult) { |
273 | - //调整订单确认页 | ||
274 | - window.location.href = '/cart/index/orderEnsure?cartType=tickets'; | 276 | + if (addRestult.code != 200) { |
277 | + tip.show(addRestult.masseage); | ||
278 | + } else { | ||
279 | + $productSku.val(productSku); | ||
280 | + $buyNumber.val(buyNumber); | ||
281 | + $buyNowForm.submit(); | ||
282 | + } | ||
275 | }, | 283 | }, |
276 | error: function () { | 284 | error: function () { |
277 | tip.show('网络异常~'); | 285 | tip.show('网络异常~'); |
@@ -184,9 +184,9 @@ | @@ -184,9 +184,9 @@ | ||
184 | {{/loginUrl}} | 184 | {{/loginUrl}} |
185 | 185 | ||
186 | {{#if tickets}} | 186 | {{#if tickets}} |
187 | - <form name="buyNow" method="post" action="{{buyNowUrl}}"> | ||
188 | - <input type="hidden" name="productId"> | ||
189 | - <input type="hidden" name="buyNumber"> | 187 | + <form id="buyNowForm" method="post" action="{{ticketsConfirm}}"> |
188 | + <input type="hidden" name="productSku" id="productSku"> | ||
189 | + <input type="hidden" name="buyNumber" id="buyNumber"> | ||
190 | </form> | 190 | </form> |
191 | {{/if}} | 191 | {{/if}} |
192 | 192 |
@@ -1106,4 +1106,19 @@ class CartModel | @@ -1106,4 +1106,19 @@ class CartModel | ||
1106 | return $result; | 1106 | return $result; |
1107 | } | 1107 | } |
1108 | 1108 | ||
1109 | + /** | ||
1110 | + * 获取门票数据 | ||
1111 | + * @param int $uid | ||
1112 | + * @param int $productSku | ||
1113 | + * @param int $buyNumber | ||
1114 | + * @param int $useYohoCoin | ||
1115 | + * @return arr | ||
1116 | + */ | ||
1117 | + public static function getTickets($uid, $productSku, $buyNumber, $useYohoCoin = 0) | ||
1118 | + { | ||
1119 | + $result = CartData::checkickets($uid, $productSku, $buyNumber, $useYohoCoin); | ||
1120 | + | ||
1121 | + return $result; | ||
1122 | + } | ||
1123 | + | ||
1109 | } | 1124 | } |
@@ -575,22 +575,39 @@ class IndexController extends AbstractAction | @@ -575,22 +575,39 @@ class IndexController extends AbstractAction | ||
575 | } | 575 | } |
576 | 576 | ||
577 | /** | 577 | /** |
578 | - * 电子票添加 | 578 | + * 校验电子票 |
579 | * | 579 | * |
580 | */ | 580 | */ |
581 | - public function addTickets() | 581 | + public function checkTicketsAction() |
582 | { | 582 | { |
583 | - if (!$this->isAjax()) { | ||
584 | - exit; | ||
585 | - } | 583 | +// $uid = $this->getUid(); |
584 | +// if (!$this->isAjax() || !$uid) { | ||
585 | +// exit; | ||
586 | +// } | ||
587 | +// $productSku = $this->post('$productSku'); | ||
588 | +// $buyNumber = $this->post('$buyNumber'); | ||
589 | +// $data = CartData::checkTickets($uid, $productSku, $buyNumber); | ||
590 | + $data = array( | ||
591 | + 'code' => 200, | ||
592 | + 'data' => array() | ||
593 | + ); | ||
594 | + $this->echoJson($data); | ||
595 | + } | ||
596 | + | ||
597 | + //电子票确认 | ||
598 | + public function ticketsConfirmAction() | ||
599 | + { | ||
600 | + // 审判跳转登录页 | ||
601 | + $this->auditJumpLogin(); | ||
586 | $uid = $this->getUid(); | 602 | $uid = $this->getUid(); |
587 | - if (!$uid) { | ||
588 | - exit; | 603 | + $productSku = $this->post('productSku'); |
604 | + $buyNumber = $this->post('buyNumber'); | ||
605 | + if (empty($productSku) || empty($buyNumber)) { | ||
606 | + $this->error(); | ||
589 | } | 607 | } |
590 | - $productSku = $this->post('$productSku'); | ||
591 | - $buyNumber = $this->post('$buyNumber'); | ||
592 | - $this->echoJson(CartData::addTickets($uid, $productSku, $buyNumber)); | ||
593 | - } | ||
594 | 608 | ||
609 | + $tickets = CartModel::getTickets($uid, $productSku, $buyNumber); | ||
610 | + $this->_view->display('order-ensure', $tickets); | ||
611 | + } | ||
595 | 612 | ||
596 | } | 613 | } |
@@ -54,7 +54,7 @@ class DetailController extends AbstractAction | @@ -54,7 +54,7 @@ class DetailController extends AbstractAction | ||
54 | 54 | ||
55 | //门票 | 55 | //门票 |
56 | $data['tickets'] = true; | 56 | $data['tickets'] = true; |
57 | - $data['buyNowurl'] = Helpers::url('/cart/index/buyNow'); | 57 | + $data['ticketsConfirm'] = Helpers::url('/cart/index/ticketsConfirm'); |
58 | $data['cartInfo']['colorName'] = $data['tickets'] ? '日期' : '颜色'; | 58 | $data['cartInfo']['colorName'] = $data['tickets'] ? '日期' : '颜色'; |
59 | $data['cartInfo']['sizeName'] = $data['tickets'] ? '区域' : '尺码'; | 59 | $data['cartInfo']['sizeName'] = $data['tickets'] ? '区域' : '尺码'; |
60 | //单日票 | 60 | //单日票 |
-
Please register or login to post a comment