Authored by weiqingting

Revert "Revert "基础商品bug修改""

This reverts commit cf253c94.
@@ -24,17 +24,46 @@ RESPONSEDATA.ENUMYEAR=(function(){ @@ -24,17 +24,46 @@ RESPONSEDATA.ENUMYEAR=(function(){
24 })() 24 })()
25 console.log(RESPONSEDATA); 25 console.log(RESPONSEDATA);
26 26
  27 +
  28 +
27 /*审核*/ 29 /*审核*/
28 30
29 $("#basicInfo").html(common.util.__template2($("#template2").html(),RESPONSEDATA)); 31 $("#basicInfo").html(common.util.__template2($("#template2").html(),RESPONSEDATA));
30 32
  33 +/*商品名称*/
  34 +var Bll={
  35 + validateSort:function(){
  36 + var select=tabTree.getAddress();
  37 + if(select[2]&&select[2].id){
  38 + return select[2].id;
  39 + }
  40 + return false;
  41 + },
  42 + productNameArr:['','',''],
  43 + setProductName:function(){
  44 + $("#productName").val(Bll.productNameArr.join("-"));
  45 + }
  46 +}
  47 +
  48 +
  49 +
  50 +
31 var SORTDATA={ 51 var SORTDATA={
32 datas:[ 52 datas:[
33 {id:RESPONSEDATA.maxSortId,sortName:RESPONSEDATA.maxSortName}, 53 {id:RESPONSEDATA.maxSortId,sortName:RESPONSEDATA.maxSortName},
34 {id:RESPONSEDATA.middleSortId,sortName:RESPONSEDATA.middleSortName}, 54 {id:RESPONSEDATA.middleSortId,sortName:RESPONSEDATA.middleSortName},
35 {id:RESPONSEDATA.smallSortId,sortName:RESPONSEDATA.smallSortName} 55 {id:RESPONSEDATA.smallSortId,sortName:RESPONSEDATA.smallSortName}
36 - ] 56 + ],
  57 + complete:function(data){
  58 + if(data.length>2){
  59 + Bll.productNameArr[2]=data[data.length-1].sortName;
  60 + Bll.setProductName();
  61 + }
  62 + }
37 }; 63 };
  64 +
  65 +
  66 +
38 var tabTree=new common.tabTree("#tree",SORTDATA); 67 var tabTree=new common.tabTree("#tree",SORTDATA);
39 tabTree.init(); 68 tabTree.init();
40 69
@@ -53,17 +82,9 @@ var ENUM={ @@ -53,17 +82,9 @@ var ENUM={
53 *isSuppled 能否补货,'N','Y' 82 *isSuppled 能否补货,'N','Y'
54 *barCode 条形码 83 *barCode 条形码
55 */ 84 */
56 - goodsSizeList:{"sizeId":"","salePrice":"","barCode":"","isSuppled":"N"}  
57 -}  
58 -var Bll={  
59 - validateSort:function(){  
60 - var select=tabTree.getAddress();  
61 - if(select[2]&&select[2].id){  
62 - return select[2].id;  
63 - }  
64 - return false;  
65 - } 85 + goodsSizeList:{"sizeId":"","salePrice":"","barCode":"","isSuppled":"N","presaleStorageNum":""}
66 } 86 }
  87 +
