Authored by 郝肖肖

门票去支付订单生成

... ... @@ -127,7 +127,7 @@
</div>
</div>
<div class="to-play">
<div class="ticket-play">
<p>您需要实际支付金额:<em>{{lastOrderAmount}}</em>元</p>
<div class="btn-group clearfix">
<input type="button" class="submit" value="去付款"/>
... ...
... ... @@ -30,7 +30,7 @@ var TicketCat = {
$biok: $('#bisubmit'),
$loading: $('.loading'),
$payTotal: $('.play-total'),
$toPay: $('.to-play em'),
$toPay: $('.ticket-play em'),
$errorTip: $('.errbitip'),
$tbody: $('table tbody', '.pay-wapper'),
... ... @@ -40,7 +40,10 @@ var TicketCat = {
$ticketModifyBtn: $('.ticket-modify-btn'),
$setTicketMobile: $('.set-ticket-mobile'),
$ticketMobileBtn: $('.ticket-mobile-btn'),
$ticketMobileInput: $('.ticket-mobile-input')
$ticketMobileInput: $('.ticket-mobile-input'),
//变量
phoneReg: /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/
},
Data: {
buyNumber: 0,//购买总数量
... ... @@ -115,10 +118,9 @@ var TicketCat = {
//保存手机号按钮
el.$ticketMobileBtn.click(function() {
var val = el.$ticketMobileInput.val(),
phoneReg = /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
var val = el.$ticketMobileInput.val();
if (!phoneReg.test(val)) {
if (!el.phoneReg.test(val)) {
new dialog.Alert('请输入正确的手机号!').show();
return;
}
... ... @@ -140,6 +142,7 @@ var TicketCat = {
}
});
//使用有货币确认按钮
el.$biok.click(function() {
var pan = $(this).parents('dl.pan');
var selectData = {};
... ... @@ -221,6 +224,45 @@ var TicketCat = {
}
});
});
// 去支付
$('.ticket-play input.submit').click(function() {
var $this = $(this);
var selectData = _this.getSelectData();
selectData.mobile = el.$ticketMobile.text();
if (!el.phoneReg.test(selectData.mobile)) {
new dialog.Alert('手机号格式不正确!').show();
return;
}
el.$loading.show();
if (!!$this.attr('disabled')) {
return;
}
$this.attr('disabled', 'disabled');
$.ajax({
type: 'POST',
dataType: 'json',
url: '/cart/index/ticketOrderSub',
data: selectData
}).then(function(data) {
el.$loading.hide();
if (data.code === 200) {
window.location.href = '/shopping/pay?ordercode=' + data.data.order_code;
} else {
new dialog.Alert('去付款失败!<br /><br />' + data.message).show();
}
}).always(function() {
el.$loading.hide();
$this.removeAttr('disabled');
});
});
},
//渲染价格明细
... ...
... ... @@ -326,7 +326,7 @@
}
}
.to-play {
.to-play, .ticket-play {
p {
padding: 10px 0px;
font-size: 14px;
... ...
... ... @@ -1011,8 +1011,6 @@ class ItemModel
$defaultImage = '';//默认图
$chooseSkuFlag = false;//选中sku状态
//摸拟数据
$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'])) {
... ... @@ -1028,7 +1026,7 @@ class ItemModel
$goodsGroup = array(
'productSkc' => $value['productSkc'],
'title' => trim($baseInfo['productName']).' '.$value['colorName'],
'name' => $dates[$pos % 7],
'name' => $value['colorName'],
'focus'=> false,
'total' => 0,
'thumbs' => array(),
... ...
... ... @@ -1432,7 +1432,20 @@ class CartModel
$cartType = 'advance';
$data = self::addTicket($uid, $productSku, $buyNumber, $yohoCoin);
return self::filterCartPay($data, $cartType, false);
}
/**
* 电子票下单
* @param type int $uid 用户ID
* @param type int $productSku 产品sku
* @param type int $buyNumber 购买数量,范围1-4
* @param type string $mobile 手机号码
* @param type int $yohoCoin yoho币
* @return type []
*/
public function submitTicket($uid, $productSku, $buyNumber, $mobile, $yohoCoin = 0)
{
return CartData::submitTicket($uid, $productSku, $buyNumber, $mobile, $yohoCoin);
}
}
... ...
... ... @@ -577,8 +577,7 @@ class IndexController extends WebAction
// $orderEnsure = CartModel::cartPay($uid, 'ordinary', false);
// print_r($orderEnsure);exit;
//产品sku
// $productSku = $this->post('productSku', 0);
$productSku = 178284;
$productSku = $this->post('productSku', 0);
//购买数量,范围1-4
$buyNumber = $this->post('buyNumber', 0);
//yoho币数量
... ... @@ -613,8 +612,7 @@ class IndexController extends WebAction
break;
}
//产品sku
// $productSku = $this->post('productSku', 0);
$productSku = 178284;
$productSku = $this->post('productSku', 0);
//购买数量,范围1-4
$buyNumber = $this->post('buyNumber', 0);
//yoho币数量
... ... @@ -626,5 +624,36 @@ class IndexController extends WebAction
$this->echoJson($result);
}
/**
* 门票-下单
*/
public function ticketOrderSubAction()
{
$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', 0);
//购买数量,范围1-4
$buyNumber = $this->post('buyNumber', 0);
//yoho币数量
$yohoCoin = $this->post('yohoCoin', 0);
//手机号码
$mobile = $this->post('mobile', 0);
$result = CartModel::submitTicket($uid, $productSku, $buyNumber, $mobile, $yohoCoin);
} while (false);
$this->echoJson($result);
}
}
... ...
... ... @@ -9,11 +9,19 @@ 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('SERVICE_URL', 'http://testservice.yoho.cn:28077/');
#test环境
//define('API_URL', 'http://testapi.yoho.cn:28078/');
//define('SERVICE_URL', 'http://testservice.yoho.cn:28077/');
//define('YOHOBUY_URL', 'http://www.yohobuy.com/');
//define('SERVICE_NOTIFY', 'http://testservice.yoho.cn:28077/');
//define('API_OLD', 'http://test2.open.yohobuy.com/');
#dev环境
define('API_URL', 'http://devapi.yoho.cn:58078/');
define('SERVICE_URL', 'http://devservice.yoho.cn:58077/');
define('YOHOBUY_URL', 'http://www.yohobuy.com/');
define('SERVICE_NOTIFY', 'http://testservice.yoho.cn:28077/');
define('API_OLD', 'http://test2.open.yohobuy.com/');
define('SERVICE_NOTIFY', 'http://test2.open.yohobuy.com/');
define('API_OLD', 'http://devservice.yoho.cn:58077/');
$application = new Application(APPLICATION_PATH . '/configs/application.developer.ini');
$application->bootstrap()->run();
\ No newline at end of file
... ...