Authored by weiqingting

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

... ... @@ -10,7 +10,7 @@
**************************提示********************************/
(function () {
(function() {
/**
* 编辑器资源文件根路径。它所表示的含义是:以编辑器实例化页面为当前路径,指向编辑器资源文件(即dialog等文件夹)的路径。
* 鉴于很多同学在使用编辑器的时候出现的种种路径问题,此处强烈建议大家使用"相对于网站根目录的相对路径"进行配置。
... ... @@ -19,8 +19,8 @@
* 因此,UEditor提供了针对不同页面的编辑器可单独配置的根路径,具体来说,在需要实例化编辑器的页面最顶部写上如下代码即可。当然,需要令此处的URL等于对应的配置。
* window.UMEDITOR_HOME_URL = "/xxxx/xxxx/";
*/
window.UMEDITOR_HOME_URL="http://"+location.host+"/";
var URL = window.UMEDITOR_HOME_URL || (function(){
window.UMEDITOR_HOME_URL = "http://" + location.host + "/";
var URL = window.UMEDITOR_HOME_URL || (function() {
function PathStack() {
... ... @@ -34,83 +34,83 @@
this.path = this.documentURL;
this.stack = [];
this.push( this.documentURL );
this.push(this.documentURL);
}
PathStack.isParentPath = function( path ){
PathStack.isParentPath = function(path) {
return path === '..';
};
PathStack.hasProtocol = function( path ){
return !!PathStack.getProtocol( path );
PathStack.hasProtocol = function(path) {
return !!PathStack.getProtocol(path);
};
PathStack.getProtocol = function( path ){
PathStack.getProtocol = function(path) {
var protocol = /^[^:]*:\/*/.exec( path );
var protocol = /^[^:]*:\/*/.exec(path);
return protocol ? protocol[0] : null;
};
PathStack.prototype = {
push: function( path ){
push: function(path) {
this.path = path;
update.call( this );
parse.call( this );
update.call(this);
parse.call(this);
return this;
},
getPath: function(){
getPath: function() {
return this + "";
},
toString: function(){
return this.protocol + ( this.stack.concat( [''] ) ).join( this.separator );
toString: function() {
return this.protocol + (this.stack.concat([''])).join(this.separator);
}
};
function update() {
var protocol = PathStack.getProtocol( this.path || '' );
var protocol = PathStack.getProtocol(this.path || '');
if( protocol ) {
if (protocol) {
//根协议
this.protocol = protocol;
//local
this.localSeparator = /\\|\//.exec( this.path.replace( protocol, '' ) )[0];
this.localSeparator = /\\|\//.exec(this.path.replace(protocol, ''))[0];
this.stack = [];
} else {
protocol = /\\|\//.exec( this.path );
protocol = /\\|\//.exec(this.path);
protocol && (this.localSeparator = protocol[0]);
}
}
function parse(){
function parse() {
var parsedStack = this.path.replace( this.currentDirPattern, '' );
var parsedStack = this.path.replace(this.currentDirPattern, '');
if( PathStack.hasProtocol( this.path ) ) {
parsedStack = parsedStack.replace( this.protocol , '');
if (PathStack.hasProtocol(this.path)) {
parsedStack = parsedStack.replace(this.protocol, '');
}
parsedStack = parsedStack.split( this.localSeparator );
parsedStack = parsedStack.split(this.localSeparator);
parsedStack.length = parsedStack.length - 1;
for(var i= 0,tempPath,l=parsedStack.length,root = this.stack;i<l;i++){
for (var i = 0, tempPath, l = parsedStack.length, root = this.stack; i < l; i++) {
tempPath = parsedStack[i];
if(tempPath){
if( PathStack.isParentPath( tempPath ) ) {
if (tempPath) {
if (PathStack.isParentPath(tempPath)) {
root.pop();
} else {
root.push( tempPath );
root.push(tempPath);
}
}
... ... @@ -121,9 +121,9 @@
var currentPath = document.getElementsByTagName('script');
currentPath = currentPath[ currentPath.length -1 ].src;
currentPath = currentPath[currentPath.length - 1].src;
return new PathStack().push( currentPath ) + "";
return new PathStack().push(currentPath) + "";
})();
... ... @@ -134,21 +134,24 @@
window.UMEDITOR_CONFIG = {
//为编辑器实例添加一个路径,这个不能被注释
UMEDITOR_HOME_URL : URL
UMEDITOR_HOME_URL: URL
//图片上传配置区
,imageUrl:URL+"ajax/ueditor" //图片上传提交地址
,imagePath:"" //图片修正地址,引用了fixedImagePath,如有特殊需求,可自行配置
,imageFieldName:"upfile" //图片数据的key,若此处修改,需要在后台对应文件修改对应参数
,
imageUrl: URL + "ajax/ueditor" //图片上传提交地址
,
imagePath: "" //图片修正地址,引用了fixedImagePath,如有特殊需求,可自行配置
,
imageFieldName: "upfile" //图片数据的key,若此处修改,需要在后台对应文件修改对应参数
//工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的从新定义
,toolbar:[
,
toolbar: [
'source | undo redo | bold italic underline strikethrough | superscript subscript | forecolor backcolor | removeformat |',
'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontfamily fontsize' ,
'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontfamily fontsize',
'| justifyleft justifycenter justifyright justifyjustify |',
'link unlink | emotion image video | map',
'| horizontal print preview fullscreen', 'drafts', 'formula'
'link unlink | emotion image video | map', 'drafts', 'formula'
]
//语言配置项,默认是zh-cn。有需要的话也可以使用如下这样的方式来自动多语言切换,当然,前提条件是lang文件夹下存在对应的语言文件:
... ... @@ -203,9 +206,9 @@
//fontfamily
//字体设置
// ,'fontfamily':[
// { name: 'songti', val: '宋体,SimSun'},
// ]
// ,'fontfamily':[
// { name: 'songti', val: '宋体,SimSun'},
// ]
//fontsize
//字号
... ... @@ -247,4 +250,4 @@
//填写过滤规则
//,filterRules: {}
};
})();
})();
\ No newline at end of file
... ...
... ... @@ -33,9 +33,11 @@ window.GOLABDATA = {
}
} else {
var map = {},
args = [].slice.call(arguments, 1);
args = [].slice.call(arguments, 1),
listeners = null;
for (var key in that.registerEvent) {
var listeners = that.registerEvent[key];
listeners = that.registerEvent[key];
for (var i in listeners) {
map[key] = listeners[i].apply(this, args);
}
... ... @@ -75,6 +77,7 @@ if ($('.contentpanel').data('type') == 'info') {
$('#saveAllInfo').hide();
$(".goods-img i").remove();
$("#search-key-list").hide();
$(".brand-list").hide();
// 上架审核的查看页面
if ($('.contentpanel').data('action') != 'audit') {
... ... @@ -101,7 +104,9 @@ if ($('.contentpanel').data('type') == 'info') {
var e = new common.edit('#netsaleAllInfo');
$(document).on("click", "#saveAllInfo", function() {
var data = {};
$.each(GOLABDATA.fire(), function(key, value) {
var allData = GOLABDATA.fire();
$.each(allData, function(key, value) {
if (typeof value == 'string') {
data = value;
return;
... ... @@ -109,15 +114,6 @@ $(document).on("click", "#saveAllInfo", function() {
$.extend(data, value, true);
});
/*common.util.__ajax({
url: '/goods/product/saveNetSaleAllInfo',
data: data
}, function(res) {
});*/
e.submit('/goods/product/saveNetSaleAllInfo', function(option) {
option.data = data;
option.success = function(res) {
... ... @@ -131,7 +127,7 @@ $(document).on("click", "#saveAllInfo", function() {
}
return false;
}
})
});
})
... ... @@ -202,4 +198,11 @@ $('.floatnav').on('mouseenter', function() {
$('.floatnav').addClass('show');
}).on('mouseleave', function() {
$('.floatnav').removeClass('show');
});
\ No newline at end of file
});
if (location.hash) {
var hashPos = location.hash.substring(1);
setTimeout(function() {
$('.floatnav').find('li[name="' + hashPos + '"]').trigger('click');
}, 500);
}
\ No newline at end of file
... ...
... ... @@ -37,8 +37,8 @@ var ENUM = {
},
isVIP: {
"Y": "是",
"N": "否",
"B": "品牌设置"
"N": "否",
"B": "品牌设置"
}
};
... ... @@ -75,6 +75,8 @@ var t = new common.tab({
if (columnname == 1 || columnname == 2) {
editPostion = '#position9';
} else {
editPostion = '';
}
g.init($("#gridurl").val());
... ... @@ -163,7 +165,8 @@ var g = new common.grid({
}
}, {
display: '商品信息',width:'30%',
display: '商品信息',
width: '30%',
render: function(item) {
var productName = item.productName ? item.productName : '',
brandName = item.brandName ? item.brandName : '',
... ... @@ -338,7 +341,12 @@ function shelveModal(title, html) {
g.reload();
}, 'growl-success');
} else {
e.$tip(res.data.message);
//e.$tip(res.data.message);
var html = '';
$.each(res.data.data, function(key, value) {
html += key + ':' + value + '<br>';
});
e.$tip(html);
}
}
});
... ... @@ -398,31 +406,32 @@ var shelveTable = new common.grid({
display: 'SKC上架操作(状态)',
render: function(item) {
if (item.status == 0) {
return '<a class="btn btn-success btnskc" data-type="1" data-index="'+item.__index+'" href="javascript:;">点击上架</a>';
return '<a class="btn btn-success btnskc" data-type="1" data-index="' + item.__index + '" href="javascript:;">点击上架</a>';
} else {
return '<a class="btn btn-danger btnskc" data-type="0" data-index="'+item.__index+'" href="javascript:;">点击下架</a>';
return '<a class="btn btn-danger btnskc" data-type="0" data-index="' + item.__index + '" href="javascript:;">点击下架</a>';
}
}
}, {
display: '<div class="subhhead"><span>SKU</span><span>尺码</span><span>库存</span><span>SKU上架操作</span><span>SKU上架操作</span></div>',
render: function(item){
render: function(item) {
console.log(item);
return common.util.__template2($("#template2").html(),item)
return common.util.__template2($("#template2").html(), item)
}
}]
});
/*代码优惠*/
var goodsList={},shelveLayer=null;
var goodsList = {},
shelveLayer = null;
//单个sku,skc上下架
$('#basicTable').on('click', '.shelve-btn', function() {
var item=g.rows[$(this).data("index")];
var item = g.rows[$(this).data("index")];
var that = this;
$(that).addClass('disabled');
getdata(item.productSkn,function(res){
getdata(item.productSkn, function(res) {
shelveLayer = common.dialog.open({
title: '上/下架',
width: 900,
... ... @@ -430,78 +439,86 @@ $('#basicTable').on('click', '.shelve-btn', function() {
});
$(that).removeClass('disabled');
goodsList=res.data.goodsList;
goodsList = res.data.goodsList;
shelveTable.init(goodsList);
});
});
function getdata(Skn,callback){
function getdata(Skn, callback) {
common.util.__ajax({
url: '/goods/netsale/getdata',
data: {
param: Skn
}
}, function(res) {
callback&&callback(res);
},true);
callback && callback(res);
}, true);
}
$(document).on("click",".btnskc",function(){
var item=goodsList[$(this).data("index")];
$(document).on("click", ".btnskc", function() {
var item = goodsList[$(this).data("index")];
console.log(item);
common.util.__ajax({
url: '/goods/product/updateGoodsStatus',
data: {productSkc:item.productSkc,targetStatus:item.status}
url: '/goods/product/updateGoodsStatus',
data: {
productSkc: item.productSkc,
targetStatus: item.status ? 0 : 1
}
}, function(res) {
if (res.code == 200) {
getdata(item.productSkc,function(res){
goodsList=res.data.goodsList;
shelveTable.reload();
getdata(item.productSkn, function(res) {
goodsList = res.data.goodsList;
shelveTable.init(res.data.goodsList);
});
}
})
});
$(document).on("click",".btnsku",function(){
var item=goodsList[$(this).data("index")]
var item1=item.goodsSizeList[$(this).data("subindex")];
$(document).on("click", ".btnsku", function() {
var item = goodsList[$(this).data("index")]
var item1 = item.goodsSizeList[$(this).data("subindex")];
common.util.__ajax({
url: '/goods/product/updateProductSkuStatus',
data: {productSkc:item1.productSku,targetStatus:item.status}
url: '/goods/product/updateProductSkuStatus',
data: {
productSku: item1.productSku,
targetStatus: item1.status ? 0 : 1
}
}, function(res) {
if (res.code == 200) {
getdata(item.productSkc,function(res){
goodsList=res.data.goodsList;
getdata(item.productSkn, function(res) {
goodsList = res.data.goodsList;
console.log(goodsList);
shelveTable.reload();
shelveTable.init(res.data.goodsList);
});
}
})
});
$(document).on("change",".wqt_checkbox,.wqt_all",function(){
var _count1=0,_count2=0;
$.each(g.selected,function(index,item){
console.log(item.status);
$(document).on("change", ".wqt_checkbox,.wqt_all", function() {
var _count1 = 0,
_count2 = 0;
$.each(g.selected, function(index, item) {
/*添加兼容逻辑*/
if(item.status){
_count1++;//上
}else{
_count2++;//下
if (item.status == 8 || item.status == 3 || item.status == 2 || item.status == 0) {
_count1++; //上
} else {
_count2++; //下
}
});
if(_count2==g.selected.length){
$("#offshelve").addClass("btn-info").removeClass("btn-default").prop("disabled",false);
}else{
$("#offshelve").addClass("btn-default").removeClass("btn-info").prop("disabled",true);
if (_count1 == g.selected.length) {
$('#onshelve').removeClass('disabled');
} else {
$('#onshelve').addClass('disabled');
}
if(_count1==g.selected.length){
$("#onshelve").addClass("btn-info").removeClass("btn-default").prop("disabled",false);
}else{
$("#onshelve").addClass("btn-default").removeClass("btn-info").prop("disabled",true);
if (_count2 == g.selected.length) {
$('#offshelve').removeClass('disabled');
} else {
$('#offshelve').addClass('disabled');
}
})
\ No newline at end of file
});
\ No newline at end of file
... ...
... ... @@ -123,7 +123,7 @@ suppledTable.init(NETSALEDATA.goodsList, 'goodsSizeList')
//上架必填
productExtBo.renderType = $('.contentpanel').data('type');
productExtBo.sellChannels = productExtBo.sellChannels ? productExtBo.sellChannels.replace(/,/g, "|") : '';
productExtBo.shopIds = productExtBo.shopIdList ? productExtBo.shopIdList.join('|') : '';
//productExtBo.shopList =
common.util.__ajax({
url: '/goods/ShopsRest/queryShopsByBrandId',
... ... @@ -132,12 +132,23 @@ common.util.__ajax({
}
}, function(res) {
productExtBo.shopList = res.data;
productExtBo.shopIds = '';
if (productExtBo.shopIdList && productExtBo.shopIdList.length > 0) {
//如有选择店铺
productExtBo.shopIds = productExtBo.shopIdList ? productExtBo.shopIdList.join('|') : '';
} else if (res.data.length > 0) {
//如没有已选择店铺,默认选择全部
$.each(res.data, function(i, value) {
productExtBo.shopIds += value.shopsId + '|';
});
}
//
$('#product-ext').html(common.util.__template2($('#productExtBoTemp').html(), productExtBo));
e.init();
}, true);
$('#product-ext').html(common.util.__template2($('#productExtBoTemp').html(), productExtBo));
//如果是info页,所有input btn置灰
if ($('.contentpanel').data('type') == 'info') {
$('.contentpanel').find('input').prop('disabled', true);
$('.contentpanel').find('.btn').addClass('disabled');
... ... @@ -146,6 +157,7 @@ if ($('.contentpanel').data('type') == 'info') {
var e = new common.edit('#basicInfoWrap');
e.init();
//保存基本信息
$('#saveBasicInfo').on('click', function() {
e.submit('/goods/product/saveNetSaleBaseInfo', function(option) {
option.data = GOLABDATA.fire("LYbasicInfo");;
... ... @@ -177,6 +189,5 @@ GOLABDATA.on("LYbasicInfo", function() {
data[key] = $(this).val().split('|').join(',');
}
});
console.log(data);
return data;
});
\ No newline at end of file
... ...
... ... @@ -35,11 +35,12 @@ $(document).on("click", "#btn-descriptioner", function() {
return false;
});
window.UMrecommender = UM.getEditor('edit-recommender');
/*小编推荐*/
window.UMrecommender = UM.getEditor('edit-recommender');
if (window.NETSALEDATA && window.NETSALEDATA.productExtBo && window.NETSALEDATA.productExtBo.recommend) {
UMrecommender.setContent(window.NETSALEDATA.productExtBo.recommend);
}
$(document).on("click", "#btn-recommand", function() {
common.util.__ajax({
url: '/netSale/saveNetSaleRecommend',
... ... @@ -355,7 +356,7 @@ $(document).on('click', '.remove-item-btn', function() {
$(document).on("click", "#fenMainSave", function() {
var data = GOLABDATA.fire("fenmian");
if(typeof data == "undefined") {
if (typeof data == "undefined") {
return false;
}
common.util.__ajax({
... ...
... ... @@ -420,7 +420,10 @@ ul {
padding: 0 38px 0 10px;
color: #333;
z-index: 99;
white-space: nowrap
width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.citySelect .cityboxbtn:hover {
... ...
... ... @@ -142,8 +142,8 @@
</div>
<div class="row" style="margin: 0 0 0 -5px;">
<a id="onshelve" href="javascript:;" class="btn btn-default" >上架</a>
<a id="offshelve" href="javascript:;" class="btn btn-default">下架</a>
<a id="onshelve" href="javascript:;" class="btn btn-info" >上架</a>
<a id="offshelve" href="javascript:;" class="btn btn-info">下架</a>
<a id="export-btn" href="javascript:;" class="btn btn-info">导出</a>
<a id="import-btn" href="/goods/netsale/batch" class="btn btn-info">批量(排序、款型系列)</a>
</div>
... ... @@ -225,10 +225,10 @@
<span>[[item.stock]]</span>
<span>[[ ["下架","上架"][item.status] ]]</span>
<span>
[[if item.state]]
<a class="btn btn-success btnsku" data-subindex='[[index]]' data-index=[[__index]] href="javascript:;">上架</a>
[[else]]
[[if item.status]]
<a class="btn btn-danger btnsku" data-subindex='[[index]]' data-index=[[__index]] href="javascript:;">下架</a>
[[else]]
<a class="btn btn-success btnsku" data-subindex='[[index]]' data-index=[[__index]] href="javascript:;">上架</a>
[[/if]]
</span>
</div>
... ...
... ... @@ -141,7 +141,7 @@
<input id="salesPhrase" class="form-control" type="text" value="[[salesPhrase]]" style="display: inline-block;width: 280px;">
</div>
<div class="form-group">
<label>是否销:</label>
<label>是否销:</label>
<span>
<label class="radio-inline"><input type="radio" name="isHostsell" value="Y"></label>
<label class="radio-inline"><input type="radio" name="isHostsell" value="N"></label>
... ...
... ... @@ -44,7 +44,7 @@
<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]]" required="required">
<input id="[[b.attributeId]]" type="hidden" for="[[b.inputType]]" value="[[b.selectedValues]]" [[b.isMust=="N"?"":"required"]] placeholder="[[b.attributeName]]">
</div>
[[/if]]
[[/each]]
... ...