Authored by xuhongyun

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

@@ -110,4 +110,15 @@ module.exports=function(app) { @@ -110,4 +110,15 @@ module.exports=function(app) {
110 } 110 }
111 }); 111 });
112 112
  113 + /*批量修改学生价格*/
  114 + app.get("/supplier/baseproduct/batchUpdateStudentPrice","goods.batchUpdateStudentPrice.Batch",function(){
  115 + this.$extend={
  116 + moduleName:"基础商品",
  117 + pageName:"批量修改学生价",
  118 + isPL:true
  119 + }
  120 + });
  121 +
  122 + /*通过任务ID查看任务是否被执行完 学生价变价*/
  123 + app.post("/product/queryBatchImportStudentPriceResult","basegoods_queryBatchUpdateStudentPriceResult");
113 } 124 }
@@ -192,6 +192,13 @@ module.exports={ @@ -192,6 +192,13 @@ module.exports={
192 params:[ 192 params:[
193 {name:"param",type:"String"} 193 {name:"param",type:"String"}
194 ] 194 ]
  195 + },
  196 + queryBatchUpdateStudentPriceResult:{
  197 + title:'',
  198 + url:'/product/queryBatchImportStudentPriceResult',
  199 + params:[
  200 + {name:"param",type:"String"}
  201 + ]
195 } 202 }
196 } 203 }
197 } 204 }
  1 +<%include '../../../common/views/__ui/header'%>
  2 +<%include '../../../common/views/__partail/ListHeader'%>
  3 +<%if isPL%>
  4 +<div class="contentpanel">
  5 + <div class="panel panel-default" style="margin-bottom:10px;">
  6 + <div class="panel-body">
  7 + <table class="table table-bordered">
  8 + <tr>
  9 + <td rowspan="2">学生价格</td>
  10 + <td>上传EXCEL:</td>
  11 + <td style="position: relative;"><input id="batchUpdateStudentPrice" name="file" data-type="" type="file" style="border:1px solid red; cursor: pointer; height: 37px; top: 8px;">
  12 + </td>
  13 + </tr>
  14 + <tr>
  15 + <td>说明:</td>
  16 + <td colspan="2">
  17 + 1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br>
  18 + 2、第一行标题栏:<span style="color: #67D267;">SKN,学生价格</span><br>
  19 + 3、<a href="/ajax/link/batchUpdateStudentPrice">下载样例</a>
  20 + </td>
  21 + </tr>
  22 + </table>
  23 + </div>
  24 + <div class="panel-body red" id="message">
  25 + </div>
  26 + </div>
  27 +</div>
  28 +<%else%>
  29 +
  30 +<div class="contentpanel">
  31 +
  32 + <div class="panel panel-default" style="margin-bottom:10px;">
  33 + <div class="panel-body">
  34 +
  35 + <div class="rows">
  36 + <div class="form-group">
  37 + <label class="col-sm-1 control-label">品牌 <span class="red">*</span></label>
  38 + <div class="col-sm-2">
  39 + <select id="brandId" class="form-control" required>
  40 + <option value="-1">选择品牌</option>
  41 + </select>
  42 + </div>
  43 +
  44 + <label class="col-sm-1 control-label">管理店铺 <span class="red">*</span></label>
  45 + <div class="col-sm-2">
  46 + <select id="shopId" class="form-control">
  47 + <option value="-1">选择店铺</option>
  48 + </select>
  49 + </div>
  50 +
  51 + <label class="col-sm-1 control-label">JIT供应商</label>
  52 + <div class="col-sm-2">
  53 + <select id="supplierId" class="form-control">
  54 + <option value="-1">选择JIT供应商</option>
  55 + </select>
  56 + </div>
  57 + </div>
  58 + </div>
  59 +
  60 + <table class="table table-bordered">
  61 + <tr>
  62 + <td rowspan="2">基础商品</td>
  63 + <td>上传EXCEL:</td>
  64 + <td >
  65 + <div class="panel-col" style="position: relative;">
  66 + <input id="baseProduct" name="file" data-type="baseProduct" type="file" style="cursor: pointer; height: 37px; top: 8px;">
  67 + </div>
  68 + <div class="panel-col" style="line-height: 40px;position: relative;left: -60px;">
  69 + <span class="red">必须输入品牌、店铺</span>
  70 + </div>
  71 + </td>
  72 + </tr>
  73 + <tr>
  74 + <td>说明:</td>
  75 + <td colspan="2">
  76 + 1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br>
  77 + 2、第一行标题栏:<span style="color: #67D267;">货品名称、厂家编号、一级分类、二级分类、三级分类、四级分类、性别、货品年、货品季、商品属性、吊牌价、销售价、色系、厂家颜色、款型、尺码、条码、能否补货、SKN计数,年龄层(成人,大童,中童,小童,幼童),重点款,预计上架时间、upm条码</span><br>
  78 + 3、<a href="/ajax/link/baseproduct" style="margin: 0; text-decoration: underline">下载样例.xlsx</a>
  79 + </td>
  80 + </tr>
  81 + </table>
  82 + </div>
  83 + </div>
  84 +</div>
  85 +
  86 +<div class="panel panel-primary-head">
  87 + <div class="panel-body red" id="message">
  88 + </div>
  89 +</div>
  90 +<%/if%>
  91 +<%include '../../../common/views/__ui/footer'%>
