|
|
'use strict';
|
|
|
var $ = require('jquery'),
|
|
|
common = require('../../../common/common');
|
|
|
|
|
|
window.batchOperateShelve = [];
|
|
|
|
|
|
var tabTree = new common.tabTree("#sortTree");
|
|
|
tabTree.init();
|
|
|
|
|
|
new common.dropDown({
|
|
|
el: '#shopId',
|
|
|
ajax: 'shopsRest',
|
|
|
hash: true
|
|
|
});
|
|
|
|
|
|
new common.dropDown({
|
|
|
el: '#brandId',
|
|
|
ajax: 'brand',
|
|
|
hash: true,
|
|
|
params:function(){
|
|
|
return {userLimitFlag:true};
|
|
|
}
|
|
|
});
|
|
|
|
|
|
var editPostion = '', isInfoMiss, sortFlag;
|
|
|
|
|
|
var t = new common.tab2({
|
|
|
el: "#basicTab",
|
|
|
active: 0,
|
|
|
click: function () {
|
|
|
var columnname = t.options.columns[t.options.active].name;
|
|
|
g.options.columns[11].hidden = true;
|
|
|
g.options.columns[8].hidden = true;
|
|
|
if (columnname == 3) {
|
|
|
isInfoMiss = 'Y';
|
|
|
g.options.columns[11].hidden = false;
|
|
|
} else {
|
|
|
isInfoMiss = '';
|
|
|
g.options.columns[8].hidden = false;
|
|
|
}
|
|
|
|
|
|
if (columnname == 1 || columnname == 2 || columnname == 3) {
|
|
|
sortFlag = 2;
|
|
|
} else {
|
|
|
sortFlag = 1;
|
|
|
}
|
|
|
g.init("/goods/netsale/getList");
|
|
|
},
|
|
|
columns: [{
|
|
|
name: "0",
|
|
|
value: '8,3,2',
|
|
|
display: "上架前({1})"
|
|
|
}, {
|
|
|
name: "1",
|
|
|
value: '4,1,0,5,6,7,9,10',
|
|
|
display: "上架后({2})"
|
|
|
}, {
|
|
|
name: "2",
|
|
|
value: '1',
|
|
|
display: "搜索/标签({3})"
|
|
|
}, {
|
|
|
name: "3",
|
|
|
value: '1',
|
|
|
display: "上架后信息缺失({4})"
|
|
|
}, {
|
|
|
name: "all",
|
|
|
value: 'all',
|
|
|
display: "全部商品({all})"
|
|
|
}]
|
|
|
}).init(ENUM.tab);
|
|
|
|
|
|
var g = new common.grid({
|
|
|
el: "#basicTable",
|
|
|
usepagesize:true,
|
|
|
parms: function () {
|
|
|
return {
|
|
|
productSkn: common.util.__input("productSkn"),
|
|
|
productSkc: common.util.__input("productSkc"),
|
|
|
productSku: common.util.__input("productSku"),
|
|
|
productName: common.util.__input("productName"),
|
|
|
shopId: common.util.__input("shopId"),
|
|
|
brandId: common.util.__input("brandId"),
|
|
|
isJit: common.util.__input("isJit"),
|
|
|
stock: common.util.__input("stock"),
|
|
|
isScreen: common.util.__input("isScreen"),
|
|
|
isMeasure: common.util.__input("isMeasure"),
|
|
|
gender: common.util.__input("gender"),
|
|
|
maxSortId: tabTree.selected[0] ? tabTree.selected[0].id : "",
|
|
|
middleSortId: tabTree.selected[1] ? tabTree.selected[1].id : "",
|
|
|
smallSortId: tabTree.selected[2] ? tabTree.selected[2].id : "",
|
|
|
isOutLets: common.util.__input("isOutLets"),
|
|
|
productStatus: common.util.__input("productStatus"),
|
|
|
productStatusStr: t.options.columns[t.options.active].value,
|
|
|
tab: $('#basicTab').find('.active').index(),
|
|
|
isInfoMiss: isInfoMiss,
|
|
|
sortFlag: sortFlag,
|
|
|
skcOnsaleStatus: common.util.__input("skcOnsaleStatus"),
|
|
|
isAdvance: common.util.__input("isAdvance"),
|
|
|
factoryCode: common.util.__input("factoryCode"),
|
|
|
appType: common.util.__input("appType"),
|
|
|
skuFactoryCode: common.util.__input("skuFactoryCode")
|
|
|
};
|
|
|
},
|
|
|
columns: [{
|
|
|
display: '',
|
|
|
type: 'checkbox',
|
|
|
render: function (item) {
|
|
|
var htmlContent = "";
|
|
|
if(batchOperateShelve.length == 0 ){
|
|
|
htmlContent = "<input type='checkbox' class='wqt_checkbox' data-index='"+item.__index+"'>";
|
|
|
}else{
|
|
|
$.each(batchOperateShelve,function(n,value) {
|
|
|
if(item.productSkn == value){
|
|
|
htmlContent = "<input type='checkbox' checked='checked' class='wqt_checkbox' data-index='"+item.__index+"'>";
|
|
|
return false
|
|
|
}else{
|
|
|
htmlContent = "<input type='checkbox' class='wqt_checkbox'data-index='"+item.__index+"'>";
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
return htmlContent;
|
|
|
}
|
|
|
}, {
|
|
|
display: 'skn',
|
|
|
name: 'productSkn',
|
|
|
render: function (item) {
|
|
|
return '<a target="_blank" href="/goods/netsale/info/' + item.productSkn + editPostion + '">' + item.productSkn + '</a>'
|
|
|
}
|
|
|
}, {
|
|
|
display: '图片',
|
|
|
name: 'picImgUrl',
|
|
|
render: function (item) {
|
|
|
if (item.picImgUrl) {
|
|
|
return '<a class="list-img" target="_blank" href="' + item.productUrl + '">' +
|
|
|
'<img src="' + item.picImgUrl + '"></a>';
|
|
|
} else {
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}, {
|
|
|
display: '商品信息',
|
|
|
width: '30%',
|
|
|
render: function (item) {
|
|
|
var productName = item.productName ? item.productName : '',
|
|
|
brandName = item.brandName ? item.brandName : '',
|
|
|
sortName = '',
|
|
|
html = '';
|
|
|
|
|
|
if (item.smallSortName) {
|
|
|
sortName = item.smallSortName
|
|
|
} else if (item.middleSortName) {
|
|
|
sortName = item.middleSortName;
|
|
|
} else {
|
|
|
sortName = item.maxSortName;
|
|
|
}
|
|
|
html += '<p><strong>名称:</strong><a target="_blank" href="' + item.productUrl + '">' + productName + '</a></p>';
|
|
|
html += '<p><strong>品牌:</strong>' + brandName + '</p>';
|
|
|
html += '<p><strong>类目:</strong>' + sortName;
|
|
|
return html + '</p>';
|
|
|
}
|
|
|
}, {
|
|
|
display: '售价',
|
|
|
render: function (item) {
|
|
|
var vip = ENUM.isVIP[item.isVIP] ? ENUM.isVIP[item.isVIP] : '',
|
|
|
retailPrice = item.retailPrice ? item.retailPrice : '',
|
|
|
salesPrice = item.salesPrice ? item.salesPrice : '';
|
|
|
|
|
|
var html = '<p><strong>吊牌价:</strong>' + retailPrice + '</p>' +
|
|
|
'<p><strong>销售价:</strong>' + salesPrice + '</p>' +
|
|
|
'<p><strong>是否VIP:</strong>' + vip + '</p>';
|
|
|
|
|
|
if (item.returnCoinMoney) {
|
|
|
html += "<p><strong>返yoho币金额:</strong>" + item.returnCoinMoney + "</p>";
|
|
|
} else {
|
|
|
html += "<p><strong>返yoho币金额:</strong>0</p>";
|
|
|
}
|
|
|
return html;
|
|
|
}
|
|
|
}, {
|
|
|
display: '库存',
|
|
|
name: 'stock'
|
|
|
}, {
|
|
|
display: '年龄层/性别',
|
|
|
render: function (item) {
|
|
|
var html = '';
|
|
|
|
|
|
html += common.config.__ageLevel(item.ageLevel);
|
|
|
if (html && item.gender) {
|
|
|
html += '/';
|
|
|
}
|
|
|
if (ENUM.gender[item.gender]) {
|
|
|
html += ENUM.gender[item.gender]
|
|
|
}
|
|
|
return html;
|
|
|
}
|
|
|
}, {
|
|
|
display: '商品类别',
|
|
|
name: 'attribute', //商品属性(1普通、2赠品等) 商品类别
|
|
|
render: function (item) {
|
|
|
if (item.attribute) {
|
|
|
return ENUM.attribute[item.attribute];
|
|
|
} else {
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}, {
|
|
|
display: '搜索/标签',
|
|
|
hidden: true,
|
|
|
render: function (item) {
|
|
|
var searchAndLabel = item.searchAndLabel ? item.searchAndLabel : '',
|
|
|
style = item.style ? item.style : '',
|
|
|
pattern = item.pattern ? item.pattern : '',
|
|
|
makeCrafts = item.makeCrafts ? item.makeCrafts : '';
|
|
|
return '关键词:' + searchAndLabel + '<br>' +
|
|
|
'风格:' + style + '<br>' +
|
|
|
'纹理:' + pattern + '<br>' +
|
|
|
'工艺:' + makeCrafts + '<br>';
|
|
|
}
|
|
|
}, {
|
|
|
display: '操作信息',
|
|
|
render: function (item) {
|
|
|
var html = '';
|
|
|
if (item.founderName) {
|
|
|
html += '<p>' + item.founderName + '</p>';
|
|
|
}
|
|
|
|
|
|
if (item.editTime) {
|
|
|
html += '<p>' + item.editTime + '</p>';
|
|
|
}
|
|
|
|
|
|
return html;
|
|
|
}
|
|
|
}, {
|
|
|
display: '上架状态',
|
|
|
name: 'status', // 8待上架,2待审核,3驳回,4通过,1已上架,0已下架,5再上架待审核,6再上架驳回,7再上架通过。
|
|
|
render: function (item) {
|
|
|
var html = '';
|
|
|
if (ENUM.status[item.status]) {
|
|
|
html += ENUM.status[item.status];
|
|
|
}
|
|
|
|
|
|
if (item.status == 3 || item.status == 6 ||item.status == 9) {
|
|
|
html += '<p style="color:red;">(' + item.rejectReason + ')</p>'
|
|
|
}
|
|
|
if (item.status == 4||item.status == 1||item.status == 7) {
|
|
|
if (item.isAdvance == "Y") {
|
|
|
if (item.advanceBeginTime) {
|
|
|
html += '<br>预售开始时间' + item.advanceBeginTime;
|
|
|
}
|
|
|
if (item.advanceEndTime) {
|
|
|
html += '<br>预售结束时间' + item.advanceEndTime;
|
|
|
}
|
|
|
} else {
|
|
|
if (item.shelveTime) {
|
|
|
html += '<br>预上架时间' + item.shelveTime;
|
|
|
}
|
|
|
}
|
|
|
//商品为预售商品,上架状态为通过,在【上架状态】列表栏,显示上架时间(为设置的【预售开始时间】)、下架时间(为设置的【预售结束时间】)
|
|
|
//2) 商品为预上架商品,上架状态为通过,在【上架状态】列表栏,显示上架时间(为设置的【预上架时间】)
|
|
|
}
|
|
|
return html;
|
|
|
}
|
|
|
}, {
|
|
|
display: '缺失信息',
|
|
|
hidden: true,
|
|
|
render: function (item) {
|
|
|
var html = [];
|
|
|
html.push('<p style="color: red;">');
|
|
|
var arr = item.missInfo ? item.missInfo.split(',') : '';
|
|
|
for (var i in arr) {
|
|
|
var item1 = $.trim(arr[i]);
|
|
|
if (item) {
|
|
|
html.push('<a target="_blank" href="/goods/netsale/edit/' + item.productSkn + editPostion + '#' + item1 + '">' + item1 + '</a>');
|
|
|
}
|
|
|
}
|
|
|
html.push('</p>');
|
|
|
return html.join('');
|
|
|
}
|
|
|
}, {
|
|
|
display: '操作',
|
|
|
render: function (item) {
|
|
|
var HtmArr = [];
|
|
|
var intValue ;
|
|
|
if (item.status == 4 || item.status == 1 || item.status == 5 || item.status == 6) {
|
|
|
HtmArr.push('<a target="_blank" href="/goods/netsale/edit/' + item.productSkn + editPostion + '" class="btn btn-info btn-xs edit-btn">编辑</a>');
|
|
|
// HtmArr.push('<a href="javascript:;" class="btn btn-danger btn-xs shelve-btn" data-index="' + item.__index + '">下架</a>');
|
|
|
} else if (item.status == 3 || item.status == 8 || item.status == 2 || item.status == 0) {
|
|
|
HtmArr.push('<a target="_blank" href="/goods/netsale/edit/' + item.productSkn + editPostion + '" class="btn btn-info btn-xs edit-btn">编辑</a>');
|
|
|
// HtmArr.push('<a href="javascript:;" class="btn btn-success btn-xs shelve-btn" data-index="' + item.__index + '">上架</a>');
|
|
|
}
|
|
|
HtmArr.push('<a href="javascript:;" class="btn btn-success btn-xs shelve-btn" data-index="' + item.__index + '">上/下架</a>');
|
|
|
HtmArr.push('<a target="_blank" href="/goods/netsale/info/' + item.productSkn + editPostion + '" class="btn btn-info btn-xs info-btn">查看</a>');
|
|
|
HtmArr.push('<a href="javascript:;" class="btn btn-success btn-xs chima-btn" data-index="' + item.__index + '">尺码</a>');
|
|
|
if(typeof(item.productSearch) == "undefined"){
|
|
|
intValue = 0;
|
|
|
}else{
|
|
|
intValue=item.productSearch.intValue;
|
|
|
}
|
|
|
HtmArr.push('<br><br><input type="text" style="width:100px" name="brandSort" class="brandSortText" data-index="' + item.__index + '" value='+intValue+'>');
|
|
|
HtmArr.push('<a href="javascript:;" class="btn btn-success btn-xs brandSort-btn" data-index="' + item.__index + '" >品牌排序</a>');
|
|
|
return HtmArr.join('');
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
g.init("/goods/netsale/getList");
|
|
|
|
|
|
|
|
|
//tab
|
|
|
var loadtab = function () {
|
|
|
// t.active = undefined;
|
|
|
setTimeout(function () {
|
|
|
common.util.__ajax({
|
|
|
url: '/goods/product/queryTabProductNum',
|
|
|
data: g.options.parms()
|
|
|
}, function (res) {
|
|
|
var __dt = $.extend({}, ENUM.tab, res.data);
|
|
|
t.setData(__dt);
|
|
|
t.render(__dt);
|
|
|
}, true);
|
|
|
}, 400);
|
|
|
}
|
|
|
loadtab();
|
|
|
|
|
|
|
|
|
//筛选
|
|
|
$("#filter-btn").click(function () {
|
|
|
loadtab();
|
|
|
g.reload(1);
|
|
|
});
|
|
|
|
|
|
|
|
|
/*
|
|
|
* 上架下架弹框
|
|
|
* params: title(弹框标题), html(弹框内容html)
|
|
|
*/
|
|
|
function shelveModal(title, html) {
|
|
|
var selectedArr = g.selected,
|
|
|
len = selectedArr.length,
|
|
|
productSknList = [],
|
|
|
shelveLayer = null;
|
|
|
|
|
|
if (batchOperateShelve.length <= 0) {
|
|
|
common.util.__tip('请选择要' + title + '的商品', 'warning');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
shelveLayer = common.dialog.open({
|
|
|
title: title,
|
|
|
content: html
|
|
|
});
|
|
|
|
|
|
g.selected.forEach(function (item) {
|
|
|
if (item.isAdvance === 'N') {
|
|
|
$('#advanceBeginTime, #advanceEndTime').prop('disabled', true);
|
|
|
$('#advanceBeginTime').parents('.form-group').find('.btn').addClass('disabled');
|
|
|
} else {
|
|
|
$('#shelveTime').prop('disabled', true);
|
|
|
$('#shelveTime').parents('.form-group').next(".form-group").find('.btn').addClass('disabled');
|
|
|
}
|
|
|
});
|
|
|
var e = new common.edit('.shelve-form');
|
|
|
e.init();
|
|
|
|
|
|
$('.shelve-form').on('click', '.btn', function () {
|
|
|
var type = $(this).data('type');
|
|
|
$(this).closest('.form-group').find('input').attr('required', true)
|
|
|
.end().siblings('.form-group').find('input').attr('required', false);
|
|
|
var data = {}, isValidate = false;
|
|
|
data.productSknList = JSON.stringify(batchOperateShelve);
|
|
|
if (type == "5") {
|
|
|
data.advanceBeginTime = $("#advanceBeginTime").val();
|
|
|
data.advanceEndTime = $("#advanceEndTime").val();
|
|
|
if (!(data.advanceEndTime && data.advanceEndTime)) {
|
|
|
isValidate = true;
|
|
|
e.$tip("请填写预售时间");
|
|
|
return;
|
|
|
}
|
|
|
data.type = 5;
|
|
|
} else {
|
|
|
if ($("#shelveTime").val()) {
|
|
|
if (type == "1") {
|
|
|
data.shelveTime = $("#shelveTime").val();
|
|
|
data.type = 3;
|
|
|
} else {
|
|
|
data.onNewTime = $("#shelveTime").val();
|
|
|
data.type = 4;
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
data.type = type;
|
|
|
}
|
|
|
}
|
|
|
if (!isValidate) {
|
|
|
common.util.__ajax({
|
|
|
url: '/goods/product/updateProductSknTimingInfo',
|
|
|
data: data
|
|
|
}, function (res) {
|
|
|
batchOperateShelve = [] ;
|
|
|
shelveLayer.close();
|
|
|
loadtab();
|
|
|
g.reload();
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
//批量上架需要确认
|
|
|
$('#onshelve').on('click', function () {
|
|
|
var htmlContent = "",
|
|
|
sknWarnLayer = null,
|
|
|
skns = "";
|
|
|
if(batchOperateShelve.length == 0 ){
|
|
|
htmlContent = "<div class=\"alert alert-danger\">未选中任何SKN, Please check !</div>"
|
|
|
}else{
|
|
|
htmlContent = "<span class=\"label label-success\">共选中"+batchOperateShelve.length+"个SKN</span>"
|
|
|
$.each(batchOperateShelve, function (key, value) {
|
|
|
if(key != 0 && key%6 == 0){
|
|
|
skns = skns +"<br>";
|
|
|
}
|
|
|
skns = skns + value+",";
|
|
|
});
|
|
|
htmlContent += "<div class=\"alert alert-danger\" style=\"margin-top:5px;width:100% \">"+skns+"</div>"
|
|
|
}
|
|
|
htmlContent +="<div class=\"form-group\" style=\"float:right \">"+
|
|
|
"<div style=\"margin-right:10% \" class=\"col-sm-1\"><a id = \"confirmSkn\" class=\"btn btn-info\" href=\"javascript:;\">确定</a></div>"
|
|
|
"</div>"
|
|
|
|
|
|
sknWarnLayer = common.dialog.open({
|
|
|
title: "待上架SKN",
|
|
|
content: htmlContent
|
|
|
});
|
|
|
|
|
|
$('#confirmSkn').on('click', function () {
|
|
|
sknWarnLayer.close();
|
|
|
shelveModal('上架', $('#onshelve-template').html())
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
//批量skn下架
|
|
|
$('#offshelve').on('click', function () {
|
|
|
shelveModal('下架', $('#offshelve-template').html());
|
|
|
});
|
|
|
|
|
|
//导出
|
|
|
$('#export-btn').on('click', function () {
|
|
|
var count = 0,
|
|
|
selectedArr = g.selected,
|
|
|
len = selectedArr.length,
|
|
|
data = g.options.parms();
|
|
|
|
|
|
$.each(data, function (key, value) {
|
|
|
if (value && value != '' && key != 'size' && key != 'tab') {
|
|
|
count++;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
if (count == 0 && len <= 0) {
|
|
|
common.util.__tip('请选择导出商品的条件', 'warning');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (len > 0) {
|
|
|
data.productSknList = [];
|
|
|
$.each(selectedArr, function (i, value) {
|
|
|
data.productSknList.push(value['productSkn']);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
window.open("/ajax/down?queryConf=" + JSON.stringify(data) + "&type=netSale");
|
|
|
});
|
|
|
|
|
|
//sku skc上架表格
|
|
|
var shelveTable = new common.grid({
|
|
|
el: "#shelve-table",
|
|
|
secondIndex: 2,
|
|
|
columns: [{
|
|
|
display: '默认封面图',
|
|
|
render: function (item) {
|
|
|
if (item.initGoodsImageUrl) {
|
|
|
return '<img src="' + item.initGoodsImageUrl + '" width=120 height=80>';
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
display: 'SKC(商品信息)',
|
|
|
render: function (item) {
|
|
|
|
|
|
return 'SKC:' + item.productSkc + '<br>' +
|
|
|
'颜色:' + item.goodsName;
|
|
|
}
|
|
|
}, {
|
|
|
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>';
|
|
|
} else {
|
|
|
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) {
|
|
|
return common.util.__template2($("#template2").html(), item)
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
/*代码优惠*/
|
|
|
var goodsList = {},
|
|
|
shelveLayer = null;
|
|
|
//单个sku,skc上下架
|
|
|
$('#basicTable').on('click', '.shelve-btn', function () {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
$(that).addClass('disabled');
|
|
|
|
|
|
getdata(item.productSkn, function (res) {
|
|
|
shelveLayer = common.dialog.open({
|
|
|
title: '上/下架',
|
|
|
width: 900,
|
|
|
content: common.util.__template($('#template').html(), res.data.baseProductInfo.baseProduct)
|
|
|
});
|
|
|
|
|
|
$(that).removeClass('disabled');
|
|
|
goodsList = res.data.goodsList;
|
|
|
shelveTable.init(goodsList);
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
function getdata(Skn, callback) {
|
|
|
common.util.__ajax({
|
|
|
url: '/goods/netsale/getdata',
|
|
|
data: {
|
|
|
param: Skn
|
|
|
}
|
|
|
}, function (res) {
|
|
|
callback && callback(res);
|
|
|
}, true);
|
|
|
}
|
|
|
|
|
|
|
|
|
$(document).on("click", ".btnskc", function () {
|
|
|
var item = goodsList[$(this).data("index")];
|
|
|
common.util.__ajax({
|
|
|
url: '/goods/product/updateGoodsStatus',
|
|
|
data: {
|
|
|
productSkc: item.productSkc,
|
|
|
targetStatus: item.status ? 0 : 1
|
|
|
}
|
|
|
}, function (res) {
|
|
|
if (res.code == 200) {
|
|
|
getdata(item.productSkn, function (res) {
|
|
|
goodsList = res.data.goodsList;
|
|
|
shelveTable.init(res.data.goodsList);
|
|
|
});
|
|
|
// g.init("/goods/netsale/getList");
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
|
|
|
$(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: {
|
|
|
productSku: item1.productSku,
|
|
|
targetStatus: item1.status ? 0 : 1
|
|
|
}
|
|
|
}, function (res) {
|
|
|
if (res.code == 200) {
|
|
|
getdata(item.productSkn, function (res) {
|
|
|
goodsList = res.data.goodsList;
|
|
|
console.log(goodsList);
|
|
|
shelveTable.init(res.data.goodsList);
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
|
|
|
$(document).on("change", ".wqt_checkbox,.wqt_all", function () {
|
|
|
var _count1 = 0,
|
|
|
_count2 = 0,
|
|
|
_isAdvance0 = 0,
|
|
|
_isAdvance1 = 0;
|
|
|
$.each(g.selected, function (index, item) {
|
|
|
/*添加兼容逻辑*/
|
|
|
if (item.status == 8 || item.status == 3 || item.status == 2 || item.status == 0) {
|
|
|
_count1++; //上
|
|
|
} else {
|
|
|
_count2++; //下
|
|
|
}
|
|
|
if (item.isAdvance == "N") {
|
|
|
_isAdvance0++;
|
|
|
}
|
|
|
if (item.isAdvance == "Y") {
|
|
|
_isAdvance1++;
|
|
|
}
|
|
|
|
|
|
});
|
|
|
if (_isAdvance0 && _isAdvance1) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (_count1 == g.selected.length) {
|
|
|
$('#onshelve').removeClass('disabled');
|
|
|
} else {
|
|
|
$('#onshelve').addClass('disabled');
|
|
|
}
|
|
|
|
|
|
if (_count2 == g.selected.length) {
|
|
|
$('#offshelve').removeClass('disabled');
|
|
|
} else {
|
|
|
$('#offshelve').addClass('disabled');
|
|
|
}
|
|
|
});
|
|
|
/**
|
|
|
* 尺码信息
|
|
|
*/
|
|
|
$(document).on("click", ".chima-btn", function () {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
common.util.__ajax({
|
|
|
url: '/meterManage/productSize/queryProdSizeList',
|
|
|
data: {
|
|
|
productSkn: item.productSkn
|
|
|
}
|
|
|
}, function (res) {
|
|
|
if (res.data.list && res.data.list.length > 0) {
|
|
|
var dataList = res.data.list[0];
|
|
|
var a = dataList.productType.replace(/<br>/g, "/");
|
|
|
dataList.productType = a.substring(0, a.length - 1);
|
|
|
common.sizeInfo.toast("/meterManage/productSize/saveProdSizeInfo", dataList, true, g);
|
|
|
}
|
|
|
}, true);
|
|
|
});
|
|
|
/**
|
|
|
*品牌排序
|
|
|
*/
|
|
|
$(document).on("click", ".brandSort-btn", function () {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
var num = $("input:text[name='brandSort']").eq($(this).data("index")).val();
|
|
|
var searchSortList = [];
|
|
|
for (var i = 0; i < 1; i++) {
|
|
|
searchSortList[i] = {
|
|
|
productSkn: item.productSkn,
|
|
|
modelId: i + 1,
|
|
|
projectId: 1,
|
|
|
intValue: num
|
|
|
};
|
|
|
}
|
|
|
common.util.__ajax({
|
|
|
url: '/netSale/saveSearchSort',
|
|
|
data: {
|
|
|
searchSortList: JSON.stringify(searchSortList)
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
});
|
|
|
|
|
|
// $(document).on("change", ".brandSortText", function () {
|
|
|
// var item = g.rows[$(this).data("index")];
|
|
|
// var num = $("input:text[name='brandSort']").eq($(this).data("index")).val();
|
|
|
// var searchSortList = [];
|
|
|
// for (var i = 0; i < 1; i++) {
|
|
|
// searchSortList[i] = {
|
|
|
// productSkn: item.productSkn,
|
|
|
// modelId: i + 1,
|
|
|
// projectId: 1,
|
|
|
// intValue: num
|
|
|
// };
|
|
|
// }
|
|
|
// common.util.__ajax({
|
|
|
// url: '/netSale/saveSearchSort',
|
|
|
// data: {
|
|
|
// searchSortList: JSON.stringify(searchSortList)
|
|
|
// }
|
|
|
// });
|
|
|
// });
|
|
|
|
|
|
//当点击“无需测量”,该列输入框不可编辑
|
|
|
common.sizeInfo.check(); |
|
|
\ No newline at end of file |
...
|
...
|
|