Merge remote-tracking branch 'remotes/origin/feature/ticket'
Showing
40 changed files
with
1178 additions
and
411 deletions
library/Configs/TicketsConfig.php
0 → 100644
@@ -56,12 +56,8 @@ class OptData | @@ -56,12 +56,8 @@ class OptData | ||
56 | $param['client_secret'] = Sign::getSign($param); | 56 | $param['client_secret'] = Sign::getSign($param); |
57 | 57 | ||
58 | if ($opt === 'cancel') { | 58 | if ($opt === 'cancel') { |
59 | -// return Yohobuy::yarClient(SERVICE_URL . 'shops/service/v1/favorite/', 'addUidProductFav', array($uid, $skn)); | ||
60 | - | ||
61 | return Yohobuy::get(SERVICE_URL.'shops/service/v1/favorite/addUidProductFav', $param); | 59 | return Yohobuy::get(SERVICE_URL.'shops/service/v1/favorite/addUidProductFav', $param); |
62 | } else { | 60 | } else { |
63 | -// return Yohobuy::yarClient(SERVICE_URL . 'shops/service/v1/favorite/', 'delUidProductFav', array($uid, $skn)); | ||
64 | - | ||
65 | return Yohobuy::get(SERVICE_URL.'shops/service/v1/favorite/delUidProductFav', $param); | 61 | return Yohobuy::get(SERVICE_URL.'shops/service/v1/favorite/delUidProductFav', $param); |
66 | } | 62 | } |
67 | } | 63 | } |
@@ -82,12 +78,8 @@ class OptData | @@ -82,12 +78,8 @@ class OptData | ||
82 | $param['client_secret'] = Sign::getSign($param); | 78 | $param['client_secret'] = Sign::getSign($param); |
83 | 79 | ||
84 | if ($opt === 'cancel') { | 80 | if ($opt === 'cancel') { |
85 | -// return Yohobuy::yarClient(SERVICE_URL . 'guang/service/v2/praise', 'cancelPraise', array($id, $udid)); | ||
86 | - | ||
87 | return Yohobuy::get(SERVICE_URL.'guang/api/v2/praise/cancel', $param); | 81 | return Yohobuy::get(SERVICE_URL.'guang/api/v2/praise/cancel', $param); |
88 | } else { | 82 | } else { |
89 | -// return Yohobuy::yarClient(SERVICE_URL . 'guang/service/v2/praise', 'setPraise', array($id, $udid)); | ||
90 | - | ||
91 | return Yohobuy::get(SERVICE_URL.'guang/api/v2/praise/setPraise', $param); | 83 | return Yohobuy::get(SERVICE_URL.'guang/api/v2/praise/setPraise', $param); |
92 | } | 84 | } |
93 | } | 85 | } |
@@ -108,12 +100,8 @@ class OptData | @@ -108,12 +100,8 @@ class OptData | ||
108 | $param['client_secret'] = Sign::getSign($param); | 100 | $param['client_secret'] = Sign::getSign($param); |
109 | 101 | ||
110 | if ($opt === 'cancel') { | 102 | if ($opt === 'cancel') { |
111 | -// return Yohobuy::yarClient(SERVICE_URL . 'guang/service/v2/favorite/', 'cancelFavorite', array($id, $uid)); | ||
112 | - | ||
113 | return Yohobuy::get(SERVICE_URL.'guang/api/v1/favorite/cancelFavorite', $param); | 103 | return Yohobuy::get(SERVICE_URL.'guang/api/v1/favorite/cancelFavorite', $param); |
114 | } else { | 104 | } else { |
115 | -// return Yohobuy::yarClient(SERVICE_URL . 'guang/service/v2/favorite/', 'setFavorite', array($id, $uid)); | ||
116 | - | ||
117 | return Yohobuy::get(SERVICE_URL.'guang/api/v1/favorite/setFavorite', $param); | 105 | return Yohobuy::get(SERVICE_URL.'guang/api/v1/favorite/setFavorite', $param); |
118 | } | 106 | } |
119 | } | 107 | } |
@@ -145,8 +145,6 @@ class PlusstarData | @@ -145,8 +145,6 @@ class PlusstarData | ||
145 | if (!empty($cached)) { | 145 | if (!empty($cached)) { |
146 | // 判断用户是否已收藏 | 146 | // 判断用户是否已收藏 |
147 | if ($isUidOk) { | 147 | if ($isUidOk) { |
148 | -// $getUidBrandFav = Yohobuy::yarClient(SERVICE_URL . self::URI_BRANDINFO_FAVORITE, 'getUidBrandFav', array($uid, $cached['getBrandInfo']['data']['brand_id']), false, 1000); | ||
149 | - | ||
150 | $param = Yohobuy::param(); | 148 | $param = Yohobuy::param(); |
151 | $param['uid'] = $uid; | 149 | $param['uid'] = $uid; |
152 | $param['brandId'] = $cached['getBrandInfo']['data']['brand_id']; | 150 | $param['brandId'] = $cached['getBrandInfo']['data']['brand_id']; |
@@ -154,21 +152,16 @@ class PlusstarData | @@ -154,21 +152,16 @@ class PlusstarData | ||
154 | $param['private_key'] = Yohobuy::$privateKeyList[$clientType]; | 152 | $param['private_key'] = Yohobuy::$privateKeyList[$clientType]; |
155 | $param['client_secret'] = Sign::getSign($param); | 153 | $param['client_secret'] = Sign::getSign($param); |
156 | $getUidBrandFav = Yohobuy::get(SERVICE_URL . self::URI_BRANDINFO_FAVORITE . 'getUidBrandFav', $param); | 154 | $getUidBrandFav = Yohobuy::get(SERVICE_URL . self::URI_BRANDINFO_FAVORITE . 'getUidBrandFav', $param); |
157 | -// file_put_contents('../../../../../../Desktop/app/n/getUidBrandFav.txt', var_export($getUidBrandFav, true)); | ||
158 | - | ||
159 | if (isset($getUidBrandFav['code']) && $getUidBrandFav['code'] == 200) { | 155 | if (isset($getUidBrandFav['code']) && $getUidBrandFav['code'] == 200) { |
160 | $cached['getUidBrandFav'] = true; | 156 | $cached['getUidBrandFav'] = true; |
161 | }else{ | 157 | }else{ |
162 | - //$cached['getUidBrandFav'] = false; | ||
163 | $getUidBrandFavResult = false; | 158 | $getUidBrandFavResult = false; |
164 | } | 159 | } |
165 | 160 | ||
166 | } | 161 | } |
167 | }else{ | 162 | }else{ |
168 | $getUidBrandFavResult = false; | 163 | $getUidBrandFavResult = false; |
169 | - //$cached['getUidBrandFav'] = false; | ||
170 | } | 164 | } |
171 | - //return $cached; | ||
172 | 165 | ||
173 | if (!empty($cached)) { | 166 | if (!empty($cached)) { |
174 | $cached['getUidBrandFav'] = $getUidBrandFavResult; | 167 | $cached['getUidBrandFav'] = $getUidBrandFavResult; |
@@ -177,17 +170,12 @@ class PlusstarData | @@ -177,17 +170,12 @@ class PlusstarData | ||
177 | } | 170 | } |
178 | 171 | ||
179 | // 品牌详情信息 | 172 | // 品牌详情信息 |
180 | -// $brandInfo = Yohobuy::yarClient(SERVICE_URL . self::URI_BRANDINFO_PLUSSTAR, 'getBrandInfo', array(array('id' => $id)), 3600); // 缓存1小时 | ||
181 | -// file_put_contents('../../../../../../Desktop/app/o/getbrandinfo.txt', var_export($brandInfo, true)); | ||
182 | - | ||
183 | - // 品牌详情信息 | ||
184 | $param = Yohobuy::param(); | 173 | $param = Yohobuy::param(); |
185 | $param['id'] = $id; | 174 | $param['id'] = $id; |
186 | $param['client_type'] = $clientType; | 175 | $param['client_type'] = $clientType; |
187 | $param['private_key'] = Yohobuy::$privateKeyList[$clientType]; | 176 | $param['private_key'] = Yohobuy::$privateKeyList[$clientType]; |
188 | $param['client_secret'] = Sign::getSign($param); | 177 | $param['client_secret'] = Sign::getSign($param); |
189 | $brandInfo = Yohobuy::get(SERVICE_URL . self::URI_BRANDINFO_PLUSSTAR_NEW . 'getbrandinfo', $param, 3600); | 178 | $brandInfo = Yohobuy::get(SERVICE_URL . self::URI_BRANDINFO_PLUSSTAR_NEW . 'getbrandinfo', $param, 3600); |
190 | -// file_put_contents('../../../../../../Desktop/app/n/getbrandinfo.txt', var_export($brandInfo, true)); | ||
191 | 179 | ||
192 | if (!isset($brandInfo['data']['brand_id'])) { | 180 | if (!isset($brandInfo['data']['brand_id'])) { |
193 | // 再尝试获取二级缓存(master), 有数据则直接返回. | 181 | // 再尝试获取二级缓存(master), 有数据则直接返回. |
@@ -213,7 +201,6 @@ class PlusstarData | @@ -213,7 +201,6 @@ class PlusstarData | ||
213 | 201 | ||
214 | $article = Yohobuy::get(SERVICE_URL.self::URI_BRANDINFO_ARTICLE.'getArticleByBrand', $param); | 202 | $article = Yohobuy::get(SERVICE_URL.self::URI_BRANDINFO_ARTICLE.'getArticleByBrand', $param); |
215 | $result['getArticleByBrand'] = empty($article['data']) ? array() : $article['data']; | 203 | $result['getArticleByBrand'] = empty($article['data']) ? array() : $article['data']; |
216 | -// file_put_contents('../../../../../../Desktop/app/n/getArticleByBrand.txt', var_export($result['getArticleByBrand'], true)); | ||
217 | 204 | ||
218 | // 是否收藏店铺 | 205 | // 是否收藏店铺 |
219 | $param = Yohobuy::param(); | 206 | $param = Yohobuy::param(); |
@@ -477,4 +477,52 @@ class CartData | @@ -477,4 +477,52 @@ class CartData | ||
477 | return Yohobuy::get(API_URL, $param); | 477 | return Yohobuy::get(API_URL, $param); |
478 | } | 478 | } |
479 | 479 | ||
480 | + /** | ||
481 | + * 校验电子票 | ||
482 | + * @param int $uid | ||
483 | + * @param int $productSku | ||
484 | + * @param int $buyNumber | ||
485 | + * @param int $useYohoCoin | ||
486 | + * @param int $yohoCoinMode 1:使用yoho币;0:不使用yoho币 | ||
487 | + * @author sefon 2016-7-2 18:12:30 | ||
488 | + * @return array | ||
489 | + */ | ||
490 | + public static function checkTickets ($uid, $productSku, $buyNumber, $useYohoCoin = 0, $yohoCoinMode = true) | ||
491 | + { | ||
492 | + $param = Yohobuy::param(); | ||
493 | + $param['method'] = 'app.shopping.ticket'; | ||
494 | + $param['uid'] = $uid; | ||
495 | + $param['product_sku'] = $productSku; | ||
496 | + $param['buy_number'] = $buyNumber; | ||
497 | + if (!$yohoCoinMode) { | ||
498 | + $param['yoho_coin_mode'] = 0; | ||
499 | + } | ||
500 | + $param['use_yoho_coin'] = $useYohoCoin; | ||
501 | + $param['client_secret'] = Sign::getSign($param); | ||
502 | + return Yohobuy::get(API_URL, $param); | ||
503 | + } | ||
504 | + | ||
505 | + /** | ||
506 | + * 电子票下单 | ||
507 | + * @param int $uid | ||
508 | + * @param int $productSku | ||
509 | + * @param int $buyNumber | ||
510 | + * @param int $useYohoCoin | ||
511 | + * @param int $qhyUnion | ||
512 | + * @author sefon 2016-7-2 18:12:30 | ||
513 | + * @return array | ||
514 | + */ | ||
515 | + public static function submitTicket ($uid, $productSku, $buyNumber, $mobile, $useYohoCoin = 0, $qhyUnion = '') | ||
516 | + { | ||
517 | + $param = Yohobuy::param(); | ||
518 | + $param['method'] = 'app.shopping.submitTicket'; | ||
519 | + $param['uid'] = $uid; | ||
520 | + $param['product_sku'] = $productSku; | ||
521 | + $param['buy_number'] = $buyNumber; | ||
522 | + $param['mobile'] = $mobile; | ||
523 | + $param['use_yoho_coin'] = $useYohoCoin; | ||
524 | + $param['qhy_union'] = $qhyUnion; | ||
525 | + $param['client_secret'] = Sign::getSign($param); | ||
526 | + return Yohobuy::get(API_URL, $param); | ||
527 | + } | ||
480 | } | 528 | } |
@@ -84,7 +84,12 @@ class OrderData | @@ -84,7 +84,12 @@ class OrderData | ||
84 | $param = Yohobuy::param(); | 84 | $param = Yohobuy::param(); |
85 | $param['method'] = 'app.SpaceOrders.detail'; | 85 | $param['method'] = 'app.SpaceOrders.detail'; |
86 | $param['order_code'] = $orderCode; | 86 | $param['order_code'] = $orderCode; |
87 | - $param['uid'] = $uid; | 87 | + |
88 | + //异步回调无uid | ||
89 | + if (!empty($uid)) { | ||
90 | + $param['uid'] = $uid; | ||
91 | + } | ||
92 | + | ||
88 | $param['session_key'] = $sessionKey; | 93 | $param['session_key'] = $sessionKey; |
89 | $param['client_secret'] = Sign::getSign($param); | 94 | $param['client_secret'] = Sign::getSign($param); |
90 | 95 |
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | 2 | ||
3 | namespace Plugin; | 3 | namespace Plugin; |
4 | 4 | ||
5 | +use Configs\TicketsConfig; | ||
5 | use Plugin\DataProcess\CouponFloorProcess; | 6 | use Plugin\DataProcess\CouponFloorProcess; |
6 | 7 | ||
7 | /** | 8 | /** |
@@ -630,9 +631,10 @@ class Helpers | @@ -630,9 +631,10 @@ class Helpers | ||
630 | * @param array $orderGoods 订单 | 631 | * @param array $orderGoods 订单 |
631 | * @param int $count 计订单件数 | 632 | * @param int $count 计订单件数 |
632 | * @param bool $haveLink 控制是否需要商品链接 | 633 | * @param bool $haveLink 控制是否需要商品链接 |
634 | + * @param bool $tickets 门票 | ||
633 | * @return array $arr 处理之后的订单商品数据 | 635 | * @return array $arr 处理之后的订单商品数据 |
634 | */ | 636 | */ |
635 | - public static function formatOrderGoods($orderGoods, &$count = 0, $haveLink = false) | 637 | + public static function formatOrderGoods($orderGoods, &$count = 0, $haveLink = false, $tickets = false) |
636 | { | 638 | { |
637 | $arr = array(); | 639 | $arr = array(); |
638 | 640 | ||
@@ -659,6 +661,16 @@ class Helpers | @@ -659,6 +661,16 @@ class Helpers | ||
659 | } | 661 | } |
660 | // 累计购买数 | 662 | // 累计购买数 |
661 | $count += intval($vo['buy_number']); | 663 | $count += intval($vo['buy_number']); |
664 | + | ||
665 | + //门票 | ||
666 | + if ($tickets) { | ||
667 | + | ||
668 | + //展览票不显示区域 | ||
669 | + if ($vo['product_skn'] == TicketsConfig::SINGLE_TICKETS_SKN) { | ||
670 | + unset($arr[$key]['size']); | ||
671 | + } | ||
672 | + $arr[$key]['tickets'] = true; | ||
673 | + } | ||
662 | } | 674 | } |
663 | 675 | ||
664 | return $arr; | 676 | return $arr; |
@@ -6,6 +6,7 @@ use Plugin\Pay\weixin\lib\WxPayApi; | @@ -6,6 +6,7 @@ use Plugin\Pay\weixin\lib\WxPayApi; | ||
6 | use Plugin\Pay\weixin\lib\WxPayConfig; | 6 | use Plugin\Pay\weixin\lib\WxPayConfig; |
7 | use Plugin\Pay\weixin\lib\WxPayException; | 7 | use Plugin\Pay\weixin\lib\WxPayException; |
8 | use Plugin\Pay\weixin\lib\WxPayJsApiPay; | 8 | use Plugin\Pay\weixin\lib\WxPayJsApiPay; |
9 | +use Plugin\UdpLog; | ||
9 | 10 | ||
10 | /** | 11 | /** |
11 | * | 12 | * |
@@ -115,8 +116,17 @@ class JsApiPay | @@ -115,8 +116,17 @@ class JsApiPay | ||
115 | //运行curl,结果以jason形式返回 | 116 | //运行curl,结果以jason形式返回 |
116 | $res = curl_exec($ch); | 117 | $res = curl_exec($ch); |
117 | curl_close($ch); | 118 | curl_close($ch); |
119 | + | ||
120 | + UdpLog::info('微信获取openid,function:GetOpenidFromMp, 结果,', array('code' => $code, 'res' => $res)); | ||
121 | + | ||
118 | //取出openid | 122 | //取出openid |
119 | $data = json_decode($res, true); | 123 | $data = json_decode($res, true); |
124 | + //初始化 | ||
125 | + if (empty($data) || empty($data['openid'])) { | ||
126 | + $data['access_token'] = false; | ||
127 | + $data['openid'] = false; | ||
128 | + } | ||
129 | + | ||
120 | $this->data = $data; | 130 | $this->data = $data; |
121 | $openid = $data['openid']; | 131 | $openid = $data['openid']; |
122 | 132 |
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
@@ -1490,16 +1490,26 @@ function initInfosEvt($container) { | @@ -1490,16 +1490,26 @@ function initInfosEvt($container) { | ||
1490 | type: 'POST', | 1490 | type: 'POST', |
1491 | url: '/guang/opt/collectArticle', | 1491 | url: '/guang/opt/collectArticle', |
1492 | data: { | 1492 | data: { |
1493 | - id: $info.data('id'), | 1493 | + id: getUrlParam('id'), |
1494 | opt: opt, | 1494 | opt: opt, |
1495 | yh_channel: yhChannel, | 1495 | yh_channel: yhChannel, |
1496 | uid: getUrlParam('uid') | 1496 | uid: getUrlParam('uid') |
1497 | }, | 1497 | }, |
1498 | success: function(data) { | 1498 | success: function(data) { |
1499 | if (data.code && data.code === 200) { | 1499 | if (data.code && data.code === 200) { |
1500 | + if (data.data.jump) { | ||
1501 | + if ($('#intimacy-link').length <= 0) { | ||
1502 | + $('body').append('<a href=\'' + data.data.jumpUrl + | ||
1503 | + '\' style="display:none;" id="intimacy-link">' + | ||
1504 | + '<span class="intimacy-link"></span></a>'); | ||
1505 | + } | ||
1500 | 1506 | ||
1501 | - //切换收藏状态 | ||
1502 | - $btn.toggleClass('collected'); | 1507 | + $('.intimacy-link').click(); |
1508 | + } else { | ||
1509 | + | ||
1510 | + //切换收藏状态 | ||
1511 | + $btn.toggleClass('collected'); | ||
1512 | + } | ||
1503 | } | 1513 | } |
1504 | }, | 1514 | }, |
1505 | error: function() { | 1515 | error: function() { |
@@ -2109,11 +2119,6 @@ window.onload = function() { | @@ -2109,11 +2119,6 @@ window.onload = function() { | ||
2109 | myScroll && myScroll.refresh(); | 2119 | myScroll && myScroll.refresh(); |
2110 | }; | 2120 | }; |
2111 | 2121 | ||
2112 | -// 图片加载完成之后重新 refresh iscroll | ||
2113 | -$('img').on('load', function() { | ||
2114 | - myScroll && myScroll.refresh(); | ||
2115 | -}); | ||
2116 | - | ||
2117 | //初始化页面,包括是否使用iscorll初始化页面 | 2122 | //初始化页面,包括是否使用iscorll初始化页面 |
2118 | //接口暴露在HTML中,使用压缩名 | 2123 | //接口暴露在HTML中,使用压缩名 |
2119 | exports.i = function(useIscroll) { | 2124 | exports.i = function(useIscroll) { |
@@ -3882,9 +3887,8 @@ module.exports = function(specificGender) { | @@ -3882,9 +3887,8 @@ module.exports = function(specificGender) { | ||
3882 | //The kidsType can be specified by the parameter. Add by @ZhaoBiao | 3887 | //The kidsType can be specified by the parameter. Add by @ZhaoBiao |
3883 | var kidsType = specificGender === 'kids' || $('.mobile-wrap').hasClass('kids-wrap') ? true : false, | 3888 | var kidsType = specificGender === 'kids' || $('.mobile-wrap').hasClass('kids-wrap') ? true : false, |
3884 | lifestyleType = specificGender === 'lifestyle' || | 3889 | lifestyleType = specificGender === 'lifestyle' || |
3885 | - $('.mobile-wrap').hasClass('lifestyle-wrap') ? true : false, | ||
3886 | - yohoCoinType = $('.coin').length ? true : false, | ||
3887 | - logisticType = $('.logistic-page').length ? true : false; | 3890 | + $('.mobile-wrap').hasClass('lifestyle-wrap') ? true : false; |
3891 | + | ||
3888 | var $curNav, | 3892 | var $curNav, |
3889 | index, | 3893 | index, |
3890 | $navList = $('#maybe-like-nav'); | 3894 | $navList = $('#maybe-like-nav'); |
@@ -3895,25 +3899,14 @@ module.exports = function(specificGender) { | @@ -3895,25 +3899,14 @@ module.exports = function(specificGender) { | ||
3895 | 3899 | ||
3896 | //ajax url | 3900 | //ajax url |
3897 | if (kidsType) { | 3901 | if (kidsType) { |
3898 | - | ||
3899 | url = '/product/recom/maylikekids'; | 3902 | url = '/product/recom/maylikekids'; |
3900 | } else if (lifestyleType) { | 3903 | } else if (lifestyleType) { |
3901 | 3904 | ||
3902 | //有货币页面加载男生首页的数据 | 3905 | //有货币页面加载男生首页的数据 |
3903 | - url = specificGender === 'lifestyle' ? '/product/recom/maylike?gender=1,3&rec_pos=100001' : '/product/recom/maylikelife'; | ||
3904 | - } else if (yohoCoinType) { | ||
3905 | - | ||
3906 | - gender = (specificGender === 'boys' || $('.mobile-wrap').hasClass('boys-wrap')) ? | ||
3907 | - '1,3&rec_pos=100009' : '2,3&rec_pos=100009', | ||
3908 | - url = '/product/recom/maylike?gender=' + gender; | ||
3909 | - } else if (logisticType) { //物流页面 | ||
3910 | - | ||
3911 | - gender = (specificGender === 'boys' || $('.mobile-wrap').hasClass('boys-wrap')) ? | ||
3912 | - '1,3&rec_pos=100006' : '2,3&rec_pos=100006', | ||
3913 | - url = '/product/recom/maylike?gender=' + gender; | 3906 | + url = specificGender === 'lifestyle' ? '/product/recom/maylike?gender=1,3' : '/product/recom/maylikelife'; |
3914 | } else { | 3907 | } else { |
3915 | gender = (specificGender === 'boys' || $('.mobile-wrap').hasClass('boys-wrap')) ? | 3908 | gender = (specificGender === 'boys' || $('.mobile-wrap').hasClass('boys-wrap')) ? |
3916 | - '1,3&rec_pos=100001' : '2,3&rec_pos=100002', | 3909 | + '1,3' : '2,3', |
3917 | url = '/product/recom/maylike?gender=' + gender; | 3910 | url = '/product/recom/maylike?gender=' + gender; |
3918 | } | 3911 | } |
3919 | 3912 | ||
@@ -4096,17 +4089,28 @@ var $historySearch = $('.history-search'); | @@ -4096,17 +4089,28 @@ var $historySearch = $('.history-search'); | ||
4096 | var $clearHistory = $('#clear-history'); | 4089 | var $clearHistory = $('#clear-history'); |
4097 | var $buriedpoint = $('.buriedpoint'); | 4090 | var $buriedpoint = $('.buriedpoint'); |
4098 | var $search = $('#search'); | 4091 | var $search = $('#search'); |
4099 | -var searchUrl = $search.closest('form').attr('action'); | ||
4100 | 4092 | ||
4101 | var writeSearch = require("js/index/write-search"); | 4093 | var writeSearch = require("js/index/write-search"); |
4102 | 4094 | ||
4103 | var ranToken = writeSearch.getRanToken(); | 4095 | var ranToken = writeSearch.getRanToken(); |
4104 | -var historyval = writeSearch.getHistoryval(); | ||
4105 | 4096 | ||
4106 | var chHammer, cHammer; | 4097 | var chHammer, cHammer; |
4107 | 4098 | ||
4108 | chHammer = new Hammer($clearHistory[0]); | 4099 | chHammer = new Hammer($clearHistory[0]); |
4109 | 4100 | ||
4101 | +function isLocalStorageSupported() { | ||
4102 | + var testKey = 'test', | ||
4103 | + storage = Window.prototype.localStorage; | ||
4104 | + | ||
4105 | + try { | ||
4106 | + storage.setItem(testKey, 'testValue'); | ||
4107 | + storage.removeItem(testKey); | ||
4108 | + return true; | ||
4109 | + } catch (error) { | ||
4110 | + return false; | ||
4111 | + } | ||
4112 | +} | ||
4113 | + | ||
4110 | chHammer.on('tap', function() { | 4114 | chHammer.on('tap', function() { |
4111 | dialog.showDialog({ | 4115 | dialog.showDialog({ |
4112 | dialogText: '您确定要删除您的最近搜索吗?', | 4116 | dialogText: '您确定要删除您的最近搜索吗?', |
@@ -4115,9 +4119,8 @@ chHammer.on('tap', function() { | @@ -4115,9 +4119,8 @@ chHammer.on('tap', function() { | ||
4115 | rightBtnText: '确定' | 4119 | rightBtnText: '确定' |
4116 | } | 4120 | } |
4117 | }, function() { | 4121 | }, function() { |
4118 | - | ||
4119 | - if (localStorage) { | ||
4120 | - localStorage.removeItem(historyval); | 4122 | + if (isLocalStorageSupported()) { |
4123 | + localStorage.removeItem('historys'); | ||
4121 | } | 4124 | } |
4122 | 4125 | ||
4123 | $history.html(''); | 4126 | $history.html(''); |
@@ -4177,7 +4180,8 @@ function inputAction() { | @@ -4177,7 +4180,8 @@ function inputAction() { | ||
4177 | } | 4180 | } |
4178 | 4181 | ||
4179 | $searchAssociate.find('li').on('touchend', function() { | 4182 | $searchAssociate.find('li').on('touchend', function() { |
4180 | - GoSearch($(this).find('.keyword').html()); | 4183 | + $buriedpoint.val($(this).find('.keyword').html()); |
4184 | + $search.closest('form').submit(); | ||
4181 | }); | 4185 | }); |
4182 | }, | 4186 | }, |
4183 | error: function() { | 4187 | error: function() { |
@@ -4187,28 +4191,6 @@ function inputAction() { | @@ -4187,28 +4191,6 @@ function inputAction() { | ||
4187 | }); | 4191 | }); |
4188 | } | 4192 | } |
4189 | 4193 | ||
4190 | -//跳到搜索页 | ||
4191 | -function GoSearch(query) { | ||
4192 | - //保存搜索的内容 | ||
4193 | - writeSearch.setHistoryValFun(query); | ||
4194 | - document.location.href = searchUrl + '?query=' + query; | ||
4195 | -} | ||
4196 | - | ||
4197 | -//热门搜索、最近搜索事件 | ||
4198 | -$('.search-items .search-group').on('click', 'li', function(event) { | ||
4199 | - var query = ''; | ||
4200 | - | ||
4201 | - if (event.target.nodeName === 'A') { | ||
4202 | - query = $(event.target).html(); | ||
4203 | - } | ||
4204 | - | ||
4205 | - if (event.target.nodeName === 'LI') { | ||
4206 | - query = $(event.target).find('a').html(); | ||
4207 | - } | ||
4208 | - | ||
4209 | - GoSearch(query); | ||
4210 | -}); | ||
4211 | - | ||
4212 | inputAction(); | 4194 | inputAction(); |
4213 | 4195 | ||
4214 | cHammer = new Hammer($clear[0]); | 4196 | cHammer = new Hammer($clear[0]); |
@@ -4217,19 +4199,13 @@ cHammer.on('tap', function() { | @@ -4217,19 +4199,13 @@ cHammer.on('tap', function() { | ||
4217 | }); | 4199 | }); |
4218 | 4200 | ||
4219 | $search.on('touchend', function() { | 4201 | $search.on('touchend', function() { |
4220 | - var $buriedpoint = $form.find('.buriedpoint'); | ||
4221 | - | ||
4222 | - if ($buriedpoint.val() === '') { | 4202 | + if ($buriedpoint.val() === '' && $('#default-terms').val() !== '') { |
4223 | $buriedpoint.val($('#default-terms').val()); | 4203 | $buriedpoint.val($('#default-terms').val()); |
4224 | } | 4204 | } |
4225 | 4205 | ||
4226 | - //保存搜索的内容 | ||
4227 | - writeSearch.setHistoryValFun($buriedpoint.val()); | ||
4228 | - | ||
4229 | if (security.hasDangerInput()) { | 4206 | if (security.hasDangerInput()) { |
4230 | return false; | 4207 | return false; |
4231 | } | 4208 | } |
4232 | - | ||
4233 | $(this).closest('form').submit(); | 4209 | $(this).closest('form').submit(); |
4234 | return false; | 4210 | return false; |
4235 | }); | 4211 | }); |
@@ -4238,10 +4214,13 @@ $search.on('touchend', function() { | @@ -4238,10 +4214,13 @@ $search.on('touchend', function() { | ||
4238 | (function() { | 4214 | (function() { |
4239 | var html = '', | 4215 | var html = '', |
4240 | history, | 4216 | history, |
4241 | - historys, i, num = 1; | 4217 | + historys, i, num = 1, searchUrl = ''; |
4242 | 4218 | ||
4243 | if (localStorage) { | 4219 | if (localStorage) { |
4244 | - historys = localStorage.getItem(historyval); | 4220 | + if (isLocalStorageSupported()) { |
4221 | + historys = localStorage.getItem('historys'); | ||
4222 | + } | ||
4223 | + searchUrl = $form.attr('action'); | ||
4245 | 4224 | ||
4246 | if (historys && historys.length > 0) { | 4225 | if (historys && historys.length > 0) { |
4247 | historys = historys.split(ranToken); | 4226 | historys = historys.split(ranToken); |
@@ -4256,7 +4235,7 @@ $search.on('touchend', function() { | @@ -4256,7 +4235,7 @@ $search.on('touchend', function() { | ||
4256 | break; | 4235 | break; |
4257 | } | 4236 | } |
4258 | 4237 | ||
4259 | - html += '<li><a href="javascript:void(0);">' + history + '</li>'; | 4238 | + html += '<li><a href="' + searchUrl + '/?query=' + history + '">' + history + '</li>'; |
4260 | } | 4239 | } |
4261 | 4240 | ||
4262 | $history.html(html); | 4241 | $history.html(html); |
@@ -4268,6 +4247,11 @@ $search.on('touchend', function() { | @@ -4268,6 +4247,11 @@ $search.on('touchend', function() { | ||
4268 | } | 4247 | } |
4269 | } | 4248 | } |
4270 | }()); | 4249 | }()); |
4250 | + | ||
4251 | +if (isLocalStorageSupported()) { | ||
4252 | + writeSearch.bindWirteLocal($form); | ||
4253 | +} | ||
4254 | + | ||
4271 | }); | 4255 | }); |
4272 | define("js/plugin/security", ["jquery"], function(require, exports, module){ | 4256 | define("js/plugin/security", ["jquery"], function(require, exports, module){ |
4273 | /** | 4257 | /** |
@@ -4449,47 +4433,56 @@ define("js/index/write-search", [], function(require, exports, module){ | @@ -4449,47 +4433,56 @@ define("js/index/write-search", [], function(require, exports, module){ | ||
4449 | * @date: 2015/10/29 | 4433 | * @date: 2015/10/29 |
4450 | */ | 4434 | */ |
4451 | 4435 | ||
4452 | -var ranToken = ',', | ||
4453 | - historyval = 'historys1'; | 4436 | +var ranToken = ' ??++ '; |
4437 | + | ||
4438 | +function isLocalStorageSupported() { | ||
4439 | + var testKey = 'test', | ||
4440 | + storage = Window.prototype.localStorage; | ||
4441 | + | ||
4442 | + try { | ||
4443 | + storage.setItem(testKey, 'testValue'); | ||
4444 | + storage.removeItem(testKey); | ||
4445 | + return true; | ||
4446 | + } catch (error) { | ||
4447 | + return false; | ||
4448 | + } | ||
4449 | +} | ||
4454 | 4450 | ||
4455 | //获取分隔符 | 4451 | //获取分隔符 |
4456 | function getRanToken() { | 4452 | function getRanToken() { |
4457 | return ranToken; | 4453 | return ranToken; |
4458 | } | 4454 | } |
4459 | 4455 | ||
4460 | -//存变量 | ||
4461 | -function getHistoryval() { | ||
4462 | - return historyval; | ||
4463 | -} | ||
4464 | - | ||
4465 | //绑定提交前的存local操作 | 4456 | //绑定提交前的存local操作 |
4466 | function bindWirteLocal($form) { | 4457 | function bindWirteLocal($form) { |
4467 | $form.on('submit', function() { | 4458 | $form.on('submit', function() { |
4468 | - var query = this.query.value; | 4459 | + var query = this.query.value, |
4460 | + historys; | ||
4469 | 4461 | ||
4470 | - setHistoryValFun(query); | ||
4471 | - }); | ||
4472 | -} | 4462 | + if (localStorage) { |
4463 | + if (isLocalStorageSupported()) { | ||
4464 | + historys = localStorage.getItem('historys'); | ||
4465 | + } | ||
4473 | 4466 | ||
4474 | -function setHistoryValFun(query) { | ||
4475 | - var historys; | ||
4476 | - if (localStorage) { | ||
4477 | - historys = localStorage.getItem(historyval); | 4467 | + historys = historys ? historys : ''; |
4478 | 4468 | ||
4479 | - historys = historys ? historys.replace(new RegExp((query + ranToken), 'g'), '') : ''; | 4469 | + if (historys.indexOf(ranToken + query + ranToken) > -1) { |
4470 | + return; | ||
4471 | + } | ||
4480 | 4472 | ||
4481 | - if (historys === '') { | ||
4482 | - query = ranToken + query; | ||
4483 | - } | 4473 | + if (historys === '') { |
4474 | + query = ranToken + query; | ||
4475 | + } | ||
4484 | 4476 | ||
4485 | - historys += query + ranToken; | ||
4486 | - localStorage.setItem(historyval, historys); | ||
4487 | - } | 4477 | + historys += query + ranToken; |
4478 | + if (isLocalStorageSupported()) { | ||
4479 | + localStorage.setItem('historys', historys); | ||
4480 | + } | ||
4481 | + } | ||
4482 | + }); | ||
4488 | } | 4483 | } |
4489 | 4484 | ||
4490 | exports.getRanToken = getRanToken; | 4485 | exports.getRanToken = getRanToken; |
4491 | -exports.getHistoryval = getHistoryval; | ||
4492 | -exports.setHistoryValFun = setHistoryValFun; | ||
4493 | 4486 | ||
4494 | exports.bindWirteLocal = bindWirteLocal; | 4487 | exports.bindWirteLocal = bindWirteLocal; |
4495 | }); | 4488 | }); |
@@ -5809,6 +5802,7 @@ function nextStep(url, mobileNo, areaCode) { | @@ -5809,6 +5802,7 @@ function nextStep(url, mobileNo, areaCode) { | ||
5809 | }, | 5802 | }, |
5810 | success: function(res) { | 5803 | success: function(res) { |
5811 | 5804 | ||
5805 | + // console.log(res.data); | ||
5812 | if (res.code === 200) { | 5806 | if (res.code === 200) { |
5813 | 5807 | ||
5814 | // 统计代码:用于统计从哪个渠道登录 | 5808 | // 统计代码:用于统计从哪个渠道登录 |
@@ -5870,6 +5864,19 @@ $btnNext.on('touchstart', function() { | @@ -5870,6 +5864,19 @@ $btnNext.on('touchstart', function() { | ||
5870 | nickname: nickname | 5864 | nickname: nickname |
5871 | }, | 5865 | }, |
5872 | success: function(res) { | 5866 | success: function(res) { |
5867 | + | ||
5868 | + // console.log(res); | ||
5869 | + | ||
5870 | + //res : { | ||
5871 | + // code: 'xxx', | ||
5872 | + // data: { | ||
5873 | + // isReg: 0, | ||
5874 | + // next: 'xxxx' | ||
5875 | + // }, | ||
5876 | + // message: 'xxxx', | ||
5877 | + //} | ||
5878 | + | ||
5879 | + | ||
5873 | if (res.code === 200) { | 5880 | if (res.code === 200) { |
5874 | if (res.data.isReg === 1) { | 5881 | if (res.data.isReg === 1) { |
5875 | dialog.showDialog({ | 5882 | dialog.showDialog({ |
@@ -6154,11 +6161,6 @@ function search(opt) { | @@ -6154,11 +6161,6 @@ function search(opt) { | ||
6154 | color: opt.id | 6161 | color: opt.id |
6155 | }; | 6162 | }; |
6156 | break; | 6163 | break; |
6157 | - case 'ageLevel': | ||
6158 | - ext = { | ||
6159 | - age_level: opt.id | ||
6160 | - }; | ||
6161 | - break; | ||
6162 | case 'size': | 6164 | case 'size': |
6163 | ext = { | 6165 | ext = { |
6164 | size: opt.id | 6166 | size: opt.id |
@@ -6778,11 +6780,6 @@ function search(opt) { | @@ -6778,11 +6780,6 @@ function search(opt) { | ||
6778 | brand: opt.id | 6780 | brand: opt.id |
6779 | }; | 6781 | }; |
6780 | break; | 6782 | break; |
6781 | - case 'ageLevel': | ||
6782 | - ext = { | ||
6783 | - age_level: opt.id | ||
6784 | - }; | ||
6785 | - break; | ||
6786 | case 'sort': | 6783 | case 'sort': |
6787 | ext = { | 6784 | ext = { |
6788 | sort: opt.id | 6785 | sort: opt.id |
@@ -7216,7 +7213,6 @@ function getQueryString(name) { | @@ -7216,7 +7213,6 @@ function getQueryString(name) { | ||
7216 | shopId = getQueryString('shop_id'); | 7213 | shopId = getQueryString('shop_id'); |
7217 | sort = getQueryString('sort'); | 7214 | sort = getQueryString('sort'); |
7218 | outlets = getQueryString('outlets'); | 7215 | outlets = getQueryString('outlets'); |
7219 | -age_level = outlets = getQueryString('ageLevel'); | ||
7220 | 7216 | ||
7221 | /** | 7217 | /** |
7222 | * 筛选注册的回调,筛选子项点击后逻辑 | 7218 | * 筛选注册的回调,筛选子项点击后逻辑 |
@@ -7275,11 +7271,6 @@ function search(opt) { | @@ -7275,11 +7271,6 @@ function search(opt) { | ||
7275 | color: opt.id | 7271 | color: opt.id |
7276 | }; | 7272 | }; |
7277 | break; | 7273 | break; |
7278 | - case 'ageLevel': | ||
7279 | - ext = { | ||
7280 | - age_level: opt.id | ||
7281 | - }; | ||
7282 | - break; | ||
7283 | case 'size': | 7274 | case 'size': |
7284 | ext = { | 7275 | ext = { |
7285 | size: opt.id | 7276 | size: opt.id |
@@ -7335,10 +7326,6 @@ function search(opt) { | @@ -7335,10 +7326,6 @@ function search(opt) { | ||
7335 | params.shop_id = shopId; | 7326 | params.shop_id = shopId; |
7336 | } | 7327 | } |
7337 | 7328 | ||
7338 | - if (age_level) { | ||
7339 | - params.age_level = age_level | ||
7340 | - } | ||
7341 | - | ||
7342 | if (sort) { | 7329 | if (sort) { |
7343 | params.sort = sort; | 7330 | params.sort = sort; |
7344 | } | 7331 | } |
@@ -7827,6 +7814,9 @@ var productId = $('#productId').val(); | @@ -7827,6 +7814,9 @@ var productId = $('#productId').val(); | ||
7827 | var skn = $('#productSkn').val(), | 7814 | var skn = $('#productSkn').val(), |
7828 | productCode = $('#limitProductCode').val(); | 7815 | productCode = $('#limitProductCode').val(); |
7829 | 7816 | ||
7817 | + //门票 限购数量 | ||
7818 | +var ticketsLimit = $('#limitNum').val() || 0; | ||
7819 | + | ||
7830 | $('#likeBtn').on('touchstart', function() { | 7820 | $('#likeBtn').on('touchstart', function() { |
7831 | var opt, | 7821 | var opt, |
7832 | favorite; | 7822 | favorite; |
@@ -7880,6 +7870,14 @@ $('#likeBtn').on('touchstart', function() { | @@ -7880,6 +7870,14 @@ $('#likeBtn').on('touchstart', function() { | ||
7880 | }); | 7870 | }); |
7881 | 7871 | ||
7882 | $('#addtoCart').on('touchstart', function() { | 7872 | $('#addtoCart').on('touchstart', function() { |
7873 | + | ||
7874 | + //门票验证登录 | ||
7875 | + if (ticketsLimit) { | ||
7876 | + if (!ticketCheckLogin()) { | ||
7877 | + return false; | ||
7878 | + } | ||
7879 | + } | ||
7880 | + | ||
7883 | $('.cart-bar').hide(); | 7881 | $('.cart-bar').hide(); |
7884 | 7882 | ||
7885 | productCode && chosePanel.setLimitGoodModeWithSknId(productCode, skn); | 7883 | productCode && chosePanel.setLimitGoodModeWithSknId(productCode, skn); |
@@ -7896,11 +7894,32 @@ $('#addtoCart').on('touchstart', function() { | @@ -7896,11 +7894,32 @@ $('#addtoCart').on('touchstart', function() { | ||
7896 | return false; | 7894 | return false; |
7897 | }); | 7895 | }); |
7898 | 7896 | ||
7897 | +ticketCheckOpen(); | ||
7898 | + | ||
7899 | $('#buyLimit').on('touchstart', function() { | 7899 | $('#buyLimit').on('touchstart', function() { |
7900 | tip.show('打开APP可抢购该商品哦~'); | 7900 | tip.show('打开APP可抢购该商品哦~'); |
7901 | return false; | 7901 | return false; |
7902 | }); | 7902 | }); |
7903 | 7903 | ||
7904 | +//门票立即购买验证登录 | ||
7905 | + function ticketCheckLogin() { | ||
7906 | + | ||
7907 | + if (!window.getUid()) { | ||
7908 | + var urlArray = window.location.href.split('?'); | ||
7909 | + window.location.href = '//m.yohobuy.com/signin.html?refer=' + urlArray[0] + '?product_type=ticket'; | ||
7910 | + return false; | ||
7911 | + } | ||
7912 | + return true; | ||
7913 | + } | ||
7914 | + | ||
7915 | +// 门票登录后自动弹出 | ||
7916 | + function ticketCheckOpen() { | ||
7917 | + var showPannel = $('#showPannel').val(); | ||
7918 | + if (showPannel) { | ||
7919 | + chosePanel.show(); | ||
7920 | + } | ||
7921 | + } | ||
7922 | + | ||
7904 | }); | 7923 | }); |
7905 | define("js/cart/chose-panel", ["jquery"], function(require, exports, module){ | 7924 | define("js/cart/chose-panel", ["jquery"], function(require, exports, module){ |
7906 | /** | 7925 | /** |
@@ -7942,7 +7961,13 @@ var $chosePanel = $('#chose-panel'), | @@ -7942,7 +7961,13 @@ var $chosePanel = $('#chose-panel'), | ||
7942 | $choseArea, | 7961 | $choseArea, |
7943 | $cartBar, | 7962 | $cartBar, |
7944 | $soonSoldOut = $('.soonSoldOut-tag'), | 7963 | $soonSoldOut = $('.soonSoldOut-tag'), |
7945 | - $yohoPage = $('.yoho-page'); | 7964 | + $yohoPage = $('.yoho-page'), |
7965 | + //门票 限购数量 | ||
7966 | + ticketsLimit = $('#limitNum').val() || 0, | ||
7967 | + single = $('#single').val() || 0; | ||
7968 | + $productSku = $('#productSku'), | ||
7969 | + $buyNumber = $('#buyNumber'), | ||
7970 | + $buyNowForm = $('#buyNowForm'); | ||
7946 | 7971 | ||
7947 | // 购物车编辑标相关变量 | 7972 | // 购物车编辑标相关变量 |
7948 | var isEdit, | 7973 | var isEdit, |
@@ -8031,6 +8056,14 @@ function removePannel() { | @@ -8031,6 +8056,14 @@ function removePannel() { | ||
8031 | } | 8056 | } |
8032 | 8057 | ||
8033 | function checkColorSizeNum() { | 8058 | function checkColorSizeNum() { |
8059 | + | ||
8060 | + if (ticketsLimit) { | ||
8061 | + //门票 | ||
8062 | + if (!checkTickets()) { | ||
8063 | + return; | ||
8064 | + } | ||
8065 | + } | ||
8066 | + | ||
8034 | if (!hasChooseColor && !hasChooseSize) { | 8067 | if (!hasChooseColor && !hasChooseSize) { |
8035 | tip.show('请选择颜色和尺码~'); | 8068 | tip.show('请选择颜色和尺码~'); |
8036 | return false; | 8069 | return false; |
@@ -8044,6 +8077,24 @@ function checkColorSizeNum() { | @@ -8044,6 +8077,24 @@ function checkColorSizeNum() { | ||
8044 | return true; | 8077 | return true; |
8045 | } | 8078 | } |
8046 | 8079 | ||
8080 | +//检查门票选择 | ||
8081 | +function checkTickets() { | ||
8082 | + if (!hasChooseColor && !hasChooseSize) { | ||
8083 | + if (single) { | ||
8084 | + tip.show('请选择日期~'); | ||
8085 | + } else { | ||
8086 | + tip.show('请选择日期和区域~'); | ||
8087 | + }; | ||
8088 | + return false; | ||
8089 | + } else if (!hasChooseColor) { | ||
8090 | + tip.show('请选择日期~'); | ||
8091 | + return false; | ||
8092 | + } else if (!hasChooseSize && !single) { | ||
8093 | + tip.show('请选择区域~'); | ||
8094 | + return false; | ||
8095 | + } | ||
8096 | + return true; | ||
8097 | +} | ||
8047 | 8098 | ||
8048 | 8099 | ||
8049 | function show(html, cb) { | 8100 | function show(html, cb) { |
@@ -8078,7 +8129,7 @@ function updateConformButtonClassAndText() { | @@ -8078,7 +8129,7 @@ function updateConformButtonClassAndText() { | ||
8078 | $chosed = $allChoseItems.find('.chosed'); | 8129 | $chosed = $allChoseItems.find('.chosed'); |
8079 | if (2 === $chosed.closest('.zero-stock').length) { | 8130 | if (2 === $chosed.closest('.zero-stock').length) { |
8080 | $('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄'); | 8131 | $('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄'); |
8081 | - } else if (limitProductCode) { | 8132 | + } else if (limitProductCode || ticketsLimit) { |
8082 | $('#chose-btn-sure').css('background-color', '#eb0313').html('立即购买'); | 8133 | $('#chose-btn-sure').css('background-color', '#eb0313').html('立即购买'); |
8083 | } else { | 8134 | } else { |
8084 | $('#chose-btn-sure').css('background-color', '#eb0313').html(isEdit ? '确认' : '加入购物车'); | 8135 | $('#chose-btn-sure').css('background-color', '#eb0313').html(isEdit ? '确认' : '加入购物车'); |
@@ -8088,7 +8139,14 @@ function updateConformButtonClassAndText() { | @@ -8088,7 +8139,14 @@ function updateConformButtonClassAndText() { | ||
8088 | //显示剩余件数 | 8139 | //显示剩余件数 |
8089 | function displayGoodNum(curGoodNum) { | 8140 | function displayGoodNum(curGoodNum) { |
8090 | 8141 | ||
8091 | - //数量大于0 | 8142 | + //门票限购 |
8143 | + if (ticketsLimit) { | ||
8144 | + $allChoseItems.find('.num .left-num').html('限购' + ticketsLimit + '件'); | ||
8145 | + $leftNum.val(curGoodNum); | ||
8146 | + return; | ||
8147 | + } | ||
8148 | + | ||
8149 | + //数量大于 | ||
8092 | if (curGoodNum > 0) { | 8150 | if (curGoodNum > 0) { |
8093 | if ($soonSoldOut.length > 0) { | 8151 | if ($soonSoldOut.length > 0) { |
8094 | $allChoseItems.find('.num .left-num').html('即将售罄'); | 8152 | $allChoseItems.find('.num .left-num').html('即将售罄'); |
@@ -8152,6 +8210,39 @@ function changeColorChosed(newColorIndex) { | @@ -8152,6 +8210,39 @@ function changeColorChosed(newColorIndex) { | ||
8152 | return 0; | 8210 | return 0; |
8153 | } | 8211 | } |
8154 | 8212 | ||
8213 | +//添加门票 | ||
8214 | +function addTickets(productSku, buyNumber) { | ||
8215 | + var data = { | ||
8216 | + productSku: productSku, | ||
8217 | + buyNumber: buyNumber | ||
8218 | + }; | ||
8219 | + | ||
8220 | + //校验电子票 | ||
8221 | + $.ajax({ | ||
8222 | + url: '/cart/index/checkTickets', | ||
8223 | + dataType: 'json', | ||
8224 | + data: data, | ||
8225 | + type: 'post', | ||
8226 | + success: function (addRestult) { | ||
8227 | + if (addRestult.code != 200) { | ||
8228 | + if (addRestult.code == 401) { | ||
8229 | + var refer = window.location.href; | ||
8230 | + window.location.href = '//m.yohobuy.com/signin.html?refer=' + refer; | ||
8231 | + } | ||
8232 | + tip.show(addRestult.message); | ||
8233 | + } else { | ||
8234 | + $productSku.val(productSku); | ||
8235 | + $buyNumber.val(buyNumber); | ||
8236 | + $buyNowForm.submit(); | ||
8237 | + } | ||
8238 | + }, | ||
8239 | + error: function () { | ||
8240 | + tip.show('网络异常~'); | ||
8241 | + } | ||
8242 | + | ||
8243 | + }); | ||
8244 | +} | ||
8245 | + | ||
8155 | init(); | 8246 | init(); |
8156 | 8247 | ||
8157 | 8248 | ||
@@ -8201,7 +8292,6 @@ $yohoPage.on('touchstart', '.color-list .block', function() { | @@ -8201,7 +8292,6 @@ $yohoPage.on('touchstart', '.color-list .block', function() { | ||
8201 | 8292 | ||
8202 | //老的选中尺码去掉勾选,新的选中尺码加上勾选 | 8293 | //老的选中尺码去掉勾选,新的选中尺码加上勾选 |
8203 | curGoodNum = changeSizeChosed(index + 1); | 8294 | curGoodNum = changeSizeChosed(index + 1); |
8204 | - | ||
8205 | // 显示剩余数量 | 8295 | // 显示剩余数量 |
8206 | displayGoodNum(curGoodNum); | 8296 | displayGoodNum(curGoodNum); |
8207 | 8297 | ||
@@ -8232,6 +8322,19 @@ $yohoPage.on('touchstart', '.color-list .block', function() { | @@ -8232,6 +8322,19 @@ $yohoPage.on('touchstart', '.color-list .block', function() { | ||
8232 | 8322 | ||
8233 | // 设置按钮的样式和文字 | 8323 | // 设置按钮的样式和文字 |
8234 | updateConformButtonClassAndText(); | 8324 | updateConformButtonClassAndText(); |
8325 | + | ||
8326 | + //展览票 | ||
8327 | + if (ticketsLimit && single) { | ||
8328 | + //选中日期 | ||
8329 | + $curSizeBlock = $('.size-list .size-row .block').eq(index + 1); | ||
8330 | + $curSizeBlock.addClass('chosed'); | ||
8331 | + // 显示剩余数量 | ||
8332 | + displayGoodNum($curColorBlock.data('num')); | ||
8333 | + hasChooseSize = true; | ||
8334 | + return false; | ||
8335 | + } | ||
8336 | + | ||
8337 | + | ||
8235 | }).on('touchstart', '.size-list .block', function() { | 8338 | }).on('touchstart', '.size-list .block', function() { |
8236 | var $this = $(this), | 8339 | var $this = $(this), |
8237 | index, | 8340 | index, |
@@ -8307,9 +8410,10 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -8307,9 +8410,10 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
8307 | 8410 | ||
8308 | $num.val(num - 1); | 8411 | $num.val(num - 1); |
8309 | }).on('touchstart', '.btn-plus', function() { | 8412 | }).on('touchstart', '.btn-plus', function() { |
8310 | - var num = parseInt($num.val(), 10); | 8413 | + var num = parseInt($num.val(), 10), |
8414 | + maxTips = ticketsLimit ? '每人只可购买' + ticketsLimit + '张当日门票' : '您选择的数量超过了最大库存量~'; | ||
8311 | 8415 | ||
8312 | - leftNum = $('#left-num').val(); | 8416 | + leftNum = ticketsLimit || $('#left-num').val(); |
8313 | 8417 | ||
8314 | if (!checkColorSizeNum()) { | 8418 | if (!checkColorSizeNum()) { |
8315 | return; | 8419 | return; |
@@ -8321,7 +8425,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -8321,7 +8425,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
8321 | 8425 | ||
8322 | //TODO:库存数验证 | 8426 | //TODO:库存数验证 |
8323 | if (num > leftNum - 1) { | 8427 | if (num > leftNum - 1) { |
8324 | - tip.show('您选择的数量超过了最大库存量~'); | 8428 | + tip.show(maxTips); |
8325 | return; | 8429 | return; |
8326 | } | 8430 | } |
8327 | $num.val(num + 1); | 8431 | $num.val(num + 1); |
@@ -8363,9 +8467,18 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -8363,9 +8467,18 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
8363 | return false; | 8467 | return false; |
8364 | } | 8468 | } |
8365 | 8469 | ||
8366 | - confirming = true; | 8470 | + if (!ticketsLimit) { |
8471 | + confirming = true; | ||
8472 | + } | ||
8473 | + | ||
8367 | loading.showLoadingMask(); | 8474 | loading.showLoadingMask(); |
8368 | 8475 | ||
8476 | + //立即购买门票 | ||
8477 | + if (ticketsLimit) { | ||
8478 | + addTickets(productSku, buyNumber); | ||
8479 | + return; | ||
8480 | + } | ||
8481 | + | ||
8369 | //针对是否处于编辑模式设置不同的url和需要post的数据 | 8482 | //针对是否处于编辑模式设置不同的url和需要post的数据 |
8370 | if (isEdit) { | 8483 | if (isEdit) { |
8371 | cartGoodData = { | 8484 | cartGoodData = { |
@@ -9269,6 +9382,7 @@ var winH = $(window).height(), | @@ -9269,6 +9382,7 @@ var winH = $(window).height(), | ||
9269 | var defaultOpt = require("js/product/query-param"); | 9382 | var defaultOpt = require("js/product/query-param"); |
9270 | 9383 | ||
9271 | var $listNav = $('#list-nav'), | 9384 | var $listNav = $('#list-nav'), |
9385 | + $posList = $('#pos-list'), | ||
9272 | 9386 | ||
9273 | //导航数据信息 | 9387 | //导航数据信息 |
9274 | navInfo = { | 9388 | navInfo = { |
@@ -9643,9 +9757,7 @@ function search(opt) { | @@ -9643,9 +9757,7 @@ function search(opt) { | ||
9643 | } | 9757 | } |
9644 | } | 9758 | } |
9645 | 9759 | ||
9646 | - $listNav.children('.active').removeClass('active'); | ||
9647 | - $pre.addClass('active'); | ||
9648 | - if (opt.hasOwnProperty('id')) { | 9760 | + if (opt.id) { |
9649 | switch (opt.type) { | 9761 | switch (opt.type) { |
9650 | case 'shop_id': | 9762 | case 'shop_id': |
9651 | ext = { | 9763 | ext = { |
@@ -9687,11 +9799,6 @@ function search(opt) { | @@ -9687,11 +9799,6 @@ function search(opt) { | ||
9687 | discount: opt.id | 9799 | discount: opt.id |
9688 | }; | 9800 | }; |
9689 | break; | 9801 | break; |
9690 | - case 'ageLevel': | ||
9691 | - ext = { | ||
9692 | - age_level: opt.id | ||
9693 | - }; | ||
9694 | - break; | ||
9695 | } | 9802 | } |
9696 | $.extend(defaultOpt, ext); //扩展筛选项 | 9803 | $.extend(defaultOpt, ext); //扩展筛选项 |
9697 | } | 9804 | } |
@@ -9815,6 +9922,11 @@ $.ajax({ | @@ -9815,6 +9922,11 @@ $.ajax({ | ||
9815 | success: function(data) { | 9922 | success: function(data) { |
9816 | $goodsContainer.append(data); | 9923 | $goodsContainer.append(data); |
9817 | 9924 | ||
9925 | + setTimeout(function() { | ||
9926 | + myScroll.refresh(); | ||
9927 | + scH = $('#scroller').outerHeight(); | ||
9928 | + }, 1000); | ||
9929 | + | ||
9818 | //初始化filter&注册filter回调 | 9930 | //初始化filter&注册filter回调 |
9819 | filter.initFilter({ | 9931 | filter.initFilter({ |
9820 | fCbFn: search, | 9932 | fCbFn: search, |
@@ -9826,11 +9938,6 @@ $.ajax({ | @@ -9826,11 +9938,6 @@ $.ajax({ | ||
9826 | }, | 9938 | }, |
9827 | missStatus: true | 9939 | missStatus: true |
9828 | }); | 9940 | }); |
9829 | - | ||
9830 | - setTimeout(function() { | ||
9831 | - myScroll.refresh(); | ||
9832 | - scH = $('#scroller').outerHeight(); | ||
9833 | - }, 1000); | ||
9834 | } | 9941 | } |
9835 | }); | 9942 | }); |
9836 | 9943 | ||
@@ -9838,6 +9945,10 @@ $listNav.bind('contextmenu', function(e) { | @@ -9838,6 +9945,10 @@ $listNav.bind('contextmenu', function(e) { | ||
9838 | return false; | 9945 | return false; |
9839 | }); | 9946 | }); |
9840 | 9947 | ||
9948 | +$posList.bind('contextmenu', function(e) { | ||
9949 | + return false; | ||
9950 | +}); | ||
9951 | + | ||
9841 | $subNav.on('touchend touchcancel', function(e) { | 9952 | $subNav.on('touchend touchcancel', function(e) { |
9842 | var $this = $(e.target).closest('li'), | 9953 | var $this = $(e.target).closest('li'), |
9843 | cname, | 9954 | cname, |
@@ -10005,11 +10116,12 @@ $listNav.on('touchstart', 'li', function(e) { | @@ -10005,11 +10116,12 @@ $listNav.on('touchstart', 'li', function(e) { | ||
10005 | myScroll.refresh(); | 10116 | myScroll.refresh(); |
10006 | }); | 10117 | }); |
10007 | 10118 | ||
10008 | -$nav2.on('touchstart', 'li', function(e) { | 10119 | +$posList.on('touchstart', 'li', function(e) { |
10009 | $(this).addClass('bytouch'); | 10120 | $(this).addClass('bytouch'); |
10010 | }).on('touchend touchcancel', function() { | 10121 | }).on('touchend touchcancel', function() { |
10011 | - $nav2.find('li').removeClass('bytouch'); | 10122 | + $posList.find('li').removeClass('bytouch'); |
10012 | myScroll.refresh(); | 10123 | myScroll.refresh(); |
10124 | + myScroll.scrollTo(0, -(imgH + nav1H + main1oH + 5)); | ||
10013 | }); | 10125 | }); |
10014 | 10126 | ||
10015 | //底部导航点击 | 10127 | //底部导航点击 |
@@ -12026,7 +12138,7 @@ var jQuery = require("jquery"); | @@ -12026,7 +12138,7 @@ var jQuery = require("jquery"); | ||
12026 | 12138 | ||
12027 | })(jQuery); | 12139 | })(jQuery); |
12028 | }); | 12140 | }); |
12029 | -define("js/me/index", ["jquery","swiper","lazyload","index"], function(require, exports, module){ | 12141 | +define("js/me/index", ["jquery","swiper","index"], function(require, exports, module){ |
12030 | /** | 12142 | /** |
12031 | * 个人中心首页 | 12143 | * 个人中心首页 |
12032 | * @author: bikai<kai.bi@yoho.cn> | 12144 | * @author: bikai<kai.bi@yoho.cn> |
@@ -12040,7 +12152,7 @@ var $userAvatar = $('.user-avatar'), | @@ -12040,7 +12152,7 @@ var $userAvatar = $('.user-avatar'), | ||
12040 | var myImage = new Image(), | 12152 | var myImage = new Image(), |
12041 | avatar; | 12153 | avatar; |
12042 | 12154 | ||
12043 | -require("js/product/recommend-for-you-user-center"); | 12155 | +require("js/product/recommend-for-you"); |
12044 | require("js/product/suspend-cart"); | 12156 | require("js/product/suspend-cart"); |
12045 | 12157 | ||
12046 | // 部分老用户没有头像,显示默认头像 | 12158 | // 部分老用户没有头像,显示默认头像 |
@@ -12060,7 +12172,7 @@ $('.yoho-page').on('touchstart', '.list-item, .type-item, .order-title', functio | @@ -12060,7 +12172,7 @@ $('.yoho-page').on('touchstart', '.list-item, .type-item, .order-title', functio | ||
12060 | }); | 12172 | }); |
12061 | 12173 | ||
12062 | }); | 12174 | }); |
12063 | -define("js/product/recommend-for-you-user-center", ["swiper","jquery","lazyload","index"], function(require, exports, module){ | 12175 | +define("js/product/recommend-for-you", ["swiper","jquery","index"], function(require, exports, module){ |
12064 | /** | 12176 | /** |
12065 | * 为您优选 | 12177 | * 为您优选 |
12066 | * @author: bikai<kai.bi@yoho.cn> | 12178 | * @author: bikai<kai.bi@yoho.cn> |
@@ -12069,15 +12181,22 @@ define("js/product/recommend-for-you-user-center", ["swiper","jquery","lazyload" | @@ -12069,15 +12181,22 @@ define("js/product/recommend-for-you-user-center", ["swiper","jquery","lazyload" | ||
12069 | 12181 | ||
12070 | 12182 | ||
12071 | var Swiper = require("swiper"), | 12183 | var Swiper = require("swiper"), |
12072 | - $ = require("jquery"), | ||
12073 | - lazyLoad = require("lazyload"); | 12184 | + $ = require("jquery"); |
12074 | 12185 | ||
12075 | -var $recommendForYou = $('.recommend-for-you'); | 12186 | +var recommendSwiper, |
12187 | + $recommendForYou = $('.recommend-for-you'); | ||
12076 | 12188 | ||
12077 | -$.get('/product/recommend-for-you/userCenter').then(function(html) { | 12189 | +$.get('/home/preference').then(function(html) { |
12078 | $recommendForYou.html(html).show(); | 12190 | $recommendForYou.html(html).show(); |
12079 | - lazyLoad($('img.lazy')); | ||
12080 | - | 12191 | + if ($('#swiper-recommend').length) { |
12192 | + recommendSwiper = new Swiper('#swiper-recommend', { | ||
12193 | + slidesPerView: 'auto', | ||
12194 | + grabCursor: true, | ||
12195 | + slideElement: 'a', | ||
12196 | + lazyLoading: true, | ||
12197 | + watchSlidesVisibility: true | ||
12198 | + }); | ||
12199 | + } | ||
12081 | }).fail(function() { | 12200 | }).fail(function() { |
12082 | $recommendForYou.hide(); | 12201 | $recommendForYou.hide(); |
12083 | }); | 12202 | }); |
@@ -13109,7 +13228,6 @@ require("js/cart/order-ensure"); | @@ -13109,7 +13228,6 @@ require("js/cart/order-ensure"); | ||
13109 | require("js/cart/invoice-info"); | 13228 | require("js/cart/invoice-info"); |
13110 | require("js/cart/select-coupon"); | 13229 | require("js/cart/select-coupon"); |
13111 | require("js/cart/select-address"); | 13230 | require("js/cart/select-address"); |
13112 | -require("js/cart/jit-detail"); | ||
13113 | 13231 | ||
13114 | }); | 13232 | }); |
13115 | define("js/cart/cart", ["jquery","mlellipsis","hammer","handlebars","source-map","swiper","lazyload","index"], function(require, exports, module){ | 13233 | define("js/cart/cart", ["jquery","mlellipsis","hammer","handlebars","source-map","swiper","lazyload","index"], function(require, exports, module){ |
@@ -13149,11 +13267,15 @@ function needLoadRecommandForYou() { | @@ -13149,11 +13267,15 @@ function needLoadRecommandForYou() { | ||
13149 | $('.cart-goods').length <= 0 && !isRefreshByDelete : | 13267 | $('.cart-goods').length <= 0 && !isRefreshByDelete : |
13150 | $('.cart-goods').length <= 0; | 13268 | $('.cart-goods').length <= 0; |
13151 | } | 13269 | } |
13152 | - require("js/product/recommend-for-you-cart"); | ||
13153 | 13270 | ||
13154 | -if (!needLoadRecommandForYou()) { | 13271 | +if (needLoadRecommandForYou()) { |
13272 | + require("js/product/recommend-for-you"); | ||
13273 | +} else { | ||
13274 | + if (isRefreshByDelete) { | ||
13275 | + $('body').css('background-color', '#f0f0f0'); | ||
13276 | + } | ||
13155 | require("js/cart/good"); | 13277 | require("js/cart/good"); |
13156 | -} | 13278 | +} |
13157 | 13279 | ||
13158 | $cartPage.css('display', 'block'); | 13280 | $cartPage.css('display', 'block'); |
13159 | loading.hideLoadingMask(); | 13281 | loading.hideLoadingMask(); |
@@ -13356,27 +13478,6 @@ if ($('.invalid-goods').find('.shopping-cart-good').length === 0) { | @@ -13356,27 +13478,6 @@ if ($('.invalid-goods').find('.shopping-cart-good').length === 0) { | ||
13356 | $('#failure-goods').removeClass('invalid-goods'); | 13478 | $('#failure-goods').removeClass('invalid-goods'); |
13357 | } | 13479 | } |
13358 | }); | 13480 | }); |
13359 | -define("js/product/recommend-for-you-cart", ["swiper","jquery","lazyload","index"], function(require, exports, module){ | ||
13360 | -/** | ||
13361 | - * 为您优选 | ||
13362 | - * @author: bikai<kai.bi@yoho.cn> | ||
13363 | - * @date: 2015/11/16 | ||
13364 | - */ | ||
13365 | - | ||
13366 | - | ||
13367 | -var Swiper = require("swiper"), | ||
13368 | - $ = require("jquery"), | ||
13369 | - lazyLoad = require("lazyload"); | ||
13370 | - | ||
13371 | -var $recommendForYou = $('.recommend-for-you'); | ||
13372 | - | ||
13373 | -$.get('/product/recommend-for-you/cart').then(function(html) { | ||
13374 | - $recommendForYou.html(html).show(); | ||
13375 | - lazyLoad($('img.lazy')); | ||
13376 | -}).fail(function() { | ||
13377 | - $recommendForYou.hide(); | ||
13378 | -}); | ||
13379 | -}); | ||
13380 | define("js/cart/good", ["jquery","mlellipsis","lazyload","handlebars","source-map","hammer"], function(require, exports, module){ | 13481 | define("js/cart/good", ["jquery","mlellipsis","lazyload","handlebars","source-map","hammer"], function(require, exports, module){ |
13381 | /** | 13482 | /** |
13382 | * 购物车商品 | 13483 | * 购物车商品 |
@@ -13781,41 +13882,21 @@ var $invoice = $('.invoice'), | @@ -13781,41 +13882,21 @@ var $invoice = $('.invoice'), | ||
13781 | $coinCheck = $('.coin-check'), | 13882 | $coinCheck = $('.coin-check'), |
13782 | $coinUsed = $('.coin .used'), | 13883 | $coinUsed = $('.coin .used'), |
13783 | $subBlock = $('.sub-block'), | 13884 | $subBlock = $('.sub-block'), |
13885 | + $ticketsMobile = $('#mobile'), | ||
13784 | payType, | 13886 | payType, |
13785 | queryString = $.queryString(), | 13887 | queryString = $.queryString(), |
13786 | orderInfo = order.orderInfo, | 13888 | orderInfo = order.orderInfo, |
13787 | isSubmiting, | 13889 | isSubmiting, |
13788 | dispatchInfo, | 13890 | dispatchInfo, |
13789 | - total; | ||
13790 | - | ||
13791 | -var orderCont = window.cookie('order-info') && JSON.parse(window.cookie('order-info')); | ||
13792 | -var invoiceCont = { | ||
13793 | - 7: '服装', | ||
13794 | - 1: '图书', | ||
13795 | - 9: '配件', | ||
13796 | - 11: '日用品', | ||
13797 | - 3: '办公用品', | ||
13798 | - 6: '体育用品', | ||
13799 | - 10: '数码产品' | ||
13800 | - }, | ||
13801 | - invoicesType = { | ||
13802 | - 1: '纸质', | ||
13803 | - 2: '电子' | ||
13804 | - }; | 13891 | + total, |
13892 | + isTickets = $('#ticketsPage').val(), | ||
13893 | + productSku = $('#productSku').val(), | ||
13894 | + buyNumber = $('#buyNumber').val(); | ||
13805 | 13895 | ||
13806 | require("js/common"); | 13896 | require("js/common"); |
13807 | 13897 | ||
13808 | lazyLoad(); | 13898 | lazyLoad(); |
13809 | 13899 | ||
13810 | -// 初始化发票信息 | ||
13811 | -function invoiceInit() { | ||
13812 | - if (orderCont.invoiceType) { | ||
13813 | - $('.invoice-type').text(invoiceCont[orderCont.invoiceType] + '(' + invoicesType[orderCont.invoicesType] + ')'); | ||
13814 | - } else { | ||
13815 | - $('.invoice-type').text('服装(电子)'); | ||
13816 | - } | ||
13817 | -} | ||
13818 | - | ||
13819 | function getQueryParam() { | 13900 | function getQueryParam() { |
13820 | var queryArray = location.search.substr(1).split('&'), | 13901 | var queryArray = location.search.substr(1).split('&'), |
13821 | i, | 13902 | i, |
@@ -13896,23 +13977,10 @@ $invoice.on('touchend', '.checkbox', function() { | @@ -13896,23 +13977,10 @@ $invoice.on('touchend', '.checkbox', function() { | ||
13896 | 13977 | ||
13897 | if ($this.hasClass('icon-cb-radio')) { | 13978 | if ($this.hasClass('icon-cb-radio')) { |
13898 | $invoice.addClass('focus'); | 13979 | $invoice.addClass('focus'); |
13899 | - orderInfo('invoiceText', ''); | ||
13900 | - orderInfo('invoiceType', '7'); | ||
13901 | - orderInfo('receiverMobile', $('.user-mobile').val()); | ||
13902 | - orderInfo('invoicesType', '2'); | ||
13903 | - orderInfo('invoiceTitle', '个人'); | ||
13904 | } | 13980 | } |
13905 | if ($this.hasClass('icon-radio')) { | 13981 | if ($this.hasClass('icon-radio')) { |
13906 | $invoice.removeClass('focus'); | 13982 | $invoice.removeClass('focus'); |
13907 | - orderInfo('invoiceText', null); | ||
13908 | - orderInfo('invoiceType', null); | ||
13909 | - orderInfo('receiverMobile', null); | ||
13910 | - orderInfo('invoicesType', null); | ||
13911 | - orderInfo('invoiceTitle', null); | ||
13912 | } | 13983 | } |
13913 | - | ||
13914 | - orderCont = window.cookie('order-info') && JSON.parse(window.cookie('order-info')); | ||
13915 | - invoiceInit(); | ||
13916 | }); | 13984 | }); |
13917 | 13985 | ||
13918 | 13986 | ||
@@ -13935,20 +14003,30 @@ function updateDeliverId(id) { | @@ -13935,20 +14003,30 @@ function updateDeliverId(id) { | ||
13935 | 14003 | ||
13936 | function orderCompute() { | 14004 | function orderCompute() { |
13937 | var yohoCoin = orderInfo('yohoCoin'), | 14005 | var yohoCoin = orderInfo('yohoCoin'), |
13938 | - deliverId = orderInfo('deliveryId'); | ||
13939 | - | ||
13940 | - loading.showLoadingMask(); | ||
13941 | - $.ajax({ | ||
13942 | - method: 'POST', | ||
13943 | - url: '/cart/index/orderCompute', | ||
13944 | - data: { | 14006 | + deliverId = orderInfo('deliveryId'), |
14007 | + data = { | ||
13945 | cartType: orderInfo('cartType') || 'ordinary', | 14008 | cartType: orderInfo('cartType') || 'ordinary', |
13946 | deliveryId: orderInfo('deliveryId'), | 14009 | deliveryId: orderInfo('deliveryId'), |
13947 | paymentTypeId: orderInfo('paymentTypeId'), | 14010 | paymentTypeId: orderInfo('paymentTypeId'), |
13948 | couponCode: orderInfo('couponCode'), | 14011 | couponCode: orderInfo('couponCode'), |
13949 | yohoCoin: yohoCoin, | 14012 | yohoCoin: yohoCoin, |
13950 | skuList: isLimitGood() ? orderInfo('skuList') : undefined | 14013 | skuList: isLimitGood() ? orderInfo('skuList') : undefined |
14014 | + }; | ||
14015 | + //门票 | ||
14016 | + if (isTickets) { | ||
14017 | + data = { | ||
14018 | + type: 'tickets', | ||
14019 | + productSku: productSku, | ||
14020 | + buyNumber: buyNumber, | ||
14021 | + yohoCoin: yohoCoin | ||
13951 | } | 14022 | } |
14023 | + }; | ||
14024 | + | ||
14025 | + loading.showLoadingMask(); | ||
14026 | + $.ajax({ | ||
14027 | + method: 'POST', | ||
14028 | + url: '/cart/index/orderCompute', | ||
14029 | + data: data | ||
13952 | }).then(function(res) { | 14030 | }).then(function(res) { |
13953 | if ($.type(res) !== 'object') { | 14031 | if ($.type(res) !== 'object') { |
13954 | window.location.reload(); | 14032 | window.location.reload(); |
@@ -13992,16 +14070,16 @@ function submitOrder() { | @@ -13992,16 +14070,16 @@ function submitOrder() { | ||
13992 | return false; | 14070 | return false; |
13993 | } | 14071 | } |
13994 | 14072 | ||
13995 | - // if (orderInfo('invoice')) { | ||
13996 | - // if (!invoiceText) { | ||
13997 | - // tip.show('请输入发票抬头'); | ||
13998 | - // return; | ||
13999 | - // } | ||
14000 | - // if (invoiceText.length > 30) { | ||
14001 | - // tip.show('发票抬头不得超过30个汉字'); | ||
14002 | - // return; | ||
14003 | - // } | ||
14004 | - // } | 14073 | + if (orderInfo('invoice')) { |
14074 | + if (!invoiceText) { | ||
14075 | + tip.show('请输入发票抬头'); | ||
14076 | + return; | ||
14077 | + } | ||
14078 | + if (invoiceText.length > 30) { | ||
14079 | + tip.show('发票抬头不得超过30个汉字'); | ||
14080 | + return; | ||
14081 | + } | ||
14082 | + } | ||
14005 | 14083 | ||
14006 | if (msg) { | 14084 | if (msg) { |
14007 | if (msg.length > 40) { | 14085 | if (msg.length > 40) { |
@@ -14159,6 +14237,10 @@ $subBlock.on('touchstart', 'li', function() { | @@ -14159,6 +14237,10 @@ $subBlock.on('touchstart', 'li', function() { | ||
14159 | 14237 | ||
14160 | 14238 | ||
14161 | $('.bill a').on('touchstart', function() { | 14239 | $('.bill a').on('touchstart', function() { |
14240 | + if (isTickets) { | ||
14241 | + ticketsConfirm(); | ||
14242 | + return ; | ||
14243 | + } | ||
14162 | orderInfo('paymentTypeId', $('.delivery-id .icon-cb-radio').data('id')); | 14244 | orderInfo('paymentTypeId', $('.delivery-id .icon-cb-radio').data('id')); |
14163 | orderInfo('paymentType', $('.payment-type .icon-cb-radio').data('id')); | 14245 | orderInfo('paymentType', $('.payment-type .icon-cb-radio').data('id')); |
14164 | 14246 | ||
@@ -14177,9 +14259,48 @@ if (orderInfo('address') && orderInfo('address').is_support === 'N') { | @@ -14177,9 +14259,48 @@ if (orderInfo('address') && orderInfo('address').is_support === 'N') { | ||
14177 | orderInfo('deliveryId', $('.delivery-id .icon-cb-radio').data('id')); | 14259 | orderInfo('deliveryId', $('.delivery-id .icon-cb-radio').data('id')); |
14178 | orderCompute(); | 14260 | orderCompute(); |
14179 | } | 14261 | } |
14262 | +//电子票下单 | ||
14263 | +function ticketsConfirm () { | ||
14264 | + | ||
14265 | + if(!$ticketsMobile.val()) { | ||
14266 | + tip.show('手机号必填'); | ||
14267 | + return; | ||
14268 | + } | ||
14269 | + var data = { | ||
14270 | + productSku: productSku, | ||
14271 | + buyNumber: buyNumber, | ||
14272 | + mobile: $ticketsMobile.val(), | ||
14273 | + useYohoCoin: orderInfo('yohoCoin') | ||
14274 | + }; | ||
14275 | + | ||
14276 | + $.ajax({ | ||
14277 | + url: '/cart/index/submitTicket', | ||
14278 | + type: 'POST', | ||
14279 | + dataType: 'json', | ||
14280 | + data: data, | ||
14281 | + success: function(ticket) { | ||
14282 | + //下单成功调整支付页面 | ||
14283 | + if (ticket.code === 200) { | ||
14284 | + window.location.href = '/home/orders/pay?order_code=' + ticket.data.order_code | ||
14285 | + } else { | ||
14286 | + tip.show(ticket.message); | ||
14287 | + } | ||
14288 | + | ||
14289 | + }, | ||
14290 | + error: function () { | ||
14291 | + tip.show('网络异常~'); | ||
14292 | + } | ||
14293 | + }); | ||
14294 | +} | ||
14180 | 14295 | ||
14181 | -// 初始化发票信息内容 | ||
14182 | -invoiceInit(); | 14296 | +//校验手机号 |
14297 | +$ticketsMobile.blur(function function_name (e) { | ||
14298 | + var reg = /^[0123456789]{1,30}$/; | ||
14299 | + var mobile = $ticketsMobile.val(); | ||
14300 | + if (!reg.test(mobile)) { | ||
14301 | + tip.show('手机号码不正确!'); | ||
14302 | + } | ||
14303 | +}) | ||
14183 | }); | 14304 | }); |
14184 | define("js/cart/order-info", ["jquery","hammer"], function(require, exports, module){ | 14305 | define("js/cart/order-info", ["jquery","hammer"], function(require, exports, module){ |
14185 | /** | 14306 | /** |
@@ -14207,7 +14328,6 @@ function init() { | @@ -14207,7 +14328,6 @@ function init() { | ||
14207 | invoiceType: null, | 14328 | invoiceType: null, |
14208 | invoiceTitle: null, | 14329 | invoiceTitle: null, |
14209 | receiverMobile: null, | 14330 | receiverMobile: null, |
14210 | - isModifyTel: false, | ||
14211 | invoicesType: null, | 14331 | invoicesType: null, |
14212 | msg: null, | 14332 | msg: null, |
14213 | cartType: 'ordinary' | 14333 | cartType: 'ordinary' |
@@ -14255,13 +14375,10 @@ var $invoiceNotice = $('.invoice-notice'), | @@ -14255,13 +14375,10 @@ var $invoiceNotice = $('.invoice-notice'), | ||
14255 | $invoiceType = $('.invoice-type'), | 14375 | $invoiceType = $('.invoice-type'), |
14256 | $tel = $('.tel'), | 14376 | $tel = $('.tel'), |
14257 | $company = $('.company'), | 14377 | $company = $('.company'), |
14258 | - $telArea = $('.tel-area'), | ||
14259 | orderInfo = order.orderInfo, | 14378 | orderInfo = order.orderInfo, |
14260 | - $chooseContLi = $('.invoice-cont').find('.icon-cb-radio').parent(), | ||
14261 | - $copyTel = $('.copy-tel'), | ||
14262 | - isModifyTel = false; | 14379 | + $chooseContLi = $('.invoice-cont').find('.icon-cb-radio').parent(); |
14263 | 14380 | ||
14264 | -var myreg = /^(((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/, | 14381 | +var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/, |
14265 | linkUrl = '/cart/index/orderEnsure?cartType=ordinary'; | 14382 | linkUrl = '/cart/index/orderEnsure?cartType=ordinary'; |
14266 | 14383 | ||
14267 | require("js/common"); | 14384 | require("js/common"); |
@@ -14293,7 +14410,7 @@ function confirmAction() { | @@ -14293,7 +14410,7 @@ function confirmAction() { | ||
14293 | cont = $chooseCont.data('id'); | 14410 | cont = $chooseCont.data('id'); |
14294 | 14411 | ||
14295 | if ($editFlag.val() === 'true') { | 14412 | if ($editFlag.val() === 'true') { |
14296 | - if (type === 2 && !myreg.test($tel.attr('data-tel'))) { | 14413 | + if (!myreg.test($tel.attr('data-tel'))) { |
14297 | tip.show('请输入正确手机号'); | 14414 | tip.show('请输入正确手机号'); |
14298 | $tel.focus(); | 14415 | $tel.focus(); |
14299 | return false; | 14416 | return false; |
@@ -14319,12 +14436,6 @@ function confirmAction() { | @@ -14319,12 +14436,6 @@ function confirmAction() { | ||
14319 | orderInfo('invoicesType', type); | 14436 | orderInfo('invoicesType', type); |
14320 | orderInfo('invoiceTitle', title); | 14437 | orderInfo('invoiceTitle', title); |
14321 | 14438 | ||
14322 | - if (isModifyTel && $copyTel !== tel) { | ||
14323 | - orderInfo('isModifyTel', true); | ||
14324 | - } else { | ||
14325 | - orderInfo('isModifyTel', false); | ||
14326 | - } | ||
14327 | - | ||
14328 | dialog.showDialog({ | 14439 | dialog.showDialog({ |
14329 | dialogText: '保存成功', | 14440 | dialogText: '保存成功', |
14330 | autoHide: true, | 14441 | autoHide: true, |
@@ -14366,13 +14477,6 @@ $('.invoice-type span').on('touchstart', function() { | @@ -14366,13 +14477,6 @@ $('.invoice-type span').on('touchstart', function() { | ||
14366 | } else { | 14477 | } else { |
14367 | $(this).addClass('on').siblings().removeClass('on'); | 14478 | $(this).addClass('on').siblings().removeClass('on'); |
14368 | $editFlag.val('true'); | 14479 | $editFlag.val('true'); |
14369 | - | ||
14370 | - // 纸质发票不显示手机号 | ||
14371 | - if ($(this).index() === 1) { | ||
14372 | - $telArea.slideUp(); | ||
14373 | - } else { | ||
14374 | - $telArea.slideDown(); | ||
14375 | - } | ||
14376 | } | 14480 | } |
14377 | }); | 14481 | }); |
14378 | 14482 | ||
@@ -14395,7 +14499,6 @@ $('.istel').one('input', function() { | @@ -14395,7 +14499,6 @@ $('.istel').one('input', function() { | ||
14395 | $tel.on('input', function() { | 14499 | $tel.on('input', function() { |
14396 | $(this).attr('data-tel', $(this).val()); | 14500 | $(this).attr('data-tel', $(this).val()); |
14397 | $editFlag.val('true'); | 14501 | $editFlag.val('true'); |
14398 | - isModifyTel = true; | ||
14399 | }); | 14502 | }); |
14400 | 14503 | ||
14401 | $company.on('input', function() { | 14504 | $company.on('input', function() { |
@@ -14630,6 +14733,7 @@ $('.address-item').on('touchend', function() { | @@ -14630,6 +14733,7 @@ $('.address-item').on('touchend', function() { | ||
14630 | 14733 | ||
14631 | orderInfo('addressId', addressId); | 14734 | orderInfo('addressId', addressId); |
14632 | orderInfo('address', address); | 14735 | orderInfo('address', address); |
14736 | + console.log($this.data('href') + (orderInfo('limitUrlSufix') || '')); | ||
14633 | window.location.href = $this.data('href') + (orderInfo('limitUrlSufix') || ''); | 14737 | window.location.href = $this.data('href') + (orderInfo('limitUrlSufix') || ''); |
14634 | }).on('touchend', '.edit', function() { | 14738 | }).on('touchend', '.edit', function() { |
14635 | window.location.href = $(this).data('href'); | 14739 | window.location.href = $(this).data('href'); |
@@ -14646,40 +14750,6 @@ $confim.on('touchend', '.confim', function() { | @@ -14646,40 +14750,6 @@ $confim.on('touchend', '.confim', function() { | ||
14646 | }); | 14750 | }); |
14647 | 14751 | ||
14648 | }); | 14752 | }); |
14649 | -define("js/cart/jit-detail", ["swiper","jquery","index"], function(require, exports, module){ | ||
14650 | -/** | ||
14651 | - * jit拆单配送信息页面 | ||
14652 | - * @author: zhaobiao<bill.zhao@yoho.cn> | ||
14653 | - * @date: 2016/04/26 | ||
14654 | - */ | ||
14655 | - | ||
14656 | -var Swiper = require("swiper"), | ||
14657 | - $ = require("jquery"); | ||
14658 | - | ||
14659 | -var height = $(window).height() - $('#yoho-header').height(); | ||
14660 | - | ||
14661 | -// 为了展示页面背景色,需要把页面根据窗口大小撑开 | ||
14662 | -$('.jit-detail-page').css('height', height); | ||
14663 | - | ||
14664 | -$('.jit-detail-page>div').show(); | ||
14665 | - | ||
14666 | -// 内容展示之后,再根据document高度,调整一次容器高度 | ||
14667 | -height = $(document).height() - $('#yoho-header').height(); | ||
14668 | -$('.jit-detail-page').css('height', height); | ||
14669 | - | ||
14670 | - | ||
14671 | -(function() { | ||
14672 | - return new Swiper('.swiper-container', { | ||
14673 | - slidesPerView: 'auto', | ||
14674 | - grabCursor: true, | ||
14675 | - slideElement: 'a', | ||
14676 | - lazyLoading: true, | ||
14677 | - watchSlidesVisibility: true | ||
14678 | - }); | ||
14679 | -})(); | ||
14680 | - | ||
14681 | - | ||
14682 | -}); | ||
14683 | define("js/life/entry", ["jquery","hammer"], function(require, exports, module){ | 14753 | define("js/life/entry", ["jquery","hammer"], function(require, exports, module){ |
14684 | /* | 14754 | /* |
14685 | * To change this license header, choose License Headers in Project Properties. | 14755 | * To change this license header, choose License Headers in Project Properties. |
This diff could not be displayed because it is too large.
static/dist/myohobuy/4.8.4/index.css
0 → 100644
This diff could not be displayed because it is too large.
static/dist/myohobuy/4.8.4/index.js
0 → 100644
This diff could not be displayed because it is too large.
static/dist/myohobuy/4.8.4/lib.js
0 → 100644
This diff could not be displayed because it is too large.
@@ -37,7 +37,13 @@ var $chosePanel = $('#chose-panel'), | @@ -37,7 +37,13 @@ var $chosePanel = $('#chose-panel'), | ||
37 | $choseArea, | 37 | $choseArea, |
38 | $cartBar, | 38 | $cartBar, |
39 | $soonSoldOut = $('.soonSoldOut-tag'), | 39 | $soonSoldOut = $('.soonSoldOut-tag'), |
40 | - $yohoPage = $('.yoho-page'); | 40 | + $yohoPage = $('.yoho-page'), |
41 | + //门票 限购数量 | ||
42 | + ticketsLimit = $('#limitNum').val() || 0, | ||
43 | + single = $('#single').val() || 0; | ||
44 | + $productSku = $('#productSku'), | ||
45 | + $buyNumber = $('#buyNumber'), | ||
46 | + $buyNowForm = $('#buyNowForm'); | ||
41 | 47 | ||
42 | // 购物车编辑标相关变量 | 48 | // 购物车编辑标相关变量 |
43 | var isEdit, | 49 | var isEdit, |
@@ -126,6 +132,14 @@ function removePannel() { | @@ -126,6 +132,14 @@ function removePannel() { | ||
126 | } | 132 | } |
127 | 133 | ||
128 | function checkColorSizeNum() { | 134 | function checkColorSizeNum() { |
135 | + | ||
136 | + if (ticketsLimit) { | ||
137 | + //门票 | ||
138 | + if (!checkTickets()) { | ||
139 | + return; | ||
140 | + } | ||
141 | + } | ||
142 | + | ||
129 | if (!hasChooseColor && !hasChooseSize) { | 143 | if (!hasChooseColor && !hasChooseSize) { |
130 | tip.show('请选择颜色和尺码~'); | 144 | tip.show('请选择颜色和尺码~'); |
131 | return false; | 145 | return false; |
@@ -139,6 +153,24 @@ function checkColorSizeNum() { | @@ -139,6 +153,24 @@ function checkColorSizeNum() { | ||
139 | return true; | 153 | return true; |
140 | } | 154 | } |
141 | 155 | ||
156 | +//检查门票选择 | ||
157 | +function checkTickets() { | ||
158 | + if (!hasChooseColor && !hasChooseSize) { | ||
159 | + if (single) { | ||
160 | + tip.show('请选择日期~'); | ||
161 | + } else { | ||
162 | + tip.show('请选择日期和区域~'); | ||
163 | + }; | ||
164 | + return false; | ||
165 | + } else if (!hasChooseColor) { | ||
166 | + tip.show('请选择日期~'); | ||
167 | + return false; | ||
168 | + } else if (!hasChooseSize && !single) { | ||
169 | + tip.show('请选择区域~'); | ||
170 | + return false; | ||
171 | + } | ||
172 | + return true; | ||
173 | +} | ||
142 | 174 | ||
143 | 175 | ||
144 | function show(html, cb) { | 176 | function show(html, cb) { |
@@ -173,7 +205,7 @@ function updateConformButtonClassAndText() { | @@ -173,7 +205,7 @@ function updateConformButtonClassAndText() { | ||
173 | $chosed = $allChoseItems.find('.chosed'); | 205 | $chosed = $allChoseItems.find('.chosed'); |
174 | if (2 === $chosed.closest('.zero-stock').length) { | 206 | if (2 === $chosed.closest('.zero-stock').length) { |
175 | $('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄'); | 207 | $('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄'); |
176 | - } else if (limitProductCode) { | 208 | + } else if (limitProductCode || ticketsLimit) { |
177 | $('#chose-btn-sure').css('background-color', '#eb0313').html('立即购买'); | 209 | $('#chose-btn-sure').css('background-color', '#eb0313').html('立即购买'); |
178 | } else { | 210 | } else { |
179 | $('#chose-btn-sure').css('background-color', '#eb0313').html(isEdit ? '确认' : '加入购物车'); | 211 | $('#chose-btn-sure').css('background-color', '#eb0313').html(isEdit ? '确认' : '加入购物车'); |
@@ -183,7 +215,14 @@ function updateConformButtonClassAndText() { | @@ -183,7 +215,14 @@ function updateConformButtonClassAndText() { | ||
183 | //显示剩余件数 | 215 | //显示剩余件数 |
184 | function displayGoodNum(curGoodNum) { | 216 | function displayGoodNum(curGoodNum) { |
185 | 217 | ||
186 | - //数量大于0 | 218 | + //门票限购 |
219 | + if (ticketsLimit) { | ||
220 | + $allChoseItems.find('.num .left-num').html('限购' + ticketsLimit + '件'); | ||
221 | + $leftNum.val(curGoodNum); | ||
222 | + return; | ||
223 | + } | ||
224 | + | ||
225 | + //数量大于 | ||
187 | if (curGoodNum > 0) { | 226 | if (curGoodNum > 0) { |
188 | if ($soonSoldOut.length > 0) { | 227 | if ($soonSoldOut.length > 0) { |
189 | $allChoseItems.find('.num .left-num').html('即将售罄'); | 228 | $allChoseItems.find('.num .left-num').html('即将售罄'); |
@@ -247,6 +286,39 @@ function changeColorChosed(newColorIndex) { | @@ -247,6 +286,39 @@ function changeColorChosed(newColorIndex) { | ||
247 | return 0; | 286 | return 0; |
248 | } | 287 | } |
249 | 288 | ||
289 | +//添加门票 | ||
290 | +function addTickets(productSku, buyNumber) { | ||
291 | + var data = { | ||
292 | + productSku: productSku, | ||
293 | + buyNumber: buyNumber | ||
294 | + }; | ||
295 | + | ||
296 | + //校验电子票 | ||
297 | + $.ajax({ | ||
298 | + url: '/cart/index/checkTickets', | ||
299 | + dataType: 'json', | ||
300 | + data: data, | ||
301 | + type: 'post', | ||
302 | + success: function (addRestult) { | ||
303 | + if (addRestult.code != 200) { | ||
304 | + if (addRestult.code == 401) { | ||
305 | + var refer = window.location.href; | ||
306 | + window.location.href = '//m.yohobuy.com/signin.html?refer=' + refer; | ||
307 | + } | ||
308 | + tip.show(addRestult.message); | ||
309 | + } else { | ||
310 | + $productSku.val(productSku); | ||
311 | + $buyNumber.val(buyNumber); | ||
312 | + $buyNowForm.submit(); | ||
313 | + } | ||
314 | + }, | ||
315 | + error: function () { | ||
316 | + tip.show('网络异常~'); | ||
317 | + } | ||
318 | + | ||
319 | + }); | ||
320 | +} | ||
321 | + | ||
250 | init(); | 322 | init(); |
251 | 323 | ||
252 | 324 | ||
@@ -296,7 +368,6 @@ $yohoPage.on('touchstart', '.color-list .block', function() { | @@ -296,7 +368,6 @@ $yohoPage.on('touchstart', '.color-list .block', function() { | ||
296 | 368 | ||
297 | //老的选中尺码去掉勾选,新的选中尺码加上勾选 | 369 | //老的选中尺码去掉勾选,新的选中尺码加上勾选 |
298 | curGoodNum = changeSizeChosed(index + 1); | 370 | curGoodNum = changeSizeChosed(index + 1); |
299 | - | ||
300 | // 显示剩余数量 | 371 | // 显示剩余数量 |
301 | displayGoodNum(curGoodNum); | 372 | displayGoodNum(curGoodNum); |
302 | 373 | ||
@@ -327,6 +398,19 @@ $yohoPage.on('touchstart', '.color-list .block', function() { | @@ -327,6 +398,19 @@ $yohoPage.on('touchstart', '.color-list .block', function() { | ||
327 | 398 | ||
328 | // 设置按钮的样式和文字 | 399 | // 设置按钮的样式和文字 |
329 | updateConformButtonClassAndText(); | 400 | updateConformButtonClassAndText(); |
401 | + | ||
402 | + //展览票 | ||
403 | + if (ticketsLimit && single) { | ||
404 | + //选中日期 | ||
405 | + $curSizeBlock = $('.size-list .size-row .block').eq(index + 1); | ||
406 | + $curSizeBlock.addClass('chosed'); | ||
407 | + // 显示剩余数量 | ||
408 | + displayGoodNum($curColorBlock.data('num')); | ||
409 | + hasChooseSize = true; | ||
410 | + return false; | ||
411 | + } | ||
412 | + | ||
413 | + | ||
330 | }).on('touchstart', '.size-list .block', function() { | 414 | }).on('touchstart', '.size-list .block', function() { |
331 | var $this = $(this), | 415 | var $this = $(this), |
332 | index, | 416 | index, |
@@ -402,9 +486,10 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -402,9 +486,10 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
402 | 486 | ||
403 | $num.val(num - 1); | 487 | $num.val(num - 1); |
404 | }).on('touchstart', '.btn-plus', function() { | 488 | }).on('touchstart', '.btn-plus', function() { |
405 | - var num = parseInt($num.val(), 10); | 489 | + var num = parseInt($num.val(), 10), |
490 | + maxTips = ticketsLimit ? '每人只可购买' + ticketsLimit + '张当日门票' : '您选择的数量超过了最大库存量~'; | ||
406 | 491 | ||
407 | - leftNum = $('#left-num').val(); | 492 | + leftNum = ticketsLimit || $('#left-num').val(); |
408 | 493 | ||
409 | if (!checkColorSizeNum()) { | 494 | if (!checkColorSizeNum()) { |
410 | return; | 495 | return; |
@@ -416,7 +501,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -416,7 +501,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
416 | 501 | ||
417 | //TODO:库存数验证 | 502 | //TODO:库存数验证 |
418 | if (num > leftNum - 1) { | 503 | if (num > leftNum - 1) { |
419 | - tip.show('您选择的数量超过了最大库存量~'); | 504 | + tip.show(maxTips); |
420 | return; | 505 | return; |
421 | } | 506 | } |
422 | $num.val(num + 1); | 507 | $num.val(num + 1); |
@@ -458,9 +543,18 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -458,9 +543,18 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
458 | return false; | 543 | return false; |
459 | } | 544 | } |
460 | 545 | ||
461 | - confirming = true; | 546 | + if (!ticketsLimit) { |
547 | + confirming = true; | ||
548 | + } | ||
549 | + | ||
462 | loading.showLoadingMask(); | 550 | loading.showLoadingMask(); |
463 | 551 | ||
552 | + //立即购买门票 | ||
553 | + if (ticketsLimit) { | ||
554 | + addTickets(productSku, buyNumber); | ||
555 | + return; | ||
556 | + } | ||
557 | + | ||
464 | //针对是否处于编辑模式设置不同的url和需要post的数据 | 558 | //针对是否处于编辑模式设置不同的url和需要post的数据 |
465 | if (isEdit) { | 559 | if (isEdit) { |
466 | cartGoodData = { | 560 | cartGoodData = { |
@@ -16,12 +16,16 @@ var $invoice = $('.invoice'), | @@ -16,12 +16,16 @@ var $invoice = $('.invoice'), | ||
16 | $coinCheck = $('.coin-check'), | 16 | $coinCheck = $('.coin-check'), |
17 | $coinUsed = $('.coin .used'), | 17 | $coinUsed = $('.coin .used'), |
18 | $subBlock = $('.sub-block'), | 18 | $subBlock = $('.sub-block'), |
19 | + $ticketsMobile = $('#mobile'), | ||
19 | payType, | 20 | payType, |
20 | queryString = $.queryString(), | 21 | queryString = $.queryString(), |
21 | orderInfo = order.orderInfo, | 22 | orderInfo = order.orderInfo, |
22 | isSubmiting, | 23 | isSubmiting, |
23 | dispatchInfo, | 24 | dispatchInfo, |
24 | - total; | 25 | + total, |
26 | + isTickets = $('#ticketsPage').val(), | ||
27 | + productSku = $('#productSku').val(), | ||
28 | + buyNumber = $('#buyNumber').val(); | ||
25 | 29 | ||
26 | var orderCont = window.cookie('order-info') && JSON.parse(window.cookie('order-info')); | 30 | var orderCont = window.cookie('order-info') && JSON.parse(window.cookie('order-info')); |
27 | var invoiceCont = { | 31 | var invoiceCont = { |
@@ -170,20 +174,30 @@ function updateDeliverId(id) { | @@ -170,20 +174,30 @@ function updateDeliverId(id) { | ||
170 | 174 | ||
171 | function orderCompute() { | 175 | function orderCompute() { |
172 | var yohoCoin = orderInfo('yohoCoin'), | 176 | var yohoCoin = orderInfo('yohoCoin'), |
173 | - deliverId = orderInfo('deliveryId'); | ||
174 | - | ||
175 | - loading.showLoadingMask(); | ||
176 | - $.ajax({ | ||
177 | - method: 'POST', | ||
178 | - url: '/cart/index/orderCompute', | ||
179 | - data: { | 177 | + deliverId = orderInfo('deliveryId'), |
178 | + data = { | ||
180 | cartType: orderInfo('cartType') || 'ordinary', | 179 | cartType: orderInfo('cartType') || 'ordinary', |
181 | deliveryId: orderInfo('deliveryId'), | 180 | deliveryId: orderInfo('deliveryId'), |
182 | paymentTypeId: orderInfo('paymentTypeId'), | 181 | paymentTypeId: orderInfo('paymentTypeId'), |
183 | couponCode: orderInfo('couponCode'), | 182 | couponCode: orderInfo('couponCode'), |
184 | yohoCoin: yohoCoin, | 183 | yohoCoin: yohoCoin, |
185 | skuList: isLimitGood() ? orderInfo('skuList') : undefined | 184 | skuList: isLimitGood() ? orderInfo('skuList') : undefined |
185 | + }; | ||
186 | + //门票 | ||
187 | + if (isTickets) { | ||
188 | + data = { | ||
189 | + type: 'tickets', | ||
190 | + productSku: productSku, | ||
191 | + buyNumber: buyNumber, | ||
192 | + yohoCoin: yohoCoin | ||
186 | } | 193 | } |
194 | + }; | ||
195 | + | ||
196 | + loading.showLoadingMask(); | ||
197 | + $.ajax({ | ||
198 | + method: 'POST', | ||
199 | + url: '/cart/index/orderCompute', | ||
200 | + data: data | ||
187 | }).then(function(res) { | 201 | }).then(function(res) { |
188 | if ($.type(res) !== 'object') { | 202 | if ($.type(res) !== 'object') { |
189 | window.location.reload(); | 203 | window.location.reload(); |
@@ -394,6 +408,10 @@ $subBlock.on('touchstart', 'li', function() { | @@ -394,6 +408,10 @@ $subBlock.on('touchstart', 'li', function() { | ||
394 | 408 | ||
395 | 409 | ||
396 | $('.bill a').on('touchstart', function() { | 410 | $('.bill a').on('touchstart', function() { |
411 | + if (isTickets) { | ||
412 | + ticketsConfirm(); | ||
413 | + return ; | ||
414 | + } | ||
397 | orderInfo('paymentTypeId', $('.delivery-id .icon-cb-radio').data('id')); | 415 | orderInfo('paymentTypeId', $('.delivery-id .icon-cb-radio').data('id')); |
398 | orderInfo('paymentType', $('.payment-type .icon-cb-radio').data('id')); | 416 | orderInfo('paymentType', $('.payment-type .icon-cb-radio').data('id')); |
399 | 417 | ||
@@ -412,6 +430,47 @@ if (orderInfo('address') && orderInfo('address').is_support === 'N') { | @@ -412,6 +430,47 @@ if (orderInfo('address') && orderInfo('address').is_support === 'N') { | ||
412 | orderInfo('deliveryId', $('.delivery-id .icon-cb-radio').data('id')); | 430 | orderInfo('deliveryId', $('.delivery-id .icon-cb-radio').data('id')); |
413 | orderCompute(); | 431 | orderCompute(); |
414 | } | 432 | } |
433 | +//电子票下单 | ||
434 | +function ticketsConfirm () { | ||
415 | 435 | ||
436 | + if(!$ticketsMobile.val()) { | ||
437 | + tip.show('手机号必填'); | ||
438 | + return; | ||
439 | + } | ||
440 | + var data = { | ||
441 | + productSku: productSku, | ||
442 | + buyNumber: buyNumber, | ||
443 | + mobile: $ticketsMobile.val(), | ||
444 | + useYohoCoin: orderInfo('yohoCoin') | ||
445 | + }; | ||
446 | + | ||
447 | + $.ajax({ | ||
448 | + url: '/cart/index/submitTicket', | ||
449 | + type: 'POST', | ||
450 | + dataType: 'json', | ||
451 | + data: data, | ||
452 | + success: function(ticket) { | ||
453 | + //下单成功调整支付页面 | ||
454 | + if (ticket.code === 200) { | ||
455 | + window.location.href = '/home/orders/pay?order_code=' + ticket.data.order_code | ||
456 | + } else { | ||
457 | + tip.show(ticket.message); | ||
458 | + } | ||
459 | + | ||
460 | + }, | ||
461 | + error: function () { | ||
462 | + tip.show('网络异常~'); | ||
463 | + } | ||
464 | + }); | ||
465 | +} | ||
466 | + | ||
467 | +//校验手机号 | ||
468 | +$ticketsMobile.blur(function function_name (e) { | ||
469 | + var reg = /^[0123456789]{1,30}$/; | ||
470 | + var mobile = $ticketsMobile.val(); | ||
471 | + if (!reg.test(mobile)) { | ||
472 | + tip.show('手机号码不正确!'); | ||
473 | + } | ||
474 | +}) | ||
416 | // 初始化发票信息内容 | 475 | // 初始化发票信息内容 |
417 | invoiceInit(); | 476 | invoiceInit(); |
@@ -28,7 +28,7 @@ if (window.wx) { | @@ -28,7 +28,7 @@ if (window.wx) { | ||
28 | } | 28 | } |
29 | 29 | ||
30 | function onBridgeReady() { | 30 | function onBridgeReady() { |
31 | - document.addEventListener('WeixinJSBridgeReady', function () { | 31 | + document.addEventListener('WeixinJSBridgeReady', function() { |
32 | window.WeixinJSBridge && window.WeixinJSBridge.call('hideOptionMenu'); | 32 | window.WeixinJSBridge && window.WeixinJSBridge.call('hideOptionMenu'); |
33 | }); | 33 | }); |
34 | } | 34 | } |
@@ -53,16 +53,8 @@ function jsApiCall(orderCode, jsApiParameters) { | @@ -53,16 +53,8 @@ function jsApiCall(orderCode, jsApiParameters) { | ||
53 | window.WeixinJSBridge && window.WeixinJSBridge.invoke( | 53 | window.WeixinJSBridge && window.WeixinJSBridge.invoke( |
54 | 'getBrandWCPayRequest', | 54 | 'getBrandWCPayRequest', |
55 | jsApiParameters, | 55 | jsApiParameters, |
56 | - function (res) { | ||
57 | - //发送支付确认 | ||
58 | - $.ajax({ | ||
59 | - type: 'GET', | ||
60 | - url: '/shopping/pay/wechatPayConfirm?order_code=' + orderCode, | ||
61 | - dataType: 'json', | ||
62 | - success: function (res) { | ||
63 | - window.location.href = '/home/orders/detail?order_code=' + orderCode; | ||
64 | - } | ||
65 | - }); | 56 | + function(res) { |
57 | + window.location.href = '/home/orders/detail?order_code=' + orderCode + '&openId=true'; | ||
66 | } | 58 | } |
67 | ); | 59 | ); |
68 | } | 60 | } |
@@ -82,9 +74,12 @@ function callpay(orderCode) { | @@ -82,9 +74,12 @@ function callpay(orderCode) { | ||
82 | } else { | 74 | } else { |
83 | $.ajax({ | 75 | $.ajax({ |
84 | type: 'GET', | 76 | type: 'GET', |
85 | - url: '/shopping/pay/wechatwapapi?order_code=' + orderCode, | 77 | + url: '/shopping/pay/wechatwapapi', |
78 | + data: { | ||
79 | + 'order_code': orderCode | ||
80 | + }, | ||
86 | dataType: 'json', | 81 | dataType: 'json', |
87 | - success: function (res) { | 82 | + success: function(res) { |
88 | if (res.code === 200) { | 83 | if (res.code === 200) { |
89 | jsApiParameters = res.data.jsApiParameters; | 84 | jsApiParameters = res.data.jsApiParameters; |
90 | jsApiCall(orderCode, jsApiParameters); | 85 | jsApiCall(orderCode, jsApiParameters); |
@@ -92,10 +87,10 @@ function callpay(orderCode) { | @@ -92,10 +87,10 @@ function callpay(orderCode) { | ||
92 | tip.show('微信支付调取失败'); | 87 | tip.show('微信支付调取失败'); |
93 | } | 88 | } |
94 | }, | 89 | }, |
95 | - error: function () { | 90 | + error: function() { |
96 | tip.show('请刷新本页面,完成微信支付'); | 91 | tip.show('请刷新本页面,完成微信支付'); |
97 | }, | 92 | }, |
98 | - complete: function () { | 93 | + complete: function() { |
99 | $loadingToast.addClass("hide"); | 94 | $loadingToast.addClass("hide"); |
100 | } | 95 | } |
101 | }); | 96 | }); |
@@ -112,7 +107,7 @@ function isWXOpen() { | @@ -112,7 +107,7 @@ function isWXOpen() { | ||
112 | function hideWeChatPay() { | 107 | function hideWeChatPay() { |
113 | var $payApps = $('.app'); | 108 | var $payApps = $('.app'); |
114 | 109 | ||
115 | - $payApps.each(function (idx, app) { | 110 | + $payApps.each(function(idx, app) { |
116 | if ($(app).parent().attr('id') === 'weixin') { | 111 | if ($(app).parent().attr('id') === 'weixin') { |
117 | $(app).parent().css('display', 'none'); | 112 | $(app).parent().css('display', 'none'); |
118 | return false; | 113 | return false; |
@@ -136,7 +131,7 @@ function loadIcon() { | @@ -136,7 +131,7 @@ function loadIcon() { | ||
136 | var $div = null; | 131 | var $div = null; |
137 | var appid = null; | 132 | var appid = null; |
138 | 133 | ||
139 | - $boxs.each(function (idx, box) { | 134 | + $boxs.each(function(idx, box) { |
140 | $div = $(box).find('.icon').find('div'); | 135 | $div = $(box).find('.icon').find('div'); |
141 | if ($div.length > 0) { | 136 | if ($div.length > 0) { |
142 | appid = $(box).attr('id'); | 137 | appid = $(box).attr('id'); |
@@ -154,15 +149,15 @@ function showPage() { | @@ -154,15 +149,15 @@ function showPage() { | ||
154 | function bindTouchedEvent() { | 149 | function bindTouchedEvent() { |
155 | var $boxs = $('.box'); | 150 | var $boxs = $('.box'); |
156 | 151 | ||
157 | - $boxs.on('touchstart', function (e) { | 152 | + $boxs.on('touchstart', function(e) { |
158 | $(this).addClass('bytouch'); | 153 | $(this).addClass('bytouch'); |
159 | - }).on('touchend touchcancel', function () { | 154 | + }).on('touchend touchcancel', function() { |
160 | $boxs.removeClass('bytouch'); | 155 | $boxs.removeClass('bytouch'); |
161 | }); | 156 | }); |
162 | } | 157 | } |
163 | 158 | ||
164 | if (wxHammer) { | 159 | if (wxHammer) { |
165 | - wxHammer.on('tap', function () { | 160 | + wxHammer.on('tap', function() { |
166 | callpay(theOrderCode); | 161 | callpay(theOrderCode); |
167 | }); | 162 | }); |
168 | } | 163 | } |
@@ -14,6 +14,9 @@ var productId = $('#productId').val(); | @@ -14,6 +14,9 @@ var productId = $('#productId').val(); | ||
14 | var skn = $('#productSkn').val(), | 14 | var skn = $('#productSkn').val(), |
15 | productCode = $('#limitProductCode').val(); | 15 | productCode = $('#limitProductCode').val(); |
16 | 16 | ||
17 | + //门票 限购数量 | ||
18 | +var ticketsLimit = $('#limitNum').val() || 0; | ||
19 | + | ||
17 | $('#likeBtn').on('touchstart', function() { | 20 | $('#likeBtn').on('touchstart', function() { |
18 | var opt, | 21 | var opt, |
19 | favorite; | 22 | favorite; |
@@ -67,6 +70,14 @@ $('#likeBtn').on('touchstart', function() { | @@ -67,6 +70,14 @@ $('#likeBtn').on('touchstart', function() { | ||
67 | }); | 70 | }); |
68 | 71 | ||
69 | $('#addtoCart').on('touchstart', function() { | 72 | $('#addtoCart').on('touchstart', function() { |
73 | + | ||
74 | + //门票验证登录 | ||
75 | + if (ticketsLimit) { | ||
76 | + if (!ticketCheckLogin()) { | ||
77 | + return false; | ||
78 | + } | ||
79 | + } | ||
80 | + | ||
70 | $('.cart-bar').hide(); | 81 | $('.cart-bar').hide(); |
71 | 82 | ||
72 | productCode && chosePanel.setLimitGoodModeWithSknId(productCode, skn); | 83 | productCode && chosePanel.setLimitGoodModeWithSknId(productCode, skn); |
@@ -83,7 +94,28 @@ $('#addtoCart').on('touchstart', function() { | @@ -83,7 +94,28 @@ $('#addtoCart').on('touchstart', function() { | ||
83 | return false; | 94 | return false; |
84 | }); | 95 | }); |
85 | 96 | ||
97 | +ticketCheckOpen(); | ||
98 | + | ||
86 | $('#buyLimit').on('touchstart', function() { | 99 | $('#buyLimit').on('touchstart', function() { |
87 | tip.show('打开APP可抢购该商品哦~'); | 100 | tip.show('打开APP可抢购该商品哦~'); |
88 | return false; | 101 | return false; |
89 | }); | 102 | }); |
103 | + | ||
104 | +//门票立即购买验证登录 | ||
105 | + function ticketCheckLogin() { | ||
106 | + | ||
107 | + if (!window.getUid()) { | ||
108 | + var urlArray = window.location.href.split('?'); | ||
109 | + window.location.href = '//m.yohobuy.com/signin.html?refer=' + urlArray[0] + '?product_type=ticket'; | ||
110 | + return false; | ||
111 | + } | ||
112 | + return true; | ||
113 | + } | ||
114 | + | ||
115 | +// 门票登录后自动弹出 | ||
116 | + function ticketCheckOpen() { | ||
117 | + var showPannel = $('#showPannel').val(); | ||
118 | + if (showPannel) { | ||
119 | + chosePanel.show(); | ||
120 | + } | ||
121 | + } |
@@ -570,3 +570,85 @@ | @@ -570,3 +570,85 @@ | ||
570 | } | 570 | } |
571 | } | 571 | } |
572 | } | 572 | } |
573 | + | ||
574 | +.tickets-confirm-page { | ||
575 | + | ||
576 | + .sorry-tips { | ||
577 | + border-bottom: 1px solid #e0e0e0; | ||
578 | + height: 50px; | ||
579 | + line-height: 50px; | ||
580 | + | ||
581 | + p { | ||
582 | + color: #d0021b; | ||
583 | + font-size: 24px; | ||
584 | + margin-left: 5%; | ||
585 | + } | ||
586 | + } | ||
587 | + | ||
588 | + .delivery-id { | ||
589 | + h3 { | ||
590 | + border: 0px; | ||
591 | + } | ||
592 | + h4 { | ||
593 | + width: 95%; | ||
594 | + margin-left: 5%; | ||
595 | + font-size: 30px; | ||
596 | + color: #b0b0b0; | ||
597 | + margin-bottom: 20px; | ||
598 | + } | ||
599 | + } | ||
600 | + | ||
601 | + .yoho-coin { | ||
602 | + margin-left: 5%; | ||
603 | + width: 90%; | ||
604 | + overflow: hidden; | ||
605 | + border-bottom: 1px solid #e0e0e0; | ||
606 | + | ||
607 | + .sale-invoice { | ||
608 | + margin-top: 0px; | ||
609 | + } | ||
610 | + } | ||
611 | + .dispatch { | ||
612 | + | ||
613 | + .sub-block { | ||
614 | + | ||
615 | + h3 { | ||
616 | + width: 90%; | ||
617 | + | ||
618 | + span { | ||
619 | + color: #afafaf; | ||
620 | + font-size: 26px; | ||
621 | + float: right; | ||
622 | + } | ||
623 | + } | ||
624 | + } | ||
625 | + | ||
626 | + } | ||
627 | + | ||
628 | + | ||
629 | + .tickets-mobile { | ||
630 | + position: relative; | ||
631 | + | ||
632 | + input { | ||
633 | + background: #fff; | ||
634 | + border: 1px solid #b0b0b0; | ||
635 | + height: 85px; | ||
636 | + line-height: 85px; | ||
637 | + margin: 0px; | ||
638 | + outline: none; | ||
639 | + -webkit-appearance: none; | ||
640 | + } | ||
641 | + | ||
642 | + .mobile-tips { | ||
643 | + display: inline-block; | ||
644 | + position: absolute; | ||
645 | + height: 85px; | ||
646 | + line-height: 85px; | ||
647 | + right: 30px; | ||
648 | + top: 50%; | ||
649 | + margin-top: -43px; | ||
650 | + font-size: 22px; | ||
651 | + color: #b0b0b0; | ||
652 | + } | ||
653 | + } | ||
654 | +} |
@@ -349,4 +349,18 @@ | @@ -349,4 +349,18 @@ | ||
349 | color: #d0021b; | 349 | color: #d0021b; |
350 | } | 350 | } |
351 | } | 351 | } |
352 | + | ||
353 | + .tickets-mobile { | ||
354 | + font-size:32px; | ||
355 | + height: 90px; | ||
356 | + line-height: 90px; | ||
357 | + | ||
358 | + .pull-left { | ||
359 | + float:left; | ||
360 | + } | ||
361 | + | ||
362 | + .pull-right { | ||
363 | + float:right; | ||
364 | + } | ||
365 | + } | ||
352 | } | 366 | } |
1 | +{{> layout/header}} | ||
2 | +<div class="order-ensure-page yoho-page tickets-confirm-page"> | ||
3 | + <section class="dispatch block"> | ||
4 | + <!--<div class="sorry-tips"> | ||
5 | + <p>虚拟商品不支持退换货,抱歉!</p> | ||
6 | + </div>--> | ||
7 | + <div class="sub-block payment-type"> | ||
8 | + <h3> | ||
9 | + <p>支付方式</p> | ||
10 | + <span>在线支付</span> | ||
11 | + </h3> | ||
12 | + </div> | ||
13 | + <div class="sub-block delivery-id"> | ||
14 | + <h3> | ||
15 | + <p>发送时间</p> | ||
16 | + <span>自动发货</span> | ||
17 | + </h3> | ||
18 | + <h4>在您支付成功后,系统将立即为您发送二维码,您可以在订单中查看。</h4> | ||
19 | + </div> | ||
20 | + </section> | ||
21 | + | ||
22 | + <section class="block tickets-mobile"> | ||
23 | + <input type="text" name="mobile" placeholder="手机号" id="mobile"> | ||
24 | + <span class="mobile-tips">(必填)</span> | ||
25 | + </section> | ||
26 | + | ||
27 | + <section class="block goods-bottom"> | ||
28 | + {{#each goods}} | ||
29 | + {{> me/order/good}} | ||
30 | + {{/each}} | ||
31 | + </section> | ||
32 | + | ||
33 | + <section class="block dispatch"> | ||
34 | + <div class="yoho-coin"> | ||
35 | + <ul class="sale-invoice"> | ||
36 | + <li class="coin" data-yoho-coin="{{yohoCoin}}"> | ||
37 | + <span class="title">YOHO币</span> | ||
38 | + | ||
39 | + {{#if yohoCoin}} | ||
40 | + <span class="desc used {{#unless useYohoCoin}}hide{{/unless}}">已抵¥{{useYohoCoin}}</span> | ||
41 | + <span class="desc can-use {{#if useYohoCoin}}hide{{/if}}">可抵¥{{yohoCoin}}</span> | ||
42 | + | ||
43 | + {{#if useYohoCoin}} | ||
44 | + <span class="coin-check"> | ||
45 | + <!-- <em>- ¥ {{useYohoCoin}}</em> --> | ||
46 | + <i class="iconfont checkbox icon-cb-radio"></i> | ||
47 | + </span> | ||
48 | + {{else}} | ||
49 | + <span class="coin-check"> | ||
50 | + <!-- <em style="display: none;">- ¥ {{useYohoCoin}}</em> --> | ||
51 | + <i class="iconfont checkbox icon-radio"></i> | ||
52 | + </span> | ||
53 | + {{/if}} | ||
54 | + {{^}} | ||
55 | + <span class="not-used coin-check"> | ||
56 | + 无YOHO币可用 | ||
57 | + </span> | ||
58 | + {{/if}} | ||
59 | + </li> | ||
60 | + </ul> | ||
61 | + </div> | ||
62 | + <div class="sub-block delivery-id"> | ||
63 | + <h3> | ||
64 | + <p>发票</p> | ||
65 | + </h3> | ||
66 | + <h4> | ||
67 | + 如需开具发票,请于我们的客服联系<br> | ||
68 | + 客服电话:400-889-9646。 | ||
69 | + </h4> | ||
70 | + </div> | ||
71 | + </section> | ||
72 | + | ||
73 | + <section class="price-cal block"> | ||
74 | + <ul class="total"> | ||
75 | + {{#cartPayData}} | ||
76 | + <li> | ||
77 | + <p>{{promotion}}</p> | ||
78 | + <span>{{promotion_amount}}</span> | ||
79 | + </li> | ||
80 | + {{/cartPayData}} | ||
81 | + </ul> | ||
82 | + <div class="price-cost"> | ||
83 | + 实付金额 | ||
84 | + <span>¥{{price}}</span> | ||
85 | + </div> | ||
86 | + </section> | ||
87 | + <div class="bill"> | ||
88 | + 您需要支付:<span>¥{{price}}</span> | ||
89 | + <a href="javascript:;" id="ticketsConfirm">确认</a> | ||
90 | + </div> | ||
91 | + <input type="hidden" name="ticketsPage" id="ticketsPage" value="1"> | ||
92 | + <input type="hidden" name="productSku" id="productSku" value="{{productSku}}"> | ||
93 | + <input type="hidden" name="buyNumber" id="buyNumber" value="{{buyNumber}}"> | ||
94 | +</div> | ||
95 | +{{> layout/footer}} |
@@ -2,24 +2,33 @@ | @@ -2,24 +2,33 @@ | ||
2 | <div class="order-detail-page yoho-page"> | 2 | <div class="order-detail-page yoho-page"> |
3 | {{# orderDetail}} | 3 | {{# orderDetail}} |
4 | <div id="order-detail" data-id="{{orderNum}}"> | 4 | <div id="order-detail" data-id="{{orderNum}}"> |
5 | - <section class="owner-info block" data-changeable="{{changeable}}" data-url="{{url}}"> | ||
6 | - <span class="iconfont"></span> | 5 | + {{#if isVirtual}} |
6 | + <section class="block"> | ||
7 | + <div class="tickets-mobile"> | ||
8 | + <span class="pull-left">手机号码:</span> | ||
9 | + <span class="pull-right">{{mobile}}</span> | ||
10 | + </div> | ||
11 | + </section> | ||
12 | + {{else}} | ||
13 | + <section class="owner-info block" data-changeable="{{changeable}}" data-url="{{url}}"> | ||
14 | + <span class="iconfont"></span> | ||
7 | 15 | ||
8 | - <div class="beside-icon"> | ||
9 | - <p class="name-phone"> | ||
10 | - {{name}} | ||
11 | - <span>{{phoneNum}}</span> | ||
12 | - </p> | 16 | + <div class="beside-icon"> |
17 | + <p class="name-phone"> | ||
18 | + {{name}} | ||
19 | + <span>{{phoneNum}}</span> | ||
20 | + </p> | ||
13 | 21 | ||
14 | - <p class="address"> | ||
15 | - {{address}} | ||
16 | - </p> | 22 | + <p class="address"> |
23 | + {{address}} | ||
24 | + </p> | ||
17 | 25 | ||
18 | - <div class="rest">其他地址<span class="iconfont iconAddress"></span></div> | ||
19 | - </div> | ||
20 | - | ||
21 | - </section> | ||
22 | - <div class="range"></div> | 26 | + <div class="rest">其他地址<span class="iconfont iconAddress"></span></div> |
27 | + </div> | ||
28 | + | ||
29 | + </section> | ||
30 | + <div class="range"></div> | ||
31 | + {{/if}} | ||
23 | <section class="order-status block"> | 32 | <section class="order-status block"> |
24 | <div class="status sub"> | 33 | <div class="status sub"> |
25 | <span class="iconfont"></span> | 34 | <span class="iconfont"></span> |
@@ -98,33 +107,43 @@ | @@ -98,33 +107,43 @@ | ||
98 | 107 | ||
99 | <div class="opt block"> | 108 | <div class="opt block"> |
100 | {{#unless unreceived}} | 109 | {{#unless unreceived}} |
101 | - {{#unless unpaid}} | ||
102 | - <span class="btn btn-del">删除订单</span> | ||
103 | - <span class="btn btn-rebuy">再次购买</span> | ||
104 | - {{/unless}} | 110 | + {{#unless unpaid}} |
111 | + <span class="btn btn-del">删除订单</span> | ||
112 | + {{#if isVirtual}} | ||
113 | + <!--虚拟商品--> | ||
114 | + {{else}} | ||
115 | + <span class="btn btn-rebuy">再次购买</span> | ||
116 | + {{/if}} | ||
117 | + {{/unless}} | ||
105 | {{/unless}} | 118 | {{/unless}} |
106 | 119 | ||
107 | {{#if unpaid}} | 120 | {{#if unpaid}} |
108 | - <ul class="count-down hide"> | ||
109 | - <li> | ||
110 | - <span class="iconfont count-down-icon"></span> | ||
111 | - </li> | ||
112 | - <li> | ||
113 | - <span class="hours">{{leftTime}}</span> | ||
114 | - </li> | ||
115 | - </ul> | ||
116 | - <span class="btn btn-cancel">取消订单</span> | ||
117 | - {{#if payUrl}} | ||
118 | - <a href="{{payUrl}}"> | ||
119 | - <span class="btn btn-pay">立即付款</span> | ||
120 | - </a> | ||
121 | - {{/if}} | 121 | + <ul class="count-down hide"> |
122 | + <li> | ||
123 | + <span class="iconfont count-down-icon"></span> | ||
124 | + </li> | ||
125 | + <li> | ||
126 | + <span class="hours">{{leftTime}}</span> | ||
127 | + </li> | ||
128 | + </ul> | ||
129 | + <span class="btn btn-cancel">取消订单</span> | ||
130 | + {{#if payUrl}} | ||
131 | + <a href="{{payUrl}}"> | ||
132 | + <span class="btn btn-pay">立即付款</span> | ||
133 | + </a> | ||
134 | + {{/if}} | ||
122 | {{/if}} | 135 | {{/if}} |
123 | 136 | ||
124 | {{#if logisticsUrl}} | 137 | {{#if logisticsUrl}} |
125 | - <a href="{{logisticsUrl}}"> | ||
126 | - <span class="btn btn-check-logistics">查看物流</span> | ||
127 | - </a> | 138 | + <a href="{{logisticsUrl}}"> |
139 | + <span class="btn btn-check-logistics">查看物流</span> | ||
140 | + </a> | ||
141 | + {{/if}} | ||
142 | + | ||
143 | + {{#if qrcode}} | ||
144 | + <a href="{{qrcode}}"> | ||
145 | + <span class="btn btn-check-logistics">查看二维码</span> | ||
146 | + </a> | ||
128 | {{/if}} | 147 | {{/if}} |
129 | </div> | 148 | </div> |
130 | </div> | 149 | </div> |
@@ -5,9 +5,9 @@ | @@ -5,9 +5,9 @@ | ||
5 | {{/if}} | 5 | {{/if}} |
6 | <div class="payapp-list"> | 6 | <div class="payapp-list"> |
7 | {{# payAppInfo}} | 7 | {{# payAppInfo}} |
8 | - {{#if payLink}} | ||
9 | - <a href="{{payLink}}"> | ||
10 | - {{/if}} | 8 | + {{#if payLink}} |
9 | + <a href="{{payLink}}"> | ||
10 | + {{/if}} | ||
11 | <div class="box" id="{{appId}}"> | 11 | <div class="box" id="{{appId}}"> |
12 | <div class="icon"> | 12 | <div class="icon"> |
13 | {{#if appIcon}} | 13 | {{#if appIcon}} |
@@ -26,9 +26,9 @@ | @@ -26,9 +26,9 @@ | ||
26 | </div> | 26 | </div> |
27 | <div class="iconfont"></div> | 27 | <div class="iconfont"></div> |
28 | </div> | 28 | </div> |
29 | - {{#if payLink}} | ||
30 | - </a> | ||
31 | - {{/if}} | 29 | + {{#if payLink}} |
30 | + </a> | ||
31 | + {{/if}} | ||
32 | {{/ payAppInfo}} | 32 | {{/ payAppInfo}} |
33 | </div> | 33 | </div> |
34 | <div class="loading-toast hide"></div> | 34 | <div class="loading-toast hide"></div> |
@@ -136,7 +136,7 @@ | @@ -136,7 +136,7 @@ | ||
136 | 136 | ||
137 | {{#if addToCartUrl}} | 137 | {{#if addToCartUrl}} |
138 | <!-- <a id="addtoCart" href="{{addToCartUrl}}" class="addto-cart">加入购物车</a> --> | 138 | <!-- <a id="addtoCart" href="{{addToCartUrl}}" class="addto-cart">加入购物车</a> --> |
139 | - <a id="addtoCart" href="javascript:;" class="addto-cart">加入购物车</a> | 139 | + <a id="addtoCart" href="javascript:;" class="addto-cart">{{#if ../tickets}}立即购买{{else}}加入购物车{{/if}}</a> |
140 | {{/if}} | 140 | {{/if}} |
141 | 141 | ||
142 | {{#if soldOut}} | 142 | {{#if soldOut}} |
@@ -183,5 +183,16 @@ | @@ -183,5 +183,16 @@ | ||
183 | <input type="hidden" name="loginUrl" id="loginUrl" value="{{.}}"> | 183 | <input type="hidden" name="loginUrl" id="loginUrl" value="{{.}}"> |
184 | {{/loginUrl}} | 184 | {{/loginUrl}} |
185 | 185 | ||
186 | + {{#if tickets}} | ||
187 | + <form id="buyNowForm" method="post" action="{{ticketsConfirm}}"> | ||
188 | + <input type="hidden" name="productSku" id="productSku"> | ||
189 | + <input type="hidden" name="buyNumber" id="buyNumber"> | ||
190 | + </form> | ||
191 | + {{/if}} | ||
192 | + | ||
193 | + {{#if showPannel}} | ||
194 | + <input type="hidden" id="showPannel" value="1"> | ||
195 | + {{/if}} | ||
196 | + | ||
186 | </div> | 197 | </div> |
187 | {{> layout/footer}} | 198 | {{> layout/footer}} |
1 | {{#cartInfo}} | 1 | {{#cartInfo}} |
2 | <div class="chose-panel"> | 2 | <div class="chose-panel"> |
3 | <div class="main"> | 3 | <div class="main"> |
4 | - <div class="infos"> | 4 | + <div class="infos {{#if ../tickets}}tickets-info{{/if}}"> |
5 | <div class="basic-info" > | 5 | <div class="basic-info" > |
6 | {{#thumbs}} | 6 | {{#thumbs}} |
7 | <img class="thumb {{#unless @first}}hide{{/if}}" src={{img}}> | 7 | <img class="thumb {{#unless @first}}hide{{/if}}" src={{img}}> |
@@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
18 | </div> | 18 | </div> |
19 | <div class="chose-items"> | 19 | <div class="chose-items"> |
20 | <div class="color-list block-list"> | 20 | <div class="color-list block-list"> |
21 | - <span>颜色</span> | 21 | + <span>{{colorName}}</span> |
22 | {{# colors}} | 22 | {{# colors}} |
23 | <ul id="{{id}}" data-index="{{@index}}" class="size-row clearfix {{#unless @first}}hide{{/if}}"> | 23 | <ul id="{{id}}" data-index="{{@index}}" class="size-row clearfix {{#unless @first}}hide{{/if}}"> |
24 | {{# color}} | 24 | {{# color}} |
@@ -29,8 +29,8 @@ | @@ -29,8 +29,8 @@ | ||
29 | </ul> | 29 | </ul> |
30 | {{/ colors}} | 30 | {{/ colors}} |
31 | </div> | 31 | </div> |
32 | - <div class="size-list block-list"> | ||
33 | - <span>尺码</span> | 32 | + <div class="size-list block-list {{#if ../single}}hide{{/if}}"> |
33 | + <span>{{sizeName}}</span> | ||
34 | {{# sizes}} | 34 | {{# sizes}} |
35 | <ul class="size-row clearfix {{#unless @first}}hide{{/if}}"> | 35 | <ul class="size-row clearfix {{#unless @first}}hide{{/if}}"> |
36 | {{# size}} | 36 | {{# size}} |
@@ -55,13 +55,15 @@ | @@ -55,13 +55,15 @@ | ||
55 | </div> | 55 | </div> |
56 | <span class="left-num"></span> | 56 | <span class="left-num"></span> |
57 | <input id="left-num" type="hidden" value="0"> | 57 | <input id="left-num" type="hidden" value="0"> |
58 | + <input id="limitNum" type="hidden" value="{{limit}}"> | ||
58 | </div> | 59 | </div> |
59 | </div> | 60 | </div> |
60 | </div> | 61 | </div> |
61 | <div class="btn-wrap"> | 62 | <div class="btn-wrap"> |
62 | - <button id="chose-btn-sure" class="btn btn-sure">加入购物车</button> | 63 | + <button id="chose-btn-sure" class="btn btn-sure">{{#if ../tickets}}立即购买{{else}}加入购物车{{/if}}</button> |
63 | </div> | 64 | </div> |
64 | </div> | 65 | </div> |
65 | </div> | 66 | </div> |
66 | {{/cartInfo}} | 67 | {{/cartInfo}} |
67 | -<input id="promotionId" type="hidden" value="{{promotionId}}"> | ||
68 | +<input id="promotionId" type="hidden" value="{{promotionId}}"> | ||
69 | +<input id="single" type="hidden" value="{{single}}"> |
@@ -12,13 +12,13 @@ | @@ -12,13 +12,13 @@ | ||
12 | <p class="row"> | 12 | <p class="row"> |
13 | {{#if color}} | 13 | {{#if color}} |
14 | <span class="color"> | 14 | <span class="color"> |
15 | - 颜色:{{color}} | 15 | + {{#if tickets}}日期{{else}}颜色{{/if}}:{{color}} |
16 | </span> | 16 | </span> |
17 | {{/if}} | 17 | {{/if}} |
18 | 18 | ||
19 | {{#if size}} | 19 | {{#if size}} |
20 | <span class="size"> | 20 | <span class="size"> |
21 | - 尺码:{{size}} | 21 | + {{#if tickets}}区域{{else}}尺码{{/if}}:{{size}} |
22 | </span> | 22 | </span> |
23 | {{/if}} | 23 | {{/if}} |
24 | </p> | 24 | </p> |
@@ -17,12 +17,22 @@ | @@ -17,12 +17,22 @@ | ||
17 | 17 | ||
18 | {{!-- 完成和取消订单显示删除按钮 --}} | 18 | {{!-- 完成和取消订单显示删除按钮 --}} |
19 | {{#unless unpaid}} | 19 | {{#unless unpaid}} |
20 | - {{#unless unreceived}} | ||
21 | - <div class="order-opt"> | ||
22 | - <span class="btn del">删除订单</span> | ||
23 | - <span class="btn rebuy">再次购买</span> | ||
24 | - </div> | ||
25 | - {{/unless}} | 20 | + <div class="order-opt"> |
21 | + {{#unless unreceived}} | ||
22 | + <span class="btn del">删除订单</span> | ||
23 | + {{#if isVirtual}} | ||
24 | + <!--虚拟商品--> | ||
25 | + {{else}} | ||
26 | + <span class="btn rebuy">再次购买</span> | ||
27 | + {{/if}} | ||
28 | + {{/unless}} | ||
29 | + | ||
30 | + {{#if qrcode}} | ||
31 | + <a class="locHref" href="{{qrcode}}"> | ||
32 | + <span class="btn check-logistics">查看二维码</span> | ||
33 | + </a> | ||
34 | + {{/if}} | ||
35 | + </div> | ||
26 | {{/unless}} | 36 | {{/unless}} |
27 | 37 | ||
28 | {{#if unpaid}} | 38 | {{#if unpaid}} |
@@ -53,5 +63,6 @@ | @@ -53,5 +63,6 @@ | ||
53 | </a> | 63 | </a> |
54 | </div> | 64 | </div> |
55 | {{/if}} | 65 | {{/if}} |
66 | + | ||
56 | {{/if}} | 67 | {{/if}} |
57 | </div> | 68 | </div> |
1 | {{#goodsDescription}} | 1 | {{#goodsDescription}} |
2 | <div class="goods-desc page-block"> | 2 | <div class="goods-desc page-block"> |
3 | + | ||
4 | + {{#unless hideService}} | ||
3 | <div class="service"></div> | 5 | <div class="service"></div> |
6 | + {{/unless}} | ||
7 | + | ||
4 | <h1 class="title"> | 8 | <h1 class="title"> |
5 | {{title}} | 9 | {{title}} |
6 | <span class="en-title">{{enTitle}}</span> | 10 | <span class="en-title">{{enTitle}}</span> |
@@ -72,7 +72,7 @@ class Bootstrap extends Bootstrap_Abstract | @@ -72,7 +72,7 @@ class Bootstrap extends Bootstrap_Abstract | ||
72 | $controller = 'Index'; | 72 | $controller = 'Index'; |
73 | $action = 'Index'; | 73 | $action = 'Index'; |
74 | // 三级域名 | 74 | // 三级域名 |
75 | - if (3 === $level) { | 75 | + if (4 === $level) { |
76 | $subDomain = strval($hostParts[0]); | 76 | $subDomain = strval($hostParts[0]); |
77 | switch (strtolower($subDomain)) { | 77 | switch (strtolower($subDomain)) { |
78 | case 'm': // 老版(到频道选择) | 78 | case 'm': // 老版(到频道选择) |
@@ -987,7 +987,6 @@ class HomeController extends AbstractAction | @@ -987,7 +987,6 @@ class HomeController extends AbstractAction | ||
987 | $tools = new JsApiPay(); | 987 | $tools = new JsApiPay(); |
988 | $openId = $tools->GetOpenid(); | 988 | $openId = $tools->GetOpenid(); |
989 | if ($openId) { | 989 | if ($openId) { |
990 | - $this->setSession('weixinOpenId', $openId); | ||
991 | $this->setSession('weixinOpenId' . $orderCode, $openId); | 990 | $this->setSession('weixinOpenId' . $orderCode, $openId); |
992 | } | 991 | } |
993 | } | 992 | } |
@@ -1051,7 +1050,7 @@ class HomeController extends AbstractAction | @@ -1051,7 +1050,7 @@ class HomeController extends AbstractAction | ||
1051 | } | 1050 | } |
1052 | 1051 | ||
1053 | $totalFee = strval($orderDetail['data']['payment_amount'] * 100); | 1052 | $totalFee = strval($orderDetail['data']['payment_amount'] * 100); |
1054 | - $openId = $this->getSession('weixinOpenId'); | 1053 | + $openId = $this->getSession('weixinOpenId' . $orderCode); |
1055 | if (empty($openId)) { | 1054 | if (empty($openId)) { |
1056 | UdpLog::info('【微信支付下单】Session中的weixinOpenId校验','weixinOpenId为空'); | 1055 | UdpLog::info('【微信支付下单】Session中的weixinOpenId校验','weixinOpenId为空'); |
1057 | break; | 1056 | break; |
@@ -1112,6 +1111,11 @@ class HomeController extends AbstractAction | @@ -1112,6 +1111,11 @@ class HomeController extends AbstractAction | ||
1112 | $this->setTitle('订单详情'); | 1111 | $this->setTitle('订单详情'); |
1113 | $this->setNavHeader('订单详情', true, false); | 1112 | $this->setNavHeader('订单详情', true, false); |
1114 | 1113 | ||
1114 | + $openId = $this->get('openId', ''); | ||
1115 | + if (!empty($openId)) { | ||
1116 | + //微信支付成功,发送支付确认接口 | ||
1117 | + OrderData::payConfirm($orderCode, 22, $this->_uid); | ||
1118 | + } | ||
1115 | 1119 | ||
1116 | $this->_view->display('order-detail', array( | 1120 | $this->_view->display('order-detail', array( |
1117 | 'orderDetailPage' => true, | 1121 | 'orderDetailPage' => true, |
@@ -66,6 +66,7 @@ class OrderModel | @@ -66,6 +66,7 @@ class OrderModel | ||
66 | $result = array(); | 66 | $result = array(); |
67 | //调用接口获得数据 | 67 | //调用接口获得数据 |
68 | $data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, $uid); | 68 | $data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, $uid); |
69 | + | ||
69 | // 判断是否还有数据, 没有数据则返回空 | 70 | // 判断是否还有数据, 没有数据则返回空 |
70 | if (isset($data['data']['page_total']) && $page > $data['data']['page_total']) { | 71 | if (isset($data['data']['page_total']) && $page > $data['data']['page_total']) { |
71 | return $result; | 72 | return $result; |
@@ -87,7 +88,12 @@ class OrderModel | @@ -87,7 +88,12 @@ class OrderModel | ||
87 | $result[$key]['shippingCost'] = $vo['shipping_cost']; | 88 | $result[$key]['shippingCost'] = $vo['shipping_cost']; |
88 | } | 89 | } |
89 | //类内调用格式化订单商品数据方法 | 90 | //类内调用格式化订单商品数据方法 |
90 | - $result[$key]['goods'] = Helpers::formatOrderGoods($vo['order_goods'], $count); | 91 | + $tickets = false; |
92 | + if (isset($vo['virtual_type']) && $vo['virtual_type'] * 1 == 3) { | ||
93 | + $tickets = true; | ||
94 | + $result[$key]['isVirtual'] = true;//虚拟商品 | ||
95 | + } | ||
96 | + $result[$key]['goods'] = Helpers::formatOrderGoods($vo['order_goods'], $count, false, $tickets); | ||
91 | $result[$key]['detailUrl'] = Helpers::url('/home/orderdetail', array('order_code' => $vo['order_code'])); | 97 | $result[$key]['detailUrl'] = Helpers::url('/home/orderdetail', array('order_code' => $vo['order_code'])); |
92 | $result[$key]['count'] = $count; | 98 | $result[$key]['count'] = $count; |
93 | //倒计时时间 | 99 | //倒计时时间 |
@@ -202,7 +208,15 @@ class OrderModel | @@ -202,7 +208,15 @@ class OrderModel | ||
202 | $orderDetail = OrderData::viewOrderData($orderCode, $uid, $sessionKey); | 208 | $orderDetail = OrderData::viewOrderData($orderCode, $uid, $sessionKey); |
203 | if (isset($orderDetail['data']['order_code'])) { | 209 | if (isset($orderDetail['data']['order_code'])) { |
204 | $count = 0; | 210 | $count = 0; |
211 | + $orderDetail['data']['virtual_type'] = empty($orderDetail['data']['virtual_type']) ? '' : $orderDetail['data']['virtual_type'] * 1; | ||
205 | $result = self::getOrderStatus($orderDetail['data'], true); // 订单状态 | 212 | $result = self::getOrderStatus($orderDetail['data'], true); // 订单状态 |
213 | + //门票 | ||
214 | + | ||
215 | + if (isset($orderDetail['data']['virtual_type']) && $orderDetail['data']['virtual_type'] == 3) { | ||
216 | + //手机号 | ||
217 | + $result['isVirtual'] = true; | ||
218 | + $result['mobile'] = isset($orderDetail['data']['mobile']) ? $orderDetail['data']['mobile'] : ''; | ||
219 | + } | ||
206 | $result['name'] = $orderDetail['data']['user_name']; | 220 | $result['name'] = $orderDetail['data']['user_name']; |
207 | $result['phoneNum'] = $orderDetail['data']['mobile']; | 221 | $result['phoneNum'] = $orderDetail['data']['mobile']; |
208 | $result['address'] = $orderDetail['data']['area'] . $orderDetail['data']['address']; | 222 | $result['address'] = $orderDetail['data']['area'] . $orderDetail['data']['address']; |
@@ -213,7 +227,7 @@ class OrderModel | @@ -213,7 +227,7 @@ class OrderModel | ||
213 | if (isset($orderDetail['data']['counter_flag']) && $orderDetail['data']['counter_flag'] == 'Y') { | 227 | if (isset($orderDetail['data']['counter_flag']) && $orderDetail['data']['counter_flag'] == 'Y') { |
214 | $result['leftTime'] = $orderDetail['data']['pay_lefttime']*1000; | 228 | $result['leftTime'] = $orderDetail['data']['pay_lefttime']*1000; |
215 | } | 229 | } |
216 | - $result['goods'] = Helpers::formatOrderGoods($orderDetail['data']['order_goods'], $count, true); | 230 | + $result['goods'] = Helpers::formatOrderGoods($orderDetail['data']['order_goods'], $count, true, true); |
217 | if (isset($orderDetail['data']['promo_code_amount'])) { | 231 | if (isset($orderDetail['data']['promo_code_amount'])) { |
218 | $result['promo_code_amount'] = self::filterOrderPrice($orderDetail['data']['promo_code_amount']); // 优惠码 | 232 | $result['promo_code_amount'] = self::filterOrderPrice($orderDetail['data']['promo_code_amount']); // 优惠码 |
219 | } | 233 | } |
@@ -310,6 +324,9 @@ class OrderModel | @@ -310,6 +324,9 @@ class OrderModel | ||
310 | break; | 324 | break; |
311 | } | 325 | } |
312 | 326 | ||
327 | + //转数字 | ||
328 | + $order['virtual_type'] = empty($order['virtual_type']) ? '' : $order['virtual_type'] * 1; | ||
329 | + | ||
313 | // 先判断订单付款方式,根据不同的付款方式计算订单状态。(注:货到付款没有待付款状态) | 330 | // 先判断订单付款方式,根据不同的付款方式计算订单状态。(注:货到付款没有待付款状态) |
314 | // 支付方式为非货到付款时,计算订单状态。 | 331 | // 支付方式为非货到付款时,计算订单状态。 |
315 | if ($order['payment_type'] != 2) { | 332 | if ($order['payment_type'] != 2) { |
@@ -327,14 +344,29 @@ class OrderModel | @@ -327,14 +344,29 @@ class OrderModel | ||
327 | break; | 344 | break; |
328 | case 4: | 345 | case 4: |
329 | case 5: | 346 | case 5: |
330 | - //已发货状态,给查看物流URL | 347 | + //已发货状态,给查看物流或二维码URL |
331 | $result['unreceived'] = true; | 348 | $result['unreceived'] = true; |
332 | - self::assignExpressInfo($showLogistics, $order, $result); | 349 | + //门票 |
350 | + if (isset($order['virtual_type']) && $order['virtual_type'] === 3) { | ||
351 | + $result['qrcode'] = Helpers::url('/home/QRcode/'.$order['order_code']); | ||
352 | + } | ||
353 | + //非门票 | ||
354 | + else { | ||
355 | + self::assignExpressInfo($showLogistics, $order, $result); | ||
356 | + } | ||
333 | break; | 357 | break; |
358 | + | ||
334 | case 6: | 359 | case 6: |
335 | $result['completed'] = true; | 360 | $result['completed'] = true; |
336 | - // 已成功订单,给查看物流URL | ||
337 | - self::assignExpressInfo($showLogistics, $order, $result); | 361 | + // 已成功订单,给查看物流或二维码URL |
362 | + //门票 | ||
363 | + if (isset($order['virtual_type']) && $order['virtual_type'] === 3) { | ||
364 | + $result['qrcode'] = Helpers::url('/home/QRcode/'.$order['order_code']); | ||
365 | + } | ||
366 | + //非门票 | ||
367 | + else { | ||
368 | + self::assignExpressInfo($showLogistics, $order, $result); | ||
369 | + } | ||
338 | break; | 370 | break; |
339 | default: | 371 | default: |
340 | break; | 372 | break; |
@@ -7,6 +7,7 @@ use LibModels\Wap\Home\OrderData; | @@ -7,6 +7,7 @@ use LibModels\Wap\Home\OrderData; | ||
7 | use Plugin\Helpers; | 7 | use Plugin\Helpers; |
8 | use Plugin\Images; | 8 | use Plugin\Images; |
9 | use Plugin\UdpLog; | 9 | use Plugin\UdpLog; |
10 | +use Configs\TicketsConfig; | ||
10 | use Plugin\Encryption; | 11 | use Plugin\Encryption; |
11 | 12 | ||
12 | 13 | ||
@@ -1104,4 +1105,63 @@ class CartModel | @@ -1104,4 +1105,63 @@ class CartModel | ||
1104 | return $result; | 1105 | return $result; |
1105 | } | 1106 | } |
1106 | 1107 | ||
1108 | + /** | ||
1109 | + * 获取门票数据 | ||
1110 | + * @param int $uid | ||
1111 | + * @param int $productSku | ||
1112 | + * @param int $buyNumber | ||
1113 | + * @param int $useYohoCoin | ||
1114 | + * @return arr | ||
1115 | + */ | ||
1116 | + public static function getTickets($uid, $productSku, $buyNumber, $useYohoCoin = 0) | ||
1117 | + { | ||
1118 | + $result = array(); | ||
1119 | + | ||
1120 | + $data = CartData::checkTickets($uid, $productSku, $buyNumber, $useYohoCoin); | ||
1121 | + if (!isset($data['code']) || $data['code'] !== 200) { | ||
1122 | + return $result; | ||
1123 | + } | ||
1124 | + | ||
1125 | + //商品数据 | ||
1126 | + //门票skn | ||
1127 | + $ticketsSkn = array('single' => TicketsConfig::SINGLE_TICKETS_SKN,'package' => TicketsConfig::PACKAGE_TICKETS_SKN); | ||
1128 | + $goodsPrice = 0; | ||
1129 | + foreach ($data['data']['goods_list'] as $key => $single) { | ||
1130 | + $oneGoods = array(); | ||
1131 | + $oneGoods['tickets'] = true; | ||
1132 | + $oneGoods['id'] = $single['product_sku']; | ||
1133 | + $oneGoods['thumb'] = Images::getImageUrl($single['goods_images'], 120, 160); | ||
1134 | + $oneGoods['name'] = $single['product_name']; | ||
1135 | + $oneGoods['color'] = $single['color_name']; | ||
1136 | + $oneGoods['size'] = $single['product_skn'] == $ticketsSkn['single'] ? '' : $single['size_name']; | ||
1137 | + $oneGoods['count'] = $single['buy_number']; | ||
1138 | + $oneGoods['price'] = Helpers::transPrice($single['last_price']); | ||
1139 | + // 累加商品金额 | ||
1140 | + $goodsPrice += $oneGoods['count'] * $oneGoods['price']; | ||
1141 | + $result['goods'][] = $oneGoods; | ||
1142 | + } | ||
1143 | + | ||
1144 | + $result['cartPayData'] = $data['data']['shopping_cart_data']['promotion_formula_list']; | ||
1145 | + $price = $data['data']['shopping_cart_data']['last_order_amount']; | ||
1146 | + $result['price'] = Helpers::transPrice($price, true); | ||
1147 | + // 有货币 | ||
1148 | + $result['yohoCoin'] = Helpers::transPrice($data['data']['yoho_coin']); | ||
1149 | + $result['useYohoCoin'] = isset($data['data']['shopping_cart_data']['use_yoho_coin']) ? $data['data']['shopping_cart_data']['use_yoho_coin'] : false; | ||
1150 | + return $result; | ||
1151 | + } | ||
1152 | + | ||
1153 | + public static function ticketsOrderCompute($uid, $productSku, $buyNumber, $yohoCoin) | ||
1154 | + { | ||
1155 | + $result = array(); | ||
1156 | + | ||
1157 | + $compute = CartData::checkTickets($uid, $productSku, $buyNumber, $yohoCoin); | ||
1158 | + if ($compute && isset($compute['code']) && $compute['code'] === 200) { | ||
1159 | + // 有货币添加.00后缀 | ||
1160 | + $compute['data']['shopping_cart_data']['use_yoho_coin'] = Helpers::transPrice($compute['data']['shopping_cart_data']['use_yoho_coin']); | ||
1161 | + $result = $compute['data']['shopping_cart_data']; | ||
1162 | + } | ||
1163 | + return $result; | ||
1164 | + } | ||
1165 | + | ||
1166 | + | ||
1107 | } | 1167 | } |
@@ -40,7 +40,7 @@ class UserModel | @@ -40,7 +40,7 @@ class UserModel | ||
40 | if (isset($userData['data']) && !empty($userData['data'])) { | 40 | if (isset($userData['data']) && !empty($userData['data'])) { |
41 | $result = $userData['data']; | 41 | $result = $userData['data']; |
42 | $result['gender'] = $result['gender'] == 1 ? '男' : '女'; | 42 | $result['gender'] = $result['gender'] == 1 ? '男' : '女'; |
43 | - $result['head_ico'] = Images::getImageUrl($result['head_ico'], 128, 128); | 43 | + $result['head_ico'] = isset($result['head_ico']) && !empty($result['head_ico']) ? Images::getImageUrl($result['head_ico'], 128, 128) : ''; |
44 | } | 44 | } |
45 | 45 | ||
46 | return $result; | 46 | return $result; |
@@ -3,8 +3,8 @@ | @@ -3,8 +3,8 @@ | ||
3 | namespace Product; | 3 | namespace Product; |
4 | 4 | ||
5 | use LibModels\Wap\Product\DetailData; | 5 | use LibModels\Wap\Product\DetailData; |
6 | -use Plugin\DataProcess\CouponFloorProcess; | ||
7 | use Plugin\Helpers; | 6 | use Plugin\Helpers; |
7 | +use Configs\TicketsConfig; | ||
8 | 8 | ||
9 | /** | 9 | /** |
10 | * 商品详情页模板相关的数据模型 | 10 | * 商品详情页模板相关的数据模型 |
@@ -365,6 +365,33 @@ class DetailModel | @@ -365,6 +365,33 @@ class DetailModel | ||
365 | $result['introUrl'] = Helpers::url('/product/intro_' . $baseInfo['erpProductId'] . '/' . $baseInfo['cnAlphabet'] . '.html', null, ''); | 365 | $result['introUrl'] = Helpers::url('/product/intro_' . $baseInfo['erpProductId'] . '/' . $baseInfo['cnAlphabet'] . '.html', null, ''); |
366 | $result['id'] = $productId; | 366 | $result['id'] = $productId; |
367 | 367 | ||
368 | + //虚拟商品(门票) | ||
369 | + $ticketsSkn = array('single' => TicketsConfig::SINGLE_TICKETS_SKN,'package' => TicketsConfig::PACKAGE_TICKETS_SKN); | ||
370 | + if ($baseInfo['attribute'] == 3 && in_array($baseInfo['productPriceBo']['productSkn'], $ticketsSkn)) { | ||
371 | + $result['tickets'] = true; | ||
372 | + $result['ticketsConfirm'] = Helpers::url('/cart/index/ticketsConfirm'); | ||
373 | + $result['cartInfo']['colorName'] = $result['tickets'] ? '日期' : '颜色'; | ||
374 | + $result['cartInfo']['sizeName'] = $result['tickets'] ? '区域' : '尺码'; | ||
375 | + //展览票 | ||
376 | + if ($baseInfo['productPriceBo']['productSkn'] == $ticketsSkn['single']) { | ||
377 | + $result['single'] = true; | ||
378 | + } | ||
379 | + //套票 | ||
380 | + else { | ||
381 | + $result['package'] = true; | ||
382 | + } | ||
383 | + //购票限制 | ||
384 | + $result['cartInfo']['limit'] = '4'; | ||
385 | + | ||
386 | + //清空活动 | ||
387 | + unset($result['goodsDiscount']); | ||
388 | + | ||
389 | + // 来自登录页,自动弹出选择框 | ||
390 | + if (isset($_GET['product_type']) && $_GET['product_type'] == 'ticket') { | ||
391 | + $result['showPannel'] = true; | ||
392 | + } | ||
393 | + } | ||
394 | + | ||
368 | // 清空变量,释放内存 | 395 | // 清空变量,释放内存 |
369 | $baseInfo = array(); | 396 | $baseInfo = array(); |
370 | $goodsGroup = array(); | 397 | $goodsGroup = array(); |
@@ -7,6 +7,7 @@ use Index\UserModel; | @@ -7,6 +7,7 @@ use Index\UserModel; | ||
7 | use Plugin\Helpers; | 7 | use Plugin\Helpers; |
8 | use Plugin\UnionTrans; | 8 | use Plugin\UnionTrans; |
9 | use Home\OrderModel; | 9 | use Home\OrderModel; |
10 | +use LibModels\Wap\Home\CartData; | ||
10 | use Plugin\UdpLog; | 11 | use Plugin\UdpLog; |
11 | use LibModels\Wap\Home\UserData; | 12 | use LibModels\Wap\Home\UserData; |
12 | use Plugin\Encryption; | 13 | use Plugin\Encryption; |
@@ -495,9 +496,19 @@ class IndexController extends AbstractAction | @@ -495,9 +496,19 @@ class IndexController extends AbstractAction | ||
495 | $paymentType = $this->post('paymentTypeId', 1); | 496 | $paymentType = $this->post('paymentTypeId', 1); |
496 | $couponCode = $this->post('couponCode', null); | 497 | $couponCode = $this->post('couponCode', null); |
497 | $yohoCoin = $this->post('yohoCoin', null); | 498 | $yohoCoin = $this->post('yohoCoin', null); |
499 | + $productSku = $this->post('productSku', null); | ||
500 | + $buyNumber = $this->post('buyNumber', null); | ||
498 | $uid = $this->getUid(true); | 501 | $uid = $this->getUid(true); |
499 | $skuList = $this->post('skuList', ''); | 502 | $skuList = $this->post('skuList', ''); |
500 | - $result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin, $skuList); | 503 | + $type = $this->post('type', null); |
504 | + //type : tickets 门票 | ||
505 | + if ($type !== 'tickets' ) { | ||
506 | + $result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin, $skuList); | ||
507 | + } | ||
508 | + //非门票 | ||
509 | + else { | ||
510 | + $result = CartModel::ticketsOrderCompute($uid, $productSku, $buyNumber, $yohoCoin); | ||
511 | + } | ||
501 | } | 512 | } |
502 | 513 | ||
503 | $this->echoJson($result); | 514 | $this->echoJson($result); |
@@ -717,4 +728,74 @@ class IndexController extends AbstractAction | @@ -717,4 +728,74 @@ class IndexController extends AbstractAction | ||
717 | $this->_view->display('jit-detail', $data); | 728 | $this->_view->display('jit-detail', $data); |
718 | } | 729 | } |
719 | 730 | ||
731 | + /** | ||
732 | + * 校验电子票 | ||
733 | + * | ||
734 | + */ | ||
735 | + public function checkTicketsAction() | ||
736 | + { | ||
737 | + if (!$this->isAjax()) { | ||
738 | + exit; | ||
739 | + } | ||
740 | + $data = array(); | ||
741 | + $uid = $this->getUid(); | ||
742 | + do { | ||
743 | + //判断用户登陆 | ||
744 | + if (!$uid) { | ||
745 | + $data = array( | ||
746 | + 'code' => 401, | ||
747 | + ); | ||
748 | + break; | ||
749 | + } | ||
750 | + $productSku = $this->post('productSku'); | ||
751 | + $buyNumber = $this->post('buyNumber'); | ||
752 | + $useYohoCoin = $this->post('useYohoCoin', 0); | ||
753 | + $data = CartData::checkTickets($uid, $productSku, $buyNumber, $useYohoCoin); | ||
754 | + } while(false); | ||
755 | + $this->echoJson($data); | ||
756 | + } | ||
757 | + | ||
758 | + //电子票确认 | ||
759 | + public function ticketsConfirmAction() | ||
760 | + { | ||
761 | + // 审判跳转登录页 | ||
762 | + $this->auditJumpLogin(); | ||
763 | + $uid = $this->getUid(); | ||
764 | + $productSku = $this->post('productSku'); | ||
765 | + $buyNumber = $this->post('buyNumber'); | ||
766 | + if (empty($productSku) || empty($buyNumber)) { | ||
767 | + $this->error(); | ||
768 | + } | ||
769 | + $tickets = CartModel::getTickets($uid, $productSku, $buyNumber); | ||
770 | + $this->setTitle('确认订单'); | ||
771 | + $this->setNavHeader('确认订单', true, false); // 不显示右上角home按钮 | ||
772 | + | ||
773 | + $tickets['orderEnsurePage'] = true; | ||
774 | + $tickets['productSku'] = $productSku; | ||
775 | + $tickets['buyNumber'] = $buyNumber; | ||
776 | + $this->_view->display('tickets-confirm', $tickets); | ||
777 | + } | ||
778 | + | ||
779 | + //电子票下单 | ||
780 | + public function submitTicketAction() | ||
781 | + { | ||
782 | + $result = array(); | ||
783 | + do { | ||
784 | + $uid = $this->getUid(); | ||
785 | + $productSku = $this->post('productSku'); | ||
786 | + $buyNumber = $this->post('buyNumber'); | ||
787 | + $mobile = $this->post('mobile'); | ||
788 | + $useYohoCoin = $this->post('useYohoCoin'); | ||
789 | + if (empty($uid) || empty($productSku) || empty($buyNumber) || empty($mobile)) { | ||
790 | + break; | ||
791 | + } | ||
792 | + //联盟参数 TODO | ||
793 | + $data = CartData::submitTicket($uid, $productSku, $buyNumber, $mobile, $useYohoCoin); | ||
794 | + if (isset($data['code'])) { | ||
795 | + $result = $data; | ||
796 | + } | ||
797 | + } while(false); | ||
798 | + $this->echoJson($result); | ||
799 | + } | ||
800 | + | ||
720 | } | 801 | } |
@@ -51,7 +51,7 @@ class DetailController extends AbstractAction | @@ -51,7 +51,7 @@ class DetailController extends AbstractAction | ||
51 | if (!$this->isApp()){ | 51 | if (!$this->isApp()){ |
52 | $this->setNavHeader('商品详情'); | 52 | $this->setNavHeader('商品详情'); |
53 | } | 53 | } |
54 | - // 渲染模板 | 54 | + // 渲染模板 TODO |
55 | $this->_view->display('index', $data); | 55 | $this->_view->display('index', $data); |
56 | } | 56 | } |
57 | 57 |
@@ -121,9 +121,10 @@ class PayController extends AbstractAction | @@ -121,9 +121,10 @@ class PayController extends AbstractAction | ||
121 | } | 121 | } |
122 | 122 | ||
123 | $totalFee = strval($orderDetail['data']['payment_amount'] * 100); | 123 | $totalFee = strval($orderDetail['data']['payment_amount'] * 100); |
124 | - $openId = $this->getSession('weixinOpenId'); | 124 | + $openId = $this->getSession('weixinOpenId' . $orderCode); |
125 | + | ||
125 | if (empty($openId)) { | 126 | if (empty($openId)) { |
126 | - UdpLog::info('【wechat支付】获取wechat标识为空', 'orderCode:'.$orderCode.'uid:'.$uid.'返回openId:'.$openId); | 127 | + UdpLog::info('【wechat支付】获取wechat标识为空', array('orderCode' => $orderCode, 'uid' => $uid, 'openId' => $openId)); |
127 | break; | 128 | break; |
128 | } | 129 | } |
129 | 130 |
@@ -11,7 +11,8 @@ define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录 | @@ -11,7 +11,8 @@ define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录 | ||
11 | define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录 | 11 | define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录 |
12 | defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'developer'); | 12 | defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'developer'); |
13 | 13 | ||
14 | -define('API_URL', 'http://testapi.yoho.cn:28078/'); | 14 | +//define('API_URL', 'http://testapi.yoho.cn:28078/'); |
15 | +define('API_URL', 'http://devapi.yoho.cn:58078'); | ||
15 | define('SERVICE_URL', 'http://testservice.yoho.cn:28077/'); | 16 | define('SERVICE_URL', 'http://testservice.yoho.cn:28077/'); |
16 | define('YOHOBUY_URL', 'http://www.yohobuy.com/'); | 17 | define('YOHOBUY_URL', 'http://www.yohobuy.com/'); |
17 | define('SERVICE_NOTIFY', 'http://testservice.yoho.cn:28077/'); | 18 | define('SERVICE_NOTIFY', 'http://testservice.yoho.cn:28077/'); |
-
Please register or login to post a comment