Authored by Your Name

Merge branch 'release/4.7' of http://git.yoho.cn/fe/YOHOBUYPC into release/4.7

@@ -441,7 +441,7 @@ @@ -441,7 +441,7 @@
441 </div> 441 </div>
442 </div> 442 </div>
443 443
444 - <div class="invoice-list invoice-phone hide"> 444 + <div class="invoice-list invoice-phone">
445 <span class="invoice-star">*</span> 445 <span class="invoice-star">*</span>
446 <span class="invoice-list-type">收票人手机</span> 446 <span class="invoice-list-type">收票人手机</span>
447 <div class="invoice-line first-line input-line"> 447 <div class="invoice-line first-line input-line">
@@ -11,8 +11,11 @@ var $ = require('yoho.jquery'), @@ -11,8 +11,11 @@ var $ = require('yoho.jquery'),
11 $eReceiptBtn = $('.receipt-type .e-receipt'), 11 $eReceiptBtn = $('.receipt-type .e-receipt'),
12 $paperReceiptBtn = $('.receipt-type .paper-receipt'); 12 $paperReceiptBtn = $('.receipt-type .paper-receipt');
13 13
  14 +
14 var address = require('./address'), 15 var address = require('./address'),
15 - receiptTitle = "个人"; 16 + receiptTitle = "个人",
  17 + receiptMobile = $('#input-mobile').val(),
  18 + receiptMobileStar;
16 19
17 var dialog = require('../common/dialog'); 20 var dialog = require('../common/dialog');
18 21
@@ -876,17 +879,20 @@ $invoiceCheck.click(function(){ @@ -876,17 +879,20 @@ $invoiceCheck.click(function(){
876 }); 879 });
877 880
878 //电子发票 881 //电子发票
  882 +
  883 +(function receiptMobileToStarString(numb) {
  884 + receiptMobileStar = numb.substr(0, 3) + '****' + numb.substr(7);
  885 + $('#input-mobile').val(receiptMobileStar);
  886 +}(receiptMobile));
  887 +
