Authored by mali

Merge branch 'dev_线下店库存'

Conflicts:
	code/apps/goods/controllers/netsale.js
	code/apps/goods/interfaces/netsale.js
... ... @@ -135,4 +135,7 @@ module.exports=function(app) {
app.post("/product/saveSellingPoint","netsale_saveSellingPoint");
app.post("/goods/product/changeProductShowSize", "netsale_changeProductShowSize");
/*校验线下店库存*/
app.post("/product/checkOfflineStorage","netsale_checkOfflineStorage");
}
\ No newline at end of file
... ...
... ... @@ -456,6 +456,14 @@ module.exports={
{name: 'productSkn', type: 'number'},
{name: 'showSize', type: 'number'}
]
}
},
checkOfflineStorage:{
title:'校验线下店库存',
url: '/product/checkOfflineStorage',
params: [
{name: 'paramsStr', type: 'string'},
{name: 'type', type: 'string'},
]
}
}
}
\ No newline at end of file
... ...
... ... @@ -50,7 +50,7 @@ var apiCofig = {
//root:__dirname,
EnvConst:{
//domain:"http://127.0.0.1:8088/platform",
domain:"http://192.168.102.48:8088/platform",
domain:"http://192.168.102.202:8088/platform",
// domain:"http://172.16.6.200:8088/platform",
//domain:"http://192.168.102.202:8088/platform",
... ...
... ... @@ -409,15 +409,41 @@ $(document).on('click', "#filter-btn", function() {
var Bll = {
toast: function(content, fn) {
common.dialog.confirm("温馨提示", content, function() {
// 如果是申请下架,且通过的申请,需要校验、并提示线下店库存
var data = fn();
if (data.params && data.params != '') {
var checkStorageParam = {};
checkStorageParam.type = 'skn';
checkStorageParam.paramsStr = data.params;
common.util.__ajax({
url: '/product/checkOfflineStorage',
data: checkStorageParam
}, function(res) {
if (res.data != '') { //当下架操作时 校验线下店存在库存
var existStorageSkn = res.data;
common.dialog.confirm('警告', "此商品 " + existStorageSkn + " 正在线下店销售,下架可能会影响线下店商品正常购买!!!是否确定下架", function() {
Bll.updateProductSknStatus(data);
});
} else {
common.dialog.confirm("温馨提示", content, function() {
Bll.updateProductSknStatus(data);
});
}
}, true);
} else { // 没有申请下架审核通过的商品
common.dialog.confirm("温馨提示", content, function() {
Bll.updateProductSknStatus(data);
});
}
},
updateProductSknStatus : function(data) {
common.util.__ajax({
url: '/product/updateProductSknStatus',
data: fn()
data: data
}, function() {
g.reload();
loadTab();
});
});
}
}
... ... @@ -502,7 +528,8 @@ $(document).on("click", "#pass-btn", function() {
var selectedArr = g.selected,
len = selectedArr.length,
sknList = [];
sknList = [],
downApplySkn = [];
if (len <= 0) {
common.util.__tip('请选择审核通过的商品', 'warning');
return;
... ... @@ -513,6 +540,9 @@ $(document).on("click", "#pass-btn", function() {
$.each(selectedArr, function(i, value) {
sknList.push(value['productSkn']);
if (value['applyType'] == 0) {
downApplySkn.push(value['productSkn']);
}
});
console.log(sknList);
... ... @@ -520,7 +550,8 @@ $(document).on("click", "#pass-btn", function() {
return {
productSknList: JSON.stringify(sknList),
targetStatus: 4, // 通过
rejectReason: ""
rejectReason: "",
params : JSON.stringify(downApplySkn)
};
}
Bll.toast("确定要通过该申请吗?", data);
... ... @@ -558,7 +589,8 @@ $(document).on("click", "#btn-item-pass", function() {
return {
productSknList: JSON.stringify([item.productSkn]),
targetStatus: 4, //通过
rejectReason: ""
rejectReason: "",
params : item.applyType == 0 ? JSON.stringify([item.productSkn]) : ''
};
}
Bll.toast("确定要通过该申请吗?", data);
... ...
... ... @@ -631,16 +631,20 @@ function shelveModal(title, html) {
}
}
if (!isValidate&&nocancel) {
var checkStorageParam = {'type' : 'skn', 'paramsStr' : JSON.stringify(batchOperateShelve)};
common.util.__ajax({
url: '/goods/product/updateProductSknTimingInfo',
data: data
}, function (res) {
batchOperateShelve = [] ;
batchShelveProduct = [];
shelveLayer.close();
loadtab();
g.reload();
});
url: '/product/checkOfflineStorage',
data: checkStorageParam
}, function(res) {
if (res.data != '' && type == 7) { //当下架操作时 校验线下店存在库存
var existStorageSkn = res.data;
common.dialog.confirm('警告', "此商品 " + existStorageSkn + " 正在线下店销售,下架可能会影响线下店商品正常购买!!!是否确定下架", function() {
statusOprate.updateProductSknTimingInfo(data, shelveLayer);
});
} else {
statusOprate.updateProductSknTimingInfo(data, shelveLayer);
}
}, true);
}
});
}
... ... @@ -779,41 +783,96 @@ function getdata(Skn, callback) {
$(document).on("click", ".btnskc", function () {
var item = goodsList[$(this).data("index")];
var checkStorageParam = {};
checkStorageParam.type = 'skc';
var params = [];
params.push(item.productSkc);
checkStorageParam.paramsStr = JSON.stringify(params);
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");
}
})
url: '/product/checkOfflineStorage',
data: checkStorageParam
}, function(res) {
if (res.data != '' && item.status == 1) { //当下架操作时 校验线下店存在库存
common.dialog.confirm('警告', "此商品正在线下店销售,下架可能会影响线下店商品正常购买!!!是否确定下架", function() {
statusOprate.updateSkcStatus(item);
});
} else {
statusOprate.updateSkcStatus(item);
}
}, true);
});
var statusOprate = {
updateSkcStatus : function (item) {
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");
}
});
},
updateProductSkuStatus : function (item, item1) {
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);
});
}
})
},
updateProductSknTimingInfo : function (data, shelveLayer) {
common.util.__ajax({
url: '/goods/product/updateProductSknTimingInfo',
data: data
}, function (res) {
batchOperateShelve = [] ;
batchShelveProduct = [];
shelveLayer.close();
loadtab();
g.reload();
});
}
};
$(document).on("click", ".btnsku", function () {
var item = goodsList[$(this).data("index")]
var item1 = item.goodsSizeList[$(this).data("subindex")];
var checkStorageParam = {};
checkStorageParam.type = 'sku';
var params = [];
params.push(item1.productSku);
checkStorageParam.paramsStr = JSON.stringify(params);
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);
});
}
})
url: '/product/checkOfflineStorage',
data: checkStorageParam
}, function(res) {
if (res.data != '' && item1.status == 1) { //当下架操作时 校验线下店存在库存
common.dialog.confirm('警告', "此商品正在线下店销售,下架可能会影响线下店商品正常购买!!!是否确定下架", function() {
statusOprate.updateProductSkuStatus(item, item1);
});
} else {
statusOprate.updateProductSkuStatus(item, item1);
}
}, true);
});
... ... @@ -1055,4 +1114,22 @@ function getProductLabeldata(SknList) {
});
}
}, true);
}
var netsaleConfirm = {
checkOfflineStorage: function(content, fn) {
var data = {};
data.productSknList = JSON.stringify(batchOperateShelve);
common.dialog.confirm("SKN 正在线下店销售,下架可能会影响线下店商品正常购买!!!是否确定下架", content, function() {
common.util.__ajax({
url: '/product/checkOfflineStorage',
data: fn()
}, function() {
//g.reload();
//loadTab();
history.go(-1);
});
});
}
}
\ No newline at end of file
... ...