Showing
5 changed files
with
49 additions
and
20 deletions
@@ -359,8 +359,10 @@ class CartData | @@ -359,8 +359,10 @@ class CartData | ||
359 | * @param string $cartType 购物车类型 | 359 | * @param string $cartType 购物车类型 |
360 | * @param int $deliveryTime 寄送时间ID | 360 | * @param int $deliveryTime 寄送时间ID |
361 | * @param int $deliveryWay 寄送方式ID | 361 | * @param int $deliveryWay 寄送方式ID |
362 | - * @param string $invoiceTitle 发票说明 | ||
363 | - * @param int $invoiceId 发票类型ID | 362 | + * @param int $invoiceType 发票类型 1:纸质,2:电子 |
363 | + * @param string $invoiceTitle 发票抬头 | ||
364 | + * @param int $invoiceContent 发票内容 | ||
365 | + * @param string $receiverMobile 发票接收人电话 | ||
364 | * @param int $paymentId 支付方式ID | 366 | * @param int $paymentId 支付方式ID |
365 | * @param int $paymentType 支付类型ID | 367 | * @param int $paymentType 支付类型ID |
366 | * @param string $remark 留言 | 368 | * @param string $remark 留言 |
@@ -374,7 +376,7 @@ class CartData | @@ -374,7 +376,7 @@ class CartData | ||
374 | * @param int $redEnvelopes 红包 | 376 | * @param int $redEnvelopes 红包 |
375 | * @return array 接口返回的数据 | 377 | * @return array 接口返回的数据 |
376 | */ | 378 | */ |
377 | - public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, | 379 | + public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceType, $invoiceTitle, $invoiceContent, $receiverMobile, |
378 | $paymentId, $paymentType, $remark,$couponCode,$promotionCode, $yohoCoin, $isPreContact, $isPrintPrice, $unionKey,$userAgent, $redEnvelopes) | 380 | $paymentId, $paymentType, $remark,$couponCode,$promotionCode, $yohoCoin, $isPreContact, $isPrintPrice, $unionKey,$userAgent, $redEnvelopes) |
379 | { | 381 | { |
380 | $param = Yohobuy::param(); | 382 | $param = Yohobuy::param(); |
@@ -387,11 +389,18 @@ class CartData | @@ -387,11 +389,18 @@ class CartData | ||
387 | $param['delivery_time'] = $deliveryTime; | 389 | $param['delivery_time'] = $deliveryTime; |
388 | $param['delivery_way'] = $deliveryWay; | 390 | $param['delivery_way'] = $deliveryWay; |
389 | $param['uid'] = $uid; | 391 | $param['uid'] = $uid; |
392 | + | ||
393 | + if (!empty($invoiceType)) { | ||
394 | + $param['invoices_type'] = $invoiceType; | ||
395 | + } | ||
390 | if (!empty($invoiceTitle)) { | 396 | if (!empty($invoiceTitle)) { |
391 | $param['invoices_title'] = $invoiceTitle; | 397 | $param['invoices_title'] = $invoiceTitle; |
392 | } | 398 | } |
393 | - if (!empty($invoiceId)) { | ||
394 | - $param['invoices_type_id'] = $invoiceId; | 399 | + if (!empty($invoiceContent)) { |
400 | + $param['invoice_content'] = $invoiceContent; | ||
401 | + } | ||
402 | + if (!empty($receiverMobile)) { | ||
403 | + $param['receiverMobile'] = $receiverMobile; | ||
395 | } | 404 | } |
396 | if (!empty($redEnvelopes)) { | 405 | if (!empty($redEnvelopes)) { |
397 | $param['use_red_envelopes'] = $redEnvelopes; | 406 | $param['use_red_envelopes'] = $redEnvelopes; |
@@ -420,7 +429,6 @@ class CartData | @@ -420,7 +429,6 @@ class CartData | ||
420 | } | 429 | } |
421 | $param['remark'] = $remark; | 430 | $param['remark'] = $remark; |
422 | $param['client_secret'] = Sign::getSign($param); | 431 | $param['client_secret'] = Sign::getSign($param); |
423 | - | ||
424 | return Yohobuy::get(Yohobuy::API_URL, $param, false, false, 10, $userAgent); | 432 | return Yohobuy::get(Yohobuy::API_URL, $param, false, false, 10, $userAgent); |
425 | } | 433 | } |
426 | 434 | ||
@@ -522,5 +530,5 @@ class CartData | @@ -522,5 +530,5 @@ class CartData | ||
522 | $param['payment'] = $payment; | 530 | $param['payment'] = $payment; |
523 | $param['client_secret'] = Sign::getSign($param); | 531 | $param['client_secret'] = Sign::getSign($param); |
524 | return Yohobuy::get(Yohobuy::API_URL, $param); | 532 | return Yohobuy::get(Yohobuy::API_URL, $param); |
525 | - } | 533 | + } |
526 | } | 534 | } |
@@ -226,6 +226,16 @@ class OrderModel | @@ -226,6 +226,16 @@ class OrderModel | ||
226 | } | 226 | } |
227 | $detail['orderBalance'][] = array('promotion' => '实际应支付', 'account' => $orderDetail['amount']); | 227 | $detail['orderBalance'][] = array('promotion' => '实际应支付', 'account' => $orderDetail['amount']); |
228 | } | 228 | } |
229 | + //发票 | ||
230 | + if (isset($orderDetail['invoice']) && $orderDetail['invoice']) { | ||
231 | + $detail['invoiceMode'] = true; | ||
232 | + $detail['invoiceType'] = $orderDetail['invoice']['type']; | ||
233 | + $detail['pdfUrl'] = $orderDetail['invoice']['pdfUrl']; | ||
234 | + $detail['title'] = $orderDetail['invoice']['title']; | ||
235 | + $detail['contentValue'] = $orderDetail['invoice']['contentValue']; | ||
236 | + $detail['showInvoice'] = $orderDetail['invoice']['showInvoice']; | ||
237 | + } | ||
238 | + | ||
229 | $detail['yoho_give_coin'] = $orderDetail['yoho_give_coin']; | 239 | $detail['yoho_give_coin'] = $orderDetail['yoho_give_coin']; |
230 | $detail['yohoCoinUrl'] = Helpers::url('/help', array('category_id' => 87)); //什么是yoho币介绍 | 240 | $detail['yohoCoinUrl'] = Helpers::url('/help', array('category_id' => 87)); //什么是yoho币介绍 |
231 | $detail['remark'] = $orderDetail['remark']; | 241 | $detail['remark'] = $orderDetail['remark']; |
@@ -579,6 +579,9 @@ class CartModel | @@ -579,6 +579,9 @@ class CartModel | ||
579 | do { | 579 | do { |
580 | /* 调接口订单确认接口 */ | 580 | /* 调接口订单确认接口 */ |
581 | $pay = CartData::cartPay($uid, $cartType); | 581 | $pay = CartData::cartPay($uid, $cartType); |
582 | + //获取用户手机号码用于发票接收人 | ||
583 | + $userInfo = UserData::getUserInfo($uid); | ||
584 | + | ||
582 | if (!$pay || empty($pay['data']['goods_list'])) { | 585 | if (!$pay || empty($pay['data']['goods_list'])) { |
583 | break; | 586 | break; |
584 | } | 587 | } |
@@ -695,14 +698,14 @@ class CartModel | @@ -695,14 +698,14 @@ class CartModel | ||
695 | } | 698 | } |
696 | } | 699 | } |
697 | 700 | ||
698 | - /* 发票类型 */ | ||
699 | - if (!empty($pay['data']['invoices']['invoices_type_list'])) { | ||
700 | - $build = array(); | ||
701 | - foreach ($pay['data']['invoices']['invoices_type_list'] as $value) { | ||
702 | - $build['id'] = $value['invoices_type_id']; | ||
703 | - $build['name'] = $value['invoices_type_name']; | ||
704 | - $result['piaoTypes'][] = $build; | 701 | + /* 发票内容 */ |
702 | + if (!empty($pay['data']['invoices']['invoiceContentList'])) { | ||
703 | + foreach ($pay['data']['invoices']['invoiceContentList'] as $value) { | ||
704 | + $result['piaoTypes'][$value['invoices_type_id']]['id'] = $value['invoices_type_id']; | ||
705 | + $result['piaoTypes'][$value['invoices_type_id']]['name'] = $value['invoices_type_name']; | ||
705 | } | 706 | } |
707 | + $result['receiverMobile'] = isset($userInfo['data']['mobile']) && $userInfo['data']['mobile'] ? $userInfo['data']['mobile'] : ''; | ||
708 | + $result['invoiceUrl'] = 'http://www.yohobuy.com/help?category_id=99'; | ||
706 | } | 709 | } |
707 | 710 | ||
708 | /* 需购买的商品 */ | 711 | /* 需购买的商品 */ |
@@ -895,7 +898,7 @@ class CartModel | @@ -895,7 +898,7 @@ class CartModel | ||
895 | * @param int $redEnvelopes 红包 | 898 | * @param int $redEnvelopes 红包 |
896 | * @return array 接口返回的数据 | 899 | * @return array 接口返回的数据 |
897 | */ | 900 | */ |
898 | - public static function orderSub($uid, $addressId, $cartType, $deliveryTimeId, $deliveryWayId, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode,$promotionCode, $yohoCoin, $isPreContact, $isPrintPrice, $redEnvelopes) | 901 | + public static function orderSub($uid, $addressId, $cartType, $deliveryTimeId, $deliveryWayId, $invoiceType, $invoiceTitle, $invoiceContent, $receiverMobile, $paymentId, $paymentType, $remark, $couponCode,$promotionCode, $yohoCoin, $isPreContact, $isPrintPrice, $redEnvelopes) |
899 | { | 902 | { |
900 | $result = array('code' => 400, 'message' => self::ERROR_400_MESSAGE); | 903 | $result = array('code' => 400, 'message' => self::ERROR_400_MESSAGE); |
901 | 904 | ||
@@ -936,7 +939,7 @@ class CartModel | @@ -936,7 +939,7 @@ class CartModel | ||
936 | $userAgent = isset($unionInfo['client_id']) ? 'YOHO!Buy/3.8.2.259(Model/PC;Channel/' . $unionInfo['client_id'] . ';uid/' . $uid . ')' : null; | 939 | $userAgent = isset($unionInfo['client_id']) ? 'YOHO!Buy/3.8.2.259(Model/PC;Channel/' . $unionInfo['client_id'] . ';uid/' . $uid . ')' : null; |
937 | } | 940 | } |
938 | 941 | ||
939 | - $orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTimeId, $deliveryWayId, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode,$promotionCode,$yohoCoin, $isPreContact, $isPrintPrice,$unionKey,$userAgent, $redEnvelopes); | 942 | + $orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTimeId, $deliveryWayId, $invoiceType, $invoiceTitle, $invoiceContent, $receiverMobile, $paymentId, $paymentType, $remark, $couponCode,$promotionCode,$yohoCoin, $isPreContact, $isPrintPrice,$unionKey,$userAgent, $redEnvelopes); |
940 | if ($orderSubRes && isset($orderSubRes['code'])) { | 943 | if ($orderSubRes && isset($orderSubRes['code'])) { |
941 | $result = $orderSubRes; | 944 | $result = $orderSubRes; |
942 | } | 945 | } |
@@ -439,8 +439,11 @@ class IndexController extends WebAction | @@ -439,8 +439,11 @@ class IndexController extends WebAction | ||
439 | $cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车 | 439 | $cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车 |
440 | $deliveryTimeId = $this->post('deliveryTimeId', 1); // 默认只工作日配送 | 440 | $deliveryTimeId = $this->post('deliveryTimeId', 1); // 默认只工作日配送 |
441 | $deliveryWayId = $this->post('deliveryWayId', 1); // 默认普通快递 | 441 | $deliveryWayId = $this->post('deliveryWayId', 1); // 默认普通快递 |
442 | - $invoiceTitle = $this->post('invoiceTitle', null); // 发票抬头 | ||
443 | - $invoiceId = $this->post('invoiceId', null); // 发票类型 | 442 | + $invoiceType = $this->post('invoiceType', null); // 发票类型:纸质 1 ,电子 2 |
443 | + $invoiceTitle = $this->post('invoiceTitle', '个人'); // 发票抬头 | ||
444 | + $invoiceContent = $this->post('invoiceContent', null); // 发票内容 | ||
445 | + $receiverMobile = $this->post('receiverMobile', null); // 接收人电话 | ||
446 | + | ||
444 | $paymentId = $this->post('paymentId', 15); // 支付ID | 447 | $paymentId = $this->post('paymentId', 15); // 支付ID |
445 | $paymentType = $this->post('paymentType', 1); // 默认在线支付 | 448 | $paymentType = $this->post('paymentType', 1); // 默认在线支付 |
446 | $remark = $this->post('remark', ''); // 备注信息 | 449 | $remark = $this->post('remark', ''); // 备注信息 |
@@ -450,9 +453,8 @@ class IndexController extends WebAction | @@ -450,9 +453,8 @@ class IndexController extends WebAction | ||
450 | $isPreContact = $this->post('isPreContact', false); // 送货前是否联系 | 453 | $isPreContact = $this->post('isPreContact', false); // 送货前是否联系 |
451 | $isPrintPrice = $this->post('isPrintPrice', true); // 是否打印价格 | 454 | $isPrintPrice = $this->post('isPrintPrice', true); // 是否打印价格 |
452 | $redEnvelopes = $this->post('redEnvelopes', null); | 455 | $redEnvelopes = $this->post('redEnvelopes', null); |
453 | - | ||
454 | // 调用下单接口 | 456 | // 调用下单接口 |
455 | - $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTimeId, $deliveryWayId, $invoiceTitle, $invoiceId, | 457 | + $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTimeId, $deliveryWayId, $invoiceType, $invoiceTitle, $invoiceContent, $receiverMobile, |
456 | $paymentId, $paymentType, $remark, $couponCode, $promotionCode, $yohoCoin, $isPreContact, $isPrintPrice, $redEnvelopes); | 458 | $paymentId, $paymentType, $remark, $couponCode, $promotionCode, $yohoCoin, $isPreContact, $isPrintPrice, $redEnvelopes); |
457 | // 判断是否下单成功 | 459 | // 判断是否下单成功 |
458 | if (empty($result['data']['order_code'])) { | 460 | if (empty($result['data']['order_code'])) { |
@@ -122,6 +122,12 @@ class OrdersController extends WebAction | @@ -122,6 +122,12 @@ class OrdersController extends WebAction | ||
122 | 'operation' => $detail['operation'], | 122 | 'operation' => $detail['operation'], |
123 | 'totalYoho' => $detail['yoho_give_coin'], | 123 | 'totalYoho' => $detail['yoho_give_coin'], |
124 | 'editInfo' => $detail['editInfo'], | 124 | 'editInfo' => $detail['editInfo'], |
125 | + //发票信息 | ||
126 | + 'invoiceMode' => $detail['invoiceMode'], | ||
127 | + 'invoiceType' => $detail['invoiceType'] === 2 ? '电子发票' : '纸质发票', | ||
128 | + 'pdfUrl' => $detail['showInvoice'] && $detail['pdfUrl'] ? $detail['pdfUrl'] : '', | ||
129 | + 'title' => $detail['title'], | ||
130 | + 'contentValue' => $detail['contentValue'] ? $detail['contentValue'] : '个人', | ||
125 | ); | 131 | ); |
126 | if (isset($detail['noramlPayMode'])) { | 132 | if (isset($detail['noramlPayMode'])) { |
127 | $data['orderInfo'] = $detail['orderInfo']; | 133 | $data['orderInfo'] = $detail['orderInfo']; |
-
Please register or login to post a comment