Authored by biao

update for special reason

... ... @@ -7,6 +7,7 @@ var _alert = dialog.Alert;
var addrSelector = require('../plugins/cascading-address');
var addr;
var nameReg = /^[\u4e00-\u9fa5]{2,5}$/;
var addressReg = /^[\s\S]{2,100}$/;
var phoneReg = /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
... ... @@ -320,6 +321,9 @@ function bindConfirmEvent() {
var $changeGood = $('.change-info-box.will-change');
var changeGoodsList = [];
var changeData = {};
var $specialReason = $changeGood.find('.special-reason');
var $imgs;
var imgs = [];
if (!validateData()) {
return false;
... ... @@ -341,6 +345,18 @@ function bindConfirmEvent() {
goodObj.exchange_reason = $c.find('.exchange-reasons').data('reason');
goodObj.new_goods_id = $f.find('.color-list .img-box.active img').data('goodsId');
goodObj.new_product_sku = $f.find('.size-list span.active').data('sku');
if ($specialReason.length && $specialReason.get(0).style.display === 'block') {
goodObj.remark = $specialReason.find('.right-content').find('.mark-text').val();
$imgs = $specialReason.find('.right-content').find('img');
$imgs.each(function(idx, img) {
imgs.push(img.src);
});
goodObj.evidence_images = imgs;
}
changeGoodsList.push(goodObj);
});
... ... @@ -375,6 +391,38 @@ function initAddr() {
});
}
function bindUploadEvent() {
var $tip = $('.img-up-tip');
$tip.text('0/4');
$('.img-upload').on('click', function() {
var upload = require('../plugins/upload');
var that = this;
// var number = parseInt($t.text().split('/')[0]);
var number = $(that).siblings('img').length;
if (number < 4) {
upload.up({
callback: function(result) {
var img;
var $t;
if (result.code === 200) {
img = '<img class="envidence" src="' + result.data + '" alt="凭证图片">';
$t = $(that).next('.img-up-tip');
$(that).before(img);
number += 1;
$t.text(number + '/4');
}
}
});
}
});
}
$(document).on('ready', function() {
getProductInfo();
bindSelectEvent();
... ... @@ -383,4 +431,5 @@ $(document).on('ready', function() {
bindConfirmEvent();
initAddr();
bindBlurEvent();
bindUploadEvent();
});
... ...
... ... @@ -165,4 +165,11 @@
cursor: pointer;
}
}
img.envidence {
width: 60px;
height: 60px;
margin-right: 10px;
float: left;
}
}
... ...