Authored by liuyue

路由及商品参数修改

... ... @@ -71,6 +71,15 @@ GOLABDATA.on("LYaddInfo", function() {
});
});
function inputDisabled(callback) {
if ($('.contentpanel').data('type') == 'info') {
$('.contentpanel').find('input').prop('disabled', true);
$('.contentpanel').find('select').prop('disabled', true);
$('.contentpanel').find('.btn').addClass('disabled');
callback && callback();
}
}
$.ajax({
type: 'POST',
url: '/goods/product/queryAttributesByConf',
... ... @@ -151,12 +160,9 @@ $.ajax({
e.init();
if ($('.contentpanel').data('type') == 'info') {
$('.contentpanel').find('input').prop('disabled', true);
$('.contentpanel').find('select').prop('disabled', true);
$('.contentpanel').find('.btn').addClass('disabled');
inputDisabled(function() {
$('#addinfo-wrap').find('input').not(":checked").parents('label').hide();
}
});
}
});
... ... @@ -241,48 +247,44 @@ $('#editProductName').on('click', function() {
// });
var common_columns = [{
display: "名称",
width: '10%',
name: "attributeName",
render: function(item) {
item.required = item.isMust == "Y" ? "required" : "";
var arr = [];
arr.push(item.attributeName);
if (item.required) {
arr.push("<span class='red'>*</span>");
}
return arr.join('');
}
}]
/*陈超*/
var ag = new common.grid({
el: "#attributeTable",
columns: [{
display: "名称",
name: "attributeName",
render: function(item) {
item.required = item.isMust == "Y" ? "required" : "";
var arr = [];
arr.push(item.attributeName);
if (item.required) {
arr.push("<span class='red'>*</span>");
}
return arr.join('');
}
}, {
hash: false,
columns: common_columns.concat([{
display: "属性",
render: function(item) {
item.required = item.isMust == "Y" ? "required" : "";
// item.attributeValues=item.attributeValues.split(',').map(function(elem, index, arr){
// return {name:elem}
// });
var attrs = NETSALEDATA.productStandardRelationBoList;
if (attrs) {
for (var i in attrs) {
if (attrs[i].standardId == item.attributeId) {
item.val = attrs[i].standardVal;
item.val = attrs[i].parameterMakeId;
item.__val = attrs[i].parameterMakeId;
}
}
}
// item.attributeValues={name:};
item.__name = "attributeTable";
return common.util.__template2($("#template33").html(), item);
}
}, {
display: "备注",
name: "remark"
}],
}]),
complete: function() {
ag.__edit.init();
}
... ... @@ -297,6 +299,9 @@ common.util.__ajax({
}
}, function(res) {
ag.init(res.data);
inputDisabled(function() {
$('#attributeTable').find('input').not(":checked").parents('label').hide();
});
}, true);
... ... @@ -305,43 +310,25 @@ common.util.__ajax({
console.log("attributeProValuesBosOne", NETSALEDATA.attributeProValuesBosOne);
var ag2 = new common.grid({
el: "#goodsParamWrap",
columns: [{
display: "名称",
name: "attributeName",
render: function(item) {
item.required = item.isMust == "Y" ? "required" : "";
var arr = [];
arr.push(item.attributeName);
if (item.required) {
arr.push("<span class='red'>*</span>");
}
return arr.join('');
}
}, {
hash: false,
columns: common_columns.concat([{
display: "属性",
render: function(item) {
item.required = item.isMust == "Y" ? "required" : "";
item.id = item.parameterMakeId;
// item.attributeValues=item.attributeValues.split(',').map(function(elem, index, arr){
// return {name:elem}
// });
var attrs = NETSALEDATA.attributeProValuesBosOne;
if (attrs) {
for (var i in attrs) {
if (attrs[i].attributeId == item.attributeId) {
item.val = attrs[i].standardVal;
item.val = attrs[i].attributeValueId;
item.__val = attrs[i].attributeValueId.replace(/,/g, '|');
}
}
}
// item.attributeValues={name:};
item.__name = "goodsParamWrap";
return common.util.__template2($("#template33").html(), item);
}
}, {
display: "备注",
name: "remark"
}],
}]),
complete: function() {
ag2.__edit.init();
}
... ... @@ -358,21 +345,70 @@ common.util.__ajax({
}, function(res) {
console.log("res.data", res.data);
ag2.init(res.data);
inputDisabled(function() {
$('#goodsParamWrap').find('input').not(":checked").parents('label').hide();
});
}, true);
// console.log(basicInfo);
var ag3 = new common.grid({
el: "#goodsParamWrap2",
hash: false,
columns: common_columns.concat([{
display: "属性",
render: function(item) {
item.required = item.isMust == "Y" ? "required" : "";
item.id = item.parameterMakeId;
var attrs = NETSALEDATA.specialAttrBo;
if (attrs && attrs.materialList) {
var _arr = [];
for (var i in attrs.materialList) {
_arr.push(attrs.materialList[i].id);
}
item.__val = _arr.join('|');
}
item.__name = "goodsParamWrap2";
return common.util.__template2($("#template33").html(), item);
}
}]),
complete: function() {
ag3.__edit.init();
}
});
ag3.__edit = new common.edit("#goodsParamWrap2");
common.util.__ajax({
url: '/base/goods/queryMaterialList',
data: {
categoryId: basicInfo.maxSortId
}
}, function(res) {
console.log("接口queryMaterialList", res.data);
ag3.init([res.data]);
}, true);
$(document).on("change", "#goodsParamWrap .attr_input", function() {
var item = ag2.rows[$(this).data("index")];
item.val = $(this).val();
});
$(document).on("change", "#goodsParamWrap .attr_checkobx_class", function() {
var item = ag2.rows[$(this).data("index")];
item.val = $("#attr_" + $(this).data("index")).val().replace(/\|/g, ',');
})
$(document).on("change", "#attributeTable .attr_input", function() {
var item = ag.rows[$(this).data("index")];
item.val = $(this).val();
});
$(document).on("change", "#goodsParamWrap .attr_checkobx_class", function() {
var item = ag2.rows[$(this).data("index")];
item.val = $("#goodsParamWrap_attr_" + $(this).data("index")).val().replace(/\|/g, ',');
})
$(document).on("change", "#goodsParamWrap2 .attr_checkobx_class", function() {
var item = ag3.rows[$(this).data("index")];
item.val = $("#goodsParamWrap2_attr_" + $(this).data("index")).val().replace(/\|/g, ',');
})
/*保存*/
GOLABDATA.on("TYgoodsParams", function() {
... ... @@ -381,24 +417,24 @@ GOLABDATA.on("TYgoodsParams", function() {
return ag.__edit.errMessage;
}
if (!ag2.__edit.validate(true)) {
return ag.__edit.errMessage;
return ag2.__edit.errMessage;
}
if (!ag3.__edit.validate(true)) {
return ag3.__edit.errMessage;
}
var productStandardRelationStr = [];
if (ag.rows.length > 0) {
for (var i in ag.rows) {
if (ag.rows[i].val) {
var arr = ag.rows[i].val.split('|');
var idNameList = ag.rows[i].idNameList;
for (var x in idNameList) {
for (var y in arr) {
if (arr[y] == idNameList[x].id) {
productStandardRelationStr.push({
standardId: ag.rows[i].attributeId,
standardVal: idNameList[x].text,
parameterMakeId: idNameList[x].id
});
}
if (ag.rows[i].val == idNameList[x].id) {
productStandardRelationStr.push({
standardId: ag.rows[i].attributeId,
standardVal: idNameList[x].text,
parameterMakeId: idNameList[x].id
});
}
}
}
... ... @@ -421,8 +457,14 @@ GOLABDATA.on("TYgoodsParams", function() {
}
}
data.attributeProValuesOne = JSON.stringify(goodsParamArr);
data.productMaterial = "";
if (ag3.rows.length > 0) {
data.productMaterial = ag3.rows[0].val;
}
data.productSkn = $('#productSkn').val();
console.log(data);
console.log("data", data);
return data;
});
... ...
exports.domain = require('../config/common.js').domain;
//exports.domain = "http://172.16.6.240:8088/platform";
// exports.domain="http://172.16.6.240:8088/platform";
// exports.domain = "http://172.16.6.227:8088/platform";
exports.res = [{ //基础商品列表
route: '/product/base/index',
... ... @@ -166,7 +166,8 @@ exports.res = [{ //基础商品列表
url: '/productColor/queryProductColors',
data: {
pageTitle: "创建基础商品",
action: "/base/goods/ajax/add"
action: "/base/goods/ajax/add",
btnText: "提交审核"
},
src: '/basegoods/edit'
}, { //添加接口
... ... @@ -265,7 +266,8 @@ exports.res = [{ //基础商品列表
src: '/basegoods/edit',
data: {
pageTitle: "修改基础商品",
action: "/base/goods/ajax/update"
action: "/base/goods/ajax/update",
btnText: "保存"
}
}, { //删除
route: '/base/goods/ajax/delete',
... ... @@ -443,9 +445,7 @@ exports.res = [{ //基础商品列表
method: 'GET',
view: 'pages/basegoods/info',
src: '/basegoods/goodsInfo'
},
{
}, {
// 获取商品详情数据
route: '/base/goods/getData',
method: 'POST',
... ... @@ -482,9 +482,9 @@ exports.res = [{ //基础商品列表
}, {
route: '/base/goods/queryAllProductAttr',
method: 'POST',
url: '/product/queryAllProductAttr',
url: '/standard/queryAllBySortId4Html',
params: [{
name: 'categoryId',
name: 'param',
type: 'Number'
},
// 1:基础商品-非销售属性 2:网销信息-上架后补全信息 3:网销信息-商品参数
... ... @@ -494,6 +494,14 @@ exports.res = [{ //基础商品列表
}
]
}, {
route: '/base/goods/queryMaterialList',
method: 'POST',
url: '/product/queryMaterialList',
params: [{
name: 'categoryId',
type: 'Number'
}]
}, {
route: '/goods/query/querySortBySmallSort',
method: 'POST',
url: '/product/querySortBySmallSort',
... ...
... ... @@ -245,9 +245,8 @@ exports.res = [{
action: 'audit'
}
},
{
}, {
//网销信息 -> 查询网销详情
route: '/goods/netsale/getdata',
method: 'POST',
url: '/product/getNetSaleInfo',
... ... @@ -332,6 +331,12 @@ exports.res = [{
}, {
name: 'goodsImagesReq',
type: 'string'
}, {
name: 'productStandardRelationStr',
type: 'string'
}, {
name: 'productMaterial',
type: 'string'
}]
}, {
//网销信息 -> 保存基本信息接口
... ... @@ -426,6 +431,24 @@ exports.res = [{
type: 'number'
}]
}, {
//网销信息 -> 查询品牌款型系列列表
route: '/goods/brandSeries/queryAll4Select',
method: 'POST',
url: '/brandSeries/queryAll4Select',
params: [{
name: 'type',
type: 'number'
}, {
name: 'status',
type: 'number'
}, {
name: 'shopsId',
type: 'number'
}, {
name: 'brandId',
type: 'number'
}]
}, {
//网销信息 -> 品牌关联
route: '/goods/product/saveBrandRelation',
method: 'POST',
... ... @@ -500,5 +523,193 @@ exports.res = [{
name: 'endTime',
type: 'number'
}]
},
//***********************************陶雨*******************************
{
//保存搜索顺序
route: '/netSale/saveSearchSort',
method: 'POST',
url: '/product/saveSearchSort',
params: [{
name: 'searchSortList',
type: 'string'
}]
}, {
//查找热搜词
route: '/netSale/queryHotSearchTerms',
method: 'POST',
url: '/searchWords/queryHotSearchTerms',
params: [{
name: 'page',
type: 'number'
}, {
name: 'size',
type: 'number',
def: 10
}]
}, {
//查找洗涤提示
route: '/netSale/getAll4Select',
method: 'POST',
url: '/washTips/getAll4Select/',
params: []
}, {
//查找材质参数
route: '/netSale/queryAllBySortId4Select',
method: 'POST',
url: '/productMaterial/queryAllBySortId4Select',
params: [{
name: 'param',
type: 'number'
}]
}, {
//查找所有商品参数信息 //暂时没用
route: '/netSale/queryAllGoodsParams',
method: 'POST',
apis: {
washTipsList: {
url: '/washTips/getAll4Select/'
},
materialList: {
url: 'productMaterial/queryAllBySortId4Select',
params: [{
name: 'param',
type: 'number'
}],
isJsonRaw: true
}
}
}, {
//保存搜索关键词
route: '/netSale/saveNetSaleSearchKeys',
method: 'POST',
url: '/product/saveNetSaleSearchKeys',
params: [{
name: 'productSkn',
type: 'number'
}, {
name: 'searchKeys',
type: 'string'
}]
}, {
//保存商品参数
route: '/netSale/saveProductParam',
method: 'POST',
url: '/product/saveProductParam',
params: [{
name: 'productSkn',
type: 'number'
}, {
name: 'attributeProValuesOne',
type: 'string'
}, {
name: 'productStandardRelationStr',
type: 'string'
}, {
name: 'productMaterial',
type: 'string'
}]
},
//************************************weiqingting**********************
//商品描述
{
route: '/netSale/saveProductDesc',
method: 'POST',
url: '/product/saveProductDesc',
params: [{
name: 'productSkn',
type: 'Number'
}, {
name: 'productDesc',
type: 'String'
}]
},
//小编推荐
{
route: '/netSale/saveNetSaleRecommend',
method: 'POST',
url: '/product/saveNetSaleRecommend',
params: [{
name: 'productSkn',
type: 'Number'
}, {
name: 'recommend',
type: 'String'
}]
},
{ //查询搭配列表
route: "/netSale/selectCollocationListBySkn",
method: 'POST',
url: '/collocation/selectCollocationListBySkn',
params: [{
name: 'productSkn',
type: 'Number'
}, {
name: 'page',
type: 'Number'
}, {
name: 'size',
type: 'Number'
}]
}, { //获取单个商品搭配信息
route: '/netSale/selectCollocationById',
method: 'POST',
url: '/collocation/selectCollocationById',
params: [{
name: 'param',
type: 'Number'
}]
}, { //添加单个搭配
route: '/netSale/insertCollocation',
method: 'POST',
url: '/collocation/insertCollocation',
params: [{
name: 'productSkn',
type: 'Number'
}, {
name: 'imageUrl',
type: 'String'
}, {
name: 'content',
type: 'String'
}, {
name: 'infoStr',
type: 'String'
}]
}, { //更新单个搭配
route: '/netSale/updateCollocation',
method: 'POST',
url: '/collocation/updateCollocation',
params: [{
name: 'id',
type: 'Number'
}, {
name: 'imageUrl',
type: 'String'
}, {
name: 'content',
type: 'String'
}, {
name: 'infoStr',
type: 'String'
}]
}, { //删除单个搭配
route: '/netSale/delCollocationById',
method: 'POST',
url: '/collocation/delCollocationById',
params: [{
name: 'param',
type: 'Number'
}]
}, { //单独维护封面信息
//http://172.16.6.227:8083/yohobuy-platform-web/product/manageProductImg
route: '/netSale/manageProductImg',
method: 'POST',
url: '/product/manageProductImg',
params: [{
name: 'goodsImagesReq',
type: 'string'
}]
}
]
\ No newline at end of file
];
\ No newline at end of file
... ...
... ... @@ -20,7 +20,7 @@
</div>
</div>
<div class="panel-footer">
<button class="btn btn-primary" id="btn-recommand">保存</button>
<a href="javascript:;" class="btn btn-primary" id="btn-recommand">保存</a>
</div>
</div>
... ...
... ... @@ -6,8 +6,15 @@
</div>
<h2 class="panel-title">商品参数</h2>
</div>
<div id="goodsParamWrap" class="panel-body nopadding">
<div class="panel-body">
<div id="attributeTable" class="panel-body nopadding">
</div>
<div id="goodsParamWrap" class="panel-body nopadding">
</div>
<div id="goodsParamWrap2" class="panel-body nopadding">
</div>
</div>
<div class="panel-footer" id="goodsParams-footer">
<a href="javascript:;" class="btn btn-primary" id="propertySave">保存</a>
</div>
... ... @@ -34,7 +41,7 @@
<input type="hidden" id="washTips" value="{washTips}" for="checkbox">
</script> -->
<script type="text/template" id="goodsParamTemp">
<!-- <script type="text/template" id="goodsParamTemp">
[[each data as b index]]
[[if b.idNameList && b.idNameList.length>0]]
<div class="goods-param-group form-group">
... ... @@ -53,9 +60,45 @@
<label style="cursor: pointer;"><input name="[[b.attributeId]]" type="[[b.inputType]]" value="[[c.id]]">[[c.text]]</label>
[[/each]]
</span>
<input id="[[b.attributeId]]" type="hidden" for="[[b.inputType]]" value="[[b.selectedValues||'']]">
<input id="[[b.attributeId]]" type="hidden" for="[[b.inputType]]" value="[[b.selectedValues||'']]" placeholder="[[b.attributeName]]" required>
[[/if]]
</div>
[[/if]]
[[/each]]
</script> -->
<script type="text/template" id="template33">
<div class="form-group">
[[if inputType=='checkbox']]
[[each idNameList as item index ]]
<label class="radio-inline">
<input type="checkbox" name="[[__name]]_attr_[[__index]]" data-index=[[__index]] class="attr_checkobx_class" value="[[item.id]]">[[item.text]]</label>
[[/each]]
<input type="hidden" id="[[__name]]_attr_[[__index]]" value="[[__val||'']]" [[required]] for="checkbox" placeholder="[[attributeName]]"/>
[[/if]]
[[if inputType=='radio']]
[[each idNameList as item index ]]
<label class="radio-inline">
<input type="radio" name="[[__name]]_attr_[[__index]]" data-index=[[__index]] class="attr_input" value="[[item.id]]">[[item.text]]</label>
[[/each]]
<input type="hidden" id="[[__name]]_attr_[[__index]]" data-index='[[__index]]' value="[[__val||'']]" [[required]] for="radio" placeholder="[[attributeName]]" />
[[/if]]
[[if inputType=='select']]
<select class="form-control attr_input" style="width: 280px" data-index='[[__index]]' value="[[__val||'']]" [[required]]>
<option value="">请选择[[attributeName]]</option>
[[each idNameList as item index ]]
<option value="[[item.id]]">[[item.text]]</option>
[[/each]]
</select>
[[/if]]
[[if inputType=='text']]
<input type="text" class="form-control attr_input" style="width: 280px" data-index='[[__index]]' value="[[val||'']]" [[required]] maxlength='[[maxValueLen]]' placeholder="[[attributeName]]"/>
[[/if]]
[[if inputType=='textarea']]
<textarea class="form-control attr_input" data-index='[[__index]]' [[required]] maxlength='[[maxValueLen]]' placeholder="[[attributeName]]">[[val||'']]</textarea>
[[/if]]
</div>
</script>
\ No newline at end of file
... ...
... ... @@ -10,32 +10,30 @@
</div>
</div>
<script type="text/template" id="sizeifo-template">
<table style="table-layout:fixed " class="table table-striped table-bordered responsive dataTable no-footer">
<thead>
<tr>
<td>参考尺码</td>
[[each sizeAttributeBos as item index]]
<td>[[item.attributeName]]</td>
[[/each]]
</tr>
</thead>
<script type="text/template" id="sizeinfo-template">
[[if sizeRelationsList && sizeRelationsList.length > 0]]
<table class="table table-striped table-hover table-bordered responsive dataTable no-footer">
<thead>
<tr>
<td>尺码</td>
<td>参考尺码([[genderName]])</td>
[[each sizeRelationsList[0].prdSizeAttributeBoList as item index]]
<td>[[item.sizeAttributeName]]</td>
[[/each]]
</tr>
</thead>
<tbody>
<tbody>
[[each sizeRelationsList as item index]]
<tr>
<td>
[[each sizeBoList as item index]]
<def>[[item.sizeName]]</def>
[[each item.sortAttributes as item1 index1]]
<def>[[item1.sizeValue]]</def>/
[[/each]]
<br>
[[/each]]
</td>
[[each sizeAttributeBos as item index]]
<td>[[item.id]]</td>
<td>[[item.sizeName]]</td>
<td>[[item.referenceName?item.referenceName:""]]</td>
[[each item.prdSizeAttributeBoList as item1 index1]]
<td>[[item1.sizeValue]]</td>
[[/each]]
</tr>
</tbody>
</table>
[[/each]]
</tbody>
</table>
[[/if]]
</script>
\ No newline at end of file
... ...