Authored by 周少峰

Merge branch 'feature/invoice' into release/4.7

... ... @@ -359,8 +359,10 @@ class CartData
* @param string $cartType 购物车类型
* @param int $deliveryTime 寄送时间ID
* @param int $deliveryWay 寄送方式ID
* @param string $invoiceTitle 发票说明
* @param int $invoiceId 发票类型ID
* @param int $invoiceType 发票类型 1:纸质,2:电子
* @param string $invoiceTitle 发票抬头
* @param int $invoiceContent 发票内容
* @param string $receiverMobile 发票接收人电话
* @param int $paymentId 支付方式ID
* @param int $paymentType 支付类型ID
* @param string $remark 留言
... ... @@ -374,7 +376,7 @@ class CartData
* @param int $redEnvelopes 红包
* @return array 接口返回的数据
*/
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId,
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceType, $invoiceTitle, $invoiceContent, $receiverMobile,
$paymentId, $paymentType, $remark,$couponCode,$promotionCode, $yohoCoin, $isPreContact, $isPrintPrice, $unionKey,$userAgent, $redEnvelopes)
{
$param = Yohobuy::param();
... ... @@ -387,11 +389,18 @@ class CartData
$param['delivery_time'] = $deliveryTime;
$param['delivery_way'] = $deliveryWay;
$param['uid'] = $uid;
if (!empty($invoiceType)) {
$param['invoices_type'] = $invoiceType;
}
if (!empty($invoiceTitle)) {
$param['invoices_title'] = $invoiceTitle;
}
if (!empty($invoiceId)) {
$param['invoices_type_id'] = $invoiceId;
if (!empty($invoiceContent)) {
$param['invoice_content'] = $invoiceContent;
}
if (!empty($receiverMobile)) {
$param['receiverMobile'] = $receiverMobile;
}
if (!empty($redEnvelopes)) {
$param['use_red_envelopes'] = $redEnvelopes;
... ... @@ -420,7 +429,6 @@ class CartData
}
$param['remark'] = $remark;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param, false, false, 10, $userAgent);
}
... ... @@ -522,5 +530,5 @@ class CartData
$param['payment'] = $payment;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}
}
... ...
... ... @@ -278,24 +278,28 @@
</tbody>
</table>
<!--YOHO-->
<div class="section-play">
<div class="section-head">发票信息</div>
<div class="play-pan">
<input class="invoice mes" name="invoice" type="radio" id=""/>发票开具
<div class="invoice-content hide">
<div class="invoice-type mes">电子发票</div>
<div class="invoice-partment mes">个人</div>
<div class="invoice-kind mes">服装</div>
<button class="revise mes">修改
</div>
<div class='invoice-upload hide'>
<div class="invoice-upload-type"></div>
<div class="invoice-upload-content"></div>
<div class="invoice-upload-mobile"></div>
<div class="invoice-upload-title"></div>
</div>
</div>
</div>
<div class="play-content clearfix">
<div class="play-left">
<dl class="play-piao-pan pan">
<dt>索要发票</dt>
<dd>
<div class="play-pan">
<ul>
<li><label>发票抬头 :</label><input type="text" class="textbox" id="piaodesc" /></li>
<li><label>发票类型 :</label> <select class="dropdown" id="piaotype">
<option value="0">请选择</option>
{{#each piaoTypes}}
<option value="{{id}}">{{name}}</option>
{{/each}}
</select> </li>
</ul>
</div>
</dd>
</dl>
<dl class="play-remark-pan pan">
<dt>添加备注信息</dt>
<dd>
... ... @@ -391,7 +395,70 @@
</div>
</div>
</div>
<div class="receipt-info hide">
<div class="receipt-mask">
</div>
<div class="receipt-info-container">
<div class="receipt-title">发票信息
</div>
<div class="receipt-type receipt-margin">
<span class="e-receipt receipt-type-selected">电子发票</span>
<span class="paper-receipt">纸质发票</span>
</div>
<div class="receipt-container receipt-margin">
<div class="e-receipt-desc">
</div>
<div class="invoice-list invoice-title invoice-title-personal-hight">
<span class="invoice-star">*</span>
<span class="invoice-list-type">发票抬头</span>
<div class="invoice-line first-line">
<input checked="true" type="radio" value="1" name="title" />
<label>个人</label>
<input type="radio" value="2" name="title" />
<label>单位</label>
</div>
<div class="invoice-line second-line input-line hide">
<input id="input-organization-name" type="text" placeholder="请填写单位名称" maxlength="30"/>
<i class="enpty-input iconfont hide">&#xe626; 请填写发票抬头</i>
</div>
</div>
<div class="invoice-list invoice-content">
<span class="invoice-star">*</span>
<span class="invoice-list-type">发票内容</span>
<div class="invoice-line first-line">
{{# piaoTypes}}
<div class="blind">
<input {{#if @first}}checked="true"{{/if}} type="radio" value="{{name}}" name="content" data-receiptID="{{id}}"/>
<label>{{name}}</label>
</div>
{{/ piaoTypes}}
</div>
</div>
<div class="invoice-list invoice-phone hide">
<span class="invoice-star">*</span>
<span class="invoice-list-type">收票人手机</span>
<div class="invoice-line first-line input-line">
<input id="input-mobile" value="{{receiverMobile}}" type="text" maxlength="11"/>
<i class="enpty-input iconfont hide">&#xe626; 请填写手机号码</i>
</div>
</div>
</div>
<div class="receipt-footer">
<div class="save-receipt highlight curser-button">保存发票信息</div>
<div class="cancel-receipt normal curser-button">取消</div>
</div>
</div>
</div>
{{/ orderEnsure}}
<div class="loading"><span></span>请稍后...</div>
</div>
{{> layout/footer}}
... ...
... ... @@ -97,6 +97,25 @@
</div>
{{/ orderInfo}}
<div class="pay-mode">
<p class="sub-title">
<span class="icon"></span>
发票信息
</p>
<div class="content">
{{#if invoiceMode}}
<div class="invoice-type"><p>发票类型:{{invoiceType}}</p>
{{#if pdfUrl}}<a class="invoice-button" href="{{pdfUrl}}">电子发票下载</a>
{{/if}}
</div>
<p>发票抬头:{{title}}</p>
<p>发票内容:{{contentValue}}</p>
{{^}}
<p>暂不需要发票
{{/if}}
</div>
</div>
<div class="order-remark">
<p class="sub-title">
<span class="icon"></span>
... ...

23.7 KB | W: | H:

38.2 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

23.7 KB | W: | H:

38.2 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
... ... @@ -26,7 +26,8 @@ var $addressManage = $('.address-manage'),
$useNewAddress = $('.use-new-address'),
$existAddressList = $('.exist-address-list'),
$loading = $('.loading'),
$orderEditMain = $('#order-edit-main');
$orderEditMain = $('#order-edit-main'),
$invoiceCheck = $('.invoice');
var cartType = $addressManage.attr('cart-type');
... ... @@ -761,8 +762,10 @@ $('.to-play input.submit').click(function() {
var addressId = $('.exist-address-list input[name="address"]:checked').closest('li').attr('data-id'),
deliveryTimeId = $('.pay-time-modify input[name="pay-time-radio"]:checked').val(),
deliveryWayId = $('.select-express input[name="carriagegroup"]:checked').val(),
invoiceTitle = $('#piaodesc').val(),
invoiceId = $('#piaotype').val(),
invoiceType,
invoiceContent,
receiverMobile,
invoiceTitle,
paymentType = $('.pay-time-modify input[name="pay-type"]:checked').val(),
paymentId = $('.pay-time-modify input[name="pay-type"]:checked').data('pay'),
remark = $('#notedesc').val(),
... ... @@ -774,6 +777,13 @@ $('.to-play input.submit').click(function() {
codeVal = $juangroupInput.val(),
juanCode = !!codeVal ? codeVal : $juangroupInput.closest('li').find('#juancode').val();
if ($invoiceCheck.hasClass('active')) {
invoiceType = $('.invoice-upload-type').html();
invoiceContent = $('.invoice-upload-content').html();
receiverMobile = $('.invoice-upload-mobile').html();
invoiceTitle = $('.invoice-upload-title').html();
}
$loading.show();
if (!!$this.attr('disabled')) {
... ... @@ -791,8 +801,10 @@ $('.to-play input.submit').click(function() {
cartType: cartType,
deliveryTimeId: deliveryTimeId,
deliveryWayId: deliveryWayId,
invoiceType: invoiceType,
invoiceContent: invoiceContent,
receiverMobile: receiverMobile,
invoiceTitle: invoiceTitle,
invoiceId: invoiceId,
paymentId: paymentId,
paymentType: paymentType,
remark: remark,
... ...
... ... @@ -3,16 +3,23 @@
* @time: 2015/12/21
*/
var $ = require('yoho.jquery');
var $ = require('yoho.jquery'),
$invoiceCheck = $('.invoice'),
$receiptInfo = $('.receipt-info'),
$receiptInfoSaveBtn = $('.receipt-info .save-receipt'),
$receiptInfoCancelBtn = $('.receipt-info .cancel-receipt'),
$eReceiptBtn = $('.receipt-type .e-receipt'),
$paperReceiptBtn = $('.receipt-type .paper-receipt');
var address = require('./address');
var address = require('./address'),
receiptTitle = "个人";
var dialog = require('../common/dialog');
var accMul = function(arg1, arg2) {
var m = 0,
s1 = arg1.toString(),
s2 = arg2.toString();
s1 = arg1.toString(),
s2 = arg2.toString();
try {
m += s1.split('.')[1].length;
... ... @@ -852,3 +859,123 @@ $('.bag').find('ul').each(function() {
$next.hide();
}
});
$invoiceCheck.click(function(){
if ($invoiceCheck.hasClass('active')) {
$invoiceCheck.removeAttr('checked');
$invoiceCheck.removeClass('active');
}
if ($invoiceCheck.attr('checked')) {
$invoiceCheck.addClass('active');
if ($('.invoice-content').hasClass('hide')) {
$receiptInfo.removeClass('hide');
}
}
});
//电子发票
function saveReceiptInfo() {
var passInfoVerify = true,
receiptType,
receiptContent,
receiptMobile,
verifymobile,
invoiceType,
receiptTypeID,
invoiceTypeInt;
invoiceType = '个人';
if ($eReceiptBtn.hasClass('receipt-type-selected')) {
receiptType = "电子发票";
invoiceTypeInt = '2';
} else {
receiptType = "纸质发票";
invoiceTypeInt = '1';
}
if (receiptTitle !== "个人") {
invoiceType = '单位';
$('.input-line').each(function(){
if ($(this).find('input').val() === '') {
$(this).find('.enpty-input').removeClass('hide');
passInfoVerify = false;
};
})
receiptMobile = $('#input-mobile').val();
verifymobile = /[*0-9]{11}/;
if (!verifymobile.test(receiptMobile)) {
$('.invoice-phone .enpty-input').removeClass('hide');
passInfoVerify = false;
};
if (!passInfoVerify) {
return;
} else {
$('.invoice-title .enpty-input').addClass('hide');
$('.invoice-phone .enpty-input').addClass('hide');
receiptTitle = $('#input-organization-name').val();
}
}
receiptContent = $('input[name="content"]:checked').val();
receiptTypeID = $('input[name="content"]:checked').data('receiptid');
$('.invoice-type').html(receiptType);
$('.invoice-partment').html(invoiceType);
$('.invoice-kind').html(receiptContent);
$('.invoice-upload-type').html(invoiceTypeInt);
$('.invoice-upload-content').html(receiptTypeID);
$('.invoice-upload-mobile').html(receiptMobile);
$('.invoice-upload-title').html(receiptTitle);
$receiptInfo.addClass('hide');
$('.invoice-content').removeClass('hide');
}
$receiptInfoSaveBtn.click(function(){
saveReceiptInfo();
});
$receiptInfoCancelBtn.click(function(){
$receiptInfo.addClass('hide');
if ($('.invoice-content').hasClass('hide')) {
$invoiceCheck.removeAttr('checked');
$invoiceCheck.removeClass('active');
} else {
}
});
$('.revise').click(function(){
$receiptInfo.removeClass('hide');
});
$eReceiptBtn.click(function(){
$eReceiptBtn.addClass('receipt-type-selected');
$paperReceiptBtn.removeClass('receipt-type-selected');
$('.e-receipt-desc').removeClass('hide');
});
$paperReceiptBtn.click(function(){
$paperReceiptBtn.addClass('receipt-type-selected');
$eReceiptBtn.removeClass('receipt-type-selected');
$('.e-receipt-desc').addClass('hide');
});
$('.invoice-title').change(function(){
var selectType = $('input[name="title"]:checked').val();
if (selectType === "1") {
receiptTitle = "个人";
$('.invoice-title').addClass('invoice-title-personal-hight');
$('.invoice-title .input-line').addClass('hide');
$('.invoice-phone').addClass('hide');
} else {
receiptTitle = "单位";
$('.invoice-title').removeClass('invoice-title-personal-hight');
$('.invoice-title .input-line').removeClass('hide');
$('.invoice-phone').removeClass('hide');
}
})
... ...
... ... @@ -2,6 +2,9 @@
.none{
display: none;
}
.curser-button {
cursor: pointer;
}
.gift{
position: relative;
width: 988px;
... ... @@ -122,7 +125,7 @@
line-height: 18px;
padding: 4px 5px 4px 10px;
color: #666;
background: resolve(/cart/cartnew_tipsbox.png) no-repeat;
background: resolve(/cart/cartnew_tipsbox.png) no-repeat;
position: relative;
float: left;
... ... @@ -130,7 +133,7 @@
width: 17px;
height: 17px;
padding: 0px;
background: url(/cart/i_close_f.png) no-repeat;
background: url(/cart/i_close_f.png) no-repeat;
float: right;
cursor: pointer;
}
... ... @@ -176,7 +179,7 @@
color: #c21250;
display: block;
}
}
.giftInfo{
margin-left: 30px;
}
... ... @@ -317,10 +320,10 @@
font-size: 10px;
}
.minus{
background: url(/cart/ico_minus.png);
background: url(/cart/ico_minus.png);
}
.plus{
background: url(/cart/ico_plus.png);
background: url(/cart/ico_plus.png);
}
}
.cart-add-btn{
... ... @@ -347,7 +350,7 @@
position: relative;
border: 1px solid #dcdcdc;
background: #ebebeb;
border-radius: 3px;
border-radius: 3px;
}
.cart-del-btn,.cart-remove-btn {
height: 22px;
... ...
... ... @@ -143,6 +143,22 @@
.trace-order th {
line-height: 18px;
}
.invoice-type {
display: inline-block;
p {
display: inline-block;
}
}
.invoice-button {
display: inline-block;
margin-left: 20px;
color: #d93549;
border:1px solid #444444;
padding: 5px;
}
.differentOrder{
position: relative;
width: 100%;
... ...
... ... @@ -603,6 +603,180 @@
}
}
}
.receipt-info {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%!important;
.receipt-mask {
width: 100%;
height: 100%;
overflow: hidden;
background-color: #000;
opacity: 0.4;
z-index: 1000;
}
.receipt-info-container {
position: fixed;
top: 5%;
left: 0;
right: 0;
width: 700px;
height: auto;
margin-left: auto;
margin-right: auto;
background-color: #fff;
border: 3px solid #444;
}
.receipt-title {
margin: 42px 55px 0;
text-align: left;
font-size: 16px;
padding-bottom: 20px;
border-bottom: 3px solid #888;
}
.receipt-type {
margin: 17px 0;
span {
margin-right: 17px;
padding: 5px 15px;
font-size: 14px;
border: 1px solid #e0e0e0;
color: #505050;
}
.receipt-type-selected {
border: 1px solid #d0021b;
color: #d0021b;
}
}
.e-receipt-desc {
background: url(/order/invoice-desc.png);
width: 100%;
height: 108px;
}
.receipt-margin {
margin-left: 55px;
margin-right: 55px;
}
.invoice-list {
position: relative;
margin-top: 17px;
height: 90px;
.invoice-star {
position: absolute;
top: 0;
left: 0;
margin-top: 5px;
width: 12px;
height: 20px;
line-height: 20px;
font-size: 20px;
color: #d0021b;
text-align: center;
}
.invoice-list-type {
position: absolute;
top: 0;
left: 15px;
width: 80px;
height: 20px;
line-height: 20px;
font-size: 14px
}
.invoice-line {
position: absolute;
left: 120px;
width: 500px;
height: 30px;
}
.first-line {
top: 0;
}
.second-line {
top: 30px;
}
.input-line {
height: 40px;
input {
width: 200px;
height: 30px;
font-size: 14px;
}
}
.invoice-line label {
width: 90px;
display: inline-block;
}
.invoice-line i {
margin-left: 20px;
}
}
.invoice-title-personal-hight {
height: 30px;
}
.invoice-phone {
height: 40px;
}
.invoice-title_group{
height: 90px;
}
.blind {
display: inline-block;
margin-top: 5px;
margin-bottom: 5px;
}
.receipt-footer {
margin-left: 160px;
div {
display: inline-block;
width: 140px;
height: 40px;
line-height: 40px;
text-align: center;
margin: 30px 20px 35px 20px;
}
.highlight {
border: 1px solid #3a3a3a;
background: #3a3a3a;
color: #fff;
}
.normal {
border: 1px solid #b0b0b0;
background: #fff;
color: #444;
}
}
.enpty-input {
color: #d3132a;
}
}
}
.freebie-tag{
background:#9c3;
... ...
... ... @@ -87,6 +87,33 @@
}
}
.section-play {
margin: 20px auto;
border: 1px solid #ccc;
.section-head {
line-height: 40px;
background: #eaeaea;;
font-size: 14px;
padding-left: 20px;
font-weight: 500;
}
.play-pan {
padding-left: 20px;
line-height: 60px;
font-size: 10px;
display: inline-block;
}
.invoice-content {
display: inline-block;
}
.mes {
display: inline-block;
margin: 10px;
}
}
.play-content {
padding: 10px;
... ...
... ... @@ -224,6 +224,16 @@ class OrderModel
}
$detail['orderBalance'][] = array('promotion' => '实际应支付', 'account' => $orderDetail['amount']);
}
//发票
if (isset($orderDetail['invoice']) && $orderDetail['invoice']) {
$detail['invoiceMode'] = true;
$detail['invoiceType'] = $orderDetail['invoice']['type'];
$detail['pdfUrl'] = $orderDetail['invoice']['pdfUrl'];
$detail['title'] = $orderDetail['invoice']['title'];
$detail['contentValue'] = $orderDetail['invoice']['contentValue'];
$detail['showInvoice'] = $orderDetail['invoice']['showInvoice'];
}
$detail['yoho_give_coin'] = $orderDetail['yoho_give_coin'];
$detail['yohoCoinUrl'] = Helpers::url('/help', array('category_id' => 87)); //什么是yoho币介绍
$detail['remark'] = $orderDetail['remark'];
... ...
... ... @@ -579,6 +579,9 @@ class CartModel
do {
/* 调接口订单确认接口 */
$pay = CartData::cartPay($uid, $cartType);
//获取用户手机号码用于发票接收人
$userInfo = UserData::getUserInfo($uid);
if (!$pay || empty($pay['data']['goods_list'])) {
break;
}
... ... @@ -703,6 +706,7 @@ class CartModel
$build['name'] = $value['invoices_type_name'];
$result['piaoTypes'][] = $build;
}
$result['receiverMobile'] = isset($userInfo['data']['mobile']) && $userInfo['data']['mobile'] ? $userInfo['data']['mobile'] : '';
}
/* 需购买的商品 */
... ... @@ -895,7 +899,7 @@ class CartModel
* @param int $redEnvelopes 红包
* @return array 接口返回的数据
*/
public static function orderSub($uid, $addressId, $cartType, $deliveryTimeId, $deliveryWayId, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode,$promotionCode, $yohoCoin, $isPreContact, $isPrintPrice, $redEnvelopes)
public static function orderSub($uid, $addressId, $cartType, $deliveryTimeId, $deliveryWayId, $invoiceType, $invoiceTitle, $invoiceContent, $receiverMobile, $paymentId, $paymentType, $remark, $couponCode,$promotionCode, $yohoCoin, $isPreContact, $isPrintPrice, $redEnvelopes)
{
$result = array('code' => 400, 'message' => self::ERROR_400_MESSAGE);
... ... @@ -936,7 +940,7 @@ class CartModel
$userAgent = isset($unionInfo['client_id']) ? 'YOHO!Buy/3.8.2.259(Model/PC;Channel/' . $unionInfo['client_id'] . ';uid/' . $uid . ')' : null;
}
$orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTimeId, $deliveryWayId, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode,$promotionCode,$yohoCoin, $isPreContact, $isPrintPrice,$unionKey,$userAgent, $redEnvelopes);
$orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTimeId, $deliveryWayId, $invoiceType, $invoiceTitle, $invoiceContent, $receiverMobile, $paymentId, $paymentType, $remark, $couponCode,$promotionCode,$yohoCoin, $isPreContact, $isPrintPrice,$unionKey,$userAgent, $redEnvelopes);
if ($orderSubRes && isset($orderSubRes['code'])) {
$result = $orderSubRes;
}
... ...
... ... @@ -439,8 +439,11 @@ class IndexController extends WebAction
$cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车
$deliveryTimeId = $this->post('deliveryTimeId', 1); // 默认只工作日配送
$deliveryWayId = $this->post('deliveryWayId', 1); // 默认普通快递
$invoiceTitle = $this->post('invoiceTitle', null); // 发票抬头
$invoiceId = $this->post('invoiceId', null); // 发票类型
$invoiceType = $this->post('invoiceType', null); // 发票类型:纸质 1 ,电子 2
$invoiceTitle = $this->post('invoiceTitle', '个人'); // 发票抬头
$invoiceContent = $this->post('invoiceContent', null); // 发票内容
$receiverMobile = $this->post('receiverMobile', null); // 接收人电话
$paymentId = $this->post('paymentId', 15); // 支付ID
$paymentType = $this->post('paymentType', 1); // 默认在线支付
$remark = $this->post('remark', ''); // 备注信息
... ... @@ -450,9 +453,8 @@ class IndexController extends WebAction
$isPreContact = $this->post('isPreContact', false); // 送货前是否联系
$isPrintPrice = $this->post('isPrintPrice', true); // 是否打印价格
$redEnvelopes = $this->post('redEnvelopes', null);
// 调用下单接口
$result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTimeId, $deliveryWayId, $invoiceTitle, $invoiceId,
$result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTimeId, $deliveryWayId, $invoiceType, $invoiceTitle, $invoiceContent, $receiverMobile,
$paymentId, $paymentType, $remark, $couponCode, $promotionCode, $yohoCoin, $isPreContact, $isPrintPrice, $redEnvelopes);
// 判断是否下单成功
if (empty($result['data']['order_code'])) {
... ...
... ... @@ -112,6 +112,12 @@ class OrdersController extends WebAction
'orderBalance' => isset($detail['orderBalance']) ? $detail['orderBalance'] : array(),
'operation' => $detail['operation'],
'totalYoho' => $detail['yoho_give_coin'],
//发票信息
'invoiceMode' => $detail['invoiceMode'],
'invoiceType' => $detail['invoiceType'] === 2 ? '电子发票' : '纸质发票',
'pdfUrl' => $detail['showInvoice'] && $detail['pdfUrl'] ? $detail['pdfUrl'] : '',
'title' => $detail['title'],
'contentValue' => $detail['contentValue'] ? $detail['contentValue'] : '个人',
);
if (isset($detail['noramlPayMode'])) {
$data['orderInfo'] = $detail['orderInfo'];
... ...