Authored by 陶雨

尺码信息

... ... @@ -27,6 +27,7 @@ var urlObj = {
'getAllHelpCategory': '/operations/helpcontent/getAllHelpCategory',
'getHelpCategory': '/operations/helpcontent/getHelpCategory',
'queryAll4Select': '/goods/brandSeries/queryAll4Select', //品牌款型系列
'getSelectItems': '/meterManage/brand/getSelectItems',//品牌获取选择选项的枚举
// 逛
'guangGetAuthorList':'/guang/article/getAuthorList', // 逛-获取作者
... ...
/**
* Created by ty on 2016/3/24.
*/
var $ = require('jquery'),
common = require('../common/common'),
util = require('../common/util');
$(document).on('click', '#searchSku', function() {
var val = $.trim($("#skuInput").val());
if(!val.match(/^[0-9]+$/)) {
util.__tip("输入不合法", "warning");
return;
}
if(val) {
common.util.__ajax({
url:'/meterManage/productSize/queryProdSizeList',
data:{productSku:val}
},function(res) {
if(res.data.list && res.data.list.length > 0) {
var e = new common.edit("#add-list");
e.on('validate', function() {
var flag = false;
$("input[name='noMeasureIds']").not("input:checked").each(function () {
$("." + $(this).val()).each(function() {
if(!$(this).val()){
flag = true;
return false;
}
});
if(flag) return false;
});
if (flag)
return "请将没有勾选无需测量的列填写完整!";
});
var item = res.data.list[0];
var headList = [];
var j = 0;//创造一个变量以供赋值
if(item.sizeRelationsList.length > 0) {
headList.push({display: "尺码", name: "sizeName"});//尺码
headList.push({
display: "参考尺码(" + item.genderName + ")", name: "referenceName", render: function (item) {//参考尺码列
var refName = item.referenceName ? item.referenceName : "";//非空判断
return '<input class="form-control refInfo" data-index="' + item.__index + '"' + 'value="' + refName + '"/>';
}
});
for (var i = 0; i < item.sizeRelationsList[0].prdSizeAttributeBoList.length; i++) {//尺码列
var sizeAttributes = item.sizeRelationsList[0].prdSizeAttributeBoList[i];// 码数组里的数据
var chkbox = '<label style="cursor: pointer;"><input type="checkbox" name="noMeasureIds" value="' + sizeAttributes.sizeAttributeId + '"/>无需测量</label>';
headList.push({
display: sizeAttributes.sizeAttributeName + "<br>" + chkbox,
name: "sizeValue",
render: function (item) {
if (j == item.prdSizeAttributeBoList.length) j = 0;//防止越界
var sizeVal = item.prdSizeAttributeBoList[j].sizeValue ? item.prdSizeAttributeBoList[j].sizeValue : "";
//j++;//
return '<input class="form-control sizeInfo '+ item.prdSizeAttributeBoList[j++].sizeAttributeId +'" data-index="' + item.__index + '"' + 'value="' + sizeVal + '"/>';
}
});
}
}
var grid=new common.grid({
el:"#content-list",
hash: false,
columns:headList
});
grid.init(item.sizeRelationsList);
$("#add-saveArea").show();
$("#add-head").html(common.util.__template2($("#modifySize-template").html(), item));
$("#noMeasureIds").val(item.noMeasureIds? item.noMeasureIds.join("|"):"");
e.init();
$(document).on('click', '#add-saveBtn', function() {
e.submit("/meterManage/productSize/saveProdSizeInfo",function(option){
//option.data;=
option.data.productSkn = item.productSkn;
option.data.noMeasureIds = $("#noMeasureIds").val()?$("#noMeasureIds").val().split("|"):[];
option.data.noMeasureIds = JSON.stringify(option.data.noMeasureIds);
option.data.sizeInfoList = [];
for(var i = 0; i < $(".sizeInfo").length; i++){
var info = $($(".sizeInfo")[i]);
option.data.sizeInfoList[i] = ({
productSkn: item.productSkn,
sizeId:grid.rows[info.data("index")].sizeId,
sizeAttributeId:grid.rows[info.data("index")].prdSizeAttributeBoList[parseInt(i%grid.rows[info.data("index")].prdSizeAttributeBoList.length)].sizeAttributeId,
sizeValue:info.val()
});
}
option.data.sizeInfoList = JSON.stringify(option.data.sizeInfoList);
option.data.productSizeReferList = [];
for(var i = 0; i < $(".refInfo").length; i++) {
var ref = $($(".refInfo")[i]);
option.data.productSizeReferList.push({
sizeId: grid.rows[ref.data("index")].sizeId,
gender: item.gender,
referenceName: ref.val()
});
}
option.data.productSizeReferList = JSON.stringify(option.data.productSizeReferList);
option.success=function(res){
util.__tip(res.data.message, 'success');
grid.reload();
};
option.error=function(res){
//dialog.close();
util.__tip(res.message);
}
});
return false;
});
}else {
util.__tip("未搜索到sku:" + val);
}
},true);
}
});
\ No newline at end of file
... ...
... ... @@ -9,10 +9,25 @@ var $ = require('jquery'),
new common.edit("#filter").init();
new common.dropDown({el: "#brand-filter"});
new common.dropDown({el: "#manage"});
//new common.dropDown({el: "#brand-filter", "ajax": "getSelectItems"});
new common.dropDown({el: "#hasMeasure-filter"});
new common.dropDown({el: "#category-filter"});
new common.dropDown({el: "#brand-filter", ajax: "brand",params:function(){
return {status:1};
}});
//new common.dropDown({el: "#category-filter", "ajax": "getHelpCategory"});
var tabTree=new common.tabTree("#category-filter",{
columns: [{
state: "prov",
text: "一级分类",
hide: false,
addclass: ""
}],
datas:[{id:"",name:""}]
});
tabTree.init();
//tabTree.getAddress()&&tabTree.getAddress()[0].id
//tabTree.isfeeze=true;
var g = new common.grid({
el: "#content-list",
... ... @@ -22,14 +37,14 @@ var g = new common.grid({
productSkn: common.util.__input('skn-filter'),
brandId: common.util.__input('brand-filter'),
productSku: common.util.__input('sku-filter'),
maxSortId: common.util.__input('category-filter'),
arriveStartTime: new Date(common.util.__input('startTime')).getTime()/1000,
arriveEndTime: new Date(common.util.__input('endTime')).getTime()/1000,
isMeasure: common.util.__input('hasMeasure-filter')
isMeasure: common.util.__input('hasMeasure-filter'),
maxSortId:tabTree.getAddress()[0]?tabTree.getAddress()[0].id:""
};
},
columns: [
{display: "SKN", name: "id"},
{display: "SKN", name: "productSkn"},
{display: "名称", name: "productName"},
{display: "品牌", name: "brandName"},
{display: "分类", name: "productType"},
... ... @@ -52,7 +67,6 @@ var g = new common.grid({
display: "操作",name: "", render: function (item) {
var arr = [];
arr.push('<a class="btn btn-info add2" data-index="' + item.__index + '">编辑</a>');
arr.push('<a class="btn btn-info delbtn" data-index="' + item.__index + '">整理</a>');
return arr.join("");
}
}
... ... @@ -74,46 +88,116 @@ var Bll = {
+ (min < 10 ? "0" + min : min) + ":" + (second < 10 ? "0" + second : second);
},
toast:function(url, item, hint) {
var e = new common.edit("#baseform", {bucket:"activity"});
var dialog=common.dialog.confirm(hint,
common.util.__template($("#template").html(), item),
function() {
e.submit(url,function(option){
//option.data;
if(typeof option.data.startTime == "string") {
option.data.startTime=new Date(option.data.startTime).getTime() / 1000;
option.data.endTime=new Date(option.data.endTime).getTime() / 1000;
}
var e = new common.edit("#nidaye");
option.success=function(res){
dialog.close();
util.__tip(res.data.message, 'success');
g.reload();
};
option.error=function(res){
dialog.close();
util.__tip(res.data.message);
e.on('validate', function() {
var flag = false;
$("input[name='noMeasureIds']").not("input:checked").each(function () {
$("." + $(this).val()).each(function() {
if(!$(this).val()){
flag = true;
return false;
}
});
return false;
if(flag) return false;
});
//
if (flag)
return "请将没有勾选无需测量的列填写完整!";
});
e.init();
new common.dropDown({el: "#productPoolId","ajax":"productPool"});
var dialog=new common.dialog({
title:hint,
content:'<div id="nidaye"><input type="hidden" id="noMeasureIds" for="checkbox">'+ common.util.__template2($("#modifySize-template").html(), item) +'<div id="faGrid" style="height: 600px;overflow:auto;"></div></div>',
width: "90%",
button:[{
value:"提交",
callback:function(){
e.submit(url,function(option){
//option.data;=
option.data.productSkn = item.productSkn;
option.data.noMeasureIds = $("#noMeasureIds").val()?$("#noMeasureIds").val().split("|"):[];
option.data.noMeasureIds = JSON.stringify(option.data.noMeasureIds);
option.data.sizeInfoList = [];
for(var i = 0; i < $(".sizeInfo").length; i++){
var info = $($(".sizeInfo")[i]);
option.data.sizeInfoList[i] = ({
productSkn: item.productSkn,
sizeId:grid.rows[info.data("index")].sizeId,
sizeAttributeId:grid.rows[info.data("index")].prdSizeAttributeBoList[parseInt(i%grid.rows[info.data("index")].prdSizeAttributeBoList.length)].sizeAttributeId,
sizeValue:info.val()
});
}
option.data.sizeInfoList = JSON.stringify(option.data.sizeInfoList);
option.data.productSizeReferList = [];
for(var i = 0; i < $(".refInfo").length; i++) {
var ref = $($(".refInfo")[i]);
option.data.productSizeReferList.push({
sizeId: grid.rows[ref.data("index")].sizeId,
gender: item.gender,
referenceName: ref.val()
});
}
option.data.productSizeReferList = JSON.stringify(option.data.productSizeReferList);
option.success=function(res){
dialog.close();
util.__tip(res.data.message, 'success');
g.reload();
};
option.error=function(res){
//dialog.close();
util.__tip(res.message);
}
});
return false;
}},
{
value:"取消"
}]
});
var headList = [];
var j = 0;//创造一个变量以供赋值
if(item.sizeRelationsList.length > 0) {
headList.push({display: "尺码", name: "sizeName"});//尺码
headList.push({
display: "参考尺码(" + item.genderName + ")", name: "referenceName", render: function (item) {//参考尺码列
var refName = item.referenceName ? item.referenceName : "";//非空判断
return '<input class="form-control refInfo" data-index="' + item.__index + '"' + 'value="' + refName + '"/>';
}
});
for (var i = 0; i < item.sizeRelationsList[0].prdSizeAttributeBoList.length; i++) {//尺码列
var sizeAttributes = item.sizeRelationsList[0].prdSizeAttributeBoList[i];// 码数组里的数据
var chkbox = '<label style="cursor: pointer;"><input type="checkbox" name="noMeasureIds" value="' + sizeAttributes.sizeAttributeId + '"/>无需测量</label>';
headList.push({
display: sizeAttributes.sizeAttributeName + "<br>" + chkbox,
name: "sizeValue",
render: function (item) {
if (j == item.prdSizeAttributeBoList.length) j = 0;//防止越界
var sizeVal = item.prdSizeAttributeBoList[j].sizeValue ? item.prdSizeAttributeBoList[j].sizeValue : "";
//j++;//
return '<input class="form-control sizeInfo '+ item.prdSizeAttributeBoList[j++].sizeAttributeId +'" data-index="' + item.__index + '"' + 'value="' + sizeVal + '"/>';
}
});
}
}
if(hint == "专题编辑") {
common.util.__ajax({
url:'/runManage/subjectManage/queryBaseProductPoolListById',
data:{id:item.productPoolId}
},function(res) {
$("#select2-productPoolId-container").html(res.data[0].text);
},true);
var grid=new common.grid({
el:"#faGrid",
hash: false,
columns:headList
});
grid.init(item.sizeRelationsList);
$("#noMeasureIds").val(item.noMeasureIds? item.noMeasureIds.join("|"):"");
e.init();
}
}
};
};
$(document).on('click', '#filter-btn', function() {
g.reload(1);
});
$(document).on('click', '.add2', function () {
var item = g.rows[$(this).data("index")];
Bll.toast("/meterManage/productSize/saveProdSizeInfo", item, "修改尺码");
});
\ No newline at end of file
... ...
... ... @@ -3,8 +3,8 @@
* 测量尺码管理
*/
//exports.domain = require('../config/common.js').domain;
//exports.domain = 'http://172.16.6.162:8080/platform'; //李建
exports.domain = 'http://192.168.102.216:8180/platform'; //测试环境
exports.domain = 'http://172.16.6.162:8088/platform'; //李建
//exports.domain = 'http://192.168.102.216:8180/platform'; //测试环境
exports.res = [
... ... @@ -21,6 +21,7 @@ exports.res = [
method: 'POST',
url: '/productSize/queryProdSizeList',
params: [
{name: "page", type: "number"},
{name: "productSkn", type: "number"},
{name: "brandId", type: "number"},
{name: "productSku", type: "number"},
... ... @@ -29,5 +30,28 @@ exports.res = [
{name: "arriveEndTime", type: "number"},
{name: "isMeasure", type: "string"}
]
},
{
route: '/meterManage/productSize/saveProdSizeInfo',
method: 'POST',
url: '/productSize/saveProdSizeInfo',
params: [
{name: "productSkn", type: "number"},
{name: "sizeInfoList", type: "string"},
{name: "productSizeReferList", type: "string"},
{name: "noMeasureIds", type: "string"}
]
},
{
route: '/meterManage/brand/getSelectItems',
method: 'POST',
url: '/brand/getSelectItems',
params: []
},
{//添加页面
route: '/meterManage/meterSize/add',//访问路由
method: 'GET',//方法
view: 'pages/meterManage/addSizeInfo',//视图
src: '/meterManage/addSizeInfo'//控制层
}
];
\ No newline at end of file
... ...
/**
* Created by ty on 2016/3/17.
*/
exports.domain = require('../config/common.js').domain;
//exports.domain = 'http://172.16.6.252:9080';
exports.res = [
{
//查找洗涤提示
route:'/netSale/queryWashTipsList',
method:'POST',
url: '/product/queryWashTipsList/',
params: [
{name:'categoryId', type:'number'},
{name:'saleType', type:'number'},
{name:'displayPosition', type:'number'}
]
},
{
//查找材质参数
route:'/netSale/queryMaterialList',
method:'POST',
url: '/product/queryMaterialList',
params: [
{name:'categoryId', type:'number'},
{name:'saleType', type:'number'},
{name:'displayPosition', type:'number'}
]
}
];
\ No newline at end of file
<!--尺码测量添加界面-->
<div class="pageheader">
<div class="media">
<div class="pageicon pull-left">
<i class="fa fa-th-list"></i>
</div>
<div class="media-body">
<ul class="breadcrumb">
<li><a href=""><i class="glyphicon glyphicon-home"></i></a></li>
<li><a href="">测量管理</a></li>
<li>尺码信息添加</li>
</ul>
<div>
<div style="width: 30%;float: left;">
<h4>尺码信息添加</h4>
</div>
</div>
</div>
</div>
</div>
<div class="contentpanel">
<div class="panel panel-default" style="...">
<div class="panel-body">
<div class="row">
<div class="panel-col">
<input type="text" class="form-control" id="skuInput" />
</div>
<div class="panel-col">
<input type="button" class="btn" value="搜索" id="searchSku" />
</div>
</div>
</div>
</div>
<div id="add-list">
<input type="hidden" id="noMeasureIds" for="checkbox">
<div id="add-head"></div>
<div id="content-list"></div>
<div id="add-saveArea" hidden="hidden">
<input type="button" class="btn" value="保存" id="add-saveBtn" />
</div>
</div>
</div>
<script type="text/template" id="modifySize-template" style="width: 900px">
<div id="base-form">
<table style="width: 100%">
<tr>
<th>SKN</th>
<td width="60px;">[[productSkn]]</td>
<th> 名称:</th>
<td>[[productName]]</td>
<th> 品牌:</th>
<td>[[brandName]]</td>
<th> 分类:</th>
<td>[[maxSortName]]</td>
<th> 性别:</th>
<td>[[genderName]]</td>
<input type="hidden" id="productSkn" value="[[productSkn]]" />
</tr>
</table>
</div>
</script>
\ No newline at end of file
... ...
... ... @@ -21,6 +21,9 @@
<div class="contentpanel">
<div class="panel panel-default" style="...">
<div class="panel-heading">
<a class="btn btn-success " href="/meterManage/meterSize/add" id="add-sizeInfo"><i class="fa fa-plus"></i> 添加尺码信息</a>
</div>
<div class="panel-body">
<div class="row" id="filter">
<div class="panel-col">
... ... @@ -35,16 +38,13 @@
</select>
</div>
<div class="panel-col">
<select name="maxSortId" id="category-filter" tabindex="-1" title="" class="form-control">
<option value="">大分类</option>
</select>
<div id="category-filter"></div>
</div>
<div class="panel-col">
<select name="hasMeasure" id="hasMeasure-filter" tabindex="-1" title="" class="form-control">
<select name="isMeasure" id="hasMeasure-filter" tabindex="-1" title="" class="form-control">
<option value="">是否测量</option>
<option value="0">未测量</option>
<option value="1">已测量</option>
<option value="2">测量不全</option>
<option value="N">未测量</option>
<option value="Y">已测量</option>
</select>
</div>
<div class="panel-col">
... ... @@ -65,7 +65,8 @@
</div>
<script type="text/template" id="sizeinfo-template">
<table style="table-layout:automatic" class="table table-striped table-hover table-bordered responsive dataTable no-footer">
[[if sizeRelationsList && sizeRelationsList.length > 0]]
<table class="table table-striped table-hover table-bordered responsive dataTable no-footer">
<thead>
<tr>
<td>尺码</td>
... ... @@ -86,4 +87,25 @@
[[/each]]
</tbody>
</table>
[[/if]]
</script>
<script type="text/template" id="modifySize-template" style="width: 900px">
<div id="base-form">
<table style="width: 100%">
<tr>
<th>SKN</th>
<td width="60px;">[[productSkn]]</td>
<th> 名称:</th>
<td>[[productName]]</td>
<th> 品牌:</th>
<td>[[brandName]]</td>
<th> 分类:</th>
<td>[[maxSortName]]</td>
<th> 性别:</th>
<td>[[genderName]]</td>
<input type="hidden" id="productSkn" value="[[productSkn]]" />
</tr>
</table>
</div>
</script>
... ...