Authored by 郝肖肖

发票支付页面

... ... @@ -535,7 +535,7 @@ class CartData
public static function addTicket($uid, $productSku, $buyNumber, $yohoNum = 0)
{
$param = Yohobuy::param();
$param['method'] = 'app.shopping.submitTicket';
$param['method'] = 'app.shopping.ticket';
$param['uid'] = intval($uid);
$param['product_sku'] = intval($productSku);
$param['buy_number'] = intval($buyNumber);
... ...
{{> layout/header}}
<div class="order-ensure-page yoho-page clearfix">
{{# orderEnsure}}
<div class="order-edit">
<div class="order-title">
<ul>
<li class="first">立即购买</li>
<li class="active">填写订单</li>
<li class="end">付款,完成购买</li>
</ul>
</div>
<div class="order-edit-main" id="order-edit-main" {{#isNewUser}}data-new="new"{{/isNewUser}} cartType="{{cartType}}">
<h2 class="title">请填写并核对以下信息</h2>
<div class="order-content">
<div class="order-selection pay-time">
<h2>支付及发劵时间:</h2>
<ul class="modity-pay-info">
<li>付款方式:<span>在线支付</span></li>
<li>发劵时间:<span>自动发货-在您支付成功后,系统将立即为您发放二维码,您可以在您的订单中查看。</span></li>
<li>手机号:<span>否</span></li>
</ul>
</div><!--/order-selection pay-time-->
</div><!--/order-content-->
</div><!--/order-edit-main-->
</div>
<!-- 订单提示-->
<div class="order-pay">
<div class="pay-wapper">
<table>
<thead>
<tr>
<th style="width:40%;">
商品信息
</th>
<th style="width:10%;">单价(元)</th>
<th style="width:10%;">返YOHO币</th>
<th style="width:10%;">数量</th>
<th style="width:10%;">小计(元)</th>
<th style="width:20%;">商品金额(元)</th>
</tr>
</thead>
<tbody>
{{#each orderProducts}}
<tr>
<td>
<div class="pay-pro">
<a class="pay-pro-icon" href="{{link}}">
<img src="{{imgCover}}" />
{{#isPriceGift}}
<span class="incentive">加价购</span>
{{/isPriceGift}}
{{#isGift}}
<span class="gift">赠品</span>
{{/isGift}}
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank">{{productTitle}}</a>
<span>颜色:{{productColor}} 尺码:{{productSize}}</span>
</p>
</div>
</td>
<td>
{{productPrice}}
{{#isVipPrice}}
<span class="vipPrice">(VIP)</span>
{{/isVipPrice}}
</td>
<td>{{yohoIcon}}个</td>
<td>{{productNum}}</td>
<td class="cart-sub-total {{#xForOne}}xforone{{/xForOne}}">
{{#if xForOne}}
<del>{{productSubtotal}}</del>
<span class="free"></span>
{{^}}
{{productSubtotal}}
{{/if}}
</td>
<td class="cart-sub-total-all">{{productSubtotal}}</td>
</tr>
{{/each}}
</tbody>
</table>
<!--YOHO-->
<div class="play-content clearfix">
<div class="play-right">
<dl class="play-bi-pan pan">
<dt>使用YOHO币支付</dt>
<dd>
<div class="play-pan">
<div class="strong">
使用YOHO币:
<input type="text" class="textbox" id="biprice" data-bi="{{ownYohoCoin}}" value="0" /> 个
</div>
<p >
您目前有YOHO币 <em class="strong">{{ownYohoCoin}}</em> 个
</p>
<p class="errbitip red"></p>
<div class="btn-group clearfix">
<input type="button" class="ok" value="确定" id="bisubmit"/>
<input type="button" class="cancel cancel-bi" value="取消"/>
</div>
</div>
</dd>
</dl>
{{#if redEnvelopes}}
<div class="red-envelopes active">
<div class="use-envelopes">
<input checked value="0" data-all="{{redEnvelopes}}" data-use="{{useRedEnvelopes}}" type="checkbox" />使用现金红包支付:<span>-¥{{useRedEnvelopes}}</span>
</div>
<div class="has-envelopes">您的现金红包余额:<span></span></div>
</div>
{{/if}}
</div>
</div>
</div>
<div class="to-play">
<p>您需要实际支付金额:<em>{{lastOrderAmount}}</em>元</p>
<div class="btn-group clearfix">
<input type="button" class="submit" value="去付款"/>
</div>
</div>
</div>
{{/ orderEnsure}}
<div class="loading"><span></span>请稍后...</div>
</div>
{{> layout/footer}}
... ...
... ... @@ -174,7 +174,7 @@
<ul class="size{{#unless focus}} hide{{/unless}}">
{{!-- 电子门票data-num最多可以买4张 --}}
{{#each size}}
<li {{#unless num}}class="disable"{{/unless}} data-sku="{{sku}}" data-num="4" data-name="{{name}}">{{name}}</li>
<li {{#unless num}}class="disable"{{/unless}} data-sku="{{sku}}" data-num="{{num}}" data-name="{{name}}">{{name}}</li>
{{/each}}
<span class="size-warn warn-tip hide">
... ... @@ -280,7 +280,8 @@
<p class="row">
{{#if isTicket}}
{{!-- 电子门票按钮 --}}
<span id="buy-now" class="buy-btn buy-now item-buy{{#if dis}} dis{{/if}}" data-base="{{buyNowBase}}">立即购买</span>
<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>
{{^}}
{{!-- 各颜色下所有尺码均售罄则只显示售罄按钮 --}}
{{#unless soldOut}}
... ...
... ... @@ -378,6 +378,48 @@ $('#keep-shopping').click(function() {
$('#balance').slideUp(SLIDETIME);
});
//电子票立即购买
$('#buy-ticket').click(function() {
var sku,
buyNumber;
if (maxStock === -1) {
showSizeWarn();
return;
}
if ($(this).hasClass('dis')) {
return;
}
sku = $('.size:not(.hide) li.focus').data('sku');
buyNumber = getNum();
$.ajax({
type: 'POST',
url: '/cart/index/setTicket',
data: {
productSku: sku,
buyNumber: buyNumber
}
}).then(function(data) {
var $ticketForm,
myAlert;
if (data.code * 1 === 200) {
$ticketForm = $('form[name="ticket-form"]');
$ticketForm.html(
'<input name="productSku" value="' + sku + '" />' +
'<input name="buyNumber" value="' + buyNumber + '" />'
);
$ticketForm.submit();
} else {
myAlert = new Alert(data.message);
myAlert.show();
}
});
});
//立即购买
$('#buy-now').click(function() {
var sku,
... ...
... ... @@ -1013,7 +1013,8 @@ class ItemModel
//摸拟数据
$dates = array('9月16 12:30','9月17 12:30','9月18 12:30','9月19 12:30','9月20 12:30','9月21 全天可用','9月13 12:30');
$areas = array();
$baseInfo['isTicket'] = empty($baseInfo['isTicket']) ? false : $baseInfo['isTicket'];
if (!empty($baseInfo['goodsList'])) {
$goodsGroup = array();
foreach ($baseInfo['goodsList'] as $pos => $value) {
... ... @@ -1034,7 +1035,7 @@ class ItemModel
'size' => array(),
);
//不是门票的要显示图片
if (empty($baseInfo['isTicket'])) {
if ($baseInfo['isTicket']) {
$goodsGroup['src'] = Images::getImageUrl($value['colorImage'], 40, 40);
}
... ... @@ -1069,7 +1070,7 @@ class ItemModel
$goodsGroup['size'][] = array(
'name' => $size['sizeName'],
'sku' => $size['goodsSizeSkuId'],
'num' => intval($size['goodsSizeStorageNum']),
'num' => $baseInfo['isTicket'] && $size['goodsSizeStorageNum'] > 4 ? 4 : intval($size['goodsSizeStorageNum']),
'goodsId'=> $size['goodsId']
);
//单个sku商品的总数
... ...
... ... @@ -1393,4 +1393,21 @@ class CartModel
return $result;
}
/**
* 立即购买
* @param int $uid 用户ID
* @param type int $productSku 产品sku
* @param type int $buyNumber 购买数量,范围1-4
* @param type int $yohoNum yoho币
* @return type []
*/
public function addTicket($uid, $productSku, $buyNumber, $yohoNum = 0)
{
$data = CartData::addTicket($uid, $productSku, $buyNumber, $yohoNum);
if (!empty($data['data'])) {
return $data['data'];
}
return $data;
}
}
... ...
... ... @@ -563,4 +563,64 @@ class IndexController extends WebAction
}
}
/**
* 发票确认订单页面
*/
public function ticketEnsureAction()
{
// 审判用户是否已登录
$uid = $this->auditJumpLogin(false);
$this->setTitle('填写订单', true, ' | ');
$this->setSimpleHeader();
$orderEnsure = CartModel::cartPay($uid, 'ordinary', false);
//产品sku
$productSku = $this->post('productSku');
//购买数量,范围1-4
$buyNumber = $this->post('buyNumber', 0);
//yoho币数量
$yohoNum = $this->post('yohoNum', 0);
// 执行加入购物车操作
// $result = CartModel::addTicket($uid, $productSku, $buyNumber, $yohoNum);
$this->_view->display('ticket-ensure', array(
'orderEnsurePage' => true,
'orderEnsure' => $orderEnsure,
));
}
/**
* 门票-立即购买接口
*/
public function setTicketAction()
{
$result = array('code' => 400, 'message' => '立即购买失败, 请稍后在试!');
do {
if (!$this->isAjax()) {
break;
}
$uid = $this->getUid();
if (empty($uid)) {
$result = array('code' => 401, 'message' => '请先登录!');
break;
}
//产品sku
$productSku = $this->post('productSku');
//购买数量,范围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);
$this->echoJson($result);
}
}
... ...