Authored by weiqingting

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

This reverts commit cf253c94.
... ... @@ -24,17 +24,46 @@ RESPONSEDATA.ENUMYEAR=(function(){
})()
console.log(RESPONSEDATA);
/*审核*/
$("#basicInfo").html(common.util.__template2($("#template2").html(),RESPONSEDATA));
/*商品名称*/
var Bll={
validateSort:function(){
var select=tabTree.getAddress();
if(select[2]&&select[2].id){
return select[2].id;
}
return false;
},
productNameArr:['','',''],
setProductName:function(){
$("#productName").val(Bll.productNameArr.join("-"));
}
}
var SORTDATA={
datas:[
{id:RESPONSEDATA.maxSortId,sortName:RESPONSEDATA.maxSortName},
{id:RESPONSEDATA.middleSortId,sortName:RESPONSEDATA.middleSortName},
{id:RESPONSEDATA.smallSortId,sortName:RESPONSEDATA.smallSortName}
]
],
complete:function(data){
if(data.length>2){
Bll.productNameArr[2]=data[data.length-1].sortName;
Bll.setProductName();
}
}
};
var tabTree=new common.tabTree("#tree",SORTDATA);
tabTree.init();
... ... @@ -53,17 +82,9 @@ var ENUM={
*isSuppled 能否补货,'N','Y'
*barCode 条形码
*/
goodsSizeList:{"sizeId":"","salePrice":"","barCode":"","isSuppled":"N"}
}
var Bll={
validateSort:function(){
var select=tabTree.getAddress();
if(select[2]&&select[2].id){
return select[2].id;
}
return false;
}
goodsSizeList:{"sizeId":"","salePrice":"","barCode":"","isSuppled":"N","presaleStorageNum":""}
}
/*下拉选择*/
new common.dropDown({el:"#brandId",ajax:"queryBrand"});
... ... @@ -102,7 +123,10 @@ var g=new common.grid({
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>");
html.push('<div class="rows" id="rows__'+item.__index+'">');
item.goodsSizeList=item.goodsSizeList||[$.extend({},ENUM.goodsSizeList)];
html.push(common.util.__template2($("#template").html(),{index:item.__index,goodsSizeList:item.goodsSizeList}));
var ISXIANGO=common.util.__input("isLimitbuy")=="Y"?true:false;
console.log(item.goodsSizeList);
html.push(common.util.__template2($("#template").html(),{index:item.__index,ISXIANGO:ISXIANGO,goodsSizeList:item.goodsSizeList}));
html.push('</div>');
return html.join('');
}
... ... @@ -155,8 +179,18 @@ $(document).on("click",".sortadd",function(){
}
});
$(document).on("change","#brandId",function(){
//$("#productName").val($(this).text().replace());
var id=$(this).val();
Bll.productNameArr[0]=$(this).find("option[value='"+id+"']").text();
Bll.setProductName();
});
$(document).on("change",":radio[name=gender]",function(){
Bll.productNameArr[1]=["男","女","通用"][+$(this).val()-1];
Bll.setProductName();
});
$(document).on("change",":radio[name=isLimitbuy]",function(){
g.reload();
});
$(document).on("click",".sortdelete",function(){
var index=$(this).data("index");
[].splice.call(g.__rows,index,1);
... ... @@ -204,6 +238,12 @@ $(document).on("change",".btn-sort-kebu",function(){
var item=g.__rows[_index].goodsSizeList[_eq];
item.isSuppled=$(this).val();
});
$(document).on("change",".btn-sort-kucun",function(){
var _index=$(this).data("index");
var _eq=$(this).data("eq");
var item=g.__rows[_index].goodsSizeList[_eq];
item.presaleStorageNum=$(this).val();
});
$(document).on("change",".w-goods-text",function(){
var item=g.__rows[$(this).data("index")];
item.factoryGoodsName=$(this).val();
... ... @@ -251,6 +291,8 @@ $(document).on("click","#btnReview",function(){
e.submit($("#basicForm").attr("action"),function(option){
var select=tabTree.getAddress();
option.data.supplierId=common.util.__input("supplierId")?$("#supplierId").val():"0";
option.data.productSkn=param?param[2]:"";
option.data.maxSortId=select[0]?select[0].id:"";
option.data.middleSortId=select[1]?select[1].id:"";
... ...
... ... @@ -15,7 +15,7 @@ common.util.__ajax({url: '/base/goods/getData', data:{productSkn:param[2]}},func
data.data.ageLevel=data.data.ageLevel.replace("1","成人").replace("2","大童").replace("3","小童");
data.data.gender={"1":"男","2":"女","3":"通用"}[""+data.data.gender];
data.data.grade={"0":"否","1":"是"}[""+data.data.grade];
data.data.isPromotionalGifts={"0":"否","1":"是"}[""+data.data.isPromotionalGifts];
data.data.isPromotionalGifts={"N":"否","Y":"是"}[""+data.data.isPromotionalGifts];
data.data.isLimited={"N":"否","Y":"是"}[""+data.data.isLimited];
data.data.isLimitbuy={"N":"否","Y":"是"}[""+data.data.isLimitbuy];
... ...
... ... @@ -66,7 +66,7 @@ var YNEnum = {
/*下拉选择*/
new common.dropDown({el:"#shopId",ajax:"queryShop"});
new common.dropDown({el:"#brandId",ajax:"queryBrand"});
new common.dropDown({el:"#founder",ajax:"querySupplier"});
// new common.dropDown({el:"#founder",ajax:"querySupplier"});
var tabTree=new common.tabTree("#sort");
tabTree.init();
... ... @@ -166,13 +166,13 @@ var g = new common.grid({
//判断是否是预售商品
if (item.isAdvance === "Y") {
var t = new Date(item.createTime * 1000);
var formatted = t.format("yyyy.mm.dd hh:MM:ss");
var formatted = t.format("yyyy.MM.dd hh:mm:ss");
html.push("<p>是</p>");
html.push("<p>预售库存:"+item.productName+"</p>");
html.push("<p>预计到货时间:"+formatted+"</p>");
} else {
var t = new Date(item.createTime * 1000);
var formatted = t.format("yyyy.mm.dd hh:MM:ss");
var formatted = t.format("yyyy.MM.dd hh:mm:ss");
html.push("<p>否</p>");
html.push("<p>预计上架时间:"+formatted+"</p>");
}
... ...
... ... @@ -77,7 +77,7 @@
</select>
</div>
<div class="col-sm-2">
<input class="form-control btn-sort-xiaoshou" value="[[item.salePrice]]" placeholder="默认销售价" data-index=[[index]] data-eq=[[__index]] required></input>
<input class="form-control btn-sort-xiaoshou" value="[[item.salePrice]]" placeholder="默认销售价" data-index=[[index]] data-eq=[[__index]] required match="digits" type="text"></input>
</div>
<div class="col-sm-2">
<input class="form-control btn-sort-tiaoma" value="[[item.barCode]]" placeholder="条码" data-index=[[index]] data-eq=[[__index]]></input>
... ... @@ -88,6 +88,11 @@
<option value="Y">可补货</option>
</select>
</div>
[[if ISXIANGO]]
<div class="col-sm-2">
<input type="text" class="form-control btn-sort-kucun" value="[[item.presaleStorageNum]]" placeholder="预售库存" data-index=[[index]] data-eq=[[__index]]></input>
</div>
[[/if]]
<div class="col-sm-2">
[[if __index==goodsSizeList.length-1]]
<button type="button" class="btn btn-info btn-xs btn-sort-add" data-index=[[index]]>+</button>
... ... @@ -96,6 +101,7 @@
<button type="button" class="btn btn-info btn-xs btn-sort-remove" data-index=[[index]] data-eq=[[__index]]>-</button>
[[/if]]
</div>
</div>
[[/each]]
</script>
... ... @@ -306,7 +312,7 @@
<div class="form-group">
<label class="col-sm-2 control-label">吊牌价<span class="red">*</span></label>
<div class="col-sm-2">
<input type="number" id="retailPriceStr" class="form-control" required value="[[retailPriceStr]]" match="digits" placeholder="吊牌价" />
<input type="number" id="retailPriceStr" class="form-control" required value="[[retailPriceStr]]" match="numbers" placeholder="吊牌价" />
</div>
<label class="col-sm-1 control-label">销售价<span class="red">*</span></label>
<div class="col-sm-2">
... ...
... ... @@ -37,7 +37,7 @@
</div>
<div class="panel-col">
<select id="founder" class="form-control">
<option value="-1">创建人</option>
<option value="-1">供应商</option>
</select>
</div>
<div class="panel-col">
... ...
... ... @@ -75,8 +75,8 @@
</div>
<div class="form-group">
<div class="col-sm-2">预计上架时间:[[expectShelfTime]]</div>
<div class="col-sm-2">预计到货时间:[[expectArrivalTime]]</div>
<div class="col-sm-2">预计上架时间:[[expectArrivalTimeStr]]</div>
<div class="col-sm-2">预计到货时间:[[expectArrivalTimeStr]]</div>
</div>
</div>
... ...