sellingPoint.js
1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
var $ = require('jquery'),
common = require('../../../../common/common'),
util = require('../../../../common/util');
$('#btn-salePonit').on('click', function() {
var sellingPointMap = [];
$('#salePoint').find('input').each(function (){
if ($(this).val() && '' != $(this).val()) {
sellingPointMap.push({"productSkn" : NETSALEDATA.baseProductInfo.baseProduct.productSkn, "sellingPoint" : $(this).val()});
}
})
if (sellingPointMap.length == 0) { // 如果都没有值,代表需要清理该商品的主要卖点
sellingPointMap.push({"productSkn" : NETSALEDATA.baseProductInfo.baseProduct.productSkn, "sellingPoint" : ""});
}
var sellingPointStr = JSON.stringify(sellingPointMap);
var params = {
sellingPoint:sellingPointStr
};
common.util.__ajax(
{
url:'/sensitiveWord/validate',
data: {
"validateContent": JSON.stringify(params)
}
},
function(rs) {
if (rs.data) {
var jsonMain = rs.data;
if(!$.isEmptyObject(jsonMain.sellingPoint)){
var tipText = "商品主要卖点包含违禁词:" + jsonMain.sellingPoint+"!";
/*common.dialog.confirm("温馨提示", tipText + "确定提交吗?", function(){
submitPointForm(sellingPointStr);
});*/
util.__tip(tipText, 'warning');
} else {
submitPointForm(sellingPointStr);
}
}
},true);
})
function submitPointForm(sellingPointStr) {
common.util.__ajax({
url:'/product/saveSellingPoint',
data:{
sellingPointStr:sellingPointStr
}
})
}
$(document).ready(function(){
initSellingPointInfo(NETSALEDATA.sellingPointList);
});
function initSellingPointInfo(sellingPointList) {
if (sellingPointList && sellingPointList.length > 0) {
for (var index = 0; index < sellingPointList.length; index++) {
$('#salePoint').find('input').eq(index).val(sellingPointList[index]);
}
}
}