Authored by 郝肖肖

门票添加接口邦定

... ... @@ -54,7 +54,7 @@
</thead>
<tbody>
{{#each orderProducts}}
<tr>
<tr data-sku="{{id}}">
<td>
<div class="pay-pro">
<a class="pay-pro-icon" href="{{link}}">
... ... @@ -68,7 +68,7 @@
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank">{{productTitle}}</a>
<span>颜色:{{productColor}} 尺码:{{productSize}}</span>
<span>日期:{{productColor}} 区域:{{productSize}}</span>
</p>
</div>
</td>
... ...
... ... @@ -277,11 +277,11 @@
</div>
</div>
<p class="row">
<div class="row">
{{#if isTicket}}
{{!-- 电子门票按钮 --}}
<span id="buy-ticket" class="buy-btn buy-now item-buy{{#if dis}} dis{{/if}}" >立即购买</span>
<form name="ticket-form" action="/cart/index/ticketEnsure" method="POST"></form>
<span id="buy-ticket" class="buy-btn buy-now item-buy{{#if dis}} dis{{/if}}" >立即购买</span>
{{^}}
{{!-- 各颜色下所有尺码均售罄则只显示售罄按钮 --}}
{{#unless soldOut}}
... ... @@ -320,7 +320,7 @@
<em>收藏商品</em>
{{/if}}
</span>
</p>
</div>
<div class="share-row">
<span class="title pull-left">分享商品:</span>
... ...
... ... @@ -33,6 +33,7 @@ var TicketCat = {
$toPay: $('.to-play em'),
$errorTip: $('.errbitip'),
$tbody: $('table tbody', '.pay-wapper'),
//门票js
$showTicketMobile: $('.show-ticket-mobile'),
$ticketMobile: $('.ticket-mobile'),
... ... @@ -41,6 +42,10 @@ var TicketCat = {
$ticketMobileBtn: $('.ticket-mobile-btn'),
$ticketMobileInput: $('.ticket-mobile-input')
},
Data: {
buyNumber: 0,//购买总数量
productSku: 0
},
Common: {
enterNUM: function(str1, str2) {
str1 = str1.replace(/[^\d]/g, '');
... ... @@ -80,6 +85,8 @@ var TicketCat = {
var len = el.$tbody.find('tr').length;
var subtotal = parseFloat(td.eq(1).html()) * parseInt(td.eq(3).html());
_this.Data.productSku = $(this).data('sku');
_this.Data.buyNumber += parseInt(td.eq(3).html());
td.eq(1).html('¥' + td.eq(1).html());
if (td.hasClass('xforone')) {
... ... @@ -215,9 +222,9 @@ var TicketCat = {
});
});
},
//渲染价格明细
render: function(data) {
// 下面这段是在服务端算价格
var e = this.el,
i,
dArr = data.promotion_formula_list,
... ... @@ -263,7 +270,9 @@ var TicketCat = {
resultData = {
cartType: cartType,
deliveryWay: expressVal,
yohoCoin: biVal
yohoCoin: biVal,
productSku: this.Data.productSku,
buyNumber: this.Data.buyNumber
};
return resultData;
}
... ...
... ... @@ -573,12 +573,26 @@ class CartModel
*/
public static function cartPay($uid, $cartType, $isAdvanceCart)
{
$result = array();
/* 调接口订单确认接口 */
$pay = CartData::cartPay($uid, $cartType);
return self::filterCartPay($pay, $cartType, $isAdvanceCart);
}
/**
* 处理购物车返回
* @param type $pay 获取商品数据
* @param string $cartType 购物车类型,ordinary表示普通购物车
* @param bool $isAdvanceCart 是否是预售商品列表
* @return type []
*/
private static function filterCartPay($pay, $cartType, $isAdvanceCart)
{
// 存放分析用的数据
$analysisData = array('ipinyou' => '');
$result = array();
do {
/* 调接口订单确认接口 */
$pay = CartData::cartPay($uid, $cartType);
if (!$pay || empty($pay['data']['goods_list'])) {
break;
}
... ... @@ -775,8 +789,7 @@ class CartModel
//JIT拆单需求 package
$result['packages'] = self::getPackageInfo($pay['data']['shopping_cart_data']);
}
while (false);
} while (false);
return $result;
}
... ... @@ -1403,11 +1416,23 @@ class CartModel
*/
public function addTicket($uid, $productSku, $buyNumber, $yohoNum = 0)
{
$data = CartData::addTicket($uid, $productSku, $buyNumber, $yohoNum);
if (!empty($data['data'])) {
return $data['data'];
}
return CartData::addTicket($uid, $productSku, $buyNumber, $yohoNum);
}
/**
* 订单确认-处理添加商品
* @param int $uid 用户ID
* @param type int $productSku 产品sku
* @param type int $buyNumber 购买数量,范围1-4
* @param type int $yohoNum yoho币
* @return type
*/
public function filterTicket($uid, $productSku, $buyNumber, $yohoNum = 0)
{
$cartType = 'advance';
$data = self::addTicket($uid, $productSku, $buyNumber, $yohoNum);
return $data;
return self::filterCartPay($data, $cartType, false);
}
}
... ...
... ... @@ -574,17 +574,24 @@ class IndexController extends WebAction
$this->setTitle('填写订单', true, ' | ');
$this->setSimpleHeader();
$orderEnsure = CartModel::cartPay($uid, 'ordinary', false);
// $orderEnsure = CartModel::cartPay($uid, 'ordinary', false);
// print_r($orderEnsure);exit;
//产品sku
$productSku = $this->post('productSku');
// $productSku = $this->post('productSku', 0);
$productSku = 178284;
//购买数量,范围1-4
$buyNumber = $this->post('buyNumber', 0);
//yoho币数量
$yohoNum = $this->post('yohoNum', 0);
// 执行加入购物车操作
// $result = CartModel::addTicket($uid, $productSku, $buyNumber, $yohoNum);
$orderEnsure = CartModel::filterTicket($uid, $productSku, $buyNumber, $yohoNum);
// if (empty($orderEnsure)) {
// $this->error();
// }
// print_r($orderEnsure);
// print_r($result);
// exit;
$this->_view->display('ticket-ensure', array(
'ticketEnsurePage' => true,
'orderEnsure' => $orderEnsure,
... ... @@ -609,14 +616,14 @@ class IndexController extends WebAction
break;
}
//产品sku
$productSku = $this->post('productSku');
// $productSku = $this->post('productSku', 0);
$productSku = 178284;
//购买数量,范围1-4
$buyNumber = $this->post('buyNumber', 0);
//yoho币数量
$yohoNum = $this->post('yohoNum', 0);
// 执行加入购物车操作
$result = CartModel::addTicket($uid, $productSku, $buyNumber, $yohoNum);
// print_r($result);exit;
} while (false);
... ...