|
|
|
|
|
var $ = require('jquery'),
|
|
|
common = require('../../../common/common');
|
|
|
//var couponBean = require('../CouponList/AddOrUpdate');
|
|
|
var loadModal = null;
|
|
|
var _import = function(el, type) {
|
|
|
|
|
|
return {
|
|
|
params: {
|
|
|
type: type,
|
|
|
id:common.util.__input("id"),
|
|
|
__type: "batch-import"
|
|
|
},
|
|
|
onStart: function(params) {
|
|
|
var _id = window.ViewModel.id;
|
|
|
if(_id && _id>0){
|
|
|
params.args= "{'id':"+ _id +"}" ;
|
|
|
}
|
|
|
|
|
|
console.log("params",params);
|
|
|
loadModal = common.dialog.load();
|
|
|
$("#message").html('');
|
|
|
//$(el).parents('td').find('.file-name').text($(el).val().replace("C:\\fakepath\\", ""));
|
|
|
},
|
|
|
onComplete: function(response) {
|
|
|
console.log("批量接口返回数据",response);
|
|
|
$("#message").html('');
|
|
|
if (response.code == 200) {
|
|
|
//__ajaxExeclById(response.data.taskId);
|
|
|
common.util.__tip(response.message, 'success');
|
|
|
if(response.data.successList){
|
|
|
var import_skns=[];
|
|
|
response.data.successList.forEach(function(o,i){
|
|
|
import_skns.push(o.productSkn);
|
|
|
});
|
|
|
var productLimit = window.ViewModel.productLimit + "," + import_skns.join(",");
|
|
|
$("textarea[name=\"productLimit\"]").val(productLimit);
|
|
|
}
|
|
|
}
|
|
|
if (loadModal) {
|
|
|
loadModal.close();
|
|
|
}
|
|
|
if(response.data && response.data.failFileReason.length){
|
|
|
$("#message").html(response.data.failFileReason.join('<br/>'));
|
|
|
return false;
|
|
|
}
|
|
|
common.util.__tip(response.message, 'warning');
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
$(document).on("click", "#importPrds", function () {
|
|
|
//var e = new common.edit("#brandForm");
|
|
|
var _g = $(this);
|
|
|
common.dialog.confirm("导入商品", "确认导入商品?",function(){
|
|
|
var _import_input_id = "couponProductLimit";
|
|
|
var _html = common.util.__template2($("#template_import_prds").html(), {
|
|
|
impoprtKey : _import_input_id,
|
|
|
dlFile : "/ajax/link/couponProductLimit"
|
|
|
});
|
|
|
_g.closest(".form-group").after(_html);
|
|
|
$('#'+_import_input_id).after('<div class="file-name btn btn-default">请选择文件</div>');
|
|
|
common.edit.ajaxfileupload('#'+_import_input_id, _import('#sort-file', _import_input_id));
|
|
|
});
|
|
|
_g.attr("disabled",true);
|
|
|
//e.init();
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|