Authored by 陶雨

网销搜索词现在不能无限添加同一个了

1 var $ = require('jquery'), 1 var $ = require('jquery'),
2 - common = require('../../common/common'); 2 + common = require('../../common/common'),
  3 + util = require('../../common/util');
3 4
4 if (window.NETSALEDATA) { 5 if (window.NETSALEDATA) {
5 //{ //商品参数 6 //{ //商品参数
@@ -127,9 +128,13 @@ if (window.NETSALEDATA) { @@ -127,9 +128,13 @@ if (window.NETSALEDATA) {
127 $(document).on('click', '.add', function() { 128 $(document).on('click', '.add', function() {
128 var item = g.rows[$(this).data("index")]; 129 var item = g.rows[$(this).data("index")];
129 var value = $("#searchKeys").val(); 130 var value = $("#searchKeys").val();
130 - if (value) value += ",";  
131 - $("#searchKeys").val(value + item.content);  
132 - searchKeys = $("#searchKeys").val(); 131 + if(value.indexOf(item.content) == -1) {
  132 + if (value) value += ",";
  133 + $("#searchKeys").val(value + item.content);
  134 + searchKeys = $("#searchKeys").val();
  135 + } else {
  136 + util.__tip("商品关键词不能重复");
  137 + }
133 }); 138 });
134 139
135 $("#save-searchKey").on('click', function() { 140 $("#save-searchKey").on('click', function() {