Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
cailing
9 years ago
Commit
2e7d4ac2ad18b60a2cd7834da7a7db25e659c438
1 parent
4a5e3078
电子发票
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
174 additions
and
28 deletions
library/LibModels/Wap/Home/CartData.php
yohobuy/m.yohobuy.com/application/controllers/Home.php
yohobuy/m.yohobuy.com/application/models/Home/Order.php
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
library/LibModels/Wap/Home/CartData.php
View file @
2e7d4ac
...
...
@@ -366,8 +366,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 留言
...
...
@@ -378,7 +377,7 @@ class CartData
* @param string|null $userAgent 联盟过来用户下单时需要的User-Agent信息
* @return array 接口返回的数据
*/
public
static
function
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoice
Title
,
$invoiceId
,
$paymentId
,
$paymentType
,
$remark
,
$couponCode
,
$yohoCoin
,
$skuList
,
$qhyUnion
,
$userAgent
)
public
static
function
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoice
s
,
$paymentId
,
$paymentType
,
$remark
,
$couponCode
,
$yohoCoin
,
$skuList
,
$qhyUnion
,
$userAgent
)
{
$param
=
Yohobuy
::
param
();
$param
[
'debug'
]
=
'Y'
;
...
...
@@ -392,13 +391,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
[
'invoice_content'
]
=
$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
;
...
...
yohobuy/m.yohobuy.com/application/controllers/Home.php
View file @
2e7d4ac
...
...
@@ -1096,8 +1096,6 @@ class HomeController extends AbstractAction
/* 判断订单信息是否存在 */
$orderDetail
=
OrderModel
::
orderDetail
(
$orderCode
,
$this
->
_uid
,
$this
->
_usession
);
// $readd = OrderData::reAddData($this->_uid, 1611143210);
// print_r($readd);
if
(
empty
(
$orderDetail
))
{
$this
->
error
();
}
...
...
@@ -1108,6 +1106,7 @@ class HomeController extends AbstractAction
$this
->
_view
->
display
(
'order-detail'
,
array
(
'orderDetailPage'
=>
true
,
'invoice'
=>
empty
(
$orderDetail
[
'invoice'
])
?
array
()
:
$orderDetail
[
'invoice'
],
'serviceUrl'
=>
'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info='
,
'orderDetail'
=>
$orderDetail
,
'orderCode'
=>
$orderCode
,
...
...
yohobuy/m.yohobuy.com/application/models/Home/Order.php
View file @
2e7d4ac
...
...
@@ -240,6 +240,37 @@ class OrderModel
$result
[
'isJit'
]
=
true
;
$result
[
'jitDetailUrl'
]
=
Helpers
::
url
(
'/cart/index/jitDetail'
,
array
(
'orderCode'
=>
$orderCode
,
'sessionKey'
=>
$sessionKey
));
}
$result
[
'invoice'
]
=
array
();
//电子发票
do
{
if
(
empty
(
$orderDetail
[
'data'
][
'invoice'
])
||
!
isset
(
$orderDetail
[
'data'
][
'invoice'
])){
break
;
}
//判断是否显示电子发票相关信息
if
(
isset
(
$orderDetail
[
'data'
][
'invoice'
][
'type'
])
==
false
&&
empty
(
$orderDetail
[
'data'
][
'invoice'
][
'type'
])){
break
;
}
//判断是否显示电子发票下载地址
$result
[
'invoice'
]
=
$orderDetail
[
'data'
][
'invoice'
];
//纸质 1,电子 2
$result
[
'invoice'
][
'type'
]
=
$result
[
'invoice'
][
'type'
]
*
1
===
2
?
true
:
false
;
//发票类型
$result
[
'invoice'
][
'title'
]
=
$result
[
'invoice'
][
'title'
];
//发票抬头
$result
[
'invoice'
][
'contentValue'
]
=
$result
[
'invoice'
][
'contentValue'
];
//发票内容
$result
[
'invoice'
][
'mobilePhone'
]
=
$result
[
'invoice'
][
'mobilePhone'
];
//联系电话
//电子发票下载链接
if
(
$orderDetail
[
'data'
][
'invoice'
][
'showInvoice'
]
==
true
&&
isset
(
$orderDetail
[
'data'
][
'invoice'
][
'pdfUrl'
])){
$result
[
'invoice'
][
'pdfUrl'
]
=
$result
[
'invoice'
][
'pdfUrl'
];
}
}
while
(
false
);
// $result['invoice'] = array(
// 'type' => true,//-- 纸质 false,电子 true
// 'title' => '发票抬头',// --发票抬头
// 'contentValue' => '服饰',//-- 发票内容
// 'mobilePhone' => '13651898702',//--电话
// '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下载地址
// );
}
//取消订单原因列表
$resons
=
OrderData
::
closeReasons
();
...
...
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
View file @
2e7d4ac
...
...
@@ -571,14 +571,11 @@ class CartModel
// 发票有关数据
if
(
isset
(
$payReturn
[
'invoices'
])
&&
!
empty
(
$payReturn
[
'invoices'
]))
{
$one
=
array
();
foreach
(
$payReturn
[
'invoices'
][
'invoices_type_list'
]
as
$inv
)
{
$one
=
array
();
$one
[
'id'
]
=
$inv
[
'invoices_type_id'
];
$one
[
'name'
]
=
$inv
[
'invoices_type_name'
];
isset
(
$orderInfo
[
'invoiceType'
])
&&
$one
[
'id'
]
==
$orderInfo
[
'invoiceType'
]
&&
$one
[
'isSelected'
]
=
true
;
$result
[
'invoice'
][]
=
$one
;
foreach
(
$payReturn
[
'invoices'
][
'invoiceContentList'
]
as
$inv
)
{
$result
[
'invoice'
][]
=
array
(
'id'
=>
$inv
[
'invoices_type_id'
],
'name'
=>
$inv
[
'invoices_type_name'
],
);
}
// 发票信息需要记录
...
...
@@ -745,8 +742,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 留言
...
...
@@ -757,7 +753,7 @@ class CartModel
* @param string|null $userAgent 联盟过来用户下单时需要的User-Agent信息
* @return array 接口返回的数据
*/
public
static
function
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoice
Title
,
$invoiceId
,
$paymentId
,
$paymentType
,
$remark
,
$couponCode
,
$yohoCoin
,
$skuList
,
$qhyUnio
=
''
,
$userAgent
=
null
)
public
static
function
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoice
s
,
$paymentId
,
$paymentType
,
$remark
,
$couponCode
,
$yohoCoin
,
$skuList
,
$qhyUnio
=
''
,
$userAgent
=
null
)
{
$result
=
array
(
'code'
=>
400
,
'message'
=>
'出错啦'
);
...
...
@@ -775,7 +771,7 @@ class CartModel
$result
[
'message'
]
=
'请选择配送方式'
;
}
else
{
$orderSubRes
=
CartData
::
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoice
Title
,
$invoiceId
,
$paymentId
,
$paymentType
,
$remark
,
$couponCode
,
$yohoCoin
,
$skuList
,
$qhyUnio
,
$userAgent
);
$orderSubRes
=
CartData
::
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoice
s
,
$paymentId
,
$paymentType
,
$remark
,
$couponCode
,
$yohoCoin
,
$skuList
,
$qhyUnio
,
$userAgent
);
UdpLog
::
info
(
'【结算信息】接口返回'
,
'orderSubRes'
.
json_encode
(
$orderSubRes
));
if
(
$orderSubRes
&&
isset
(
$orderSubRes
[
'code'
]))
{
$result
=
$orderSubRes
;
...
...
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
View file @
2e7d4ac
...
...
@@ -8,6 +8,7 @@ use Plugin\Helpers;
use
Plugin\UnionTrans
;
use
Home\OrderModel
;
use
Plugin\UdpLog
;
use
LibModels\Wap\Home\UserData
;
/**
* 购物车相关的控制器
...
...
@@ -333,11 +334,13 @@ class IndexController extends AbstractAction
$this
->
echoJson
(
$order
);
return
;
}
$userData
=
UserData
::
userData
(
$uid
);
$mobile
=
empty
(
$userData
[
'data'
])
||
empty
(
$userData
[
'data'
][
'mobile'
])
?
''
:
$userData
[
'data'
][
'mobile'
];
//发票人手机
$data
=
array
(
'orderEnsurePage'
=>
true
,
'isOrdinaryCart'
=>
(
$cartType
!==
'advance'
),
'orderEnsure'
=>
$order
'orderEnsure'
=>
$order
,
'userMobile'
=>
$mobile
);
$this
->
setTitle
(
'确认订单'
);
...
...
@@ -347,6 +350,108 @@ 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
))));
}
$cookieData
=
$this
->
getCookie
(
'order-info'
,
null
);
//从缓存中获取电子发票信息
$userData
=
UserData
::
userData
(
$uid
);
$userMobile
=
empty
(
$userData
[
'data'
])
||
empty
(
$userData
[
'data'
][
'mobile'
])
?
''
:
$userData
[
'data'
][
'mobile'
];
//发票人手机
if
(
!
empty
(
$cookieData
))
{
$orderInfo
=
json_decode
(
$cookieData
,
true
);
$invoiceType
=
$orderInfo
[
'invoiceType'
];
//发票类型ID
$invoices_type
=
$orderInfo
[
'invoicesType'
]
*
1
;
//发票类型 /**纸质 1 ,电子 2 */
$mobile
=
isset
(
$orderInfo
[
'receiverMobile'
])
&&
!
empty
(
$orderInfo
[
'receiverMobile'
])
?
$orderInfo
[
'receiverMobile'
]
:
$userMobile
;
//发票人手机
$invoices_title
=
$orderInfo
[
'invoiceText'
];
//发票抬头
$invoice_Top
=
$orderInfo
[
'invoiceTitle'
];
}
else
{
$userData
=
UserData
::
userData
(
$uid
);
$mobile
=
$userMobile
;
//发票人手机
$invoiceType
=
'7'
;
//发票类型ID
$invoices_type
=
'2'
;
//发票类型 /**纸质 1 ,电子 2 */
$invoice_Top
=
'个人'
;
}
$data
=
array
(
'invoiceInfoPage'
=>
true
,
'invoiceNotice'
=>
'发票须知'
,
'phone'
=>
$mobile
?
substr_replace
(
$mobile
,
'****'
,
3
,
4
)
:
''
,
'completeTel'
=>
$mobile
,
'isCompany'
=>
$invoice_Top
==
'单位'
?
false
:
true
,
'companyName'
=>
$invoices_title
,
'invoicesType'
=>
array
(
array
(
'id'
=>
'2'
,
'type'
=>
'电子发票'
,
'choosed'
=>
empty
(
$invoices_type
)
||
$invoices_type
==
2
?
true
:
false
,
),
array
(
'id'
=>
'1'
,
'type'
=>
'纸质发票'
,
'choosed'
=>
$invoices_type
==
1
?
true
:
false
,
)
),
'invoiceTitle'
=>
array
(
array
(
'type'
=>
'个人'
,
'choosed'
=>
$invoice_Top
==
'个人'
?
true
:
false
,
),
array
(
'type'
=>
'单位'
,
'choosed'
=>
$invoice_Top
==
'单位'
?
true
:
false
,
)
),
'content'
=>
array
(
array
(
'choosed'
=>
empty
(
$invoiceType
)
||
$invoiceType
==
7
?
true
:
false
,
'id'
=>
7
,
'text'
=>
'服装'
),
array
(
'choosed'
=>
$invoiceType
==
1
?
true
:
false
,
'id'
=>
1
,
'text'
=>
'图书'
),
array
(
'choosed'
=>
$invoiceType
==
9
?
true
:
false
,
'id'
=>
9
,
'text'
=>
'配件'
),
array
(
'choosed'
=>
$invoiceType
==
11
?
true
:
false
,
'id'
=>
11
,
'text'
=>
'日用品'
),
array
(
'choosed'
=>
$invoiceType
==
3
?
true
:
false
,
'id'
=>
3
,
'text'
=>
'办公用品'
),
array
(
'choosed'
=>
$invoiceType
==
6
?
true
:
false
,
'id'
=>
6
,
'text'
=>
'体育用品'
),
array
(
'choosed'
=>
$invoiceType
==
10
?
true
:
false
,
'id'
=>
10
,
'text'
=>
'数码产品'
)
)
);
$this
->
setTitle
(
'发票信息'
);
$this
->
setNavHeader
(
'发票信息'
,
true
,
false
);
// 不显示右上角home按钮
$this
->
_view
->
display
(
'invoice-info'
,
$data
);
}
/**
* 购物车选择改变字段,重新运算订单数据
*/
public
function
orderComputeAction
()
...
...
@@ -455,14 +560,22 @@ 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
);
$paymentId
=
$this
->
post
(
'paymentTypeId'
,
15
);
$paymentType
=
$this
->
post
(
'paymentType'
,
1
);
// 默认在线支付
$remark
=
$this
->
post
(
'msg'
,
null
);
$couponCode
=
$this
->
post
(
'couponCode'
,
null
);
$yohoCoin
=
$this
->
post
(
'yohoCoin'
,
1
);
$skuList
=
$this
->
post
(
'skuList'
,
''
);
$cookieData
=
$this
->
getCookie
(
'order-info'
,
null
);
//获取电子发票信息
//电子发票信息数组
$invoices
=
array
();
if
(
!
empty
(
$cookieData
))
{
$orderInfo
=
json_decode
(
$cookieData
,
true
);
$invoices
[
'invoices_type_id'
]
=
$orderInfo
[
'invoiceType'
];
//发票类型ID
$invoices
[
'invoices_type'
]
=
$orderInfo
[
'invoicesType'
];
//发票类型 /**纸质 1 ,电子 2 */
$invoices
[
'receiverMobile'
]
=
$orderInfo
[
'receiverMobile'
];
//发票人手机
$invoices
[
'invoices_title'
]
=
empty
(
$orderInfo
[
'invoiceText'
])
?
'个人'
:
$orderInfo
[
'invoiceText'
];
//发票抬头
}
/* 判断是否是友盟过来的用户 */
$userAgent
=
null
;
...
...
@@ -475,8 +588,7 @@ 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
);
$result
=
CartModel
::
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoices
,
$paymentId
,
$paymentType
,
$remark
,
$couponCode
,
$yohoCoin
,
$skuList
,
$unionKey
,
$userAgent
);
// 记录下单异常的数据
if
(
empty
(
$result
))
{
...
...
Please
register
or
login
to post a comment