Authored by 周少峰

detail tickets

... ... @@ -469,7 +469,7 @@ class CartData
}
/**
* 添加电子票
* 校验电子票
* @param int $uid
* @param int $productSku
* @param int $buyNumber
... ... @@ -477,7 +477,7 @@ class CartData
* @author sefon 2016-7-2 18:12:30
* @return array
*/
public static function addTickets ($uid, $productSku, $buyNumber, $useYohoCoin = 0)
public static function checkickets ($uid, $productSku, $buyNumber, $useYohoCoin = 0)
{
$param = Yohobuy::param();
$param['method'] = 'app.shopping.ticket';
... ...
... ... @@ -39,7 +39,10 @@ var $chosePanel = $('#chose-panel'),
$soonSoldOut = $('.soonSoldOut-tag'),
$yohoPage = $('.yoho-page'),
//门票 限购数量
ticketsLimit = $('#limitNum').val();
ticketsLimit = $('#limitNum').val(),
$productSku = $('#productSku'),
$buyNumber = $('#buyNumber'),
$buyNowForm = $('#buyNowForm');
// 购物车编辑标相关变量
var isEdit,
... ... @@ -261,17 +264,22 @@ function addTickets(productSku, buyNumber) {
var data = {
productSku: productSku,
buyNumber: buyNumber
}
};
//添加电子票
//校验电子票
$.ajax({
url: '/cart/index/cart',
url: '/cart/index/checkTickets',
dataType: 'json',
data: data,
type: 'post',
success: function (addRestult) {
//调整订单确认页
window.location.href = '/cart/index/orderEnsure?cartType=tickets';
if (addRestult.code != 200) {
tip.show(addRestult.masseage);
} else {
$productSku.val(productSku);
$buyNumber.val(buyNumber);
$buyNowForm.submit();
}
},
error: function () {
tip.show('网络异常~');
... ...
... ... @@ -184,9 +184,9 @@
{{/loginUrl}}
{{#if tickets}}
<form name="buyNow" method="post" action="{{buyNowUrl}}">
<input type="hidden" name="productId">
<input type="hidden" name="buyNumber">
<form id="buyNowForm" method="post" action="{{ticketsConfirm}}">
<input type="hidden" name="productSku" id="productSku">
<input type="hidden" name="buyNumber" id="buyNumber">
</form>
{{/if}}
... ...
... ... @@ -1106,4 +1106,19 @@ class CartModel
return $result;
}
/**
* 获取门票数据
* @param int $uid
* @param int $productSku
* @param int $buyNumber
* @param int $useYohoCoin
* @return arr
*/
public static function getTickets($uid, $productSku, $buyNumber, $useYohoCoin = 0)
{
$result = CartData::checkickets($uid, $productSku, $buyNumber, $useYohoCoin);
return $result;
}
}
... ...
... ... @@ -575,22 +575,39 @@ class IndexController extends AbstractAction
}
/**
* 电子票添加
* 校验电子票
*
*/
public function addTickets()
public function checkTicketsAction()
{
if (!$this->isAjax()) {
exit;
// $uid = $this->getUid();
// if (!$this->isAjax() || !$uid) {
// exit;
// }
// $productSku = $this->post('$productSku');
// $buyNumber = $this->post('$buyNumber');
// $data = CartData::checkTickets($uid, $productSku, $buyNumber);
$data = array(
'code' => 200,
'data' => array()
);
$this->echoJson($data);
}
//电子票确认
public function ticketsConfirmAction()
{
// 审判跳转登录页
$this->auditJumpLogin();
$uid = $this->getUid();
if (!$uid) {
exit;
}
$productSku = $this->post('$productSku');
$buyNumber = $this->post('$buyNumber');
$this->echoJson(CartData::addTickets($uid, $productSku, $buyNumber));
$productSku = $this->post('productSku');
$buyNumber = $this->post('buyNumber');
if (empty($productSku) || empty($buyNumber)) {
$this->error();
}
$tickets = CartModel::getTickets($uid, $productSku, $buyNumber);
$this->_view->display('order-ensure', $tickets);
}
}
... ...
... ... @@ -54,7 +54,7 @@ class DetailController extends AbstractAction
//门票
$data['tickets'] = true;
$data['buyNowurl'] = Helpers::url('/cart/index/buyNow');
$data['ticketsConfirm'] = Helpers::url('/cart/index/ticketsConfirm');
$data['cartInfo']['colorName'] = $data['tickets'] ? '日期' : '颜色';
$data['cartInfo']['sizeName'] = $data['tickets'] ? '区域' : '尺码';
//单日票
... ...