Authored by 王水玲

发票

  1 +/**
  2 + * 发票信息
  3 + * @author: wsl<shuiling.wang@yoho.cn>
  4 + * @date: 2016/6/14
  5 + */
  6 +
  7 +var $ = require('jquery');
  8 +
  9 +var $invoiceNotice = $('.invoice-notice'),
  10 + $companyArea = $('.company-area');
  11 +
  12 +require('../common');
  13 +
  14 +function chooseAction(pDom, dom) {
  15 + if (dom.hasClass('icon-cb-radio')) {
  16 + return;
  17 + } else {
  18 + pDom.find('.choose').removeClass('icon-cb-radio icon-radio').addClass('icon-radio');
  19 + dom.removeClass('icon-radio').addClass('icon-cb-radio');
  20 + }
  21 +}
  22 +
  23 +// 发票抬头、发票内容选择
  24 +$('.invoice-top span, .invoice-cont li').on('touchstart', function(e) {
  25 + chooseAction($(this).parent(), $(this).find('.choose'));
  26 +
  27 + if ($(this).parent().hasClass('invoice-cont')) {
  28 + $('.choose-cont').html($(this).text());
  29 + }
  30 +
  31 + if ($(this).text() === '单位') {
  32 + $companyArea.slideDown();
  33 + }
  34 +
  35 + if ($(this).text() === '个人') {
  36 + $companyArea.slideUp();
  37 + }
  38 +});
  39 +
  40 +// 发票类型选择
  41 +$('.invoice-type span').on('touchstart', function() {
  42 + if ($(this).hasClass('on')) {
  43 + return;
  44 + } else {
  45 + $(this).addClass('on').siblings().removeClass('on');
  46 + }
  47 +});
  48 +
  49 +// 发票须知
  50 +$('.invoice-btn').on('touchstart', function() {
  51 + $invoiceNotice.fadeIn();
  52 + return false;
  53 +});
  54 +
  55 +$('.think-ok, .mask-bg').on('touchstart', function() {
  56 + $invoiceNotice.fadeOut();
  57 +});
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 @import "chose-panel"; 2 @import "chose-panel";
3 @import "gift-advance-good"; 3 @import "gift-advance-good";
4 @import "order-ensure"; 4 @import "order-ensure";
  5 +@import "invoice-info";
