Authored by liuyue

商品参数修改

... ... @@ -120,7 +120,7 @@ $(document).on("click", "#saveAllInfo", function() {
res = res.data;
if (res.code == '200') {
e.$tip(res.message, function() {
history.go(-1);
//history.go(-1);
}, 'growl-success');
} else {
... ...
... ... @@ -8,6 +8,8 @@ var e = new common.edit('#addinfo-wrap'),
comfort = NETSALEDATA.specialAttrBo ? NETSALEDATA.specialAttrBo.wearSenses : "";
/*上架补全信息*/
$('#saveAddInfo').on('click', function() {
e.submit('/goods/product/saveAfterSaleInfo', function(option) {
option.data = GOLABDATA.fire('LYaddInfo');
... ... @@ -169,4 +171,62 @@ $.ajax({
//去编辑商品名称
$('#editProductName').on('click', function() {
$('#productName').focus();
})
\ No newline at end of file
})
/*商品参数*/
var goodsParamArr = [];
var goodsParamEdit = new common.edit('#goodsParamWrap');
common.util.__ajax({
url: '/goods/product/queryAttributesByConfEx',
data: {
saleType: 2,
displayPosition: 2,
categoryId: basicInfo.smallSortId
}
}, function(res) {
var data = res.data;
if (NETSALEDATA.attributeProValuesBosOne) {
$.each(NETSALEDATA.attributeProValuesBosOne, function(i, value) {
if (value.attributeId == data[i].attributeId) {
data[i].selectedValues = value.attributeValueId.replace(/,/g, "|");
}
});
}
$('#goodsParamWrap').html(common.util.__template2($('#goodsParamTemp').html(), {
data: data
}));
goodsParamEdit.init();
}, true);
GOLABDATA.on("TYcaizhi", function() {
return goodsParamEdit.submit('', function(option) {
$('.goods-param-group').each(function() {
goodsParamArr.push({
productSkn: $('#productSkn').val(),
attributeId: $(this).find(':hidden').attr('id'),
attributeValueId: $(this).find(':hidden').val().split('|').join(',')
});
});
option.data.attributeProValuesOne = JSON.stringify(goodsParamArr);
option.data.productSkn = $('#productSkn').val();
option.debug = true;
});
});
$("#propertySave").on('click', function() {
common.util.__ajax({
url: '/netSale/saveProductParam',
data: GOLABDATA.fire('TYcaizhi')
}, function() {});
});
/*console.log(goodsParamArr)
window.GOLABDATA.on('TYcaizhi', function() {
return {
attributeProValuesOne: JSON.stringify(goodsParamArr)
};
});*/
\ No newline at end of file
... ...
var $ = require('jquery'),
/*var $ = require('jquery'),
common = require('../../common/common');
var specialAttrBo = window.NETSALEDATA.specialAttrBo || {
... ... @@ -57,6 +57,7 @@ common.util.__ajax({
});
}, true);
$("#propertySave").on('click', function() {
var washTips = $("#washTips").val() || "";
... ... @@ -72,4 +73,4 @@ $("#propertySave").on('click', function() {
}, function() {
// body...
});
});
\ No newline at end of file
});*/
\ No newline at end of file
... ...
... ... @@ -2,95 +2,95 @@ var $ = require('jquery'),
common = require('../../common/common');
if (window.NETSALEDATA) {
{ //商品参数
var baseProduct = window.NETSALEDATA.baseProductInfo.baseProduct;
var specialAttrBo = {
productSkn: baseProduct.productSkn,
washTipsList: [],
materialList: []
};
if (window.NETSALEDATA.specialAttrBo) {
specialAttrBo = window.NETSALEDATA.specialAttrBo;
}
var washTipsList = specialAttrBo.washTipsList || [];
var materialList = specialAttrBo.materialList || [];
var e = new common.edit("#taoyu1");
//材质初始化
common.util.__ajax({
url: '/netSale/queryAllBySortId4Select',
data: {
param: baseProduct.maxSortId
}
}, function(res) {
$("#material-group").html(common.util.__template2($("#material-params").html(), res || {}));
var materials = [];
for (var i = 0; i < materialList.length; i++) {
materials[i] = materialList[i].id;
}
$("#material").val(materials.join("|"));
e.init();
}, true);
//{ //商品参数
/*var baseProduct = window.NETSALEDATA.baseProductInfo.baseProduct;
var specialAttrBo = {
productSkn: baseProduct.productSkn,
washTipsList: [],
materialList: []
};
if (window.NETSALEDATA.specialAttrBo) {
specialAttrBo = window.NETSALEDATA.specialAttrBo;
}
var washTipsList = specialAttrBo.washTipsList || [];
var materialList = specialAttrBo.materialList || [];
//洗涤提示初始化
common.util.__ajax({
url: '/netSale/getAll4Select',
data: {}
}, function(res) {
$("#washTip-group").html(common.util.__template2($("#washTip-params").html(), res || {}));
var washTips = [];
for (var i = 0; i < washTipsList.length; i++) {
washTips[i] = washTipsList[i].sortId;
}
$("#washTips").val(washTips.join("|"));
e.init();
}, true);
var e = new common.edit("#taoyu1");
//材质初始化
common.util.__ajax({
url: '/netSale/queryAllBySortId4Select',
data: {
param: baseProduct.maxSortId
}
}, function(res) {
$("#material-group").html(common.util.__template2($("#material-params").html(), res || {}));
var materials = [];
for (var i = 0; i < materialList.length; i++) {
materials[i] = materialList[i].id;
}
$("#material").val(materials.join("|"));
e.init();
}, true);
//洗涤提示初始化
common.util.__ajax({
url: '/netSale/getAll4Select',
data: {}
}, function(res) {
$("#washTip-group").html(common.util.__template2($("#washTip-params").html(), res || {}));
var washTips = [];
for (var i = 0; i < washTipsList.length; i++) {
washTips[i] = washTipsList[i].sortId;
}
$("#washTips").val(washTips.join("|"));
e.init();
}, true);
$(document).on('change', '.material', function() {
var items = $("#material").val().split("|");
for (var i = 0; i < items.length; i++) {
materialList[i] = {
"id": parseInt(items[i])
};
}
});
$(document).on('change', '.washTips', function() {
var items = $("#washTips").val().split("|");
for (var i = 0; i < items.length; i++) {
washTipsList[i] = {
"sortId": parseInt(items[i])
};
}
});
$(document).on('change', '.material', function() {
var items = $("#material").val().split("|");
for (var i = 0; i < items.length; i++) {
materialList[i] = {
"id": parseInt(items[i])
};
}
});
$(document).on('click', "#propertySave", function() {
$(document).on('change', '.washTips', function() {
var items = $("#washTips").val().split("|");
for (var i = 0; i < items.length; i++) {
washTipsList[i] = {
"sortId": parseInt(items[i])
};
}
});*/
var washTips = $("#washTips").val() || "";
var productMaterial = $("#material").val() || "";
/*$(document).on('click', "#propertySave", function() {
common.util.__ajax({
url: '/netSale/saveProductParam',
data: {
productSkn: specialAttrBo.productSkn,
washTips: washTips.replace(/\|/g, ","),
productMaterial: productMaterial.replace(/\|/g, ",")
}
});
return false;
});
var washTips = $("#washTips").val() || "";
var productMaterial = $("#material").val() || "";
window.GOLABDATA.on('TYcaizhi', function() {
var washTips = $("#washTips").val() || "";
var productMaterial = $("#material").val() || "";
return {
"washTips": washTips.replace(/\|/g, ","),
"productMaterial": productMaterial.replace(/\|/g, ",")
};
common.util.__ajax({
url: '/netSale/saveProductParam',
data: {
productSkn: specialAttrBo.productSkn,
washTips: washTips.replace(/\|/g, ","),
productMaterial: productMaterial.replace(/\|/g, ",")
}
});
}
return false;
});*/
/*window.GOLABDATA.on('TYcaizhi', function() {
var washTips = $("#washTips").val() || "";
var productMaterial = $("#material").val() || "";
return {
"washTips": washTips.replace(/\|/g, ","),
"productMaterial": productMaterial.replace(/\|/g, ",")
};
});*/
//}
{ //搜索关键词
... ...
... ... @@ -546,6 +546,21 @@ exports.res = [{
url: '/erpproduct/brands/queryBrandsByStatus ',
params: []
}, {
//网销信息 -> 商品参数
route: '/goods/product/queryAttributesByConfEx',
method: 'POST',
url: '/product/queryAttributesByConfEx',
params: [{
name: 'categoryId',
type: 'number'
}, {
name: 'displayPosition',
type: 'number'
}, {
name: 'saleType',
type: 'number'
}]
}, {
//价格管理 -> 代销变价页面渲染
route: '/goods/pricechange/index',
method: 'GET',
... ...
exports.domain = require('../config/common.js').domain;
//exports.domain = "http://172.16.6.227:8088/platform/";
//exports.domain = 'http://172.16.6.227:8088/platform'; //马力
exports.res = [
{
exports.res = [{
//保存搜索顺序
route:'/netSale/saveSearchSort',
method:'POST',
route: '/netSale/saveSearchSort',
method: 'POST',
url: '/product/saveSearchSort',
params: [
{name: 'searchSortList', type: 'string'}
]
},
{
params: [{
name: 'searchSortList',
type: 'string'
}]
}, {
//查找热搜词
route:'/netSale/queryHotSearchTerms',
method:'POST',
route: '/netSale/queryHotSearchTerms',
method: 'POST',
url: '/searchWords/queryHotSearchTerms',
params: [
{name: 'page', type: 'number'},
{name: 'size', type: 'number', def: 10}
]
},
{
params: [{
name: 'page',
type: 'number'
}, {
name: 'size',
type: 'number',
def: 10
}]
}, {
//查找洗涤提示
route:'/netSale/getAll4Select',
method:'POST',
route: '/netSale/getAll4Select',
method: 'POST',
url: '/washTips/getAll4Select/',
params: []
},
{
}, {
//查找材质参数
route:'/netSale/queryAllBySortId4Select',
method:'POST',
route: '/netSale/queryAllBySortId4Select',
method: 'POST',
url: '/productMaterial/queryAllBySortId4Select',
params: [
{name: 'param', type: 'number'}
]
},
{
params: [{
name: 'param',
type: 'number'
}]
}, {
//查找所有商品参数信息 //暂时没用
route:'/netSale/queryAllGoodsParams',
method:'POST',
route: '/netSale/queryAllGoodsParams',
method: 'POST',
apis: {
washTipsList: {
url: '/washTips/getAll4Select/'
},
materialList: {
url: 'productMaterial/queryAllBySortId4Select',
params: [
{name: 'param', type: 'number'}
],
params: [{
name: 'param',
type: 'number'
}],
isJsonRaw: true
}
}
},
{
}, {
//保存搜索关键词
route:'/netSale/saveNetSaleSearchKeys',
method:'POST',
route: '/netSale/saveNetSaleSearchKeys',
method: 'POST',
url: '/product/saveNetSaleSearchKeys',
params: [
{name: 'productSkn', type: 'number'},
{name: 'searchKeys', type: 'string'}
]
},
{
params: [{
name: 'productSkn',
type: 'number'
}, {
name: 'searchKeys',
type: 'string'
}]
}, {
//保存商品参数
route:'/netSale/saveProductParam',
method:'POST',
route: '/netSale/saveProductParam',
method: 'POST',
url: '/product/saveProductParam',
params: [
{name: 'productSkn', type: 'number'},
{name: 'washTips', type: 'string'},
{name: 'productMaterial', type: 'string'}
]
}
];
\ No newline at end of file
params: [{
name: 'productSkn',
type: 'number'
}, {
name: 'attributeProValuesOne',
type: 'string'
}]
}];
\ No newline at end of file
... ...
... ... @@ -6,20 +6,14 @@
</div>
<h2 class="panel-title">商品参数</h2>
</div>
<div class="panel-body nopadding">
<div class="form-group" id="material-group">
</div>
<div class="form-group" id="washTip-group">
</div>
<div id="goodsParamWrap" class="panel-body nopadding">
</div>
<div class="panel-footer">
<button class="btn btn-primary" id="propertySave">保存</button>
<a href="javascript:;" class="btn btn-primary" id="propertySave">保存</a>
</div>
</div>
<script type="text/template" id="material-params">
<!-- <script type="text/template" id="material-params">
<label class="col-sm-2 control-label">材质</label>
<div class="col-sm-8 height40">
[[each data as item index]]
... ... @@ -38,4 +32,18 @@
[[/each]]
</div>
<input type="hidden" id="washTips" value="{washTips}" for="checkbox">
</script> -->
<script type="text/template" id="goodsParamTemp">
[[each data as b index]]
<div class="goods-param-group form-group">
<label>[[b.attributeName]]</label>
<span>
[[each b.idNameList as c index]]
<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]]">
</div>
[[/each]]
</script>
\ No newline at end of file
... ...