Authored by xuhongyun

Merge branch 'dev-批量导入学生价' into grey

... ... @@ -110,4 +110,15 @@ module.exports=function(app) {
}
});
/*批量修改学生价格*/
app.get("/supplier/baseproduct/batchUpdateStudentPrice","goods.batchUpdateStudentPrice.Batch",function(){
this.$extend={
moduleName:"基础商品",
pageName:"批量修改学生价",
isPL:true
}
});
/*通过任务ID查看任务是否被执行完 学生价变价*/
app.post("/product/queryBatchImportStudentPriceResult","basegoods_queryBatchUpdateStudentPriceResult");
}
\ No newline at end of file
... ...
... ... @@ -192,6 +192,13 @@ module.exports={
params:[
{name:"param",type:"String"}
]
},
queryBatchUpdateStudentPriceResult:{
title:'',
url:'/product/queryBatchImportStudentPriceResult',
params:[
{name:"param",type:"String"}
]
}
}
}
\ No newline at end of file
... ...
<%include '../../../common/views/__ui/header'%>
<%include '../../../common/views/__partail/ListHeader'%>
<%if isPL%>
<div class="contentpanel">
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-body">
<table class="table table-bordered">
<tr>
<td rowspan="2">学生价格</td>
<td>上传EXCEL:</td>
<td style="position: relative;"><input id="batchUpdateStudentPrice" name="file" data-type="" type="file" style="border:1px solid red; cursor: pointer; height: 37px; top: 8px;">
</td>
</tr>
<tr>
<td>说明:</td>
<td colspan="2">
1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br>
2、第一行标题栏:<span style="color: #67D267;">SKN,学生价格</span><br>
3、<a href="/ajax/link/batchUpdateStudentPrice">下载样例</a>
</td>
</tr>
</table>
</div>
<div class="panel-body red" id="message">
</div>
</div>
</div>
<%else%>
<div class="contentpanel">
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-body">
<div class="rows">
<div class="form-group">
<label class="col-sm-1 control-label">品牌 <span class="red">*</span></label>
<div class="col-sm-2">
<select id="brandId" class="form-control" required>
<option value="-1">选择品牌</option>
</select>
</div>
<label class="col-sm-1 control-label">管理店铺 <span class="red">*</span></label>
<div class="col-sm-2">
<select id="shopId" class="form-control">
<option value="-1">选择店铺</option>
</select>
</div>
<label class="col-sm-1 control-label">JIT供应商</label>
<div class="col-sm-2">
<select id="supplierId" class="form-control">
<option value="-1">选择JIT供应商</option>
</select>
</div>
</div>
</div>
<table class="table table-bordered">
<tr>
<td rowspan="2">基础商品</td>
<td>上传EXCEL:</td>
<td >
<div class="panel-col" style="position: relative;">
<input id="baseProduct" name="file" data-type="baseProduct" type="file" style="cursor: pointer; height: 37px; top: 8px;">
</div>
<div class="panel-col" style="line-height: 40px;position: relative;left: -60px;">
<span class="red">必须输入品牌、店铺</span>
</div>
</td>
</tr>
<tr>
<td>说明:</td>
<td colspan="2">
1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br>
2、第一行标题栏:<span style="color: #67D267;">货品名称、厂家编号、一级分类、二级分类、三级分类、四级分类、性别、货品年、货品季、商品属性、吊牌价、销售价、色系、厂家颜色、款型、尺码、条码、能否补货、SKN计数,年龄层(成人,大童,中童,小童,幼童),重点款,预计上架时间、upm条码</span><br>
3、<a href="/ajax/link/baseproduct" style="margin: 0; text-decoration: underline">下载样例.xlsx</a>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="panel panel-primary-head">
<div class="panel-body red" id="message">
</div>
</div>
<%/if%>
<%include '../../../common/views/__ui/footer'%>
\ No newline at end of file
... ...
... ... @@ -95,7 +95,7 @@
<td width="120px"><b>说明:</b></td>
<td>
1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br>
2、Excel表头为:<span style="color: #67D267;">SKN、吊牌价、销售价、学生价、VIP折扣类型、VIP价、白金价、金卡价、银卡价</span><br>
2、Excel表头为:<span style="color: #67D267;">SKN、吊牌价、销售价、VIP折扣类型、VIP价、白金价、金卡价、银卡价</span><br>
3、第一行为表头内容,第二行开始为正式内容<br>
4、每个文件控制在2500行以内<br>
5、<a href="/ajax/link/batchUpdatePrice" style="margin: 0; text-decoration: underline">下载样例.xlsx</a>
... ...
... ... @@ -65,6 +65,7 @@ function batchExport(el, type) {
}
/*展示平台*/
common.edit.ajaxfileupload('#appTypeModify', batchExport('#sort-file', 'appTypeModify'));
/*奥莱*/
common.edit.ajaxfileupload('#outletModify', batchExport('#sort-file', 'outletModify'));
/*补货*/
... ...
'use strict';
var $ = require('jquery'),
common = require('../../../common/common');
new common.dropDown({el:"#brandId",ajax:"brand",params:function(){
return {status:1,userLimitFlag:true}
}});
new common.dropDown({el:"#shopId",ajax:"sortbybrand",params:function(){
return {brandId:$("#brandId").val()}
}});
new common.dropDown({el:"#supplierId",ajax:"getjitSup",params:function(){
return {brandId:$("#brandId").val(),shopId:$("#shopId").val()}
}});
$('input[type="file"]').after('<div class="file-name btn btn-default">请选择文件</div>');
var loadModal = null;
function batchExport(el, type) {
return {
params: {
type: type,
brandId:common.util.__input("brandId"),
shopId:common.util.__input("shopId"),
supplierId:common.util.__input("supplierId"),
__type: "batch-import"
},
onStart: function(params) {
params.brandId=common.util.__input("brandId");
params.shopsId=common.util.__input("shopId");
params.supplierId=common.util.__input("supplierId");
params.brandName=params.brandId?$("#brandId").find("option[value="+$("#brandId").val()+"]").text():"";
params.shopsName=params.shopsId?$("#shopId").find("option[value="+$("#shopId").val()+"]").text():"";
params.supplierName=params.supplierId?$("#supplierId").find("option[value="+$("#supplierId").val()+"]").text():"";
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&&response.data.taskId) {
__ajaxExeclById(response.data.taskId);
// common.util.__tip(response.message, 'success');
return;
}
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');
}
}
}
/*学生价修改*/
common.edit.ajaxfileupload('#batchUpdateStudentPrice', batchExport('#sort-file', 'studentPrice'));
/*基础商品导入*/
$("#baseProduct").prop("disabled",true);
common.edit.ajaxfileupload('#baseProduct', batchExport('#sort-file', 'baseProduct'));
var isbrandId=false,isshops=false;
function jiekai(){
if(isbrandId&&isshops){
$("#baseProduct").prop("disabled",false);
}else{
$("#baseProduct").prop("disabled",true);
}
}
$(document).on("change","#brandId",function(){
if($(this).val()>0){
isbrandId=true;
}else{
isbrandId=false;
}
jiekai();
$("#shopId").val(-1).trigger("change");
$("#supplierId").val(-1).trigger("change");
});
$(document).on("change","#shopId",function(){
if($(this).val()>0){
isshops=true;
}else{
isshops=false;
}
jiekai();
$("#supplierId").val(-1).trigger("change");
})
function __ajaxExeclById(unquid){
var params={param:unquid};
common.util.__ajax({
url:'/product/queryBatchImportStudentPriceResult',
data:params
},function(res){
if(res.data.length){
//成功操作
if (loadModal) {
loadModal.close();
}
common.util.__tip(res.message, 'success');
}else{
setTimeout(function(){
__ajaxExeclById.call(null,unquid);
},5000);
}
$("#message").html(res.message);
},true);
}
// __ajaxExeclById("batchBasePrd1459835824928");
... ...