Authored by cailing

电子发票

@@ -353,73 +353,83 @@ class IndexController extends AbstractAction @@ -353,73 +353,83 @@ class IndexController extends AbstractAction
353 if (!$uid) { 353 if (!$uid) {
354 $this->go(Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', SITE_MAIN)))); 354 $this->go(Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', SITE_MAIN))));
355 } 355 }
  356 + $cookieData = $this->getCookie('order-info', null); //从缓存中获取电子发票信息
  357 + if (!empty($cookieData)) {
  358 + $orderInfo = json_decode($cookieData, true);
  359 + $invoiceType = $orderInfo['invoiceType']; //发票类型ID
  360 + $invoices_type = $orderInfo['invoicesType'] * 1; //发票类型 /**纸质 1 ,电子 2 */
  361 + $mobile = $orderInfo['receiverMobile']; //发票人手机
  362 + $invoices_title = $orderInfo['invoiceText']; //发票抬头
  363 + }else{
356 $userData = UserData::userData($uid); 364 $userData = UserData::userData($uid);
357 - $mobile = empty($userData['data']) || empty($userData['data']['mobile']) ? '' : $userData['data']['mobile'];  
358 - 365 + $mobile = empty($userData['data']) || empty($userData['data']['mobile']) ? '' : $userData['data']['mobile'];//发票人手机
  366 + $invoiceType = '1';//发票类型ID
  367 + $invoices_type = '1';//发票类型 /**纸质 1 ,电子 2 */
  368 + }