67 /*下拉选择*/ 88 /*下拉选择*/
68 new common.dropDown({el:"#brandId",ajax:"queryBrand"}); 89 new common.dropDown({el:"#brandId",ajax:"queryBrand"});
69 90
@@ -102,7 +123,10 @@ var g=new common.grid({ @@ -102,7 +123,10 @@ var g=new common.grid({
102 html.push("<div class='form-group'><div class='col-sm-11 red'><input type=text value='"+item.factoryCode+"' data-index="+item.__index+" class='factoryCode form-control' placeholder='款型编码' required/></div></div>"); 123 html.push("<div class='form-group'><div class='col-sm-11 red'><input type=text value='"+item.factoryCode+"' data-index="+item.__index+" class='factoryCode form-control' placeholder='款型编码' required/></div></div>");
103 html.push('<div class="rows" id="rows__'+item.__index+'">'); 124 html.push('<div class="rows" id="rows__'+item.__index+'">');
104 item.goodsSizeList=item.goodsSizeList||[$.extend({},ENUM.goodsSizeList)]; 125 item.goodsSizeList=item.goodsSizeList||[$.extend({},ENUM.goodsSizeList)];
105 - html.push(common.util.__template2($("#template").html(),{index:item.__index,goodsSizeList:item.goodsSizeList})); 126 +
  127 + var ISXIANGO=common.util.__input("isLimitbuy")=="Y"?true:false;
  128 + console.log(item.goodsSizeList);
  129 + html.push(common.util.__template2($("#template").html(),{index:item.__index,ISXIANGO:ISXIANGO,goodsSizeList:item.goodsSizeList}));
106 html.push('</div>'); 130 html.push('</div>');
107 return html.join(''); 131 return html.join('');
108 } 132 }
@@ -155,8 +179,18 @@ $(document).on("click",".sortadd",function(){ @@ -155,8 +179,18 @@ $(document).on("click",".sortadd",function(){
155 } 179 }
156 }); 180 });
157 $(document).on("change","#brandId",function(){ 181 $(document).on("change","#brandId",function(){
158 - //$("#productName").val($(this).text().replace()); 182 + var id=$(this).val();
  183 + Bll.productNameArr[0]=$(this).find("option[value='"+id+"']").text();
  184 + Bll.setProductName();
  185 +});
  186 +$(document).on("change",":radio[name=gender]",function(){
  187 + Bll.productNameArr[1]=["男","女","通用"][+$(this).val()-1];
  188 + Bll.setProductName();
159 }); 189 });
  190 +$(document).on("change",":radio[name=isLimitbuy]",function(){
  191 + g.reload();
  192 +});
  193 +
