Authored by weiqingting

提交

... ... @@ -2,8 +2,33 @@
var $ = require('jquery'),
common=require('../common/common');
var RESPONSEDATA={};
common.util.__ajax({
url:'/base/goods/getData',
async:false,
data:{productSkn:51198315}
},function(res){
RESPONSEDATA=res.data;
console.log(RESPONSEDATA);
},true);
var tabTree=new common.tabTree("#tree");
$("#basicInfo").html(common.util.__template2($("#template2").html(),RESPONSEDATA));
common.util.__ajax({
url:'/base/goods/queryProductColors'
},function(res){
console.log(res);
},true);
var SORTDATA={
datas:[
{id:RESPONSEDATA.maxSortId,sortName:RESPONSEDATA.maxSortName},
{id:RESPONSEDATA.middleSortId,sortName:RESPONSEDATA.middleSortName},
{id:RESPONSEDATA.smallSortId,sortName:RESPONSEDATA.smallSortName}
]
};
var tabTree=new common.tabTree("#tree",SORTDATA);
tabTree.init();
var ENUM={
... ... @@ -25,9 +50,12 @@ var ENUM={
}
/*下拉选择*/
// 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:"#shopId",ajax:"queryShopPass"});
new common.dropDown({el:"#brandId",ajax:"queryBrand"});
new common.dropDown({el:"#supplierId",ajax:"querySupplier"});
var e=new common.edit("#basicInfo");
e.init();
//baseTable
var g=new common.grid({
... ... @@ -41,7 +69,8 @@ var g=new common.grid({
}},
{
display:"分类图片",render:function(item){
return "<input type=file name='goodsColorImage' id='file__"+item.__index+"' value='"+item.goodsColorImage+"' />";
//goodsColorImage
return "<input type=file name='goodsColorImage' id='file__"+item.__index+"' value='https://www.baidu.com/img/bd_logo1.png' />";
}
},
{
... ... @@ -55,13 +84,23 @@ var g=new common.grid({
return html.join('');
}
}
]
],
complete:function(){
new common.dropDown({
el: ".btn-sort-chima",
ajax: "sortsize",
params: {
"sortId" : tabTree.selected[0]?tabTree.selected[0].id:""
}
});
}
});
g.__rows=[];
g.__e=new common.edit("#basicTable");
g.__rows=RESPONSEDATA.baseGoodList||[];
g.__e=new common.edit("#basicTable",{bucket:"goodsimg"});
g.init(g.__rows);
g.__e.init();
g.__e.on("callback", function(obj) {
console.log(obj);
if(/^file_onComplete/.test(obj.key)){
... ... @@ -139,10 +178,21 @@ e.on("validate",function(){
});
e.init();
$(document).on("click","#btnReview",function(){
var sortid=tabTree.selected.length>0?tabTree.selected[tabTree.selected.length-1].id:"";
console.log(sortid);
e.submit($("#basicForm").attr("action"),function(option){
option.debug=true;
option.data.maxSortId=tabTree.selected[0]?tabTree.selected[0].id:"";
option.data.middleSortId=tabTree.selected[1]?tabTree.selected[1].id:"";
option.data.smallSortId=tabTree.selected[2]?tabTree.selected[2].id:"";
option.data.shopId=$("#shopId").val();
option.data.brandId=$("#brandId").val();
option.data.supplierId=$("#supplierId").val();
//expectShelfTime
// option.data=new Date(expectShelfTime).getTime();
option.data.baseGoodList=JSON.stringify(g.__rows);
// option.debug=true;
// console.log(option.data);
option.success=function(res){
res = res.data;
if(res.code == "200") {
... ... @@ -159,11 +209,3 @@ $(document).on("click","#btnReview",function(){
});
return false;
});
/*
* 分类id怎么传
*
*
*
*
**/
\ No newline at end of file
... ...
... ... @@ -213,6 +213,7 @@ grid.prototype = {
},
complete: function(res) {
console.log("complete~~");
// p.complete && p.complete();
},
error: function() {
console.log("error~~");
... ... @@ -281,6 +282,7 @@ grid.prototype = {
_r.push(_h);
g.tbody.html(_r.join(''));
}
p.complete&&p.complete();
},
__bodySecondClomun: function(row, second) {
var g = this,
... ...
... ... @@ -249,7 +249,11 @@ tabTree.prototype= {
_buildHtml(count, item, _isdirect);
_isdirect = p.datas[count].isdirect
});
g.dom["cityboxbtn"].html("请选择类目");
var arr=[];
$.each(g.selected, function(count, item) {
arr.push(item.sortName);
});
g.dom["cityboxbtn"].html(arr.join('')||'请选择类目');
if (g.selected.length > 0 && !g.selected[g.selected.length - 1].isdirect) {
if (g.selected.length != p.datas.length) {
... ...
... ... @@ -37,9 +37,11 @@ new common.dropDown({
ajax:"brand"
});
var e = new common.edit('#form-base',{
var BUCKET={
"bucket" : "brandBanner"
});
};
var e = new common.edit('#form-base',BUCKET);
e.init();
var g = new common.grid({
... ... @@ -134,7 +136,7 @@ $(document).on('click', '.edit-class-btn', function () {
function attributeOp(prefix, url, item) {
var a = new common.edit(".confirm");
var a = new common.edit(".confirm",BUCKET);
common.dialog.confirm(prefix + "款型系列", common.util.__template2($("#template").html(), item), function () {
return a.submit(url, function (option) {
... ...
... ... @@ -45,8 +45,9 @@ exports.res = [
route:'/base/goods/add',
method:'GET',
view:'pages/basegoods/edit',
url:'/productColor/queryProductColors',
data:{
data:{},
pageTitle:"创建基础商品",
action:"/base/goods/ajax/add"
},
src:'/basegoods/edit'
... ... @@ -56,30 +57,44 @@ exports.res = [
method:'POST',
url:'/product/addBaseProduct',
params:[
{name:'ageLevel',type:'String'},
{name: 'attribute',type: 'Number'},
{name: 'baseGoodList',type: 'String'},
{name:'brandId',type:'Number'},
{name:'gender',type:'Number'},
{name:'isAdvance',type:'String'},
{name:'isJit',type:'String'},
{name:'factoryCode',type:'String'},
{name:'gender',type:'String'},
{name:'goodsSeason',type:'Number'},
{name:'goodsYears',type:'Number'},
{name:'grade',type:'Number'},
{name:'isLimitbuy',type:'String'},
{name:'isLimited',type:'String'},
{name:'maxSortId',type:'Number'},
{name:'middleSortId',type:'Number'},
{name:'isPromotionalGifts',type:'String'},
{name:'productName',type:'Number'},
{name:'productTag',type:'Number'},
{name:'retailPrice',type:'Number'},
{name:'salesPrice',type:'Number'},
{name:'expectShelfTime',type:'String'},
{name: 'baseGoodList',type: 'String'},
{name:'shopId',type:'Number'},
{name:'smallSortId',type:'Number'},
{name:'sortId',type:'Number'},
{name:'brandId',type:'Number'},
{name:'supplierId',type:'Number'},
{name:'founder',type:'Number'}
{name:'maxSortId',type:'Number'},
{name:'middleSortId',type:'Number'},
{name:'smallSortId',type:'Number'}
]
},
{//修改页面
route:'/base/goods/update/:productSkn',
method:'GET',
view:'pages/basegoods/edit',
url:'xxx'
url:'/productColor/queryProductColors',
data:{
pageTitle:"修改基础商品"
}
},
{//修改接口
route:'/base/goods/ajax/update',
... ... @@ -105,5 +120,10 @@ exports.res = [
params:[
{name:'productSkn',type:'Number'},
]
},
{
route:'/base/goods/queryProductColors',
method:'POST',
url:'/productColor/queryProductColors'
}
];
\ No newline at end of file
... ...
... ... @@ -23,172 +23,11 @@
<form id="basicForm" role="form" class="form-horizontal form-bordered" method="post" action="{{action}}">
<div class="panel panel-default">
{{# data}}
<div class="panel-heading">
<h4 class="panel-title">基本信息</h4>
</div>
<div class="panel-body" id="basicInfo">
<div class="row">
<div class="form-group">
<label class="col-sm-2 control-label">店铺 <span class="red">*</span></label>
<div class="col-sm-2">
<select id="shopId" 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="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="supplierId" class="form-control" required>
<option value="-1">供应商</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">分类<span class="red">*</span></label>
<div class="col-sm-10">
<div id="tree"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">商品名称<span class="red">*</span></label>
<div class="col-sm-3">
<input type="text" id="productName" class="form-control" required/>
</div>
<label class="col-sm-1 control-label">厂家编号</label>
<div class="col-sm-1">
<input type="text" id="factoryCode" class="form-control" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">货品年<span class="red">*</span></label>
<div class="col-sm-1">
<select id="goodsYears" class="form-control" required>
<option value="2015">2015</option>
</select>
</div>
<label class="col-sm-1 control-label">货品季<span class="red">*</span></label>
<div class="col-sm-1">
<select id="goodsSeason" class="form-control" required>
<option value="春"></option>
<option value="夏"></option>
<option value="秋"></option>
<option value="冬"></option>
<option value="春夏">春夏</option>
<option value="秋冬">秋冬</option>
</select>
</div>
<label class="col-sm-1 control-label">商品属性<span class="red">*</span></label>
<div class="col-sm-1">
<select id="attribute" class="form-control" required>
<option value="1">普通商品</option>
<option value="2">赠品</option>
<option value="3">虚拟商品</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">商品话题</label>
<div class="col-sm-5">
<input type="text" id="productTag" class="form-control" />
</div>
</div>
<div class="form-group">
<!-- 【年龄层】默认 成人 ,成人和大童小童互斥,如果是童装,年龄层必填,并且大童小童可以复选。 -->
<label class="col-sm-2 control-label">年龄层<span class="red">*</span></label>
<div class="col-sm-2">
<label class="radio-inline">
<input type="checkbox" name="ageLevel" checked="checked" value="1">成人</label>
<label class="radio-inline">
<input type="checkbox" name="ageLevel" value="2">大童</label>
<label class="radio-inline">
<input type="checkbox" name="ageLevel" value="3">小童</label>
<input type="hidden" id="ageLevel" name="ageLevel" value="{{ageLevel}}" for="checkbox" required placeholder="年龄层" />
</div>
<label class="col-sm-1 control-label">性别<span class="red">*</span></label>
<div class="col-sm-2">
<label class="radio-inline">
<input type="radio" name="gender" value="1" checked="checked"></label>
<label class="radio-inline">
<input type="radio" name="gender" value="2"></label>
<label class="radio-inline">
<input type="radio" name="gender" value="3">通用</label>
<input type="hidden" id="gender" name="gender" value="{{gender}}" for="radio" required />
</div>
</div>
<div class="form-group">
<div class="col-sm-4"></div>
<label class="col-sm-1 control-label">重点款<span class="red">*</span></label>
<div class="col-sm-2">
<label class="radio-inline">
<input type="radio" name="brandLevel" value="1"></label>
<label class="radio-inline">
<input type="radio" name="brandLevel" value="0"></label>
</div>
<input type="hidden" id="grade" value="{{grade}}" for="radio" required/>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">促销礼品</label>
<div class="col-sm-2">
<label class="radio-inline">
<input type="radio" name="brandLevel" value="Y"></label>
<label class="radio-inline">
<input type="radio" name="brandLevel" value="N"></label>
<input id="isPromotionalGifts" type="hidden" value="{{isPromotionalGifts}}" for="radio" />
</div>
<label class="col-sm-1 control-label">限量款</label>
<div class="col-sm-2">
<label class="radio-inline">
<input type="radio" name="brandLevel" value="1"></label>
<label class="radio-inline">
<input type="radio" name="brandLevel" value="0"></label>
</div>
<input id="isLimited" type="hidden" value="{{isLimited}}" for="radio" />
</div>
<div class="form-group">
<label class="col-sm-2 control-label">是否限购</label>
<div class="col-sm-2">
<label class="radio-inline">
<input type="radio" name="brandLevel" value="Y"></label>
<label class="radio-inline">
<input type="radio" name="brandLevel" value="N"></label>
</div>
<input type="hidden" id="isLimitbuy" value="{{isLimitbuy}}" for="radio" />
</div>
<div class="form-group">
<label class="col-sm-2 control-label">吊牌价<span class="red">*</span></label>
<div class="col-sm-2">
<input type="text" id="retailPrice" class="form-control" required value="{{retailPrice}}" />
</div>
<label class="col-sm-1 control-label">销售价<span class="red">*</span></label>
<div class="col-sm-2">
<input type="text" id="salesPrice" class="form-control" required value="{{salesPrice}}" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">预计上架时间<span class="red">*</span></label>
<div class="col-sm-2">
<input type="text" id="expectShelfTime" jsaction="time" value="{{expectShelfTime}}" required class="form-control" />
</div>
<label class="col-sm-1 control-label">预计到货时间</label>
<div class="col-sm-2">
<input type="text" id="{{expectArrivalTime}}" jsaction="time" value="{{expectArrivalTime}}" class="form-control" />
</div>
</div>
</div>
</div>
<div class="panel-heading">
... ... @@ -199,26 +38,18 @@
<div class="form-group">
<label class="col-sm-2 control-label">颜色分类 <span class="red">*</span></label>
<p>
<button type="button" class="btn btn-default sortadd btn-xs" data-id="1">红色(+)</button>
{{#data}}
{{#each list}}
<button type="button" class="btn btn-default sortadd btn-xs" data-id="1">红色(+)</button>
{{/each}}
{{/data}}
</p>
</div>
<div id="basicTable"></div>
<!-- <div class="form-group">
<div class="col-sm-3">
<p>色系:粉红色</p>
<button type="button" class="btn btn-default btn-xs">删除</button>
</div>
<div class="col-sm-3">
<input type="file" id="filename" name="filename" />
</div>
<div class="col-sm-6">
</div>
</div> -->
</div>
</div>
{{/ data}}
<div class="panel-footer">
<div class="row">
<div class="col-sm-8 col-sm-offset-2">
... ... @@ -243,12 +74,7 @@
<!-- <label class="col-sm-1 red">*</label> -->
<div class="col-sm-2">
<select class="form-control btn-sort-chima" data-index=[[index]] data-eq=[[__index]] value='[[item.sizeId]]' required placeholder="尺码">
<option value="-1">选择尺码</option>
<option value="XS">XS</option>
<option value="S">S</option>
<option value="M">M</option>
<option value="L">L</option>
<option value="ML">ML</option>
<option value="[[item.sizeId||'-1']]">[[item.sizeName||'选择尺码']]</option>
</select>
</div>
<div class="col-sm-2">
... ... @@ -260,8 +86,8 @@
<div class="col-sm-2">
<select class="form-control btn-sort-kebu" value="[[item.isSuppled]]" data-index=[[index]] data-eq=[[__index]]>
<option value="-1">能否补货</option>
<option value="1">可补货</option>
<option value="2">不可补货</option>
<option value="Y">可补货</option>
<option value="N">不可补货</option>
</select>
</div>
<div class="col-sm-2">
... ... @@ -274,4 +100,169 @@
</div>
</div>
[[/each]]
</script>
<script type="text/template" id="template2">
<div class="row">
<div class="form-group">
<label class="col-sm-2 control-label">店铺 <span class="red">*</span></label>
<div class="col-sm-2">
<select id="shopId" class="form-control" required>
<option value="[[shopId||'-1']]">[[shopName||'店铺']]</option>
</select>
</div>
<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="[[brandId||'-1']]">[[brandName||'品牌']]</option>
</select>
</div>
<label class="col-sm-1 control-label">供应商 <span class="red">*</span></label>
<div class="col-sm-2">
<select id="supplierId" class="form-control" required>
<option value="[[supplierId||'-1']]">[[supplierName||'供应商']]</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">分类<span class="red">*</span></label>
<div class="col-sm-10">
<div id="tree"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">商品名称<span class="red">*</span></label>
<div class="col-sm-3">
<input type="text" id="productName" class="form-control" value="[[productName]]" required/>
</div>
<label class="col-sm-1 control-label">厂家编号</label>
<div class="col-sm-1">
<input type="text" id="factoryCode" value="[[factoryCode]]" class="form-control" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">货品年<span class="red">*</span></label>
<div class="col-sm-1">
<select id="goodsYears" class="form-control" required>
<option value="2015">2015</option>
</select>
</div>
<label class="col-sm-1 control-label">货品季<span class="red">*</span></label>
<div class="col-sm-1">
<select id="goodsSeason" class="form-control" value="[[goodsSeason]]" required>
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
<option value="4"></option>
<option value="5">春夏</option>
<option value="6">秋冬</option>
</select>
</div>
<label class="col-sm-1 control-label">商品属性<span class="red">*</span></label>
<div class="col-sm-1">
<select id="attribute" class="form-control" value="[[attribute]]" required>
<option value="1">普通商品</option>
<option value="2">赠品</option>
<option value="3">虚拟商品</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">商品话题</label>
<div class="col-sm-5">
<input type="text" id="productTag" class="form-control" value="[[productTag]]" />
</div>
</div>
<div class="form-group">
<!-- 【年龄层】默认 成人 ,成人和大童小童互斥,如果是童装,年龄层必填,并且大童小童可以复选。 -->
<label class="col-sm-2 control-label">年龄层<span class="red">*</span></label>
<div class="col-sm-2">
<label class="radio-inline">
<input type="checkbox" name="ageLevel" value="1">成人</label>
<label class="radio-inline">
<input type="checkbox" name="ageLevel" value="2">大童</label>
<label class="radio-inline">
<input type="checkbox" name="ageLevel" value="3">小童</label>
<input type="hidden" id="ageLevel" name="ageLevel" value="[[ageLevel||'1']]" for="checkbox" placeholder="年龄层" />
</div>
<label class="col-sm-1 control-label">性别<span class="red">*</span></label>
<div class="col-sm-2">
<label class="radio-inline">
<input type="radio" name="gender" value="1"></label>
<label class="radio-inline">
<input type="radio" name="gender" value="2"></label>
<label class="radio-inline">
<input type="radio" name="gender" value="3">通用</label>
<input type="hidden" id="gender" name="gender" value="[[gender||'1']]" for="radio" required />
</div>
</div>
<div class="form-group">
<div class="col-sm-4"></div>
<label class="col-sm-1 control-label">重点款<span class="red">*</span></label>
<div class="col-sm-2">
<label class="radio-inline">
<input type="radio" name="grade" value="1"></label>
<label class="radio-inline">
<input type="radio" name="grade" value="0"></label>
</div>
<input type="hidden" id="grade" value="[[grade]]" for="radio" required/>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">促销礼品</label>
<div class="col-sm-2">
<label class="radio-inline">
<input type="radio" name="isPromotionalGifts" value="Y"></label>
<label class="radio-inline">
<input type="radio" name="isPromotionalGifts" value="N"></label>
<input id="isPromotionalGifts" type="hidden" value="[[isPromotionalGifts]]" for="radio" />
</div>
<label class="col-sm-1 control-label">限量款</label>
<div class="col-sm-2">
<label class="radio-inline">
<input type="radio" name="isLimited" value="Y"></label>
<label class="radio-inline">
<input type="radio" name="isLimited" value="N"></label>
</div>
<input id="isLimited" type="hidden" value="[[isLimited]]" for="radio" />
</div>
<div class="form-group">
<label class="col-sm-2 control-label">是否限购</label>
<div class="col-sm-2">
<label class="radio-inline">
<input type="radio" name="brandLevel" value="Y"></label>
<label class="radio-inline">
<input type="radio" name="brandLevel" value="N"></label>
</div>
<input type="hidden" id="isLimitbuy" value="[[isLimitbuy]]" for="radio" />
</div>
<div class="form-group">
<label class="col-sm-2 control-label">吊牌价<span class="red">*</span></label>
<div class="col-sm-2">
<input type="text" id="retailPrice" class="form-control" required value="[[retailPrice]]" />
</div>
<label class="col-sm-1 control-label">销售价<span class="red">*</span></label>
<div class="col-sm-2">
<input type="text" id="salesPrice" class="form-control" required value="[[salesPrice]]" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">预计上架时间<span class="red">*</span></label>
<div class="col-sm-2">
<input type="text" id="expectShelfTime" jsaction="time" value="[[expectShelfTime]]" required class="form-control" />
</div>
<label class="col-sm-1 control-label">预计到货时间</label>
<div class="col-sm-2">
<input type="text" id="[[expectArrivalTime]]" jsaction="time" value="[[expectArrivalTime]]" class="form-control" />
</div>
</div>
</div>
</script>
\ No newline at end of file
... ...