879 function saveReceiptInfo() { 888 function saveReceiptInfo() {
880 var passInfoVerify = true, 889 var passInfoVerify = true,
881 receiptType, 890 receiptType,
882 receiptContent, 891 receiptContent,
883 - receiptMobile,  
884 verifymobile, 892 verifymobile,
885 - invoiceType,  
886 receiptTypeID, 893 receiptTypeID,
887 - invoiceTypeInt;  
888 -  
889 - invoiceType = '个人'; 894 + invoiceTypeInt,
  895 + finalReceiptMobile;
890 896
891 if ($eReceiptBtn.hasClass('receipt-type-selected')) { 897 if ($eReceiptBtn.hasClass('receipt-type-selected')) {
892 receiptType = "电子发票"; 898 receiptType = "电子发票";
@@ -896,39 +902,49 @@ function saveReceiptInfo() { @@ -896,39 +902,49 @@ function saveReceiptInfo() {
896 invoiceTypeInt = '1'; 902 invoiceTypeInt = '1';
897 } 903 }
898 904
899 - if (receiptTitle !== "个人") {  
900 - invoiceType = '单位'; 905 + if (receiptTitle === "单位") {
901 $('.input-line').each(function(){ 906 $('.input-line').each(function(){
902 if ($(this).find('input').val() === '') { 907 if ($(this).find('input').val() === '') {
903 $(this).find('.enpty-input').removeClass('hide'); 908 $(this).find('.enpty-input').removeClass('hide');
904 passInfoVerify = false; 909 passInfoVerify = false;
905 }; 910 };
906 }) 911 })
907 - receiptMobile = $('#input-mobile').val();  
908 - verifymobile = /[*0-9]{11}/;  
909 - if (!verifymobile.test(receiptMobile)) { 912 + };
  913 +
  914 + finalReceiptMobile = $('#input-mobile').val();
  915 + if (finalReceiptMobile === receiptMobileStar) {
  916 + finalReceiptMobile = receiptMobile;
  917 + } else {
  918 + verifymobile = /[0-9]{11}/;
  919 + if (!verifymobile.test(finalReceiptMobile)) {
910 $('.invoice-phone .enpty-input').removeClass('hide'); 920 $('.invoice-phone .enpty-input').removeClass('hide');
  921 + if (finalReceiptMobile.length === 0) {
  922 + $('.invoice-phone .enpty-input').html('&#xe626; 请填写手机号码');
  923 + } else {
  924 + $('.invoice-phone .enpty-input').html('&#xe626; 手机号码不正确');
  925 + }
911 passInfoVerify = false; 926 passInfoVerify = false;
912 - };  
913 - if (!passInfoVerify) {  
914 - return;  
915 - } else {  
916 - $('.invoice-title .enpty-input').addClass('hide');  
917 - $('.invoice-phone .enpty-input').addClass('hide');  
918 - receiptTitle = $('#input-organization-name').val();  
919 } 927 }
920 } 928 }
  929 +
  930 + if (!passInfoVerify) {
  931 + return;
  932 + } else {
  933 + $('.invoice-title .enpty-input').addClass('hide');
  934 + $('.invoice-phone .enpty-input').addClass('hide');
  935 + receiptTitle = $('#input-organization-name').val();
  936 + }
921 937
922 receiptContent = $('input[name="content"]:checked').val(); 938 receiptContent = $('input[name="content"]:checked').val();
923 receiptTypeID = $('input[name="content"]:checked').data('receiptid'); 939 receiptTypeID = $('input[name="content"]:checked').data('receiptid');
924 940
925 $('.invoice-type').html(receiptType); 941 $('.invoice-type').html(receiptType);
926 - $('.invoice-partment').html(invoiceType); 942 + $('.invoice-partment').html(receiptTitle);
927 $('.invoice-kind').html(receiptContent); 943 $('.invoice-kind').html(receiptContent);
928 944
929 $('.invoice-upload-type').html(invoiceTypeInt); 945 $('.invoice-upload-type').html(invoiceTypeInt);
930 $('.invoice-upload-content').html(receiptTypeID); 946 $('.invoice-upload-content').html(receiptTypeID);
931 - $('.invoice-upload-mobile').html(receiptMobile); 947 + $('.invoice-upload-mobile').html(finalReceiptMobile);
932 $('.invoice-upload-title').html(receiptTitle); 948 $('.invoice-upload-title').html(receiptTitle);
933 949
934 $receiptInfo.addClass('hide'); 950 $receiptInfo.addClass('hide');
@@ -971,11 +987,9 @@ $('.invoice-title').change(function(){ @@ -971,11 +987,9 @@ $('.invoice-title').change(function(){
971 receiptTitle = "个人"; 987 receiptTitle = "个人";
972 $('.invoice-title').addClass('invoice-title-personal-hight'); 988 $('.invoice-title').addClass('invoice-title-personal-hight');
973 $('.invoice-title .input-line').addClass('hide'); 989 $('.invoice-title .input-line').addClass('hide');
974 - $('.invoice-phone').addClass('hide');  
975 } else { 990 } else {
976 receiptTitle = "单位"; 991 receiptTitle = "单位";
977 $('.invoice-title').removeClass('invoice-title-personal-hight'); 992 $('.invoice-title').removeClass('invoice-title-personal-hight');
978 $('.invoice-title .input-line').removeClass('hide'); 993 $('.invoice-title .input-line').removeClass('hide');
979 - $('.invoice-phone').removeClass('hide');  
980 } 994 }
981 }) 995 })
@@ -698,14 +698,14 @@ class CartModel @@ -698,14 +698,14 @@ class CartModel
698 } 698 }
699 } 699 }
700 700
701 - /* 发票类型 */  
702 - if (!empty($pay['data']['invoices']['invoices_type_list'])) {  
703 - $build = array();  
704 - foreach ($pay['data']['invoices']['invoices_type_list'] as $value) {  
705 - $build['id'] = $value['invoices_type_id'];  
706 - $build['name'] = $value['invoices_type_name'];  
707 - $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'];
708 } 706 }
  707 + ksort($result['piaoTypes']);
  708 + $result['piaoTypes'] = array_values($result['piaoTypes']);
709 $result['receiverMobile'] = isset($userInfo['data']['mobile']) && $userInfo['data']['mobile'] ? $userInfo['data']['mobile'] : ''; 709 $result['receiverMobile'] = isset($userInfo['data']['mobile']) && $userInfo['data']['mobile'] ? $userInfo['data']['mobile'] : '';
710 } 710 }
711 711