Authored by yyq

personal invoice

@@ -103,6 +103,12 @@ @@ -103,6 +103,12 @@
103 </span> 103 </span>
104 </div> 104 </div>
105 </li> 105 </li>
  106 + <li class="invoice-personal-name invoice-row personal-row">
  107 + <span class="row-title"></span>
  108 + <div class="row-content">
  109 + <input id="personal-name" class="personal-name" type="text" placeholder="个人( 可修改 )">
  110 + </div>
  111 + </li>
106 <li class="invoice-title-name invoice-row company-row hide"> 112 <li class="invoice-title-name invoice-row company-row hide">
107 <span class="row-title"> 113 <span class="row-title">
108 <em>*</em> 114 <em>*</em>
@@ -59,6 +59,7 @@ function validateInvoice($el, info) { @@ -59,6 +59,7 @@ function validateInvoice($el, info) {
59 59
60 function bindInvoiceEvent($el) { 60 function bindInvoiceEvent($el) {
61 var $titleWrap = $('.invoice-title', $el), 61 var $titleWrap = $('.invoice-title', $el),
  62 + $personalRow = $('.personal-row', $el),
62 $companyRow = $('.company-row', $el); 63 $companyRow = $('.company-row', $el);
63 64
64 $titleWrap.on('click', '.radio-btn', function() { 65 $titleWrap.on('click', '.radio-btn', function() {
@@ -71,8 +72,10 @@ function bindInvoiceEvent($el) { @@ -71,8 +72,10 @@ function bindInvoiceEvent($el) {
71 72
72 if (id * 1 === 2) { 73 if (id * 1 === 2) {
73 $companyRow.removeClass('hide'); 74 $companyRow.removeClass('hide');
  75 + $personalRow.addClass('hide');
74 } else { 76 } else {
75 $companyRow.addClass('hide'); 77 $companyRow.addClass('hide');
  78 + $personalRow.removeClass('hide');
76 } 79 }
77 80
78 $titleWrap.find('.on').removeClass('on'); 81 $titleWrap.find('.on').removeClass('on');
@@ -93,6 +96,8 @@ function bindInvoiceInfo($el, info) { @@ -93,6 +96,8 @@ function bindInvoiceInfo($el, info) {
93 if (info.titleId === 2) { 96 if (info.titleId === 2) {
94 $('#company-name', $el).val(info.titleName || ''); 97 $('#company-name', $el).val(info.titleName || '');
95 $('#company-tax-num', $el).val(info.taxNumber || ''); 98 $('#company-tax-num', $el).val(info.taxNumber || '');
  99 + } else {
  100 + $('#personal-name', $el).val(info.titleName || '');
96 } 101 }
97 } 102 }
98 103
@@ -110,10 +115,10 @@ function packInvoiceInfo($el) { @@ -110,10 +115,10 @@ function packInvoiceInfo($el) {
110 resData.titleId = $('.invoice-title .on', $el).data('id') || 1; 115 resData.titleId = $('.invoice-title .on', $el).data('id') || 1;
111 116
112 if (resData.titleId * 1 === 1) { 117 if (resData.titleId * 1 === 1) {
113 - resData.titleName = '个人'; 118 + resData.titleName = $.trim($('#personal-name', $el).val()) || '个人';
114 } else { 119 } else {
115 - resData.titleName = $('#company-name', $el).val();  
116 - resData.taxNumber = $('#company-tax-num', $el).val(); 120 + resData.titleName = $.trim($('#company-name', $el).val());
  121 + resData.taxNumber = $.trim($('#company-tax-num', $el).val());
117 } 122 }
118 123
119 if (receiver) { 124 if (receiver) {