Showing
7 changed files
with
257 additions
and
6 deletions
@@ -535,7 +535,7 @@ class CartData | @@ -535,7 +535,7 @@ class CartData | ||
535 | public static function addTicket($uid, $productSku, $buyNumber, $yohoNum = 0) | 535 | public static function addTicket($uid, $productSku, $buyNumber, $yohoNum = 0) |
536 | { | 536 | { |
537 | $param = Yohobuy::param(); | 537 | $param = Yohobuy::param(); |
538 | - $param['method'] = 'app.shopping.submitTicket'; | 538 | + $param['method'] = 'app.shopping.ticket'; |
539 | $param['uid'] = intval($uid); | 539 | $param['uid'] = intval($uid); |
540 | $param['product_sku'] = intval($productSku); | 540 | $param['product_sku'] = intval($productSku); |
541 | $param['buy_number'] = intval($buyNumber); | 541 | $param['buy_number'] = intval($buyNumber); |
1 | +{{> layout/header}} | ||
2 | +<div class="order-ensure-page yoho-page clearfix"> | ||
3 | +{{# orderEnsure}} | ||
4 | + <div class="order-edit"> | ||
5 | + <div class="order-title"> | ||
6 | + <ul> | ||
7 | + <li class="first">立即购买</li> | ||
8 | + <li class="active">填写订单</li> | ||
9 | + <li class="end">付款,完成购买</li> | ||
10 | + </ul> | ||
11 | + </div> | ||
12 | + | ||
13 | + <div class="order-edit-main" id="order-edit-main" {{#isNewUser}}data-new="new"{{/isNewUser}} cartType="{{cartType}}"> | ||
14 | + <h2 class="title">请填写并核对以下信息</h2> | ||
15 | + <div class="order-content"> | ||
16 | + <div class="order-selection pay-time"> | ||
17 | + <h2>支付及发劵时间:</h2> | ||
18 | + <ul class="modity-pay-info"> | ||
19 | + <li>付款方式:<span>在线支付</span></li> | ||
20 | + <li>发劵时间:<span>自动发货-在您支付成功后,系统将立即为您发放二维码,您可以在您的订单中查看。</span></li> | ||
21 | + <li>手机号:<span>否</span></li> | ||
22 | + </ul> | ||
23 | + </div><!--/order-selection pay-time--> | ||
24 | + </div><!--/order-content--> | ||
25 | + </div><!--/order-edit-main--> | ||
26 | + </div> | ||
27 | + | ||
28 | + <!-- 订单提示--> | ||
29 | + <div class="order-pay"> | ||
30 | + <div class="pay-wapper"> | ||
31 | + <table> | ||
32 | + <thead> | ||
33 | + <tr> | ||
34 | + <th style="width:40%;"> | ||
35 | + 商品信息 | ||
36 | + </th> | ||
37 | + <th style="width:10%;">单价(元)</th> | ||
38 | + <th style="width:10%;">返YOHO币</th> | ||
39 | + <th style="width:10%;">数量</th> | ||
40 | + <th style="width:10%;">小计(元)</th> | ||
41 | + <th style="width:20%;">商品金额(元)</th> | ||
42 | + </tr> | ||
43 | + </thead> | ||
44 | + <tbody> | ||
45 | + {{#each orderProducts}} | ||
46 | + <tr> | ||
47 | + <td> | ||
48 | + <div class="pay-pro"> | ||
49 | + <a class="pay-pro-icon" href="{{link}}"> | ||
50 | + <img src="{{imgCover}}" /> | ||
51 | + {{#isPriceGift}} | ||
52 | + <span class="incentive">加价购</span> | ||
53 | + {{/isPriceGift}} | ||
54 | + {{#isGift}} | ||
55 | + <span class="gift">赠品</span> | ||
56 | + {{/isGift}} | ||
57 | + </a> | ||
58 | + <p class="pay-pro-info"> | ||
59 | + <a href="{{link}}" target="_blank">{{productTitle}}</a> | ||
60 | + <span>颜色:{{productColor}} 尺码:{{productSize}}</span> | ||
61 | + </p> | ||
62 | + </div> | ||
63 | + </td> | ||
64 | + <td> | ||
65 | + {{productPrice}} | ||
66 | + {{#isVipPrice}} | ||
67 | + <span class="vipPrice">(VIP)</span> | ||
68 | + {{/isVipPrice}} | ||
69 | + </td> | ||
70 | + <td>{{yohoIcon}}个</td> | ||
71 | + <td>{{productNum}}</td> | ||
72 | + <td class="cart-sub-total {{#xForOne}}xforone{{/xForOne}}"> | ||
73 | + {{#if xForOne}} | ||
74 | + <del>{{productSubtotal}}</del> | ||
75 | + <span class="free"></span> | ||
76 | + {{^}} | ||
77 | + {{productSubtotal}} | ||
78 | + {{/if}} | ||
79 | + </td> | ||
80 | + <td class="cart-sub-total-all">{{productSubtotal}}</td> | ||
81 | + </tr> | ||
82 | + {{/each}} | ||
83 | + </tbody> | ||
84 | + </table> | ||
85 | + <!--YOHO--> | ||
86 | + <div class="play-content clearfix"> | ||
87 | + <div class="play-right"> | ||
88 | + <dl class="play-bi-pan pan"> | ||
89 | + <dt>使用YOHO币支付</dt> | ||
90 | + <dd> | ||
91 | + <div class="play-pan"> | ||
92 | + <div class="strong"> | ||
93 | + 使用YOHO币: | ||
94 | + <input type="text" class="textbox" id="biprice" data-bi="{{ownYohoCoin}}" value="0" /> 个 | ||
95 | + </div> | ||
96 | + <p > | ||
97 | + 您目前有YOHO币 <em class="strong">{{ownYohoCoin}}</em> 个 | ||
98 | + </p> | ||
99 | + <p class="errbitip red"></p> | ||
100 | + <div class="btn-group clearfix"> | ||
101 | + <input type="button" class="ok" value="确定" id="bisubmit"/> | ||
102 | + <input type="button" class="cancel cancel-bi" value="取消"/> | ||
103 | + </div> | ||
104 | + </div> | ||
105 | + </dd> | ||
106 | + </dl> | ||
107 | + | ||
108 | + {{#if redEnvelopes}} | ||
109 | + <div class="red-envelopes active"> | ||
110 | + <div class="use-envelopes"> | ||
111 | + <input checked value="0" data-all="{{redEnvelopes}}" data-use="{{useRedEnvelopes}}" type="checkbox" />使用现金红包支付:<span>-¥{{useRedEnvelopes}}</span> | ||
112 | + </div> | ||
113 | + <div class="has-envelopes">您的现金红包余额:<span></span></div> | ||
114 | + </div> | ||
115 | + {{/if}} | ||
116 | + </div> | ||
117 | + </div> | ||
118 | + </div> | ||
119 | + | ||
120 | + <div class="to-play"> | ||
121 | + <p>您需要实际支付金额:<em>{{lastOrderAmount}}</em>元</p> | ||
122 | + <div class="btn-group clearfix"> | ||
123 | + <input type="button" class="submit" value="去付款"/> | ||
124 | + </div> | ||
125 | + </div> | ||
126 | + </div> | ||
127 | +{{/ orderEnsure}} | ||
128 | +<div class="loading"><span></span>请稍后...</div> | ||
129 | +</div> | ||
130 | +{{> layout/footer}} |
@@ -174,7 +174,7 @@ | @@ -174,7 +174,7 @@ | ||
174 | <ul class="size{{#unless focus}} hide{{/unless}}"> | 174 | <ul class="size{{#unless focus}} hide{{/unless}}"> |
175 | {{!-- 电子门票data-num最多可以买4张 --}} | 175 | {{!-- 电子门票data-num最多可以买4张 --}} |
176 | {{#each size}} | 176 | {{#each size}} |
177 | - <li {{#unless num}}class="disable"{{/unless}} data-sku="{{sku}}" data-num="4" data-name="{{name}}">{{name}}</li> | 177 | + <li {{#unless num}}class="disable"{{/unless}} data-sku="{{sku}}" data-num="{{num}}" data-name="{{name}}">{{name}}</li> |
178 | {{/each}} | 178 | {{/each}} |
179 | 179 | ||
180 | <span class="size-warn warn-tip hide"> | 180 | <span class="size-warn warn-tip hide"> |
@@ -280,7 +280,8 @@ | @@ -280,7 +280,8 @@ | ||
280 | <p class="row"> | 280 | <p class="row"> |
281 | {{#if isTicket}} | 281 | {{#if isTicket}} |
282 | {{!-- 电子门票按钮 --}} | 282 | {{!-- 电子门票按钮 --}} |
283 | - <span id="buy-now" class="buy-btn buy-now item-buy{{#if dis}} dis{{/if}}" data-base="{{buyNowBase}}">立即购买</span> | 283 | + <span id="buy-ticket" class="buy-btn buy-now item-buy{{#if dis}} dis{{/if}}" >立即购买</span> |
284 | + <form name="ticket-form" action="/cart/index/ticketEnsure" method="POST"></form> | ||
284 | {{^}} | 285 | {{^}} |
285 | {{!-- 各颜色下所有尺码均售罄则只显示售罄按钮 --}} | 286 | {{!-- 各颜色下所有尺码均售罄则只显示售罄按钮 --}} |
286 | {{#unless soldOut}} | 287 | {{#unless soldOut}} |
@@ -378,6 +378,48 @@ $('#keep-shopping').click(function() { | @@ -378,6 +378,48 @@ $('#keep-shopping').click(function() { | ||
378 | $('#balance').slideUp(SLIDETIME); | 378 | $('#balance').slideUp(SLIDETIME); |
379 | }); | 379 | }); |
380 | 380 | ||
381 | +//电子票立即购买 | ||
382 | +$('#buy-ticket').click(function() { | ||
383 | + var sku, | ||
384 | + buyNumber; | ||
385 | + | ||
386 | + if (maxStock === -1) { | ||
387 | + showSizeWarn(); | ||
388 | + return; | ||
389 | + } | ||
390 | + | ||
391 | + if ($(this).hasClass('dis')) { | ||
392 | + return; | ||
393 | + } | ||
394 | + | ||
395 | + sku = $('.size:not(.hide) li.focus').data('sku'); | ||
396 | + buyNumber = getNum(); | ||
397 | + | ||
398 | + $.ajax({ | ||
399 | + type: 'POST', | ||
400 | + url: '/cart/index/setTicket', | ||
401 | + data: { | ||
402 | + productSku: sku, | ||
403 | + buyNumber: buyNumber | ||
404 | + } | ||
405 | + }).then(function(data) { | ||
406 | + var $ticketForm, | ||
407 | + myAlert; | ||
408 | + | ||
409 | + if (data.code * 1 === 200) { | ||
410 | + $ticketForm = $('form[name="ticket-form"]'); | ||
411 | + $ticketForm.html( | ||
412 | + '<input name="productSku" value="' + sku + '" />' + | ||
413 | + '<input name="buyNumber" value="' + buyNumber + '" />' | ||
414 | + ); | ||
415 | + $ticketForm.submit(); | ||
416 | + } else { | ||
417 | + myAlert = new Alert(data.message); | ||
418 | + myAlert.show(); | ||
419 | + } | ||
420 | + }); | ||
421 | +}); | ||
422 | + | ||
381 | //立即购买 | 423 | //立即购买 |
382 | $('#buy-now').click(function() { | 424 | $('#buy-now').click(function() { |
383 | var sku, | 425 | var sku, |
@@ -1013,7 +1013,8 @@ class ItemModel | @@ -1013,7 +1013,8 @@ class ItemModel | ||
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'); | 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(); | 1015 | $areas = array(); |
1016 | - | 1016 | + $baseInfo['isTicket'] = empty($baseInfo['isTicket']) ? false : $baseInfo['isTicket']; |
1017 | + | ||
1017 | if (!empty($baseInfo['goodsList'])) { | 1018 | if (!empty($baseInfo['goodsList'])) { |
1018 | $goodsGroup = array(); | 1019 | $goodsGroup = array(); |
1019 | foreach ($baseInfo['goodsList'] as $pos => $value) { | 1020 | foreach ($baseInfo['goodsList'] as $pos => $value) { |
@@ -1034,7 +1035,7 @@ class ItemModel | @@ -1034,7 +1035,7 @@ class ItemModel | ||
1034 | 'size' => array(), | 1035 | 'size' => array(), |
1035 | ); | 1036 | ); |
1036 | //不是门票的要显示图片 | 1037 | //不是门票的要显示图片 |
1037 | - if (empty($baseInfo['isTicket'])) { | 1038 | + if ($baseInfo['isTicket']) { |
1038 | $goodsGroup['src'] = Images::getImageUrl($value['colorImage'], 40, 40); | 1039 | $goodsGroup['src'] = Images::getImageUrl($value['colorImage'], 40, 40); |
1039 | } | 1040 | } |
1040 | 1041 | ||
@@ -1069,7 +1070,7 @@ class ItemModel | @@ -1069,7 +1070,7 @@ class ItemModel | ||
1069 | $goodsGroup['size'][] = array( | 1070 | $goodsGroup['size'][] = array( |
1070 | 'name' => $size['sizeName'], | 1071 | 'name' => $size['sizeName'], |
1071 | 'sku' => $size['goodsSizeSkuId'], | 1072 | 'sku' => $size['goodsSizeSkuId'], |
1072 | - 'num' => intval($size['goodsSizeStorageNum']), | 1073 | + 'num' => $baseInfo['isTicket'] && $size['goodsSizeStorageNum'] > 4 ? 4 : intval($size['goodsSizeStorageNum']), |
1073 | 'goodsId'=> $size['goodsId'] | 1074 | 'goodsId'=> $size['goodsId'] |
1074 | ); | 1075 | ); |
1075 | //单个sku商品的总数 | 1076 | //单个sku商品的总数 |
@@ -1393,4 +1393,21 @@ class CartModel | @@ -1393,4 +1393,21 @@ class CartModel | ||
1393 | return $result; | 1393 | return $result; |
1394 | } | 1394 | } |
1395 | 1395 | ||
1396 | + /** | ||
1397 | + * 立即购买 | ||
1398 | + * @param int $uid 用户ID | ||
1399 | + * @param type int $productSku 产品sku | ||
1400 | + * @param type int $buyNumber 购买数量,范围1-4 | ||
1401 | + * @param type int $yohoNum yoho币 | ||
1402 | + * @return type [] | ||
1403 | + */ | ||
1404 | + public function addTicket($uid, $productSku, $buyNumber, $yohoNum = 0) | ||
1405 | + { | ||
1406 | + $data = CartData::addTicket($uid, $productSku, $buyNumber, $yohoNum); | ||
1407 | + if (!empty($data['data'])) { | ||
1408 | + return $data['data']; | ||
1409 | + } | ||
1410 | + | ||
1411 | + return $data; | ||
1412 | + } | ||
1396 | } | 1413 | } |
@@ -563,4 +563,64 @@ class IndexController extends WebAction | @@ -563,4 +563,64 @@ class IndexController extends WebAction | ||
563 | } | 563 | } |
564 | } | 564 | } |
565 | 565 | ||
566 | + /** | ||
567 | + * 发票确认订单页面 | ||
568 | + */ | ||
569 | + public function ticketEnsureAction() | ||
570 | + { | ||
571 | + // 审判用户是否已登录 | ||
572 | + $uid = $this->auditJumpLogin(false); | ||
573 | + | ||
574 | + $this->setTitle('填写订单', true, ' | '); | ||
575 | + $this->setSimpleHeader(); | ||
576 | + | ||
577 | + $orderEnsure = CartModel::cartPay($uid, 'ordinary', false); | ||
578 | + | ||
579 | + //产品sku | ||
580 | + $productSku = $this->post('productSku'); | ||
581 | + //购买数量,范围1-4 | ||
582 | + $buyNumber = $this->post('buyNumber', 0); | ||
583 | + //yoho币数量 | ||
584 | + $yohoNum = $this->post('yohoNum', 0); | ||
585 | + // 执行加入购物车操作 | ||
586 | +// $result = CartModel::addTicket($uid, $productSku, $buyNumber, $yohoNum); | ||
587 | + | ||
588 | + $this->_view->display('ticket-ensure', array( | ||
589 | + 'orderEnsurePage' => true, | ||
590 | + 'orderEnsure' => $orderEnsure, | ||
591 | + )); | ||
592 | + } | ||
593 | + | ||
594 | + /** | ||
595 | + * 门票-立即购买接口 | ||
596 | + */ | ||
597 | + public function setTicketAction() | ||
598 | + { | ||
599 | + $result = array('code' => 400, 'message' => '立即购买失败, 请稍后在试!'); | ||
600 | + do { | ||
601 | + if (!$this->isAjax()) { | ||
602 | + break; | ||
603 | + } | ||
604 | + | ||
605 | + $uid = $this->getUid(); | ||
606 | + | ||
607 | + if (empty($uid)) { | ||
608 | + $result = array('code' => 401, 'message' => '请先登录!'); | ||
609 | + break; | ||
610 | + } | ||
611 | + //产品sku | ||
612 | + $productSku = $this->post('productSku'); | ||
613 | + //购买数量,范围1-4 | ||
614 | + $buyNumber = $this->post('buyNumber', 0); | ||
615 | + //yoho币数量 | ||
616 | + $yohoNum = $this->post('yohoNum', 0); | ||
617 | + // 执行加入购物车操作 | ||
618 | + $result = CartModel::addTicket($uid, $productSku, $buyNumber, $yohoNum); | ||
619 | +// print_r($result);exit; | ||
620 | + | ||
621 | + } while (false); | ||
622 | + | ||
623 | + $this->echoJson($result); | ||
624 | + } | ||
625 | + | ||
566 | } | 626 | } |
-
Please register or login to post a comment