5 @import "select-coupon"; 6 @import "select-coupon";
6 @import "select-address"; 7 @import "select-address";
7 8
  1 +.invoice-info-page {
  2 + background: #f0f0f0;
  3 +
  4 + .invoice-btn {
  5 + position: absolute;
  6 + right: 30px;
  7 + width: auto;
  8 + font-size: 28px;
  9 + }
  10 +
  11 + .title {
  12 + color: #444;
  13 + font-size: 28px;
  14 + float: left;
  15 + }
  16 +
  17 + .invoice-form {
  18 + background: #fff;
  19 + border-bottom: 1px solid #e0e0e0;
  20 + padding: 0 30px;
  21 + box-sizing: border-box;
  22 + overflow: hidden;
  23 +
  24 + li {
  25 + width: 100%;
  26 + clear: both;
  27 + margin-top: 15px;
  28 + line-height: 60px;
  29 + float: left;
  30 + }
  31 +
  32 + li:first-child {
  33 + margin-bottom: 15px;
  34 + }
  35 +
  36 + li:last-child {
  37 + margin-bottom: 10px;
  38 + }
  39 +
  40 + .company-area {
  41 + display: none;
  42 + }
  43 +
  44 + .company {
  45 + width: 100%;
  46 + height: 88px;
  47 + line-height: 88px;
  48 + border-radius: 8px;
  49 + border: 1px solid #e0e0e0;
  50 + font-size: 28px;
  51 + color: #b0b0b0;
  52 + padding: 0 20px;
  53 + margin-bottom: 15px;
  54 + }
  55 +
  56 + .tel {
  57 + border: none;
  58 + font-size: 28px;
  59 + line-height: 60px;
  60 + }
  61 +
  62 + .invoice-type {
  63 + float: left;
  64 +
  65 + span {
  66 + width: 120px;
  67 + height: 60px;
  68 + line-height: 60px;
  69 + text-align: center;
  70 + font-size: 24px;
  71 + color: #b0b0b0;
  72 + border-radius: 5px;
  73 + border: 1px solid #b0b0b0;
  74 + display: inline-block;
  75 + background: #fff;
  76 + margin-right: 20px;
  77 + }
  78 +
  79 + .on {
  80 + background: #444;
  81 + border-color: #444;
  82 + color: #fff;
  83 + }
  84 + }
  85 +
  86 + .invoice-top {
  87 + float: left;
  88 +
  89 + span {
  90 + color: #444;
  91 + font-size: 28px;
  92 + margin-right: 55px;
  93 + }
  94 + }
  95 +
  96 + .phone {
  97 + color: #b0b0b0;
  98 + font-size: 28px;
  99 + }
  100 + }
  101 +
  102 + .invoice-cont {
  103 + background: #fff;
  104 + margin-top: 30px;
  105 + border-top: 1px solid #e0e0e0;
  106 + padding: 0 30px;
  107 + box-sizing: border-box;
  108 + color: #444;
  109 + font-size: 28px;
  110 + line-height: 48px;
  111 + overflow: hidden;
  112 + padding-bottom: 20px;
  113 +
  114 + li {
  115 + width: 100%;
  116 + margin-top: 28px;
  117 + float: left;
  118 + }
  119 +
  120 + .choose-cont {
  121 + float: right;
  122 + }
  123 + }
  124 +
  125 + .choose {
  126 + font-size: 44px;
  127 + display: inline-block;
  128 + vertical-align: top;
  129 + margin-right: 20px;
  130 + }
  131 +
  132 + .icon-radio {
  133 + color: #b0b0b0;
  134 + }
  135 +
  136 + .btn-area {
  137 + width: 100%;
  138 + border-top: 1px solid #e0e0e0;
  139 + background: #fff;
  140 +
  141 + .confirm-btn {
  142 + width: 259px;
  143 + height: 88px;
  144 + line-height: 88px;
  145 + text-align: center;
  146 + background: #d0021b;
  147 + color: #fff;
  148 + display: block;
  149 + margin: 0 auto;
  150 + border-radius: 8px;
  151 + font-size: 28px;
  152 + margin-top: 18px;
  153 + }
  154 + }
  155 +
  156 + .invoice-notice {
  157 + position: fixed;
  158 + left: 0;
  159 + right: 0;
  160 + top: 0;
  161 + bottom: 0;
  162 + display: none;
  163 + z-index: 9;
  164 +
  165 + .mask-bg {
  166 + background: rgba(0,0,0,0.4);
  167 + position: absolute;
  168 + top: 0;
  169 + left: 0;
  170 + right: 0;
  171 + bottom: 0;
  172 + }
  173 +
  174 + .notice-area {
  175 + width: 540px;
  176 + height: 400px;
  177 + background: #fafafa;
  178 + border-radius: 10px;
  179 + transform: translate(-50%, -50%);
  180 + position: absolute;
  181 + top: 50%;
  182 + left: 50%;
  183 +
  184 + .notice-cont {
  185 + padding: 40px;
  186 + }
  187 +
  188 + h2 {
  189 + text-align: center;
  190 + font-size: 28px;
  191 + color: #444;
  192 + padding-bottom: 4px;
  193 + }
  194 +
  195 + p {
  196 + font-size: 24px;
  197 + color: #444;
  198 + line-height: 38px;
  199 + }
  200 +
  201 + .think-ok {
  202 + width: 100%;
  203 + border-top: 1px solid #c5c5c5;
  204 + height: 90px;
  205 + line-height: 90px;
  206 + box-sizing: border-box;
  207 + text-align: center;
  208 + color: #d1021c;
  209 + font-size: 34px;
  210 + }
  211 + }
  212 + }
  213 +}