@@ -95,7 +95,7 @@ @@ -95,7 +95,7 @@
95 <td width="120px"><b>说明:</b></td> 95 <td width="120px"><b>说明:</b></td>
96 <td> 96 <td>
97 1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br> 97 1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br>
98 - 2、Excel表头为:<span style="color: #67D267;">SKN、吊牌价、销售价、学生价、VIP折扣类型、VIP价、白金价、金卡价、银卡价</span><br> 98 + 2、Excel表头为:<span style="color: #67D267;">SKN、吊牌价、销售价、VIP折扣类型、VIP价、白金价、金卡价、银卡价</span><br>
99 3、第一行为表头内容,第二行开始为正式内容<br> 99 3、第一行为表头内容,第二行开始为正式内容<br>
100 4、每个文件控制在2500行以内<br> 100 4、每个文件控制在2500行以内<br>
101 5、<a href="/ajax/link/batchUpdatePrice" style="margin: 0; text-decoration: underline">下载样例.xlsx</a> 101 5、<a href="/ajax/link/batchUpdatePrice" style="margin: 0; text-decoration: underline">下载样例.xlsx</a>
@@ -65,6 +65,7 @@ function batchExport(el, type) { @@ -65,6 +65,7 @@ function batchExport(el, type) {
65 } 65 }
66 /*展示平台*/ 66 /*展示平台*/
67 common.edit.ajaxfileupload('#appTypeModify', batchExport('#sort-file', 'appTypeModify')); 67 common.edit.ajaxfileupload('#appTypeModify', batchExport('#sort-file', 'appTypeModify'));
  68 +