359 $data = array( 369 $data = array(
360 'invoiceInfoPage' => true, 370 'invoiceInfoPage' => true,
361 'invoiceNotice' => '发票须知', 371 'invoiceNotice' => '发票须知',
362 'phone' => $mobile ? substr_replace($mobile, '****', 3, 4) : '', 372 'phone' => $mobile ? substr_replace($mobile, '****', 3, 4) : '',
363 'completeTel' => $mobile, 373 'completeTel' => $mobile,
364 - 'invoiceCont' => '服装',  
365 - 'invoiceId' => '1', 374 +// 'invoiceCont' => '服装',
  375 +// 'invoiceId' => $invoices_type,
366 'isCompany' => true, 376 'isCompany' => true,
367 - 'companyName' => '南京新与力文化传媒有限公司', 377 + 'companyName' => $invoices_title,
368 'invoicesType' => array( 378 'invoicesType' => array(
369 array( 379 array(
370 'id' => '1', 380 'id' => '1',
371 'type' => '电子发票', 381 'type' => '电子发票',
372 - 'choosed' => true 382 + 'choosed' => empty($invoices_type) || $invoices_type == 1 ? true : false,
373 ), 383 ),
374 array( 384 array(
375 'id' => '2', 385 'id' => '2',
376 'type' => '纸质发票', 386 'type' => '纸质发票',
377 - 'choosed' => false 387 + 'choosed' => $invoices_type == 2 ? true : false,
378 ) 388 )
379 ), 389 ),
380 'invoiceTitle' => array( 390 'invoiceTitle' => array(
381 array( 391 array(
382 'type' => '个人', 392 'type' => '个人',
383 - 'choosed' => false 393 + 'choosed' => !isset($invoices_title) ? true : false,
384 ), 394 ),
385 array( 395 array(
386 'type' => '单位', 396 'type' => '单位',
387 - 'choosed' => true 397 + 'choosed' => isset($invoices_title) ? true : false,
388 ) 398 )
389 ), 399 ),
390 'content' => array( 400 'content' => array(
391 array( 401 array(
392 - 'choosed' => false, 402 + 'choosed' => $invoiceType == 3 ? true : false,
393 'id' => 3, 403 'id' => 3,
394 'text' => '配件' 404 'text' => '配件'
395 ), 405 ),
396 array( 406 array(
397 - 'choosed' => false, 407 + 'choosed' => $invoiceType == 2 ? true : false,
398 'id' => 2, 408 'id' => 2,
399 'text' => '图书' 409 'text' => '图书'
400 ), 410 ),
401 array( 411 array(
402 - 'choosed' => true, 412 + 'choosed' => $invoiceType == 1 ? true : false,
403 'id' => 1, 413 'id' => 1,
404 'text' => '服装' 414 'text' => '服装'
405 ), 415 ),
406 array( 416 array(
407 - 'choosed' => false, 417 + 'choosed' => $invoiceType == 4 ? true : false,
408 'id' => 4, 418 'id' => 4,
409 'text' => '日用品' 419 'text' => '日用品'
410 ), 420 ),
411 array( 421 array(
412 - 'choosed' => false, 422 + 'choosed' => $invoiceType == 7 ? true : false,
413 'id' => 7, 423 'id' => 7,
414 'text' => '数码产品' 424 'text' => '数码产品'
415 ), 425 ),
416 array( 426 array(
417 - 'choosed' => false, 427 + 'choosed' => $invoiceType == 6 ? true : false,
418 'id' => 6, 428 'id' => 6,
419 'text' => '体育用品' 429 'text' => '体育用品'
420 ), 430 ),
421 array( 431 array(
422 - 'choosed' => false, 432 + 'choosed' => $invoiceType == 5 ? true : false,
423 'id' => 5, 433 'id' => 5,
424 'text' => '办公用品' 434 'text' => '办公用品'
425 ) 435 )
@@ -547,15 +557,15 @@ class IndexController extends AbstractAction @@ -547,15 +557,15 @@ class IndexController extends AbstractAction
547 $couponCode = $this->post('couponCode', null); 557 $couponCode = $this->post('couponCode', null);
548 $yohoCoin = $this->post('yohoCoin', 1); 558 $yohoCoin = $this->post('yohoCoin', 1);
549 $skuList = $this->post('skuList', ''); 559 $skuList = $this->post('skuList', '');
550 - $cookieData = $this->getCookie('order-info', null);//获取电子发票信息 560 + $cookieData = $this->getCookie('order-info', null); //获取电子发票信息
551 //电子发票信息数组 561 //电子发票信息数组
552 $invoices = array(); 562 $invoices = array();
553 if (!empty($cookieData)) { 563 if (!empty($cookieData)) {
554 $orderInfo = json_decode($cookieData, true); 564 $orderInfo = json_decode($cookieData, true);
555 - $invoices['invoices_type_id'] = $orderInfo['invoiceType'];//发票类型ID  
556 - $invoices['invoices_type'] = $orderInfo['invoicesType'];//发票类型 /**纸质 1 ,电子 2 */  
557 - $invoices['receiverMobile'] = $orderInfo['receiverMobile'];//发票人手机  
558 - $invoices['invoices_title'] = $orderInfo['invoiceText'];//发票抬头 565 + $invoices['invoices_type_id'] = $orderInfo['invoiceType']; //发票类型ID
  566 + $invoices['invoices_type'] = $orderInfo['invoicesType']; //发票类型 /**纸质 1 ,电子 2 */
  567 + $invoices['receiverMobile'] = $orderInfo['receiverMobile']; //发票人手机
  568 + $invoices['invoices_title'] = $orderInfo['invoiceText']; //发票抬头
559 } 569 }
560 570
561 /* 判断是否是友盟过来的用户 */ 571 /* 判断是否是友盟过来的用户 */
@@ -576,7 +586,7 @@ class IndexController extends AbstractAction @@ -576,7 +586,7 @@ class IndexController extends AbstractAction
576 $message = 'uid:' . $uid . ',addressId:' . $addressId . ',cartType:' . $cartType . ',deliveryTime:' . $deliveryTime 586 $message = 'uid:' . $uid . ',addressId:' . $addressId . ',cartType:' . $cartType . ',deliveryTime:' . $deliveryTime
577 . ',deliveryWay:' . $deliveryWay . ',yohoCoin:' . $yohoCoin 587 . ',deliveryWay:' . $deliveryWay . ',yohoCoin:' . $yohoCoin
578 . ',paymentId:' . $paymentId . ',paymentType:' . $paymentType . ',remark:' . $remark . ',couponCode:' . $couponCode . "\n"; 588 . ',paymentId:' . $paymentId . ',paymentType:' . $paymentType . ',remark:' . $remark . ',couponCode:' . $couponCode . "\n";
579 - UdpLog::info('【下单】下单异常数据','message:'.$message,'返回:'.json_encode($result)); 589 + UdpLog::info('【下单】下单异常数据', 'message:' . $message, '返回:' . json_encode($result));
580 } 590 }
581 // 返回数据 591 // 返回数据
582 else { 592 else {