Authored by leo

Fixed: SKN去除空格

@@ -1947,19 +1947,13 @@ $(document).on('change', '.model-default-hotproduct', function() { @@ -1947,19 +1947,13 @@ $(document).on('change', '.model-default-hotproduct', function() {
1947 let _this = $(this); 1947 let _this = $(this);
1948 let sknList = $(this).val().trim(); 1948 let sknList = $(this).val().trim();
1949 1949
1950 - if(sknList.length === 0) {  
1951 - if(jsonMain.resources.defaultHotProducts) {  
1952 - jsonMain.resources.defaultHotProducts.data = ''; // 默认值,在发布的时候,如果是默认值,移除该模块  
1953 - }  
1954 - return;  
1955 - }  
1956 -  
1957 // 去重 1950 // 去重
1958 let sknArray = sknList.split(','); 1951 let sknArray = sknList.split(',');
1959 let skns = []; 1952 let skns = [];
1960 $.each(sknArray, function(index, item) { 1953 $.each(sknArray, function(index, item) {
  1954 + item = item.trim();
1961 // 排除形如 ‘111,222,’ 最后一个逗号 1955 // 排除形如 ‘111,222,’ 最后一个逗号
1962 - if(item.trim().length === 0) { 1956 + if(item.length === 0) {
1963 return; 1957 return;
1964 } 1958 }
1965 1959
@@ -1977,6 +1971,14 @@ $(document).on('change', '.model-default-hotproduct', function() { @@ -1977,6 +1971,14 @@ $(document).on('change', '.model-default-hotproduct', function() {
1977 }); 1971 });
1978 1972
1979 sknList = skns.toString(); 1973 sknList = skns.toString();
  1974 + $(_this).val(sknList);
  1975 +
  1976 + if(sknList.length === 0) {
  1977 + if(jsonMain.resources.defaultHotProducts) {
  1978 + jsonMain.resources.defaultHotProducts.data = '';
  1979 + }
  1980 + return;
  1981 + }
1980 1982
1981 common.util.__ajax({ 1983 common.util.__ajax({
1982 url: '/shop/decoration/findProductNotInShop', 1984 url: '/shop/decoration/findProductNotInShop',
@@ -1990,7 +1992,6 @@ $(document).on('change', '.model-default-hotproduct', function() { @@ -1990,7 +1992,6 @@ $(document).on('change', '.model-default-hotproduct', function() {
1990 if(data.length > 0) { 1992 if(data.length > 0) {
1991 common.util.__tip('该店铺不包含以下SKN: ' + data, 'warning'); 1993 common.util.__tip('该店铺不包含以下SKN: ' + data, 'warning');
1992 } else { 1994 } else {
1993 - $(_this).val(sknList);  
1994 let hotProductResource = jsonMain.resources.defaultHotProducts; 1995 let hotProductResource = jsonMain.resources.defaultHotProducts;
1995 if(hotProductResource === undefined) { 1996 if(hotProductResource === undefined) {
1996 hotProductResource = {}; 1997 hotProductResource = {};