Authored by 郝肖肖

电子票接口

@@ -523,4 +523,66 @@ class CartData @@ -523,4 +523,66 @@ class CartData
523 $param['client_secret'] = Sign::getSign($param); 523 $param['client_secret'] = Sign::getSign($param);
524 return Yohobuy::get(API_URL, $param); 524 return Yohobuy::get(API_URL, $param);
525 } 525 }
  526 +
  527 + /**
  528 + * 电子票添加和查询
  529 + * @param int $uid 用户ID
  530 + * @param type int $productSku 产品sku
  531 + * @param type int $buyNumber 购买数量,范围1-4
  532 + * @param type int $yohoNum yoho币
  533 + * @return type []
  534 + */
  535 + public static function addTicket($uid, $productSku, $buyNumber, $yohoNum = 0)
  536 + {
  537 + $param = Yohobuy::param();
  538 + $param['method'] = 'app.shopping.submitTicket';
  539 + $param['uid'] = intval($uid);
  540 + $param['product_sku'] = intval($productSku);
  541 + $param['buy_number'] = intval($buyNumber);
  542 + //yoho币转换成元,1yoho币等于一分钱
  543 + if (isset($yohoNum) && $yohoNum > 0) {
  544 + $param['use_yoho_coin'] = $yohoNum / 100;
  545 + }
  546 + $param['client_secret'] = Sign::getSign($param);
  547 + return Yohobuy::get(API_URL, $param);
  548 + }
  549 +
  550 + /**
  551 + * 电子票下单
  552 + * @param type int $uid 用户ID
  553 + * @param type int $productSku 产品sku
  554 + * @param type int $buyNumber 购买数量,范围1-4
  555 + * @param type string $mobile 手机号码
  556 + * @param type int $yohoNum yoho币
  557 + * @return type []
  558 + */
  559 + public static function submitTicket($uid, $productSku, $buyNumber, $mobile, $yohoNum = 0)
  560 + {
  561 + $param = Yohobuy::param();
  562 + $param['method'] = 'app.shopping.submitTicket';
  563 + $param['uid'] = intval($uid);
  564 + $param['product_sku'] = intval($productSku);
  565 + $param['buy_number'] = intval($buyNumber);
  566 + $param['mobile'] = $mobile;
  567 + //yoho币转换成元,1yoho币等于一分钱
  568 + if (isset($yohoNum) && $yohoNum > 0) {
  569 + $param['use_yoho_coin'] = $yohoNum / 100;
  570 + }
  571 + $param['client_secret'] = Sign::getSign($param);
  572 + return Yohobuy::get(API_URL, $param);
  573 + }
  574 +
  575 + /**
  576 + * 根据订单号获取电子票二维码
  577 + * @param type $orderCode
  578 + * @return type
  579 + */
  580 + public static function getQrByOrderCode($orderCode)
  581 + {
  582 + $param = Yohobuy::param();
  583 + $param['method'] = 'app.SpaceOrders.getQrByOrderCode';
  584 + $param['order_code'] = intval($orderCode);
  585 + $param['client_secret'] = Sign::getSign($param);
  586 + return Yohobuy::get(API_URL, $param);
  587 + }