68 /*奥莱*/ 69 /*奥莱*/
69 common.edit.ajaxfileupload('#outletModify', batchExport('#sort-file', 'outletModify')); 70 common.edit.ajaxfileupload('#outletModify', batchExport('#sort-file', 'outletModify'));
70 /*补货*/ 71 /*补货*/
  1 +'use strict';
  2 +var $ = require('jquery'),
  3 + common = require('../../../common/common');
  4 +
  5 +new common.dropDown({el:"#brandId",ajax:"brand",params:function(){
  6 + return {status:1,userLimitFlag:true}
  7 + }});
  8 +
  9 +new common.dropDown({el:"#shopId",ajax:"sortbybrand",params:function(){
  10 + return {brandId:$("#brandId").val()}
  11 +}});
  12 +
  13 +new common.dropDown({el:"#supplierId",ajax:"getjitSup",params:function(){
  14 + return {brandId:$("#brandId").val(),shopId:$("#shopId").val()}
  15 +}});
  16 +
  17 +
  18 +$('input[type="file"]').after('<div class="file-name btn btn-default">请选择文件</div>');
  19 +
  20 +var loadModal = null;
  21 +
  22 +function batchExport(el, type) {
  23 +
  24 + return {
  25 + params: {
  26 + type: type,
  27 + brandId:common.util.__input("brandId"),
  28 + shopId:common.util.__input("shopId"),
  29 + supplierId:common.util.__input("supplierId"),
  30 + __type: "batch-import"
  31 + },
  32 + onStart: function(params) {
  33 + params.brandId=common.util.__input("brandId");
  34 + params.shopsId=common.util.__input("shopId");
  35 + params.supplierId=common.util.__input("supplierId");
  36 +
  37 + params.brandName=params.brandId?$("#brandId").find("option[value="+$("#brandId").val()+"]").text():"";
  38 + params.shopsName=params.shopsId?$("#shopId").find("option[value="+$("#shopId").val()+"]").text():"";
  39 + params.supplierName=params.supplierId?$("#supplierId").find("option[value="+$("#supplierId").val()+"]").text():"";
  40 +
  41 + console.log("params",params);
  42 + loadModal = common.dialog.load();
  43 + $("#message").html('');
  44 +
  45 + //$(el).parents('td').find('.file-name').text($(el).val().replace("C:\\fakepath\\", ""));
  46 + },
  47 + onComplete: function(response) {
  48 + console.log("批量接口返回数据",response);
  49 + $("#message").html('');
  50 + if (response.code == 200&&response.data.taskId) {
  51 + __ajaxExeclById(response.data.taskId);
  52 + // common.util.__tip(response.message, 'success');
  53 + return;
  54 + }
  55 + if (loadModal) {
  56 + loadModal.close();
  57 + }
  58 + if(response.data&&response.data.failFileReason.length){
  59 + $("#message").html(response.data.failFileReason.join('<br/>'));
  60 + return false;
  61 + }
  62 + common.util.__tip(response.message, 'warning');
  63 + }
  64 + }
  65 +}
  66 +
  67 +/*学生价修改*/
  68 +common.edit.ajaxfileupload('#batchUpdateStudentPrice', batchExport('#sort-file', 'studentPrice'));
  69 +
  70 +/*基础商品导入*/
  71 +$("#baseProduct").prop("disabled",true);
  72 +common.edit.ajaxfileupload('#baseProduct', batchExport('#sort-file', 'baseProduct'));
  73 +
  74 +var isbrandId=false,isshops=false;
  75 +
  76 +function jiekai(){
  77 + if(isbrandId&&isshops){
  78 + $("#baseProduct").prop("disabled",false);
  79 + }else{
  80 + $("#baseProduct").prop("disabled",true);
  81 + }
  82 +}
  83 +$(document).on("change","#brandId",function(){
  84 + if($(this).val()>0){
  85 + isbrandId=true;
  86 + }else{
  87 + isbrandId=false;
  88 + }
  89 + jiekai();
  90 + $("#shopId").val(-1).trigger("change");
  91 + $("#supplierId").val(-1).trigger("change");
  92 +});
  93 +$(document).on("change","#shopId",function(){
  94 + if($(this).val()>0){
  95 + isshops=true;
  96 + }else{
  97 + isshops=false;
  98 + }
  99 + jiekai();
  100 + $("#supplierId").val(-1).trigger("change");
  101 +})
  102 +
  103 +
  104 +function __ajaxExeclById(unquid){
  105 + var params={param:unquid};
  106 +
  107 + common.util.__ajax({
  108 + url:'/product/queryBatchImportStudentPriceResult',
  109 + data:params
  110 + },function(res){
  111 + if(res.data.length){
  112 +
  113 + //成功操作
  114 + if (loadModal) {
  115 + loadModal.close();
  116 + }
  117 + common.util.__tip(res.message, 'success');
  118 +
  119 + }else{
  120 + setTimeout(function(){
  121 + __ajaxExeclById.call(null,unquid);
  122 + },5000);
  123 + }
  124 + $("#message").html(res.message);
  125 + },true);
  126 +}
  127 +// __ajaxExeclById("batchBasePrd1459835824928");