Authored by 周少峰

submit tickets , order list qrcode

... ... @@ -500,7 +500,7 @@ class CartData
* @author sefon 2016-7-2 18:12:30
* @return array
*/
public static function submitTicket ($uid, $productSku, $buyNumber, $mobile, $useYohoCoin = 0, $qhyUnion)
public static function submitTicket ($uid, $productSku, $buyNumber, $mobile, $useYohoCoin = 0, $qhyUnion = '')
{
$param = Yohobuy::param();
$param['method'] = 'app.shopping.submitTicket';
... ...
... ... @@ -16,14 +16,16 @@ var $invoice = $('.invoice'),
$coinCheck = $('.coin-check'),
$coinUsed = $('.coin .used'),
$subBlock = $('.sub-block'),
$ticketsConfirm = $('#ticketsConfirm'),
$ticketsMobile = $('#mobile'),
payType,
queryString = $.queryString(),
orderInfo = order.orderInfo,
isSubmiting,
dispatchInfo,
total;
total,
isTickets = $('#ticketsPage').val(),
productSku = $('#productSku').val(),
buyNumber = $('#buyNumber').val();
require('../common');
... ... @@ -357,6 +359,10 @@ $subBlock.on('touchstart', 'li', function() {
$('.bill a').on('touchstart', function() {
if (isTickets) {
ticketsConfirm();
return ;
}
orderInfo('paymentTypeId', $('.delivery-id .icon-cb-radio').data('id'));
orderInfo('paymentType', $('.payment-type .icon-cb-radio').data('id'));
... ... @@ -375,16 +381,32 @@ if (orderInfo('address') && orderInfo('address').is_support === 'N') {
orderInfo('deliveryId', $('.delivery-id .icon-cb-radio').data('id'));
orderCompute();
}
//电子票下单
function ticketsConfirm () {
var data = {
productSku: productSku,
buyNumber: buyNumber,
mobile: $ticketsMobile.val(),
useYohoCoin: ''
};
$.ajax({
url: '/cart/index/submitTicket',
type: 'POST',
dataType: 'json',
data: data,
success: function(ticket) {
//下单成功调整支付页面
if (ticket.code === 200) {
function ticketsConfirm () {
}
}
//确认门票
$ticketsConfirm.on('touchstart', function() {
ticketsConfirm();
});
},
error: function () {
tip.show('网络异常~');
}
});
}
//校验手机号
$ticketsMobile.blur(function function_name (e) {
... ...
... ... @@ -87,5 +87,8 @@
您需要支付:<span>¥{{price}}</span>
<a href="javascript:;" id="ticketsConfirm">确认</a>
</div>
<input type="hidden" name="ticketsPage" id="ticketsPage" value="1">
<input type="hidden" name="productSku" id="productSku" value="{{productSku}}">
<input type="hidden" name="buyNumber" id="buyNumber" value="{{buyNumber}}">
</div>
{{> layout/footer}}
... ...
... ... @@ -54,9 +54,11 @@
</div>
{{/if}}
{{/if}}
<div class="order-opt">
<a class="locHref" href="{{logisticsUrl}}">
<span class="btn check-logistics">查看二维码</span>
</a>
</div>
{{#if qrcode}}
<div class="order-opt">
<a class="locHref" href="{{codeUrl}}">
<span class="btn check-logistics">查看二维码</span>
</a>
</div>
{{/if}}
</div>
\ No newline at end of file
... ...
... ... @@ -1124,11 +1124,10 @@ class CartModel
}
//商品数据
$oneGoods = array();
$goodsPrice = 0;
foreach ($data['data']['goods_list'] as $key => $single) {
$oneGoods = array();
$oneGoods['id'] = $single['product_sku']; // TODO 未确定用哪个
$oneGoods['id'] = $single['product_sku'];
$oneGoods['thumb'] = Images::getImageUrl($single['goods_images'], 120, 160);
$oneGoods['name'] = $single['product_name'];
$oneGoods['color'] = $single['color_name'];
... ... @@ -1139,6 +1138,10 @@ class CartModel
$goodsPrice += $oneGoods['count'] * $oneGoods['price'];
$result['goods'][] = $oneGoods;
}
$result['cartPayData'] = $data['data']['shopping_cart_data']['promotion_formula_list'];
$price = $data['data']['shopping_cart_data']['last_order_amount'];
$result['price'] = Helpers::transPrice($price, true);
// 有货币
$result['yohoCoin'] = Helpers::transPrice($data['data']['yoho_coin']);
/*
... ...
... ... @@ -602,16 +602,17 @@ class IndexController extends AbstractAction
$uid = $this->getUid();
$productSku = $this->post('productSku');
$buyNumber = $this->post('buyNumber');
// if (empty($productSku) || empty($buyNumber)) {
// $this->error();
// }
if (empty($productSku) || empty($buyNumber)) {
$this->error();
}
$tickets = CartModel::getTickets($uid, $productSku, $buyNumber);
// print_r($tickets); exit;
$this->setTitle('确认订单');
$this->setNavHeader('确认订单', '', false); // 不显示右上角home按钮
$tickets['orderEnsurePage'] = true;
$tickets['productSku'] = $productSku;
$tickets['buyNumber'] = $buyNumber;
$this->_view->display('tickets-confirm', $tickets);
}
... ... @@ -621,21 +622,19 @@ class IndexController extends AbstractAction
$result = array();
do {
$uid = $this->getUid();
if (empty($uid)) {
break;
}
$productSku = $this->post('productSku');
$buyNumber = $this->post('buyNumber');
$mobile = $this->post('mobile');
$useYohoCoin = $this->post('useYohoCoin');
if (empty($uid) || empty($productSku) || empty($buyNumber) || empty($mobile)) {
break;
}
//联盟参数 TODO
$data = CartData::submitTicket($uid, $productSku, $buyNumber, $mobile, $useYohoCoin);
if (isset($data['code'])) {
$result = $data;
}
}
} while(false);
$this->echoJson($result);
}
... ...
... ... @@ -11,7 +11,8 @@ define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录
define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录
defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'developer');
define('API_URL', 'http://testapi.yoho.cn:28078/');
//define('API_URL', 'http://testapi.yoho.cn:28078/');
define('API_URL', 'http://devapi.yoho.cn:58078');
define('SERVICE_URL', 'http://testservice.yoho.cn:28077/');
define('YOHOBUY_URL', 'http://www.yohobuy.com/');
define('SERVICE_NOTIFY', 'http://testservice.yoho.cn:28077/');
... ...