160 $(document).on("click",".sortdelete",function(){ 194 $(document).on("click",".sortdelete",function(){
161 var index=$(this).data("index"); 195 var index=$(this).data("index");
162 [].splice.call(g.__rows,index,1); 196 [].splice.call(g.__rows,index,1);
@@ -204,6 +238,12 @@ $(document).on("change",".btn-sort-kebu",function(){ @@ -204,6 +238,12 @@ $(document).on("change",".btn-sort-kebu",function(){
204 var item=g.__rows[_index].goodsSizeList[_eq]; 238 var item=g.__rows[_index].goodsSizeList[_eq];
205 item.isSuppled=$(this).val(); 239 item.isSuppled=$(this).val();
206 }); 240 });
  241 +$(document).on("change",".btn-sort-kucun",function(){
  242 + var _index=$(this).data("index");
  243 + var _eq=$(this).data("eq");
  244 + var item=g.__rows[_index].goodsSizeList[_eq];
  245 + item.presaleStorageNum=$(this).val();
  246 +});
207 $(document).on("change",".w-goods-text",function(){ 247 $(document).on("change",".w-goods-text",function(){
208 var item=g.__rows[$(this).data("index")]; 248 var item=g.__rows[$(this).data("index")];
209 item.factoryGoodsName=$(this).val(); 249 item.factoryGoodsName=$(this).val();
@@ -251,6 +291,8 @@ $(document).on("click","#btnReview",function(){ @@ -251,6 +291,8 @@ $(document).on("click","#btnReview",function(){
251 e.submit($("#basicForm").attr("action"),function(option){ 291 e.submit($("#basicForm").attr("action"),function(option){
252 var select=tabTree.getAddress(); 292 var select=tabTree.getAddress();
253 293
  294 + option.data.supplierId=common.util.__input("supplierId")?$("#supplierId").val():"0";
  295 +
254 option.data.productSkn=param?param[2]:""; 296 option.data.productSkn=param?param[2]:"";
255 option.data.maxSortId=select[0]?select[0].id:""; 297 option.data.maxSortId=select[0]?select[0].id:"";
256 option.data.middleSortId=select[1]?select[1].id:""; 298 option.data.middleSortId=select[1]?select[1].id:"";
@@ -15,7 +15,7 @@ common.util.__ajax({url: '/base/goods/getData', data:{productSkn:param[2]}},func @@ -15,7 +15,7 @@ common.util.__ajax({url: '/base/goods/getData', data:{productSkn:param[2]}},func
15 data.data.ageLevel=data.data.ageLevel.replace("1","成人").replace("2","大童").replace("3","小童"); 15 data.data.ageLevel=data.data.ageLevel.replace("1","成人").replace("2","大童").replace("3","小童");
16 data.data.gender={"1":"男","2":"女","3":"通用"}[""+data.data.gender]; 16 data.data.gender={"1":"男","2":"女","3":"通用"}[""+data.data.gender];
17 data.data.grade={"0":"否","1":"是"}[""+data.data.grade]; 17 data.data.grade={"0":"否","1":"是"}[""+data.data.grade];
18 - data.data.isPromotionalGifts={"0":"否","1":"是"}[""+data.data.isPromotionalGifts]; 18 + data.data.isPromotionalGifts={"N":"否","Y":"是"}[""+data.data.isPromotionalGifts];
19 data.data.isLimited={"N":"否","Y":"是"}[""+data.data.isLimited]; 19 data.data.isLimited={"N":"否","Y":"是"}[""+data.data.isLimited];
20 data.data.isLimitbuy={"N":"否","Y":"是"}[""+data.data.isLimitbuy]; 20 data.data.isLimitbuy={"N":"否","Y":"是"}[""+data.data.isLimitbuy];
21 21
@@ -66,7 +66,7 @@ var YNEnum = { @@ -66,7 +66,7 @@ var YNEnum = {
66 /*下拉选择*/ 66 /*下拉选择*/
67 new common.dropDown({el:"#shopId",ajax:"queryShop"}); 67 new common.dropDown({el:"#shopId",ajax:"queryShop"});
68 new common.dropDown({el:"#brandId",ajax:"queryBrand"}); 68 new common.dropDown({el:"#brandId",ajax:"queryBrand"});
69 -new common.dropDown({el:"#founder",ajax:"querySupplier"}); 69 +// new common.dropDown({el:"#founder",ajax:"querySupplier"});
70 70
71 var tabTree=new common.tabTree("#sort"); 71 var tabTree=new common.tabTree("#sort");
72 tabTree.init(); 72 tabTree.init();
@@ -166,13 +166,13 @@ var g = new common.grid({ @@ -166,13 +166,13 @@ var g = new common.grid({
166 //判断是否是预售商品 166 //判断是否是预售商品
167 if (item.isAdvance === "Y") { 167 if (item.isAdvance === "Y") {
168 var t = new Date(item.createTime * 1000); 168 var t = new Date(item.createTime * 1000);
169 - var formatted = t.format("yyyy.mm.dd hh:MM:ss"); 169 + var formatted = t.format("yyyy.MM.dd hh:mm:ss");
170 html.push("<p>是</p>"); 170 html.push("<p>是</p>");
171 html.push("<p>预售库存:"+item.productName+"</p>"); 171 html.push("<p>预售库存:"+item.productName+"</p>");
172 html.push("<p>预计到货时间:"+formatted+"</p>"); 172 html.push("<p>预计到货时间:"+formatted+"</p>");
173 } else { 173 } else {
174 var t = new Date(item.createTime * 1000); 174 var t = new Date(item.createTime * 1000);
175 - var formatted = t.format("yyyy.mm.dd hh:MM:ss"); 175 + var formatted = t.format("yyyy.MM.dd hh:mm:ss");
176 html.push("<p>否</p>"); 176 html.push("<p>否</p>");
177 html.push("<p>预计上架时间:"+formatted+"</p>"); 177 html.push("<p>预计上架时间:"+formatted+"</p>");
178 } 178 }
@@ -77,7 +77,7 @@ @@ -77,7 +77,7 @@
77 </select> 77 </select>
78 </div> 78 </div>
79 <div class="col-sm-2"> 79 <div class="col-sm-2">
80 - <input class="form-control btn-sort-xiaoshou" value="[[item.salePrice]]" placeholder="默认销售价" data-index=[[index]] data-eq=[[__index]] required></input> 80 + <input class="form-control btn-sort-xiaoshou" value="[[item.salePrice]]" placeholder="默认销售价" data-index=[[index]] data-eq=[[__index]] required match="digits" type="text"></input>
81 </div> 81 </div>
82 <div class="col-sm-2"> 82 <div class="col-sm-2">
83 <input class="form-control btn-sort-tiaoma" value="[[item.barCode]]" placeholder="条码" data-index=[[index]] data-eq=[[__index]]></input> 83 <input class="form-control btn-sort-tiaoma" value="[[item.barCode]]" placeholder="条码" data-index=[[index]] data-eq=[[__index]]></input>
@@ -88,6 +88,11 @@ @@ -88,6 +88,11 @@
88 <option value="Y">可补货</option> 88 <option value="Y">可补货</option>
89 </select> 89 </select>
90 </div> 90 </div>
  91 + [[if ISXIANGO]]
  92 + <div class="col-sm-2">
  93 + <input type="text" class="form-control btn-sort-kucun" value="[[item.presaleStorageNum]]" placeholder="预售库存" data-index=[[index]] data-eq=[[__index]]></input>
  94 + </div>
  95 + [[/if]]
91 <div class="col-sm-2"> 96 <div class="col-sm-2">
92 [[if __index==goodsSizeList.length-1]] 97 [[if __index==goodsSizeList.length-1]]
93 <button type="button" class="btn btn-info btn-xs btn-sort-add" data-index=[[index]]>+</button> 98 <button type="button" class="btn btn-info btn-xs btn-sort-add" data-index=[[index]]>+</button>
@@ -96,6 +101,7 @@ @@ -96,6 +101,7 @@
96 <button type="button" class="btn btn-info btn-xs btn-sort-remove" data-index=[[index]] data-eq=[[__index]]>-</button> 101 <button type="button" class="btn btn-info btn-xs btn-sort-remove" data-index=[[index]] data-eq=[[__index]]>-</button>
97 [[/if]] 102 [[/if]]
98 </div> 103 </div>
  104 +
99 </div> 105 </div>
100 [[/each]] 106 [[/each]]
101 </script> 107 </script>
@@ -306,7 +312,7 @@ @@ -306,7 +312,7 @@
306 <div class="form-group"> 312 <div class="form-group">
307 <label class="col-sm-2 control-label">吊牌价<span class="red">*</span></label> 313 <label class="col-sm-2 control-label">吊牌价<span class="red">*</span></label>
308 <div class="col-sm-2"> 314 <div class="col-sm-2">
309 - <input type="number" id="retailPriceStr" class="form-control" required value="[[retailPriceStr]]" match="digits" placeholder="吊牌价" /> 315 + <input type="number" id="retailPriceStr" class="form-control" required value="[[retailPriceStr]]" match="numbers" placeholder="吊牌价" />
310 </div> 316 </div>
311 <label class="col-sm-1 control-label">销售价<span class="red">*</span></label> 317 <label class="col-sm-1 control-label">销售价<span class="red">*</span></label>
312 <div class="col-sm-2"> 318 <div class="col-sm-2">
@@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
37 </div> 37 </div>
38 <div class="panel-col"> 38 <div class="panel-col">
39 <select id="founder" class="form-control"> 39 <select id="founder" class="form-control">
40 - <option value="-1">创建人</option> 40 + <option value="-1">供应商</option>
41 </select> 41 </select>
42 </div> 42 </div>
43 <div class="panel-col"> 43 <div class="panel-col">
@@ -75,8 +75,8 @@ @@ -75,8 +75,8 @@
75 </div> 75 </div>
76 76
77 <div class="form-group"> 77 <div class="form-group">
78 - <div class="col-sm-2">预计上架时间:[[expectShelfTime]]</div>  
79 - <div class="col-sm-2">预计到货时间:[[expectArrivalTime]]</div> 78 + <div class="col-sm-2">预计上架时间:[[expectArrivalTimeStr]]</div>
  79 + <div class="col-sm-2">预计到货时间:[[expectArrivalTimeStr]]</div>
80 </div> 80 </div>
81 81
82 </div> 82 </div>