From e864201f921f9c8c8570693a4548e8b3362b6bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Sat, 17 Jul 2021 16:29:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=A7=BB=E5=8A=A8=E6=93=8D?= =?UTF-8?q?=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/data/view/shop/goods/form.html | 44 +++++++++++------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/app/data/view/shop/goods/form.html b/app/data/view/shop/goods/form.html index b83bdd2ff..e6c8e1ece 100644 --- a/app/data/view/shop/goods/form.html +++ b/app/data/view/shop/goods/form.html @@ -437,38 +437,26 @@ for (var i in data) if (data[i].check) return check; return true; }; + /*! 下移整行规格分组 */ + $rootScope.dnSpecRow = function (items, index) { + if (index + 1 < items.length) (function (item) { + items.splice(index + 1, 1), items.splice(index, 0, item); + })(items[index + 1]); + }; + /*! 上移整行规格分组 */ + $rootScope.upSpecRow = function (items, index) { + if (index > 0) (function (item) { + items.splice(index - 1, 1), items.splice(index, 0, item); + })(items[index - 1]); + }; + /*! 移除整行规格分组 */ + $rootScope.delSpecRow = function (items, index) { + items.splice(index, 1) + }; /*! 增加整行规格分组 */ $rootScope.addSpecRow = function (data) { data.push({name: '规格分组' + data.length, list: [{name: '规格属性', check: true}]}) }; - /*! 下移整行规格分组 */ - $rootScope.dnSpecRow = function (data, $index) { - var temp = [], self = data[$index]; - if ($index > data.length - 2) return false; - data.forEach(function (item, index) { - if (parseInt(index) !== parseInt($index)) temp.push(item); - if (parseInt(index) === parseInt($index) + 1) temp.push(self); - }); - return $rootScope.specs = temp; - }; - /*! 上移整行规格分组 */ - $rootScope.upSpecRow = function (data, $index) { - var temp = [], self = data[$index]; - if ($index < 1) return false; - data.forEach(function (item, index) { - if (parseInt(index) === parseInt($index) - 1) temp.push(self); - if (parseInt(index) !== parseInt($index)) temp.push(item); - }); - return $rootScope.specs = temp; - }; - /*! 移除整行规格分组 */ - $rootScope.delSpecRow = function (data, $index) { - var temp = []; - data.forEach(function (item, index) { - if (parseInt(index) !== parseInt($index)) temp.push(item); - }); - return $rootScope.specs = temp; - }; /*! 增加分组的属性 */ $rootScope.addSpecVal = function (data) { data.push({name: '规格属性' + data.length, check: true});