Showing
5 changed files
with
174 additions
and
28 deletions
@@ -366,8 +366,7 @@ class CartData | @@ -366,8 +366,7 @@ class CartData | ||
366 | * @param int $cartType 购物车类型ID | 366 | * @param int $cartType 购物车类型ID |
367 | * @param int $deliveryTime 寄送时间ID | 367 | * @param int $deliveryTime 寄送时间ID |
368 | * @param int $deliveryWay 寄送方式ID | 368 | * @param int $deliveryWay 寄送方式ID |
369 | - * @param string $invoiceTitle 发票说明 | ||
370 | - * @param int $invoiceId 发票类型ID | 369 | + * @param array $invoices 发票参数数组 |
371 | * @param int $paymentId 支付方式ID | 370 | * @param int $paymentId 支付方式ID |
372 | * @param int $paymentType 支付类型ID | 371 | * @param int $paymentType 支付类型ID |
373 | * @param string $remark 留言 | 372 | * @param string $remark 留言 |
@@ -378,7 +377,7 @@ class CartData | @@ -378,7 +377,7 @@ class CartData | ||
378 | * @param string|null $userAgent 联盟过来用户下单时需要的User-Agent信息 | 377 | * @param string|null $userAgent 联盟过来用户下单时需要的User-Agent信息 |
379 | * @return array 接口返回的数据 | 378 | * @return array 接口返回的数据 |
380 | */ | 379 | */ |
381 | - public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnion, $userAgent) | 380 | + public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoices, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnion, $userAgent) |
382 | { | 381 | { |
383 | $param = Yohobuy::param(); | 382 | $param = Yohobuy::param(); |
384 | $param['debug'] = 'Y'; | 383 | $param['debug'] = 'Y'; |
@@ -392,13 +391,22 @@ class CartData | @@ -392,13 +391,22 @@ class CartData | ||
392 | $param['cart_type'] = $cartType; | 391 | $param['cart_type'] = $cartType; |
393 | $param['delivery_time'] = $deliveryTime; | 392 | $param['delivery_time'] = $deliveryTime; |
394 | $param['delivery_way'] = $deliveryWay; | 393 | $param['delivery_way'] = $deliveryWay; |
395 | - if (!empty($invoiceTitle)) { | ||
396 | - $param['invoices_title'] = $invoiceTitle; | 394 | + if (!empty($invoices['invoices_type_id'])) { |
395 | + //发票内容id--图书:1 | ||
396 | + $param['invoice_content'] = $invoices['invoices_type_id']; | ||
397 | } | 397 | } |
398 | - if (!empty($invoiceId)) { | ||
399 | - $param['invoices_type_id'] = $invoiceId; | 398 | + if (!empty($invoices['invoices_type'])) { |
399 | + //数字类型 发票类型 /**纸质 1 ,电子 2 */ | ||
400 | + $param['invoices_type'] = $invoices['invoices_type']; | ||
401 | + } | ||
402 | + if (!empty($invoices['receiverMobile'])) { | ||
403 | + //发票人手机 | ||
404 | + $param['receiverMobile'] = $invoices['receiverMobile']; | ||
405 | + } | ||
406 | + if (!empty($invoices['invoices_title'])) { | ||
407 | + //发票抬头 OR 填写单位名称,这二个是一个意思,只是叫法不一样 | ||
408 | + $param['invoices_title'] = $invoices['invoices_title']; | ||
400 | } | 409 | } |
401 | - | ||
402 | $param['payment_id'] = $paymentId; | 410 | $param['payment_id'] = $paymentId; |
403 | $param['payment_type'] = $paymentType; | 411 | $param['payment_type'] = $paymentType; |
404 | $param['remark'] = $remark; | 412 | $param['remark'] = $remark; |
@@ -1096,8 +1096,6 @@ class HomeController extends AbstractAction | @@ -1096,8 +1096,6 @@ class HomeController extends AbstractAction | ||
1096 | 1096 | ||
1097 | /* 判断订单信息是否存在 */ | 1097 | /* 判断订单信息是否存在 */ |
1098 | $orderDetail = OrderModel::orderDetail($orderCode, $this->_uid, $this->_usession); | 1098 | $orderDetail = OrderModel::orderDetail($orderCode, $this->_uid, $this->_usession); |
1099 | -// $readd = OrderData::reAddData($this->_uid, 1611143210); | ||
1100 | -// print_r($readd); | ||
1101 | if (empty($orderDetail)) { | 1099 | if (empty($orderDetail)) { |
1102 | $this->error(); | 1100 | $this->error(); |
1103 | } | 1101 | } |
@@ -1108,6 +1106,7 @@ class HomeController extends AbstractAction | @@ -1108,6 +1106,7 @@ class HomeController extends AbstractAction | ||
1108 | 1106 | ||
1109 | $this->_view->display('order-detail', array( | 1107 | $this->_view->display('order-detail', array( |
1110 | 'orderDetailPage' => true, | 1108 | 'orderDetailPage' => true, |
1109 | + 'invoice' => empty($orderDetail['invoice']) ? array() : $orderDetail['invoice'], | ||
1111 | 'serviceUrl' => 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=', | 1110 | 'serviceUrl' => 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=', |
1112 | 'orderDetail' => $orderDetail, | 1111 | 'orderDetail' => $orderDetail, |
1113 | 'orderCode' => $orderCode, | 1112 | 'orderCode' => $orderCode, |
@@ -240,6 +240,37 @@ class OrderModel | @@ -240,6 +240,37 @@ class OrderModel | ||
240 | $result['isJit'] = true; | 240 | $result['isJit'] = true; |
241 | $result['jitDetailUrl'] = Helpers::url('/cart/index/jitDetail', array('orderCode' => $orderCode, 'sessionKey' => $sessionKey)); | 241 | $result['jitDetailUrl'] = Helpers::url('/cart/index/jitDetail', array('orderCode' => $orderCode, 'sessionKey' => $sessionKey)); |
242 | } | 242 | } |
243 | + | ||
244 | + $result['invoice'] = array(); | ||
245 | + //电子发票 | ||
246 | + do{ | ||
247 | + if(empty($orderDetail['data']['invoice']) || !isset($orderDetail['data']['invoice'])){ | ||
248 | + break; | ||
249 | + } | ||
250 | + //判断是否显示电子发票相关信息 | ||
251 | + if(isset($orderDetail['data']['invoice']['type']) == false && empty($orderDetail['data']['invoice']['type'])){ | ||
252 | + break; | ||
253 | + } | ||
254 | + //判断是否显示电子发票下载地址 | ||
255 | + $result['invoice'] = $orderDetail['data']['invoice']; | ||
256 | + //纸质 1,电子 2 | ||
257 | + $result['invoice']['type'] = $result['invoice']['type'] * 1 === 2 ? true : false;//发票类型 | ||
258 | + $result['invoice']['title'] = $result['invoice']['title'];//发票抬头 | ||
259 | + $result['invoice']['contentValue'] = $result['invoice']['contentValue'];//发票内容 | ||
260 | + $result['invoice']['mobilePhone'] = $result['invoice']['mobilePhone'];//联系电话 | ||
261 | + //电子发票下载链接 | ||
262 | + if($orderDetail['data']['invoice']['showInvoice'] == true && isset($orderDetail['data']['invoice']['pdfUrl'])){ | ||
263 | + $result['invoice']['pdfUrl'] = $result['invoice']['pdfUrl']; | ||
264 | + } | ||
265 | + } | ||
266 | + while(false); | ||
267 | +// $result['invoice'] = array( | ||
268 | +// 'type' => true,//-- 纸质 false,电子 true | ||
269 | +// 'title' => '发票抬头',// --发票抬头 | ||
270 | +// 'contentValue' => '服饰',//-- 发票内容 | ||
271 | +// 'mobilePhone' => '13651898702',//--电话 | ||
272 | +// 'pdfUrl' => 'http://redmine.yoho.cn/attachments/download/2732/%E7%94%B5%E5%AD%90%E5%8F%91%E7%A5%A8-wap%E7%AB%AF.pdf',//--pdf下载地址 | ||
273 | +// ); | ||
243 | } | 274 | } |
244 | //取消订单原因列表 | 275 | //取消订单原因列表 |
245 | $resons = OrderData::closeReasons(); | 276 | $resons = OrderData::closeReasons(); |
@@ -571,14 +571,11 @@ class CartModel | @@ -571,14 +571,11 @@ class CartModel | ||
571 | 571 | ||
572 | // 发票有关数据 | 572 | // 发票有关数据 |
573 | if (isset($payReturn['invoices']) && !empty($payReturn['invoices'])) { | 573 | if (isset($payReturn['invoices']) && !empty($payReturn['invoices'])) { |
574 | - $one = array(); | ||
575 | - foreach ($payReturn['invoices']['invoices_type_list'] as $inv) { | ||
576 | - $one = array(); | ||
577 | - $one['id'] = $inv['invoices_type_id']; | ||
578 | - $one['name'] = $inv['invoices_type_name']; | ||
579 | - isset($orderInfo['invoiceType']) && $one['id'] == $orderInfo['invoiceType'] && $one['isSelected'] = true; | ||
580 | - | ||
581 | - $result['invoice'][] = $one; | 574 | + foreach ($payReturn['invoices']['invoiceContentList'] as $inv) { |
575 | + $result['invoice'][] = array( | ||
576 | + 'id' => $inv['invoices_type_id'], | ||
577 | + 'name' => $inv['invoices_type_name'], | ||
578 | + ); | ||
582 | } | 579 | } |
583 | 580 | ||
584 | // 发票信息需要记录 | 581 | // 发票信息需要记录 |
@@ -745,8 +742,7 @@ class CartModel | @@ -745,8 +742,7 @@ class CartModel | ||
745 | * @param int $cartType 购物车类型ID | 742 | * @param int $cartType 购物车类型ID |
746 | * @param int $deliveryTime 寄送时间ID | 743 | * @param int $deliveryTime 寄送时间ID |
747 | * @param int $deliveryWay 寄送方式ID | 744 | * @param int $deliveryWay 寄送方式ID |
748 | - * @param string $invoiceTitle 发票说明 | ||
749 | - * @param int $invoiceId 发票类型ID | 745 | + * @param array $invoices 发票参数数组 |
750 | * @param int $paymentId 支付方式ID | 746 | * @param int $paymentId 支付方式ID |
751 | * @param int $paymentType 支付类型ID | 747 | * @param int $paymentType 支付类型ID |
752 | * @param string $remark 留言 | 748 | * @param string $remark 留言 |
@@ -757,7 +753,7 @@ class CartModel | @@ -757,7 +753,7 @@ class CartModel | ||
757 | * @param string|null $userAgent 联盟过来用户下单时需要的User-Agent信息 | 753 | * @param string|null $userAgent 联盟过来用户下单时需要的User-Agent信息 |
758 | * @return array 接口返回的数据 | 754 | * @return array 接口返回的数据 |
759 | */ | 755 | */ |
760 | - public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnio = '', $userAgent = null) | 756 | + public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoices, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnio = '', $userAgent = null) |
761 | { | 757 | { |
762 | $result = array('code' => 400, 'message' => '出错啦'); | 758 | $result = array('code' => 400, 'message' => '出错啦'); |
763 | 759 | ||
@@ -775,7 +771,7 @@ class CartModel | @@ -775,7 +771,7 @@ class CartModel | ||
775 | $result['message'] = '请选择配送方式'; | 771 | $result['message'] = '请选择配送方式'; |
776 | } | 772 | } |
777 | else { | 773 | else { |
778 | - $orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnio, $userAgent); | 774 | + $orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoices, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnio, $userAgent); |
779 | UdpLog::info('【结算信息】接口返回','orderSubRes'.json_encode($orderSubRes)); | 775 | UdpLog::info('【结算信息】接口返回','orderSubRes'.json_encode($orderSubRes)); |
780 | if ($orderSubRes && isset($orderSubRes['code'])) { | 776 | if ($orderSubRes && isset($orderSubRes['code'])) { |
781 | $result = $orderSubRes; | 777 | $result = $orderSubRes; |
@@ -8,6 +8,7 @@ use Plugin\Helpers; | @@ -8,6 +8,7 @@ use Plugin\Helpers; | ||
8 | use Plugin\UnionTrans; | 8 | use Plugin\UnionTrans; |
9 | use Home\OrderModel; | 9 | use Home\OrderModel; |
10 | use Plugin\UdpLog; | 10 | use Plugin\UdpLog; |
11 | +use LibModels\Wap\Home\UserData; | ||
11 | 12 | ||
12 | /** | 13 | /** |
13 | * 购物车相关的控制器 | 14 | * 购物车相关的控制器 |
@@ -333,11 +334,13 @@ class IndexController extends AbstractAction | @@ -333,11 +334,13 @@ class IndexController extends AbstractAction | ||
333 | $this->echoJson($order); | 334 | $this->echoJson($order); |
334 | return; | 335 | return; |
335 | } | 336 | } |
336 | - | 337 | + $userData = UserData::userData($uid); |
338 | + $mobile = empty($userData['data']) || empty($userData['data']['mobile']) ? '' : $userData['data']['mobile']; //发票人手机 | ||
337 | $data = array( | 339 | $data = array( |
338 | 'orderEnsurePage' => true, | 340 | 'orderEnsurePage' => true, |
339 | 'isOrdinaryCart' => ($cartType !== 'advance'), | 341 | 'isOrdinaryCart' => ($cartType !== 'advance'), |
340 | - 'orderEnsure' => $order | 342 | + 'orderEnsure' => $order, |
343 | + 'userMobile' => $mobile | ||
341 | ); | 344 | ); |
342 | 345 | ||
343 | $this->setTitle('确认订单'); | 346 | $this->setTitle('确认订单'); |
@@ -347,6 +350,108 @@ class IndexController extends AbstractAction | @@ -347,6 +350,108 @@ class IndexController extends AbstractAction | ||
347 | } | 350 | } |
348 | 351 | ||
349 | /** | 352 | /** |
353 | + * 发票信息 | ||
354 | + */ | ||
355 | + public function invoiceInfoAction() | ||
356 | + { | ||
357 | + $uid = $this->getUid(); | ||
358 | + if (!$uid) { | ||
359 | + $this->go(Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', SITE_MAIN)))); | ||
360 | + } | ||
361 | + $cookieData = $this->getCookie('order-info', null); //从缓存中获取电子发票信息 | ||
362 | + $userData = UserData::userData($uid); | ||
363 | + $userMobile = empty($userData['data']) || empty($userData['data']['mobile']) ? '' : $userData['data']['mobile']; //发票人手机 | ||
364 | + if (!empty($cookieData)) { | ||
365 | + $orderInfo = json_decode($cookieData, true); | ||
366 | + $invoiceType = $orderInfo['invoiceType']; //发票类型ID | ||
367 | + $invoices_type = $orderInfo['invoicesType'] * 1; //发票类型 /**纸质 1 ,电子 2 */ | ||
368 | + $mobile = isset($orderInfo['receiverMobile']) && !empty($orderInfo['receiverMobile']) ? $orderInfo['receiverMobile'] : $userMobile; //发票人手机 | ||
369 | + $invoices_title = $orderInfo['invoiceText']; //发票抬头 | ||
370 | + $invoice_Top = $orderInfo['invoiceTitle']; | ||
371 | + } | ||
372 | + else { | ||
373 | + $userData = UserData::userData($uid); | ||
374 | + $mobile = $userMobile; //发票人手机 | ||
375 | + $invoiceType = '7'; //发票类型ID | ||
376 | + $invoices_type = '2'; //发票类型 /**纸质 1 ,电子 2 */ | ||
377 | + $invoice_Top = '个人'; | ||
378 | + } | ||
379 | + | ||
380 | + $data = array( | ||
381 | + 'invoiceInfoPage' => true, | ||
382 | + 'invoiceNotice' => '发票须知', | ||
383 | + 'phone' => $mobile ? substr_replace($mobile, '****', 3, 4) : '', | ||
384 | + 'completeTel' => $mobile, | ||
385 | + 'isCompany' => $invoice_Top =='单位' ? false : true, | ||
386 | + 'companyName' => $invoices_title, | ||
387 | + 'invoicesType' => array( | ||
388 | + array( | ||
389 | + 'id' => '2', | ||
390 | + 'type' => '电子发票', | ||
391 | + 'choosed' => empty($invoices_type) || $invoices_type == 2 ? true : false, | ||
392 | + ), | ||
393 | + array( | ||
394 | + 'id' => '1', | ||
395 | + 'type' => '纸质发票', | ||
396 | + 'choosed' => $invoices_type == 1 ? true : false, | ||
397 | + ) | ||
398 | + ), | ||
399 | + 'invoiceTitle' => array( | ||
400 | + array( | ||
401 | + 'type' => '个人', | ||
402 | + 'choosed' =>$invoice_Top == '个人'? true : false, | ||
403 | + ), | ||
404 | + array( | ||
405 | + 'type' => '单位', | ||
406 | + 'choosed' => $invoice_Top == '单位' ? true : false, | ||
407 | + ) | ||
408 | + ), | ||
409 | + 'content' => array( | ||
410 | + array( | ||
411 | + 'choosed' => empty($invoiceType) || $invoiceType == 7 ? true : false, | ||
412 | + 'id' => 7, | ||
413 | + 'text' => '服装' | ||
414 | + ), | ||
415 | + array( | ||
416 | + 'choosed' => $invoiceType == 1 ? true : false, | ||
417 | + 'id' => 1, | ||
418 | + 'text' => '图书' | ||
419 | + ), | ||
420 | + array( | ||
421 | + 'choosed' => $invoiceType == 9 ? true : false, | ||
422 | + 'id' => 9, | ||
423 | + 'text' => '配件' | ||
424 | + ), | ||
425 | + array( | ||
426 | + 'choosed' => $invoiceType == 11 ? true : false, | ||
427 | + 'id' => 11, | ||
428 | + 'text' => '日用品' | ||
429 | + ), | ||
430 | + array( | ||
431 | + 'choosed' => $invoiceType == 3 ? true : false, | ||
432 | + 'id' => 3, | ||
433 | + 'text' => '办公用品' | ||
434 | + ), | ||
435 | + array( | ||
436 | + 'choosed' => $invoiceType == 6 ? true : false, | ||
437 | + 'id' => 6, | ||
438 | + 'text' => '体育用品' | ||
439 | + ), | ||
440 | + array( | ||
441 | + 'choosed' => $invoiceType == 10 ? true : false, | ||
442 | + 'id' => 10, | ||
443 | + 'text' => '数码产品' | ||
444 | + ) | ||
445 | + ) | ||
446 | + ); | ||
447 | + | ||
448 | + $this->setTitle('发票信息'); | ||
449 | + $this->setNavHeader('发票信息', true, false); // 不显示右上角home按钮 | ||
450 | + | ||
451 | + $this->_view->display('invoice-info', $data); | ||
452 | + } | ||
453 | + | ||
454 | + /** | ||
350 | * 购物车选择改变字段,重新运算订单数据 | 455 | * 购物车选择改变字段,重新运算订单数据 |
351 | */ | 456 | */ |
352 | public function orderComputeAction() | 457 | public function orderComputeAction() |
@@ -455,14 +560,22 @@ class IndexController extends AbstractAction | @@ -455,14 +560,22 @@ class IndexController extends AbstractAction | ||
455 | $cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车 | 560 | $cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车 |
456 | $deliveryTime = $this->post('deliveryTimeId', 1); // 默认只工作日配送 | 561 | $deliveryTime = $this->post('deliveryTimeId', 1); // 默认只工作日配送 |
457 | $deliveryWay = $this->post('deliveryId', 1); // 默认普通快递 | 562 | $deliveryWay = $this->post('deliveryId', 1); // 默认普通快递 |
458 | - $invoiceTitle = $this->post('invoiceText', null); | ||
459 | - $invoiceId = $this->post('invoiceType', null); | ||
460 | $paymentId = $this->post('paymentTypeId', 15); | 563 | $paymentId = $this->post('paymentTypeId', 15); |
461 | $paymentType = $this->post('paymentType', 1); // 默认在线支付 | 564 | $paymentType = $this->post('paymentType', 1); // 默认在线支付 |
462 | $remark = $this->post('msg', null); | 565 | $remark = $this->post('msg', null); |
463 | $couponCode = $this->post('couponCode', null); | 566 | $couponCode = $this->post('couponCode', null); |
464 | $yohoCoin = $this->post('yohoCoin', 1); | 567 | $yohoCoin = $this->post('yohoCoin', 1); |
465 | $skuList = $this->post('skuList', ''); | 568 | $skuList = $this->post('skuList', ''); |
569 | + $cookieData = $this->getCookie('order-info', null); //获取电子发票信息 | ||
570 | + //电子发票信息数组 | ||
571 | + $invoices = array(); | ||
572 | + if (!empty($cookieData)) { | ||
573 | + $orderInfo = json_decode($cookieData, true); | ||
574 | + $invoices['invoices_type_id'] = $orderInfo['invoiceType']; //发票类型ID | ||
575 | + $invoices['invoices_type'] = $orderInfo['invoicesType']; //发票类型 /**纸质 1 ,电子 2 */ | ||
576 | + $invoices['receiverMobile'] = $orderInfo['receiverMobile']; //发票人手机 | ||
577 | + $invoices['invoices_title'] = empty($orderInfo['invoiceText']) ? '个人' : $orderInfo['invoiceText']; //发票抬头 | ||
578 | + } | ||
466 | 579 | ||
467 | /* 判断是否是友盟过来的用户 */ | 580 | /* 判断是否是友盟过来的用户 */ |
468 | $userAgent = null; | 581 | $userAgent = null; |
@@ -475,8 +588,7 @@ class IndexController extends AbstractAction | @@ -475,8 +588,7 @@ class IndexController extends AbstractAction | ||
475 | /* 模拟APP的User-Agent */ | 588 | /* 模拟APP的User-Agent */ |
476 | $userAgent = isset($unionInfo['client_id']) ? 'YOHO!Buy/3.8.2.259(Model/PC;Channel/' . $unionInfo['client_id'] . ';uid/' . $uid . ')' : null; | 589 | $userAgent = isset($unionInfo['client_id']) ? 'YOHO!Buy/3.8.2.259(Model/PC;Channel/' . $unionInfo['client_id'] . ';uid/' . $uid . ')' : null; |
477 | } | 590 | } |
478 | - | ||
479 | - $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $unionKey, $userAgent); | 591 | + $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoices, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $unionKey, $userAgent); |
480 | 592 | ||
481 | // 记录下单异常的数据 | 593 | // 记录下单异常的数据 |
482 | if (empty($result)) { | 594 | if (empty($result)) { |
-
Please register or login to post a comment