Authored by 郝肖肖

门票去支付订单生成

@@ -127,7 +127,7 @@ @@ -127,7 +127,7 @@
127 </div> 127 </div>
128 </div> 128 </div>
129 129
130 - <div class="to-play"> 130 + <div class="ticket-play">
131 <p>您需要实际支付金额:<em>{{lastOrderAmount}}</em>元</p> 131 <p>您需要实际支付金额:<em>{{lastOrderAmount}}</em>元</p>
132 <div class="btn-group clearfix"> 132 <div class="btn-group clearfix">
133 <input type="button" class="submit" value="去付款"/> 133 <input type="button" class="submit" value="去付款"/>
@@ -30,7 +30,7 @@ var TicketCat = { @@ -30,7 +30,7 @@ var TicketCat = {
30 $biok: $('#bisubmit'), 30 $biok: $('#bisubmit'),
31 $loading: $('.loading'), 31 $loading: $('.loading'),
32 $payTotal: $('.play-total'), 32 $payTotal: $('.play-total'),
33 - $toPay: $('.to-play em'), 33 + $toPay: $('.ticket-play em'),
34 $errorTip: $('.errbitip'), 34 $errorTip: $('.errbitip'),
35 $tbody: $('table tbody', '.pay-wapper'), 35 $tbody: $('table tbody', '.pay-wapper'),
36 36
@@ -40,7 +40,10 @@ var TicketCat = { @@ -40,7 +40,10 @@ var TicketCat = {
40 $ticketModifyBtn: $('.ticket-modify-btn'), 40 $ticketModifyBtn: $('.ticket-modify-btn'),
41 $setTicketMobile: $('.set-ticket-mobile'), 41 $setTicketMobile: $('.set-ticket-mobile'),
42 $ticketMobileBtn: $('.ticket-mobile-btn'), 42 $ticketMobileBtn: $('.ticket-mobile-btn'),
43 - $ticketMobileInput: $('.ticket-mobile-input') 43 + $ticketMobileInput: $('.ticket-mobile-input'),
  44 +
  45 + //变量
  46 + phoneReg: /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/
44 }, 47 },
45 Data: { 48 Data: {
46 buyNumber: 0,//购买总数量 49 buyNumber: 0,//购买总数量
@@ -115,10 +118,9 @@ var TicketCat = { @@ -115,10 +118,9 @@ var TicketCat = {
115 118
116 //保存手机号按钮 119 //保存手机号按钮
117 el.$ticketMobileBtn.click(function() { 120 el.$ticketMobileBtn.click(function() {
118 - var val = el.$ticketMobileInput.val(),  
119 - phoneReg = /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/; 121 + var val = el.$ticketMobileInput.val();
120 122
121 - if (!phoneReg.test(val)) { 123 + if (!el.phoneReg.test(val)) {
122 new dialog.Alert('请输入正确的手机号!').show(); 124 new dialog.Alert('请输入正确的手机号!').show();
123 return; 125 return;
124 } 126 }
@@ -140,6 +142,7 @@ var TicketCat = { @@ -140,6 +142,7 @@ var TicketCat = {
140 } 142 }
141 }); 143 });
142 144
  145 + //使用有货币确认按钮
143 el.$biok.click(function() { 146 el.$biok.click(function() {
144 var pan = $(this).parents('dl.pan'); 147 var pan = $(this).parents('dl.pan');
145 var selectData = {}; 148 var selectData = {};
@@ -221,6 +224,45 @@ var TicketCat = { @@ -221,6 +224,45 @@ var TicketCat = {
221 } 224 }
222 }); 225 });
223 }); 226 });
  227 +
  228 + // 去支付
  229 + $('.ticket-play input.submit').click(function() {
  230 + var $this = $(this);
  231 + var selectData = _this.getSelectData();
  232 +
  233 + selectData.mobile = el.$ticketMobile.text();
  234 +
  235 + if (!el.phoneReg.test(selectData.mobile)) {
  236 + new dialog.Alert('手机号格式不正确!').show();
  237 + return;
  238 + }
  239 +
  240 + el.$loading.show();
  241 +
  242 + if (!!$this.attr('disabled')) {
  243 + return;
  244 + }
  245 +
  246 + $this.attr('disabled', 'disabled');
  247 + $.ajax({
  248 + type: 'POST',
  249 + dataType: 'json',
  250 + url: '/cart/index/ticketOrderSub',
  251 + data: selectData
  252 + }).then(function(data) {
  253 + el.$loading.hide();
  254 +
  255 + if (data.code === 200) {
  256 + window.location.href = '/shopping/pay?ordercode=' + data.data.order_code;
  257 + } else {
  258 + new dialog.Alert('去付款失败!<br /><br />' + data.message).show();
  259 + }
  260 + }).always(function() {
  261 + el.$loading.hide();
  262 + $this.removeAttr('disabled');
  263 + });
  264 + });
  265 +
224 }, 266 },
225 267
226 //渲染价格明细 268 //渲染价格明细
@@ -326,7 +326,7 @@ @@ -326,7 +326,7 @@
326 } 326 }
327 } 327 }
328 328
329 - .to-play { 329 + .to-play, .ticket-play {
330 p { 330 p {
331 padding: 10px 0px; 331 padding: 10px 0px;
332 font-size: 14px; 332 font-size: 14px;
@@ -1011,8 +1011,6 @@ class ItemModel @@ -1011,8 +1011,6 @@ class ItemModel
1011 $defaultImage = '';//默认图 1011 $defaultImage = '';//默认图
1012 $chooseSkuFlag = false;//选中sku状态 1012 $chooseSkuFlag = false;//选中sku状态
1013 //摸拟数据 1013 //摸拟数据
1014 - $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');  
1015 - $areas = array();  
1016 $baseInfo['isTicket'] = empty($baseInfo['isTicket']) ? false : $baseInfo['isTicket']; 1014 $baseInfo['isTicket'] = empty($baseInfo['isTicket']) ? false : $baseInfo['isTicket'];
1017 1015
1018 if (!empty($baseInfo['goodsList'])) { 1016 if (!empty($baseInfo['goodsList'])) {
@@ -1028,7 +1026,7 @@ class ItemModel @@ -1028,7 +1026,7 @@ class ItemModel
1028 $goodsGroup = array( 1026 $goodsGroup = array(
1029 'productSkc' => $value['productSkc'], 1027 'productSkc' => $value['productSkc'],
1030 'title' => trim($baseInfo['productName']).' '.$value['colorName'], 1028 'title' => trim($baseInfo['productName']).' '.$value['colorName'],
1031 - 'name' => $dates[$pos % 7], 1029 + 'name' => $value['colorName'],
1032 'focus'=> false, 1030 'focus'=> false,
1033 'total' => 0, 1031 'total' => 0,
1034 'thumbs' => array(), 1032 'thumbs' => array(),
@@ -1432,7 +1432,20 @@ class CartModel @@ -1432,7 +1432,20 @@ class CartModel
1432 $cartType = 'advance'; 1432 $cartType = 'advance';
1433 1433
1434 $data = self::addTicket($uid, $productSku, $buyNumber, $yohoCoin); 1434 $data = self::addTicket($uid, $productSku, $buyNumber, $yohoCoin);
1435 -  
1436 return self::filterCartPay($data, $cartType, false); 1435 return self::filterCartPay($data, $cartType, false);
1437 } 1436 }
  1437 +
  1438 + /**
  1439 + * 电子票下单
  1440 + * @param type int $uid 用户ID
  1441 + * @param type int $productSku 产品sku
  1442 + * @param type int $buyNumber 购买数量,范围1-4
  1443 + * @param type string $mobile 手机号码
  1444 + * @param type int $yohoCoin yoho币
  1445 + * @return type []
  1446 + */
  1447 + public function submitTicket($uid, $productSku, $buyNumber, $mobile, $yohoCoin = 0)
  1448 + {
  1449 + return CartData::submitTicket($uid, $productSku, $buyNumber, $mobile, $yohoCoin);
  1450 + }
1438 } 1451 }
@@ -577,8 +577,7 @@ class IndexController extends WebAction @@ -577,8 +577,7 @@ class IndexController extends WebAction
577 // $orderEnsure = CartModel::cartPay($uid, 'ordinary', false); 577 // $orderEnsure = CartModel::cartPay($uid, 'ordinary', false);
578 // print_r($orderEnsure);exit; 578 // print_r($orderEnsure);exit;
579 //产品sku 579 //产品sku
580 -// $productSku = $this->post('productSku', 0);  
581 - $productSku = 178284; 580 + $productSku = $this->post('productSku', 0);
582 //购买数量,范围1-4 581 //购买数量,范围1-4
583 $buyNumber = $this->post('buyNumber', 0); 582 $buyNumber = $this->post('buyNumber', 0);
584 //yoho币数量 583 //yoho币数量
@@ -613,8 +612,7 @@ class IndexController extends WebAction @@ -613,8 +612,7 @@ class IndexController extends WebAction
613 break; 612 break;
614 } 613 }
615 //产品sku 614 //产品sku
616 -// $productSku = $this->post('productSku', 0);  
617 - $productSku = 178284; 615 + $productSku = $this->post('productSku', 0);
618 //购买数量,范围1-4 616 //购买数量,范围1-4
619 $buyNumber = $this->post('buyNumber', 0); 617 $buyNumber = $this->post('buyNumber', 0);
620 //yoho币数量 618 //yoho币数量
@@ -626,5 +624,36 @@ class IndexController extends WebAction @@ -626,5 +624,36 @@ class IndexController extends WebAction
626 624
627 $this->echoJson($result); 625 $this->echoJson($result);
628 } 626 }
  627 + /**
  628 + * 门票-下单
  629 + */
  630 + public function ticketOrderSubAction()
  631 + {
  632 + $result = array('code' => 400, 'message' => '立即购买失败, 请稍后在试!');
  633 + do {
  634 + if (!$this->isAjax()) {
  635 + break;
  636 + }
  637 +
  638 + $uid = $this->getUid();
  639 +
  640 + if (empty($uid)) {
  641 + $result = array('code' => 401, 'message' => '请先登录!');
  642 + break;
  643 + }
  644 + //产品sku
  645 + $productSku = $this->post('productSku', 0);
  646 + //购买数量,范围1-4
  647 + $buyNumber = $this->post('buyNumber', 0);
  648 + //yoho币数量
  649 + $yohoCoin = $this->post('yohoCoin', 0);
  650 + //手机号码
  651 + $mobile = $this->post('mobile', 0);
  652 + $result = CartModel::submitTicket($uid, $productSku, $buyNumber, $mobile, $yohoCoin);
  653 +
  654 + } while (false);
  655 +
  656 + $this->echoJson($result);
  657 + }
