Authored by weiqingting

基础商品修改

@@ -29,10 +29,14 @@ function batchExport(el, type) { @@ -29,10 +29,14 @@ function batchExport(el, type) {
29 __type: "batch-import" 29 __type: "batch-import"
30 }, 30 },
31 onStart: function(params) { 31 onStart: function(params) {
32 -  
33 params.brandId=common.util.__input("brandId"); 32 params.brandId=common.util.__input("brandId");
34 params.shopId=common.util.__input("shopId"); 33 params.shopId=common.util.__input("shopId");
35 params.supplierId=common.util.__input("supplierId"); 34 params.supplierId=common.util.__input("supplierId");
  35 +
  36 + params.brandName=params.brandId?$("#brandId").find("option[value="+$("#brandId").val()+"]").text():"";
  37 + params.shopsName=params.shopId?$("#shopId").find("option[value="+$("#shopId").val()+"]").text():"";
  38 + params.supplierName=params.supplierId?$("#supplierId").find("option[value="+$("#supplierId").val()+"]").text():"";
  39 +
36 console.log("params",params); 40 console.log("params",params);
37 loadModal = common.dialog.load(); 41 loadModal = common.dialog.load();
38 42
@@ -68,7 +68,15 @@ var Bll={ @@ -68,7 +68,15 @@ var Bll={
68 var ag=new common.grid({ 68 var ag=new common.grid({
69 el:"#attributeTable", 69 el:"#attributeTable",
70 columns:[ 70 columns:[
71 - {display:"名称",name:"attributeName"}, 71 + {display:"名称",name:"attributeName",render:function(item){
  72 + item.required=item.isMust=="Y"?"required":"";
  73 + var arr=[];
  74 + arr.push(item.attributeName);
  75 + if(item.required){
  76 + arr.push("<span class='red'>*</span>");
  77 + }
  78 + return arr.join('');
  79 + }},
72 {display:"属性",render:function(item){ 80 {display:"属性",render:function(item){
73 item.required=item.isMust=="Y"?"required":""; 81 item.required=item.isMust=="Y"?"required":"";
74 // item.attributeValues=item.attributeValues.split(',').map(function(elem, index, arr){ 82 // item.attributeValues=item.attributeValues.split(',').map(function(elem, index, arr){
@@ -403,14 +411,15 @@ e.on("validate",function(){ @@ -403,14 +411,15 @@ e.on("validate",function(){
403 return "请选择完整的分类目录"; 411 return "请选择完整的分类目录";
404 }); 412 });
405 e.on("validate",function(){ 413 e.on("validate",function(){
  414 + console.log(g.__gsm);
406 if(g.__rows.length==0){ 415 if(g.__rows.length==0){
407 return "请添加销售属性"; 416 return "请添加销售属性";
408 } 417 }
409 - var map={},map2={},_count=0,_count1=0; 418 + var map={},map2={},map3=[],_count=0,_count1=0;
410 if(g.__rows.length>0){ 419 if(g.__rows.length>0){
411 $.each(g.__rows,function(index,item){ 420 $.each(g.__rows,function(index,item){
412 var gname= item.factoryGoodsName; 421 var gname= item.factoryGoodsName;
413 - $.each(item.goodsSizeList,function(index,item1){ 422 + $.each(item.goodsSizeList,function(index1,item1){
414 var key=gname+"_"+item1.sizeId; 423 var key=gname+"_"+item1.sizeId;
415 if(map.hasOwnProperty(key)){ 424 if(map.hasOwnProperty(key)){
416 _count++; 425 _count++;
@@ -421,6 +430,10 @@ e.on("validate",function(){ @@ -421,6 +430,10 @@ e.on("validate",function(){
421 _count1++; 430 _count1++;
422 } 431 }
423 map2[item1.barCode]=""; 432 map2[item1.barCode]="";
  433 + if(g.__gsm[index]&&index1<g.__gsm[index]){
  434 + return;
  435 + }
  436 + map3.push(item1.barCode);
424 }); 437 });
425 }); 438 });
426 } 439 }
@@ -429,6 +442,20 @@ e.on("validate",function(){ @@ -429,6 +442,20 @@ e.on("validate",function(){
429 } 442 }
430 if(_count1>0){ 443 if(_count1>0){
431 return "商品条码不能重复"; 444 return "商品条码不能重复";
  445 + }else{
  446 + if(map3.length>0){
  447 + var ispass=true;
  448 + common.util.__ajax2({
  449 + url:'/goods/base/checkSkuBarCodeExist',
  450 + async:false,
  451 + data:{barCode:map3.join(',')}
  452 + },function(res){
  453 + if(res.data.length){
  454 + ispass="商品条码"+res.data.join(',')+"已经存在";
  455 + }
  456 + },true);
  457 + return ispass;
  458 + }
432 } 459 }
433 }); 460 });
434 e.on("validate",function(){ 461 e.on("validate",function(){
@@ -14,13 +14,13 @@ var config = { @@ -14,13 +14,13 @@ var config = {
14 apiKey: 'sd4H1ecAqlp', 14 apiKey: 'sd4H1ecAqlp',
15 //http: //192.168.102.214:8088/platform 15 //http: //192.168.102.214:8088/platform
16 // domain: 'http://172.16.6.240:8088/platform', 16 // domain: 'http://172.16.6.240:8088/platform',
17 - // domain:'http://172.16.6.240:8088/platform',//王书生 17 + domain:'http://172.16.6.240:8088/platform',//王书生
18 // domain: 'http://172.16.6.124:8088/platform',//陈超 18 // domain: 'http://172.16.6.124:8088/platform',//陈超
19 //http://172.16.6.124:8088/platform/product/queryAllProductAttr 19 //http://172.16.6.124:8088/platform/product/queryAllProductAttr
20 //domain: 'http://172.16.6.227:8088/platform', //玛丽 20 //domain: 'http://172.16.6.227:8088/platform', //玛丽
21 // domain: 'http://192.168.102.202:8088/platform', 21 // domain: 'http://192.168.102.202:8088/platform',
22 //domain:'http://172.16.9.8:8080/yohobuy-platform-web',//葛超 22 //domain:'http://172.16.9.8:8080/yohobuy-platform-web',//葛超
23 - domain: 'http://192.168.102.202:8088/platform', 23 + // domain: 'http://192.168.102.202:8088/platform',
24 //domain: 'http://172.16.6.239:8080', //孙杰翔 24 //domain: 'http://172.16.6.239:8080', //孙杰翔
25 loggers: { 25 loggers: {
26 api: { 26 api: {
@@ -313,4 +313,12 @@ exports.res = [ @@ -313,4 +313,12 @@ exports.res = [
313 domain: exports.domain 313 domain: exports.domain
314 } 314 }
315 }, 315 },
  316 + {
  317 + route:'/goods/base/checkSkuBarCodeExist',
  318 + method:'POST',
  319 + url:'/product/checkSkuBarCodeExist',
  320 + params:[
  321 + {name:"barCode",type:"String"}
  322 + ]
  323 + }
316 ]; 324 ];