526 } 588 }
@@ -152,16 +152,19 @@ @@ -152,16 +152,19 @@
152 <div class="trade-content"> 152 <div class="trade-content">
153 <div id="type-chose" class="type-chose"> 153 <div id="type-chose" class="type-chose">
154 {{#if isTicket}} 154 {{#if isTicket}}
155 - <div class="chose-color row clearfix"> 155 + <div class="chose-ticket chose-color row clearfix">
156 <span class="title pull-left">选日期:</span> 156 <span class="title pull-left">选日期:</span>
157 - <ul class="colors pull-left clearfix">  
158 - {{#each colors}}  
159 - <li class="{{#if focus}}focus{{/if}} {{#if disable}}disable{{/if}} pull-left" title="{{title}}" data-color="{{name}}" data-total="{{total}}">  
160 - <img src="{{src}}">  
161 - </li>  
162 - {{/each}}  
163 - </ul> 157 + <div class="size-wrapper pull-left">
  158 + <ul class="colors pull-left clearfix">
  159 + {{#each colors}}
  160 + <li class="{{#if focus}}focus{{/if}} {{#if disable}}disable{{/if}} pull-left" title="{{title}}" data-color="{{name}}" data-total="{{total}}">
  161 + {{name}}
  162 + </li>
  163 + {{/each}}
  164 + </ul>
  165 + </div>
164 </div> 166 </div>
  167 +
165 <div class="chose-size row clearfix"> 168 <div class="chose-size row clearfix">
166 <span class="title pull-left"> 169 <span class="title pull-left">
167 选区域: 170 选区域:
@@ -169,8 +172,9 @@ @@ -169,8 +172,9 @@
169 <div id="sizes" class="size-wrapper pull-left"> 172 <div id="sizes" class="size-wrapper pull-left">
170 {{#each colors}} 173 {{#each colors}}
171 <ul class="size{{#unless focus}} hide{{/unless}}"> 174 <ul class="size{{#unless focus}} hide{{/unless}}">
  175 + {{!-- 电子门票data-num最多可以买4张 --}}
172 {{#each size}} 176 {{#each size}}
173 - <li {{#unless num}}class="disable"{{/unless}} data-sku="{{sku}}" data-num="{{num}}" data-name="{{name}}">{{name}}</li> 177 + <li {{#unless num}}class="disable"{{/unless}} data-sku="{{sku}}" data-num="4" data-name="{{name}}">{{name}}</li>
174 {{/each}} 178 {{/each}}
175 179
176 <span class="size-warn warn-tip hide"> 180 <span class="size-warn warn-tip hide">
@@ -256,7 +256,7 @@ @@ -256,7 +256,7 @@
256 } 256 }
257 } 257 }
258 258
259 - .chose-size { 259 + .chose-size, .chose-ticket {
260 font-size: 12px; 260 font-size: 12px;
261 261
262 .title { 262 .title {
@@ -70,7 +70,7 @@ class ItemModel @@ -70,7 +70,7 @@ class ItemModel
70 } 70 }
71 71
72 //电子门票 72 //电子门票
73 - $goodsInfo['isTicket'] = TRUE; 73 + $goodsInfo['isTicket'] = $baseInfo['isTicket'] = TRUE;
74 74
75 // 商品价格 75 // 商品价格
76 if (isset($baseInfo['productPriceBo'])) { 76 if (isset($baseInfo['productPriceBo'])) {
@@ -1010,6 +1010,10 @@ class ItemModel @@ -1010,6 +1010,10 @@ class ItemModel
1010 $skuGoods = array();//sku商品 1010 $skuGoods = array();//sku商品
1011 $defaultImage = '';//默认图 1011 $defaultImage = '';//默认图
1012 $chooseSkuFlag = false;//选中sku状态 1012 $chooseSkuFlag = false;//选中sku状态
  1013 + //摸拟数据
  1014 + $dates = array('9月16 12:30','9月17 12:30','9月18 12:30','9月19 12:30','9月20 12:30','9月21 全天可用','9月13 12:30');
  1015 + $areas = array();
  1016 +
1013 if (!empty($baseInfo['goodsList'])) { 1017 if (!empty($baseInfo['goodsList'])) {
1014 $goodsGroup = array(); 1018 $goodsGroup = array();
1015 foreach ($baseInfo['goodsList'] as $pos => $value) { 1019 foreach ($baseInfo['goodsList'] as $pos => $value) {
@@ -1022,14 +1026,17 @@ class ItemModel @@ -1022,14 +1026,17 @@ class ItemModel
1022 //商品列表 1026 //商品列表
1023 $goodsGroup = array( 1027 $goodsGroup = array(
1024 'productSkc' => $value['productSkc'], 1028 'productSkc' => $value['productSkc'],
1025 - 'src' => Images::getImageUrl($value['colorImage'], 40, 40),  
1026 'title' => trim($baseInfo['productName']).' '.$value['colorName'], 1029 'title' => trim($baseInfo['productName']).' '.$value['colorName'],
1027 - 'name' => $value['colorName'], 1030 + 'name' => $dates[$pos % 7],
1028 'focus'=> false, 1031 'focus'=> false,
1029 'total' => 0, 1032 'total' => 0,
1030 'thumbs' => array(), 1033 'thumbs' => array(),
1031 'size' => array(), 1034 'size' => array(),
1032 ); 1035 );
  1036 + //不是门票的要显示图片
  1037 + if (empty($baseInfo['isTicket'])) {
  1038 + $goodsGroup['src'] = Images::getImageUrl($value['colorImage'], 40, 40);
  1039 + }
1033 1040
1034 foreach ($value['goodsImagesList'] as $goods) { 1041 foreach ($value['goodsImagesList'] as $goods) {
1035 if(!empty($goods['imageUrl'])) { 1042 if(!empty($goods['imageUrl'])) {