Authored by 郭成尧

Merge branch 'feature/fcs' into release/5.7

@@ -184,6 +184,7 @@ exports.orderSub = (req, res, next) => { @@ -184,6 +184,7 @@ exports.orderSub = (req, res, next) => {
184 let couponCode = req.body.couponCode || null; 184 let couponCode = req.body.couponCode || null;
185 let yohoCoin = req.body.yohoCoin || 0; 185 let yohoCoin = req.body.yohoCoin || 0;
186 let skuList = req.body.skuList || ''; 186 let skuList = req.body.skuList || '';
  187 + let isPrintPrice = req.body.isPrintPrice || 'Y';
187 let orderInfo; 188 let orderInfo;
188 189
189 try { 190 try {
@@ -259,6 +260,7 @@ exports.orderSub = (req, res, next) => { @@ -259,6 +260,7 @@ exports.orderSub = (req, res, next) => {
259 260
260 // 接口需要的其他参数 261 // 接口需要的其他参数
261 let otherParams = { 262 let otherParams = {
  263 + isPrintPrice: isPrintPrice,
262 unionKey: unionKey, // 友盟数据 264 unionKey: unionKey, // 友盟数据
263 userAgent: userAgent, 265 userAgent: userAgent,
264 isWechat: req.yoho.isWechat, 266 isWechat: req.yoho.isWechat,
@@ -164,7 +164,8 @@ exports.orderSub = (uid, addressId, cartType, deliveryTime, @@ -164,7 +164,8 @@ exports.orderSub = (uid, addressId, cartType, deliveryTime,
164 payment_type: paymentType, 164 payment_type: paymentType,
165 remark: remark, 165 remark: remark,
166 uid: uid, 166 uid: uid,
167 - udid: otherParams.udid 167 + udid: otherParams.udid,
  168 + is_print_price: otherParams.isPrintPrice
168 }; 169 };
169 170
170 /* tar add 161130 结算优化 */ 171 /* tar add 161130 结算优化 */
@@ -150,6 +150,15 @@ @@ -150,6 +150,15 @@
150 <form id="msg" action="" method="post"> 150 <form id="msg" action="" method="post">
151 <input type="text" name="msg" value="{{msg}}" maxlength="40" placeholder="留言"> 151 <input type="text" name="msg" value="{{msg}}" maxlength="40" placeholder="留言">
152 </form> 152 </form>
  153 + <ul class="sale-invoice">
  154 + <li class="no-print-price">
  155 + <span class="title">不打印价格</span>
  156 + <span class="desc">送朋友可不打印价格哦</span>
  157 + <span class="check">
  158 + <i class="iconfont checkbox{{#if isPrintPrice}} icon-radio{{else}} icon-cb-radio{{/if}}"></i>
  159 + </span>
  160 + </li>
  161 + </ul>
153 </section> 162 </section>
154 <section class="price-cal block"> 163 <section class="price-cal block">
155 <ul class="total"> 164 <ul class="total">
@@ -31,7 +31,9 @@ let $invoice = $('.invoice'), @@ -31,7 +31,9 @@ let $invoice = $('.invoice'),
31 buyNumber = $('#buyNumber').val(), 31 buyNumber = $('#buyNumber').val(),
32 headerTop = $('#yoho-header').outerHeight(), 32 headerTop = $('#yoho-header').outerHeight(),
33 isYohoCoinClick = $coinLi.data('yoho-coin-click') * 1, // 判断有货币是否可以单击 33 isYohoCoinClick = $coinLi.data('yoho-coin-click') * 1, // 判断有货币是否可以单击
34 - addressTop = $('.address-wrap').outerHeight(); 34 + addressTop = $('.address-wrap').outerHeight(),
  35 + $message = $('#msg'),
  36 + $noPrintPrice = $('.no-print-price');
35 37
36 let orderCont = cookie.get('order-info') && JSON.parse(cookie.get('order-info')); 38 let orderCont = cookie.get('order-info') && JSON.parse(cookie.get('order-info'));
37 let invoiceCont = { 39 let invoiceCont = {
@@ -287,6 +289,7 @@ function submitOrder() { @@ -287,6 +289,7 @@ function submitOrder() {
287 invoiceType: orderInfo('invoice') ? ($invoice.find('.invoice-type').val() || 289 invoiceType: orderInfo('invoice') ? ($invoice.find('.invoice-type').val() ||
288 orderInfo('invoiceType')) : null, 290 orderInfo('invoiceType')) : null,
289 msg: msg, 291 msg: msg,
  292 + isPrintPrice: orderInfo('isPrintPrice'),
290 paymentTypeId: orderInfo('paymentTypeId'), 293 paymentTypeId: orderInfo('paymentTypeId'),
291 paymentType: orderInfo('paymentType'), // 支付方式 294 paymentType: orderInfo('paymentType'), // 支付方式
292 couponCode: orderInfo('couponCode'), 295 couponCode: orderInfo('couponCode'),
@@ -417,6 +420,17 @@ $invoice.on('touchend', '.checkbox', function(e) { @@ -417,6 +420,17 @@ $invoice.on('touchend', '.checkbox', function(e) {
417 e.stopPropagation(); 420 e.stopPropagation();
418 }); 421 });
419 422
  423 +/**
  424 + * 是否打印价格
  425 + */
  426 +$noPrintPrice.on('touchend', '.checkbox', function(e) {
  427 + let $this = $(this);
  428 +
  429 + orderInfo('isPrintPrice', $this.hasClass('icon-cb-radio') ? 'N' : 'Y');
  430 + e.preventDefault();
  431 + e.stopPropagation();
  432 +});
  433 +
420 $invoice.find('[name="invoice-title"]').on('blur', function() { 434 $invoice.find('[name="invoice-title"]').on('blur', function() {
421 orderInfo('invoiceText', $(this).val()); 435 orderInfo('invoiceText', $(this).val());
422 }).end().find('.invoice-type').on('change', function() { 436 }).end().find('.invoice-type').on('change', function() {
@@ -554,6 +568,13 @@ $ticketsMobile.blur(function() { @@ -554,6 +568,13 @@ $ticketsMobile.blur(function() {
554 // 初始化发票信息内容 568 // 初始化发票信息内容
555 invoiceInit(); 569 invoiceInit();
556 570
  571 +// 留言点击滚动屏幕
  572 +$message.on('click', function() {
  573 + $('html,body').animate({
  574 + scrollTop: $message.offset().top
  575 + }, 500);
  576 +});
  577 +
557 $(window).scroll(function() { 578 $(window).scroll(function() {
558 579
559 if ($(this).scrollTop() >= (headerTop + addressTop)) { 580 if ($(this).scrollTop() >= (headerTop + addressTop)) {
@@ -59,6 +59,8 @@ $backBtn.on('touchend', function(e) { @@ -59,6 +59,8 @@ $backBtn.on('touchend', function(e) {
59 59
60 // 提交表单请求 60 // 提交表单请求
61 $addressForm.on('submit', function() { 61 $addressForm.on('submit', function() {
  62 + let username = $(this).find('[name="consignee"]').val();
  63 +
62 if (isSubmiting) { 64 if (isSubmiting) {
63 return false; 65 return false;
64 } 66 }
@@ -72,6 +74,19 @@ $addressForm.on('submit', function() { @@ -72,6 +74,19 @@ $addressForm.on('submit', function() {
72 tip.show('收件人不能为空'); 74 tip.show('收件人不能为空');
73 return false; 75 return false;
74 } 76 }
  77 +
  78 + username = username.replace(/(^\s+)|(\s+$)/g, '');
  79 +
  80 + if (username && username.length > 20) {
  81 + tip.show('收货人姓名最多支持20个字');
  82 + return false;
  83 + }
  84 +
  85 + if (username && /([^u4e00-\u9fa5])([^\p{P}])/gi.test(username)) {
  86 + tip.show('收货人姓名不支持特殊符号');
  87 + return false;
  88 + }
  89 +
75 if (!$(this).find('[name="mobile"]').val()) { 90 if (!$(this).find('[name="mobile"]').val()) {
76 tip.show('手机号不能为空'); 91 tip.show('手机号不能为空');
77 return false; 92 return false;
@@ -38,6 +38,20 @@ $area.on('click', function() { @@ -38,6 +38,20 @@ $area.on('click', function() {
38 * 提交表单 38 * 提交表单
39 */ 39 */
40 $btnSure.on('click', function() { 40 $btnSure.on('click', function() {
  41 + let username = $areaForm.find('input[name=username]').val();
  42 +
  43 + username = username.replace(/(^\s+)|(\s+$)/g, '');
  44 +
  45 + if (username && username.length > 20) {
  46 + tip.show('收货人姓名最多支持20个字');
  47 + return false;
  48 + }
  49 +
  50 + if (username && /([^u4e00-\u9fa5])([^\p{P}])/gi.test(username)) {
  51 + tip.show('收货人姓名不支持特殊符号');
  52 + return false;
  53 + }
  54 +
41 $.post('/home/orders/changeAddress', $areaForm.serialize(), function(result) { 55 $.post('/home/orders/changeAddress', $areaForm.serialize(), function(result) {
42 if (result && result.code === 200) { 56 if (result && result.code === 200) {
43 if (result.data && result.data.is_modified === 'Y') { 57 if (result.data && result.data.is_modified === 'Y') {
@@ -303,6 +303,35 @@ @@ -303,6 +303,35 @@
303 } 303 }
304 } 304 }
305 305
  306 + .no-print-price {
  307 + .title {
  308 + font-size: 34px;
  309 + color: #444;
  310 + }
  311 +
  312 + .desc {
  313 + color: #999;
  314 + }
  315 +
  316 + .check {
  317 + float: right;
  318 + color: #999;
  319 +
  320 + .checkbox {
  321 + margin-left: 5px;
  322 + color: #000;
  323 + }
  324 +
  325 + &.used {
  326 + color: #f00;
  327 + }
  328 +
  329 + em {
  330 + color: #f00;
  331 + }
  332 + }
  333 + }
  334 +
306 .address-bottom { 335 .address-bottom {
307 display: none; 336 display: none;
308 position: fixed; 337 position: fixed;
@@ -619,6 +648,7 @@ @@ -619,6 +648,7 @@
619 648
620 #msg { 649 #msg {
621 padding-top: 20px; 650 padding-top: 20px;
  651 + margin-bottom: 20px;
622 652
623 input { 653 input {
624 margin: 0; 654 margin: 0;
@@ -245,6 +245,7 @@ function tranformPayment(data, orderInfo, cartType, skuList, orderComputeData) { @@ -245,6 +245,7 @@ function tranformPayment(data, orderInfo, cartType, skuList, orderComputeData) {
245 245
246 // 留言 246 // 留言
247 orderInfo.msg && (result.msg = orderInfo.msg); 247 orderInfo.msg && (result.msg = orderInfo.msg);
  248 + result.isPrintPrice = true; // 是否不打印价格,默认不勾选,预留
248 249
249 // 订单数据 250 // 订单数据
250 if (data.shopping_cart_data) { 251 if (data.shopping_cart_data) {