...
|
...
|
@@ -211,24 +211,121 @@ $("#filter-btn").click(function(){ |
|
|
|
|
|
//批量导入按钮点击事件
|
|
|
$('#import-btn').on('click', function() {
|
|
|
$('#basicTable, .bulk-import').toggle()
|
|
|
$('#basicTable, .bulk-import').toggle();
|
|
|
});
|
|
|
|
|
|
//导入excel事件
|
|
|
/*$('#sure-upload').on('click', function() {
|
|
|
console.log($('#upload-input').val());
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/goods/batchUpdatePrice'
|
|
|
}).then(function(res) {
|
|
|
console.log(res);
|
|
|
})
|
|
|
})*/
|
|
|
|
|
|
//upload-input
|
|
|
var successList = null;
|
|
|
common.edit.ajaxfileupload("#upload-input",{
|
|
|
params:{type:"price",__type:"batch-import"},
|
|
|
onStart: function() {
|
|
|
$('.load-modal').show();
|
|
|
},
|
|
|
onComplete:function(response){
|
|
|
console.log(response);
|
|
|
$('.load-modal').hide();
|
|
|
if (response.code == 200) {
|
|
|
var data = response.data,
|
|
|
li = '';
|
|
|
|
|
|
$('#priceTable').show();
|
|
|
$('.success-wrap').hide();
|
|
|
successList = data.successList;
|
|
|
$.each(data.failFileReason, function(i, value) {
|
|
|
li += '<li>' + value + '</li>';
|
|
|
});
|
|
|
$('#error-msg').empty().html(li);
|
|
|
p.init(successList);
|
|
|
} else {
|
|
|
alert(response.message);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
var isFirst = false,
|
|
|
tableHtml = '';
|
|
|
var p = new common.grid({
|
|
|
el:"#priceTable",
|
|
|
columns:[
|
|
|
{display: 'SKN', render: function(item) {
|
|
|
return item.newProductPriceBo.product_skn;
|
|
|
}},
|
|
|
{display: '吊牌价', render: function(item) {
|
|
|
return item.newProductPriceBo.retail_price + '<p style="color: #ccc;">' + item.oldProductPriceBo.retail_price + '</p>';
|
|
|
}},
|
|
|
{display: 'VIP折扣类型', render: function(item) {
|
|
|
return ENUM.vipType[item.newProductPriceBo.vip_discount_type] +
|
|
|
'<p style="color: #ccc;">' + ENUM.vipType[item.oldProductPriceBo.vip_discount_type] + '</p>';
|
|
|
}},
|
|
|
{display: 'VIP价', render: function(item) {
|
|
|
return item.newProductPriceBo.vip_price + '<p style="color: #ccc;">' + item.oldProductPriceBo.vip_price + '</p>';
|
|
|
}},
|
|
|
{display: '白金价', render: function(item) {
|
|
|
return item.newProductPriceBo.vip3_price + '<p style="color: #ccc;">' + item.oldProductPriceBo.vip3_price + '</p>';
|
|
|
}},
|
|
|
{display: '金卡价', render: function(item) {
|
|
|
return item.newProductPriceBo.vip2_price + '<p style="color: #ccc;">' + item.oldProductPriceBo.vip2_price + '</p>';
|
|
|
}},
|
|
|
{display: '银卡价', render: function(item) {
|
|
|
return item.newProductPriceBo.vip1_price + '<p style="color: #ccc;">' + item.oldProductPriceBo.vip1_price + '</p>';
|
|
|
}},
|
|
|
{display: '返币金额', render: function(item) {
|
|
|
return item.newProductPriceBo.return_coin + '<p style="color: #ccc;">' + item.oldProductPriceBo.return_coin + '</p>';
|
|
|
}},
|
|
|
{display: '操作', render: function(item) {
|
|
|
return '<a class="btn btn-info delete-btn" data-index="' + item.__index + '" href="javascript:;">删除</a>';
|
|
|
}}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
$('#priceTable').on('click', '.delete-btn', function() {
|
|
|
//var index = p.rows[$(this).data('index')];
|
|
|
|
|
|
|
|
|
successList.splice($(this).data('index'),1);
|
|
|
p.reload();
|
|
|
// console.log(p.rows);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
var path = '';
|
|
|
$('#sure-change').on('click', function() {
|
|
|
var arr = [],
|
|
|
data = '';
|
|
|
|
|
|
$.each(successList, function(i, value) {
|
|
|
arr.push(value.newProductPriceBo);
|
|
|
});
|
|
|
/*var data = arr.join('');*/
|
|
|
data = JSON.stringify(arr);
|
|
|
console.log(data);
|
|
|
common.util.__ajax({
|
|
|
url:'/goods/batchUpdatePrice',
|
|
|
data:{
|
|
|
batchList: data
|
|
|
}
|
|
|
},function(res){
|
|
|
console.log(res);
|
|
|
$('#priceTable').hide();
|
|
|
$('.success-wrap').show();
|
|
|
path = res.data;
|
|
|
//$('#download-btn').attr('href', )
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$('#download-btn').on('click', function() {
|
|
|
console.log(path);
|
|
|
/*common.util.__ajax({
|
|
|
url:'/goods/batch/download',
|
|
|
data:{
|
|
|
path: path
|
|
|
}
|
|
|
},function(res){
|
|
|
console.log(res);
|
|
|
//$('#download-btn').attr('href', )
|
|
|
});*/
|
|
|
location.href = $(this).data('domain') + '/batch/download?path=' + path;
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|