@@ -495,6 +495,12 @@ @@ -495,6 +495,12 @@
495 #invoice { 495 #invoice {
496 border-top: 1px solid #f7f7f7; 496 border-top: 1px solid #f7f7f7;
497 497
  498 + .invoice-type {
  499 + float: right;
  500 + font-size: 28px;
  501 + color: #444;
  502 + }
  503 +
498 label { 504 label {
499 display: block; 505 display: block;
500 border-top: 1px solid #f7f7f7; 506 border-top: 1px solid #f7f7f7;
  1 +<div class="invoice-info-page yoho-page">
  2 + {{> layout/header}}
  3 +
  4 + <ul class="invoice-form">
  5 + <li>
  6 + <span class="title">发票类型:</span>
  7 + <div class="invoice-type">
  8 + <span class="on">电子发票</span>
  9 + <span>纸质发票</span>
  10 + </div>
  11 + </li>
  12 + <li>
  13 + <span class="title">发票抬头:</span>
  14 + <div class="invoice-top">
  15 + <span><i class="iconfont choose icon-cb-radio"></i>个人</span>
  16 + <span><i class="iconfont choose icon-radio"></i>单位</span>
  17 + </div>
  18 + </li>
  19 + <li>
  20 + <span class="title">*发票人手机:</span>
  21 + <span class="phone">
  22 + {{#if phone}}
  23 + {{.}}
  24 + {{else}}
  25 + <input type="text" name="tel" class="tel" value="" placeholder="可通过手机号在发票服务平台查询">
  26 + {{/if}}
  27 + </span>
  28 + </li>
  29 + <li class="company-area"><input type="text" name="company" class="company" value="" placeholder="填写单位名称"></li>
  30 + </ul>
  31 +
  32 + <ul class="invoice-cont">
  33 + <li>
  34 + <span>发票内容:</span>
  35 + <span class="choose-cont">{{invoiceCont}}</span>
  36 + </li>
  37 + {{#each content}}
  38 + <li><span class="iconfont choose {{#if choosed}}icon-cb-radio{{else}}icon-radio{{/if}}"></span>{{text}}</li>
  39 + {{/each}}
  40 + </ul>
  41 +
  42 + <div class="btn-area"><span class="confirm-btn">确认</span><div>
  43 +
  44 + <div class="invoice-notice">
  45 + <div class="mask-bg"></div>
  46 + <div class="notice-area">
  47 + <div class="notice-cont">
  48 + <h2>发票须知</h2>
  49 + <p>1、发票金额不含优惠券/YOHO币/红包/优惠码/运费,只包含商品实付金额</p>
  50 + <p>2、电子发票:是税局认可的有效收付款凭证,其法律效力、基本用途及使用规定同纸质发票,如需纸质发票可自行下载打印</p>
  51 + </div>
  52 + <div class="think-ok">我知道了</div>
  53 + </div>
  54 + </div>
  55 +
  56 + {{> layout/footer}}
  57 +</div>
@@ -143,7 +143,11 @@ @@ -143,7 +143,11 @@
143 <li class="invoice {{#if needInvoice}}focus{{/if}}"> 143 <li class="invoice {{#if needInvoice}}focus{{/if}}">
144 <span class="title">发票</span> 144 <span class="title">发票</span>
145 <span class="iconfont checkbox {{#if needInvoice}}icon-cb-radio{{else}}icon-radio{{/if}}"></span> 145 <span class="iconfont checkbox {{#if needInvoice}}icon-cb-radio{{else}}icon-radio{{/if}}"></span>
146 - <form id="invoice"> 146 + <a id="invoice" class="invoice-info" href="invoiceInfo">
  147 + <span class="title">发票信息</span>
  148 + <span class="invoice-type">{{invoiceType}}({{#if paper}}纸质{{else}}电子{{/if}})<i class="iconfont">&#xe614;</i></span>
  149 + </a>
  150 + <!-- <form id="invoice">
147 <input type="text" name="invoice-title" value="{{invoiceText}}" maxlength="30" placeholder="发票抬头"> 151 <input type="text" name="invoice-title" value="{{invoiceText}}" maxlength="30" placeholder="发票抬头">
148 <label> 152 <label>
149 发票类型 153 发票类型
@@ -153,7 +157,7 @@ @@ -153,7 +157,7 @@
153 {{/ invoice}} 157 {{/ invoice}}
154 </select> 158 </select>
155 </label> 159 </label>
156 - </form> 160 + </form> -->
157 </li> 161 </li>
158 {{/if}} 162 {{/if}}
159 </ul> 163 </ul>
@@ -27,6 +27,9 @@ @@ -27,6 +27,9 @@
27 {{#orderDetail}} 27 {{#orderDetail}}
28 <a href="{{serviceUrl}}" target="_blank" class="iconfont nav-home">&#xe63c;</a> 28 <a href="{{serviceUrl}}" target="_blank" class="iconfont nav-home">&#xe63c;</a>
29 {{/orderDetail}} 29 {{/orderDetail}}
  30 + {{#invoiceNotice}}
  31 + <span class="invoice-btn">{{.}}</span>
  32 + {{/invoiceNotice}}
30 </header> 33 </header>
31 {{#navBtn}} 34 {{#navBtn}}
32 <div class="homebuttom hide {{#if ../boys}} boys{{/if}}{{#if ../girls}} girls{{/if}}{{#if ../kids}} kids{{/if}}{{#if ../lifeStyle}} life-style{{/if}}"> 35 <div class="homebuttom hide {{#if ../boys}} boys{{/if}}{{#if ../girls}} girls{{/if}}{{#if ../kids}} kids{{/if}}{{#if ../lifeStyle}} life-style{{/if}}">
@@ -251,6 +251,11 @@ @@ -251,6 +251,11 @@
251 seajs.use('js/cart/order-ensure'); 251 seajs.use('js/cart/order-ensure');
252 </script> 252 </script>
253 {{/if}} 253 {{/if}}
  254 +{{#if invoiceInfoPage}}
  255 +<script>
  256 + seajs.use('js/cart/invoice-info');
  257 +</script>
  258 +{{/if}}
254 {{#if selectAddressPage}} 259 {{#if selectAddressPage}}
255 <script> 260 <script>
256 seajs.use('js/me/address'); 261 seajs.use('js/me/address');
@@ -346,6 +346,54 @@ class IndexController extends AbstractAction @@ -346,6 +346,54 @@ class IndexController extends AbstractAction
346 } 346 }
347 347
348 /** 348 /**
  349 + * 发票信息
  350 + */
  351 + public function invoiceInfoAction()
  352 + {
  353 + $data = array(
  354 + 'invoiceInfoPage' => true,
  355 + 'invoiceNotice' => '发票须知',
  356 + 'phone' => '',
  357 + 'invoiceCont' => '服装',
  358 + 'content' => array(
  359 + array(
  360 + 'choosed' => true,
  361 + 'text' => '服装'
  362 + ),
  363 + array(
  364 + 'choosed' => false,
  365 + 'text' => '图书'
  366 + ),
  367 + array(
  368 + 'choosed' => false,
  369 + 'text' => '配件'
  370 + ),
  371 + array(
  372 + 'choosed' => false,
  373 + 'text' => '日用品'
  374 + ),
  375 + array(
  376 + 'choosed' => false,
  377 + 'text' => '办公用品'
  378 + ),
  379 + array(
  380 + 'choosed' => false,
  381 + 'text' => '体育用品'
  382 + ),
  383 + array(
  384 + 'choosed' => false,
  385 + 'text' => '数码产品'
  386 + )
  387 + )
  388 + );
  389 +
  390 + $this->setTitle('发票信息');
  391 + $this->setNavHeader('发票信息', true, false); // 不显示右上角home按钮
  392 +
  393 + $this->_view->display('invoice-info', $data);
  394 + }
  395 +
  396 + /**
349 * 购物车选择改变字段,重新运算订单数据 397 * 购物车选择改变字段,重新运算订单数据
350 */ 398 */
351 public function orderComputeAction() 399 public function orderComputeAction()