Authored by liuyue

Merge branch 'release/1.6' of git.dev.yoho.cn:platform/yohobuy-portal-fe into release/1.6

... ... @@ -50,7 +50,7 @@ var $ = require('jquery'),
var Bll = {
toast:function(url, item, hint) {
var e = new common.edit("#baseform");
var e = new common.edit("#baseform", {bucket: "yhb-img01"});
common.dialog.confirm(hint,
common.util.__template($("#template").html(), item),
... ...
... ... @@ -50,6 +50,7 @@ var tableGird = new common.grid({
]
});
// 弹框里面添加属性值控件
var propValueGrid = new common.grid({
el: "#prop-value-table",
... ... @@ -58,18 +59,18 @@ var propValueGrid = new common.grid({
render: function (items) {
//items.id=items.__index+1;
return('<input id="id" class="form-control width110" value="'+items.id+'" type="text">');
return('<input id="id" disabled="true" class="form-control width110 propValueID" value="'+items.id+'" required="required" data-index="'+items.__index+'" type="text">');
}
},
{display: "属性值", name: "name",
render: function (items) {
return('<input id="name" class="form-control width110 propValue" value="'+items.name+'" data-index="'+items.__index+'" type="text" placeholder="属性值">');
return('<input id="name" class="form-control width110 propValue" value="'+items.name+'" data-index="'+items.__index+'" required="required" type="text" placeholder="属性值">');
}
},
{
display: "操作",
name: "categoryId",
name: "",
render: function (items) {
var html = [];
... ... @@ -86,21 +87,34 @@ var propValueGrid = new common.grid({
$(document).on("change",".propValueID",function(){
var item=propValueGrid.__rows[$(this).data("index")];
if (item) {
item.id = $(this).val();
}
});
$(document).on("change",".propValue",function(){
var item=propValueGrid.__rows[$(this).data("index")];
item.name = $(this).val();
if (item) {
item.name = $(this).val();
}
});
//增加属性值
$(document).on('click', '.prop-add-btn', function () {
propValueGrid.__rows.push({name:"",id:propValueGrid.__rows.length});
propValueGrid.__rows.push({name:"",id:parseInt(propValueGrid.__rows[propValueGrid.__rows.length-1].id) + 1});
propValueGrid.reload();
});
//删除属性值
$(document).on('click', '.prop-del-btn', function () {
var item = tableGird.rows[$(this).data('index')];
var item = propValueGrid.__rows[$(this).data('index')];
propValueGrid.__rows.splice($(this).data('index'),1);
propValueGrid.reload();
});
... ... @@ -121,6 +135,7 @@ $(document).on('click', '.edit-class-btn', function () {
});
$(document).on('change', '#inputType', function () {
$('#attributeValues').val('默认属性值');
showORHidePropValue();
});
... ... @@ -132,7 +147,7 @@ function attributeOp(prefix, url, item) {
if(item.attributeValues) {
propValueGrid.__rows = JSON.parse(item.attributeValues);
} else {
propValueGrid.__rows=[{ 'name':""}];
propValueGrid.__rows=[{ 'name':"", 'id':"1"}];
}
common.dialog.confirm(prefix + "属性", common.util.__template($("#template").html(), item), function () {
... ... @@ -140,6 +155,11 @@ function attributeOp(prefix, url, item) {
option.data.categoryId = item.categoryId;
option.data.attributeId = item.attributeId;
// 检查所有属性值是否为空
//if (!checkPropName()) {
// alert()
//}
var inputType = $('#inputType').val();
... ... @@ -157,7 +177,7 @@ function attributeOp(prefix, url, item) {
}
//console.log(propVlaueArr);
console.log(propVlaueArr);
//option.debug = true;
propValueGrid.__rows = [];
... ... @@ -186,6 +206,9 @@ function attributeOp(prefix, url, item) {
// 属性值列表的初始化
sortPropValuesArray();
console.log(propValueGrid.__rows);
propValueGrid.init(propValueGrid.__rows);
showORHidePropValue();
}
... ... @@ -203,4 +226,20 @@ function showORHidePropValue () {
}
}
// 给属性值数组按照id排序
function sortPropValuesArray() {
propValueGrid.__rows.sort(function (a, b) {
return a.id - b.id
});
}
function checkPropName() {
propValueGrid.__rows.forEach(function (item) {
if (!item.name) return false;
});
return true;
}
... ...
... ... @@ -20,73 +20,75 @@
</div>
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-heading">
<a class="btn btn-success " id="add-subject"><i class="fa fa-plus"></i> 添加专题</a>
</div>
<div class="panel-body">
<div class="row">
<div class="panel-col">
<select name="sort" id="subject-type" tabindex="-1" title="" class="select2-offscreen brandBtn-group">
<option value="" selected="">类型</option>
<option value="1">奥莱</option>
<option value="2">SALE</option>
</select>
</div>
<div class="panel-col">
<select name="paltform" id="subject-paltform" tabindex="-1" title="" class="select2-offscreen brandBtn-group">
<option value="" selected="">平台</option>
<option value="1">WEB</option>
<option value="2">APP</option>
<option value="3">WAP</option>
<option value="4">IPAD</option>
</select>
</div>
<div class="panel-col">
<select name="status" id="subject-status" tabindex="-1" title="" class="select2-offscreen brandBtn-group">
<option value="" selected="">状态</option>
<option value="1">未定时</option>
<option value="2">未发布</option>
<option value="3">已发布</option>
<option value="4">已结束</option>
</select>
</div>
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="filter-all" href="/runManage/subjectManage/index" class="btn btn-info">全部</a>
<div class="panel-heading">
<a class="btn btn-success " id="add-subject"><i class="fa fa-plus"></i> 添加专题</a>
</div>
<div class="panel-body">
<div class="row">
<div class="panel-col">
<select name="sort" id="subject-type" tabindex="-1" title="" class="select2-offscreen brandBtn-group">
<option value="" selected="">类型</option>
<option value="1">奥莱</option>
<option value="2">SALE</option>
</select>
</div>
<div class="panel-col">
<select name="paltform" id="subject-paltform" tabindex="-1" title=""
class="select2-offscreen brandBtn-group">
<option value="" selected="">平台</option>
<option value="1">WEB</option>
<option value="2">APP</option>
<option value="3">WAP</option>
<option value="4">IPAD</option>
</select>
</div>
<div class="panel-col">
<select name="status" id="subject-status" tabindex="-1" title=""
class="select2-offscreen brandBtn-group">
<option value="" selected="">状态</option>
<option value="1">未定时</option>
<option value="2">未发布</option>
<option value="3">已发布</option>
<option value="4">已结束</option>
</select>
</div>
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="filter-all" href="/runManage/subjectManage/index" class="btn btn-info">全部</a>
</div>
</div>
</div>
<div class="contentpanel">
<div class="panel panel-default" style="margin-bottom: 10px">
<input type="hidden" id="url" value="/runManage/subjectManage/subjectList" />
<div id="subject-manage"></div>
</div>
<div class="panel panel-default" style="margin-bottom: 10px">
<input type="hidden" id="url" value="/runManage/subjectManage/subjectList"/>
<div id="subject-manage"></div>
</div>
</div>
<script type="text/template" id="template2">
<input type="text" name="sort" size="1" placeholder="排序" />
<input type="button" class="btn btn-xs btn-info sortsave" id="save" value="保存" />
<input type="button" class="btn btn-xs btn-info sortcancel" id="cancel" value="取消" />
<input type="text" name="sort" size="1" placeholder="排序"/>
<input type="button" class="btn btn-xs btn-info sortsave" id="save" value="保存"/>
<input type="button" class="btn btn-xs btn-info sortcancel" id="cancel" value="取消"/>
</script>
<script type="text/template" id="template">
<div class="rows" id="baseform">
<div class="form-group">
<label class="col-sm-2 control-label">分类<font color="#f00">*</font></label>
<input type="hidden" value="{id}" id="id" />
<div class="col-sm-10">
<input name="sort" type="radio" value="1" />奥莱
<input name="sort" type="radio" value="2" />SALE
</div>
<input type="hidden" id="sort" value="{sort}" for="radio" />
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="title">标题<font color="#f00">*</font></label>
<div class="col-sm-8">
<input type="text" value="{title}" class="form-control" id="title" required="required" />
</div>
</div>
<div class="form-group">
<div class="rows" id="baseform">
<div class="form-group">
<label class="col-sm-2 control-label">分类<font color="#f00">*</font></label>
<input type="hidden" value="{id}" id="id"/>
<div class="col-sm-10">
<input name="sort" type="radio" value="1"/>奥莱
<input name="sort" type="radio" value="2"/>SALE
</div>
<input type="hidden" id="sort" value="{sort}" for="radio"/>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="title">标题<font color="#f00">*</font></label>
<div class="col-sm-8">
<input type="text" value="{title}" class="form-control" id="title" required="required"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">平台</label>
<div class="col-sm-8">
<label style="cursor: pointer;"><input type="checkbox" name="plateform" value="1">WEB</label>
... ... @@ -95,62 +97,70 @@
<label style="cursor: pointer;"><input type="checkbox" name="plateform" value="4">IPAD</label>
</div>
<input type="hidden" id="plateform" value="{plateform}" for="checkbox">
</div>
<div class="form-group">
</div>
<div class="form-group">
<label class="col-sm-2 control-label">促销形式</label>
<div class="col-sm-10">
<input id="promotion1" name="promotionName" type="radio" value="1" />
<input class="smalltxt" type="text" id="promotionName1" />折起&nbsp;&nbsp;
<input id="promotion1" name="promotionName" type="radio" value="1"/>
<input class="smalltxt" type="text" id="promotionName1"/>折起&nbsp;&nbsp;
<input id="promotion2" name="promotionName" type="radio" value="2" /><input class="smalltxt" type="text" id="promotionName2" />~<input class="smalltxt" type="text" id="promotionName3" />&nbsp;&nbsp;
<input id="promotion4" name="promotionName" type="radio" value="4" /><input class="smalltxt" type="text" id="promotionName4" />元起&nbsp;&nbsp;
<input id="promotion2" name="promotionName" type="radio" value="2"/><input class="smalltxt" type="text"
id="promotionName2"/>~<input
class="smalltxt" type="text" id="promotionName3"/>&nbsp;&nbsp;
<input id="promotion5" name="promotionName" type="radio" value="5" /><input class="smalltxt" type="text" id="promotionName5" />%Off(大图折扣)
</div>
</div>
<div class="form-group col-sm-100">
<label class="col-sm-2 control-label">活动时间</label>
<div class="panel-col1 col-sm-4">
<input type="text" id="startTime" jsaction="time:end:endTime" class="form-control panel-input hasDatepicker " name="start_time" placeholder="开始时间" value="{startTime}">
<input id="promotion4" name="promotionName" type="radio" value="4"/><input class="smalltxt" type="text"
id="promotionName4"/>元起&nbsp;&nbsp;
<input id="promotion5" name="promotionName" type="radio" value="5"/><input class="smalltxt" type="text"
id="promotionName5"/>%Off(大图折扣)
</div>
</div>
<div class="form-group col-sm-100">
<label class="col-sm-2 control-label">活动时间</label>
<div class="panel-col1 col-sm-4">
<input type="text" id="startTime" jsaction="time:end:endTime"
class="form-control panel-input hasDatepicker " name="start_time" placeholder="开始时间"
value="{startTime}">
</div>
<div class="panel-col1 col-sm-4">
<input type="text" id="endTime" jsaction="time:start:startTime" class="form-control panel-input hasDatepicker" name="end_time" placeholder="结束时间" value="{endTime}">
<input type="text" id="endTime" jsaction="time:start:startTime"
class="form-control panel-input hasDatepicker" name="end_time" placeholder="结束时间"
value="{endTime}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-lalbel" for="orderNum">排序</label>
<div class="col-sm-8">
<input type="text" id="orderNum" value="{orderNum}" class="form-control"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-lalbel" for="orderNum">排序</label>
<div class="col-sm-8">
<input type="text" id="orderNum" value="{orderNum}" class="form-control" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">LOGO图片</label>
<div class="col-sm-10">
<input type="file" id="logoUrl" name="logoUrl" value="{logoUrl}" /><!---->
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">封面图</label>
<div class="col-sm-10">
<input type="file" id="coverUrl" name="coverUrl" value="{coverUrl}" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">web列表页图</label>
<div class="col-sm-10">
<input type="file" id="webUrl" name="webUrl" value="{webUrl}" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="">添加商品<font color="#f00">*</font></label>
<div class="col-sm-10">
<select id="productPoolId" style="width: 280px;" value="{productPoolId}">
<option value="{productPoolId}">请选择商品池</option>
</select>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">LOGO图片</label>
<div class="col-sm-10">
<input type="file" id="logoUrl" name="logoUrl" value="{logoUrl}"/><!---->
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">封面图</label>
<div class="col-sm-10">
<input type="file" id="coverUrl" name="coverUrl" value="{coverUrl}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">web列表页图</label>
<div class="col-sm-10">
<input type="file" id="webUrl" name="webUrl" value="{webUrl}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="">添加商品<font color="#f00">*</font></label>
<div class="col-sm-10">
<select id="productPoolId" style="width: 280px;" value="{productPoolId}">
<option value="{productPoolId}">请选择商品池</option>
</select>
</div>
</div>
</div>
</script>
\ No newline at end of file
... ...