629 658
630 } 659 }
@@ -9,11 +9,19 @@ define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录 @@ -9,11 +9,19 @@ define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录
9 define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录 9 define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录
10 defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'developer'); 10 defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'developer');
11 11
12 -define('API_URL', 'http://testapi.yoho.cn:28078/');  
13 -define('SERVICE_URL', 'http://testservice.yoho.cn:28077/'); 12 +#test环境
  13 +//define('API_URL', 'http://testapi.yoho.cn:28078/');
  14 +//define('SERVICE_URL', 'http://testservice.yoho.cn:28077/');
  15 +//define('YOHOBUY_URL', 'http://www.yohobuy.com/');
  16 +//define('SERVICE_NOTIFY', 'http://testservice.yoho.cn:28077/');
  17 +//define('API_OLD', 'http://test2.open.yohobuy.com/');
  18 +
  19 +#dev环境
  20 +define('API_URL', 'http://devapi.yoho.cn:58078/');
  21 +define('SERVICE_URL', 'http://devservice.yoho.cn:58077/');
14 define('YOHOBUY_URL', 'http://www.yohobuy.com/'); 22 define('YOHOBUY_URL', 'http://www.yohobuy.com/');
15 -define('SERVICE_NOTIFY', 'http://testservice.yoho.cn:28077/');  
16 -define('API_OLD', 'http://test2.open.yohobuy.com/'); 23 +define('SERVICE_NOTIFY', 'http://test2.open.yohobuy.com/');
  24 +define('API_OLD', 'http://devservice.yoho.cn:58077/');
17 25
18 $application = new Application(APPLICATION_PATH . '/configs/application.developer.ini'); 26 $application = new Application(APPLICATION_PATH . '/configs/application.developer.ini');
19 $application->bootstrap()->run(); 27 $application->bootstrap()->run();