Authored by 郝肖肖

电子发票 保存接口字段添加

... ... @@ -365,8 +365,7 @@ class CartData
* @param int $cartType 购物车类型ID
* @param int $deliveryTime 寄送时间ID
* @param int $deliveryWay 寄送方式ID
* @param string $invoiceTitle 发票说明
* @param int $invoiceId 发票类型ID
* @param array $invoices 发票参数数组
* @param int $paymentId 支付方式ID
* @param int $paymentType 支付类型ID
* @param string $remark 留言
... ... @@ -377,7 +376,7 @@ class CartData
* @param string|null $userAgent 联盟过来用户下单时需要的User-Agent信息
* @return array 接口返回的数据
*/
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnion, $userAgent)
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoices, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnion, $userAgent)
{
$param = Yohobuy::param();
$param['debug'] = 'Y';
... ... @@ -388,13 +387,22 @@ class CartData
$param['cart_type'] = $cartType;
$param['delivery_time'] = $deliveryTime;
$param['delivery_way'] = $deliveryWay;
if (!empty($invoiceTitle)) {
$param['invoices_title'] = $invoiceTitle;
if (!empty($invoices['invoices_type_id'])) {
//发票内容id--图书:1
$param['invoices_type_id'] = $invoices['invoices_type_id'];
}
if (!empty($invoiceId)) {
$param['invoices_type_id'] = $invoiceId;
if (!empty($invoices['invoices_type'])) {
//数字类型 发票类型 /**纸质 1 ,电子 2 */
$param['invoices_type'] = $invoices['invoices_type'];
}
if (!empty($invoices['receiverMobile'])) {
//发票人手机
$param['receiverMobile'] = $invoices['receiverMobile'];
}
if (!empty($invoices['invoices_title'])) {
//发票抬头 OR 填写单位名称,这二个是一个意思,只是叫法不一样
$param['invoices_title'] = $invoices['invoices_title'];
}
$param['payment_id'] = $paymentId;
$param['payment_type'] = $paymentType;
$param['remark'] = $remark;
... ...
... ... @@ -31,7 +31,7 @@
<span class="choose-cont">{{invoiceCont}}</span>
</li>
{{#each content}}
<li><span class="iconfont choose {{#if choosed}}icon-cb-radio{{else}}icon-radio{{/if}}"></span>{{text}}</li>
<li><span class="iconfont choose {{#if choosed}}icon-cb-radio{{else}}icon-radio{{/if}}" data-id = '{{id}}'></span>{{text}}</li>
{{/each}}
</ul>
... ...
... ... @@ -739,8 +739,7 @@ class CartModel
* @param int $cartType 购物车类型ID
* @param int $deliveryTime 寄送时间ID
* @param int $deliveryWay 寄送方式ID
* @param string $invoiceTitle 发票说明
* @param int $invoiceId 发票类型ID
* @param array $invoices 发票参数数组
* @param int $paymentId 支付方式ID
* @param int $paymentType 支付类型ID
* @param string $remark 留言
... ... @@ -751,7 +750,7 @@ class CartModel
* @param string|null $userAgent 联盟过来用户下单时需要的User-Agent信息
* @return array 接口返回的数据
*/
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnio = '', $userAgent = null)
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoices, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnio = '', $userAgent = null)
{
$result = array('code' => 400, 'message' => '出错啦');
... ... @@ -769,7 +768,7 @@ class CartModel
$result['message'] = '请选择配送方式';
}
else {
$orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnio, $userAgent);
$orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoices, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnio, $userAgent);
UdpLog::info('【结算信息】接口返回','orderSubRes'.json_encode($orderSubRes));
if ($orderSubRes && isset($orderSubRes['code'])) {
$result = $orderSubRes;
... ...
... ... @@ -5,9 +5,8 @@ use Hood\Core\Security\AuthCode;
use Index\CartModel;
use Index\UserModel;
use Plugin\Helpers;
use Plugin\UnionTrans;
use Home\OrderModel;
use Plugin\UdpLog;
use LibModels\Wap\Home\UserData;
/**
* 购物车相关的控制器
... ... @@ -350,39 +349,53 @@ class IndexController extends AbstractAction
*/
public function invoiceInfoAction()
{
$uid = $this->getUid();
if (!$uid) {
$this->go(Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', SITE_MAIN))));
}
$userData = UserData::userData($uid);
$mobile = empty($userData['data']) || empty($userData['data']['mobile']) ? '' : $userData['data']['mobile'];
$data = array(
'invoiceInfoPage' => true,
'invoiceNotice' => '发票须知',
'phone' => '150****4536',
'completeTel' => '15050524536',
'invoiceCont' => '服装',
'phone' => $mobile ? substr_replace($mobile, '****', 3, 4) : '',
'completeTel' => $mobile,
'invoiceCont' => '图书',
'content' => array(
array(
'choosed' => true,
'choosed' => false,
'id' => 4,
'text' => '服装'
),
array(
'choosed' => false,
'choosed' => true,
'id' => 5,
'text' => '图书'
),
array(
'choosed' => false,
'id' => 6,
'text' => '配件'
),
array(
'choosed' => false,
'id' => 7,
'text' => '日用品'
),
array(
'choosed' => false,
'id' => 8,
'text' => '办公用品'
),
array(
'choosed' => false,
'id' => 9,
'text' => '体育用品'
),
array(
'choosed' => false,
'id' => 10,
'text' => '数码产品'
)
)
... ... @@ -503,8 +516,6 @@ class IndexController extends AbstractAction
$cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车
$deliveryTime = $this->post('deliveryTimeId', 1); // 默认只工作日配送
$deliveryWay = $this->post('deliveryId', 1); // 默认普通快递
$invoiceTitle = $this->post('invoiceText', null);//发票抬头
$invoiceId = $this->post('invoiceType', null);//发票类型ID
$paymentId = $this->post('paymentTypeId', 15);
$paymentType = $this->post('paymentType', 1); // 默认在线支付
$remark = $this->post('msg', null);
... ... @@ -523,13 +534,19 @@ class IndexController extends AbstractAction
/* 模拟APP的User-Agent */
$userAgent = isset($unionInfo['client_id']) ? 'YOHO!Buy/3.8.2.259(Model/PC;Channel/' . $unionInfo['client_id'] . ';uid/' . $uid . ')' : null;
}
$result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $unionKey, $userAgent);
//电子发票信息数组
$invoices = array(
'invoices_type_id' => $this->post('invoiceType', null),//发票类型ID
'invoices_type' => $this->post('invoices_type', null),//发票类型 /**纸质 1 ,电子 2 */
'receiverMobile' => $this->post('receiverMobile', null),//发票人手机
'invoices_title' => $this->post('invoiceText', null),//发票抬头
);
$result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoices, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $unionKey, $userAgent);
// 记录下单异常的数据
if (empty($result)) {
$message = 'uid:' . $uid . ',addressId:' . $addressId . ',cartType:' . $cartType . ',deliveryTime:' . $deliveryTime
. ',deliveryWay:' . $deliveryWay . 'invoiceTitle:' . $invoiceTitle . ',invoiceId:' . $invoiceId . ',yohoCoin:' . $yohoCoin
. ',deliveryWay:' . $deliveryWay . ',yohoCoin:' . $yohoCoin
. ',paymentId:' . $paymentId . ',paymentType:' . $paymentType . ',remark:' . $remark . ',couponCode:' . $couponCode . "\n";
UdpLog::info('【下单】下单异常数据','message:'.$message,'返回:'.json_encode($result));
}
... ...