update for special reason
Showing
2 changed files
with
56 additions
and
0 deletions
@@ -7,6 +7,7 @@ var _alert = dialog.Alert; | @@ -7,6 +7,7 @@ var _alert = dialog.Alert; | ||
7 | var addrSelector = require('../plugins/cascading-address'); | 7 | var addrSelector = require('../plugins/cascading-address'); |
8 | var addr; | 8 | var addr; |
9 | 9 | ||
10 | + | ||
10 | var nameReg = /^[\u4e00-\u9fa5]{2,5}$/; | 11 | var nameReg = /^[\u4e00-\u9fa5]{2,5}$/; |
11 | var addressReg = /^[\s\S]{2,100}$/; | 12 | var addressReg = /^[\s\S]{2,100}$/; |
12 | var phoneReg = /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/; | 13 | var phoneReg = /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/; |
@@ -320,6 +321,9 @@ function bindConfirmEvent() { | @@ -320,6 +321,9 @@ function bindConfirmEvent() { | ||
320 | var $changeGood = $('.change-info-box.will-change'); | 321 | var $changeGood = $('.change-info-box.will-change'); |
321 | var changeGoodsList = []; | 322 | var changeGoodsList = []; |
322 | var changeData = {}; | 323 | var changeData = {}; |
324 | + var $specialReason = $changeGood.find('.special-reason'); | ||
325 | + var $imgs; | ||
326 | + var imgs = []; | ||
323 | 327 | ||
324 | if (!validateData()) { | 328 | if (!validateData()) { |
325 | return false; | 329 | return false; |
@@ -341,6 +345,18 @@ function bindConfirmEvent() { | @@ -341,6 +345,18 @@ function bindConfirmEvent() { | ||
341 | goodObj.exchange_reason = $c.find('.exchange-reasons').data('reason'); | 345 | goodObj.exchange_reason = $c.find('.exchange-reasons').data('reason'); |
342 | goodObj.new_goods_id = $f.find('.color-list .img-box.active img').data('goodsId'); | 346 | goodObj.new_goods_id = $f.find('.color-list .img-box.active img').data('goodsId'); |
343 | goodObj.new_product_sku = $f.find('.size-list span.active').data('sku'); | 347 | goodObj.new_product_sku = $f.find('.size-list span.active').data('sku'); |
348 | + | ||
349 | + if ($specialReason.length && $specialReason.get(0).style.display === 'block') { | ||
350 | + goodObj.remark = $specialReason.find('.right-content').find('.mark-text').val(); | ||
351 | + | ||
352 | + $imgs = $specialReason.find('.right-content').find('img'); | ||
353 | + | ||
354 | + $imgs.each(function(idx, img) { | ||
355 | + imgs.push(img.src); | ||
356 | + }); | ||
357 | + | ||
358 | + goodObj.evidence_images = imgs; | ||
359 | + } | ||
344 | changeGoodsList.push(goodObj); | 360 | changeGoodsList.push(goodObj); |
345 | }); | 361 | }); |
346 | 362 | ||
@@ -375,6 +391,38 @@ function initAddr() { | @@ -375,6 +391,38 @@ function initAddr() { | ||
375 | }); | 391 | }); |
376 | } | 392 | } |
377 | 393 | ||
394 | +function bindUploadEvent() { | ||
395 | + var $tip = $('.img-up-tip'); | ||
396 | + | ||
397 | + $tip.text('0/4'); | ||
398 | + | ||
399 | + $('.img-upload').on('click', function() { | ||
400 | + var upload = require('../plugins/upload'); | ||
401 | + var that = this; | ||
402 | + | ||
403 | + // var number = parseInt($t.text().split('/')[0]); | ||
404 | + var number = $(that).siblings('img').length; | ||
405 | + | ||
406 | + if (number < 4) { | ||
407 | + upload.up({ | ||
408 | + callback: function(result) { | ||
409 | + var img; | ||
410 | + var $t; | ||
411 | + | ||
412 | + if (result.code === 200) { | ||
413 | + img = '<img class="envidence" src="' + result.data + '" alt="凭证图片">'; | ||
414 | + $t = $(that).next('.img-up-tip'); | ||
415 | + | ||
416 | + $(that).before(img); | ||
417 | + number += 1; | ||
418 | + $t.text(number + '/4'); | ||
419 | + } | ||
420 | + } | ||
421 | + }); | ||
422 | + } | ||
423 | + }); | ||
424 | +} | ||
425 | + | ||
378 | $(document).on('ready', function() { | 426 | $(document).on('ready', function() { |
379 | getProductInfo(); | 427 | getProductInfo(); |
380 | bindSelectEvent(); | 428 | bindSelectEvent(); |
@@ -383,4 +431,5 @@ $(document).on('ready', function() { | @@ -383,4 +431,5 @@ $(document).on('ready', function() { | ||
383 | bindConfirmEvent(); | 431 | bindConfirmEvent(); |
384 | initAddr(); | 432 | initAddr(); |
385 | bindBlurEvent(); | 433 | bindBlurEvent(); |
434 | + bindUploadEvent(); | ||
386 | }); | 435 | }); |
-
Please register or login to post a comment