shenjj 7 лет назад
Родитель
Сommit
6b3d51a3b7

+ 33 - 26
src/main/webapp/resources/js/admin/controllers/AuditRegulpicListCtrl.js

@@ -195,10 +195,11 @@ define([ 'app/app' ], function(app) {
     $scope.dismiss = dismiss;
     $scope.BrandList = []
     $scope.reason = null;
-    $scope.keyword = ''
     $scope.spec = ''
-    $scope.item = item
-    /**
+    $scope.item = item;
+    $scope.keyword = item.brand ? item.brand.nameEn : '';
+    $scope.kindId = item.kind ? item.kind.nameCn : '';
+        /**
      * 品牌联想词
      */
     $scope.onBrandChange = function(name) {
@@ -227,32 +228,38 @@ define([ 'app/app' ], function(app) {
      */
     function saveReason() {
       var info = ''
-      if (!$scope.keyword || $scope.keyword === '') {
-        toaster.pop('error', '品牌为必填项');
-        return ;
-      }
-      if ($scope.kindPojo.first === '请选择一级类目') {
-        toaster.pop('error', '商城类目未选择');
-        return ;
-      }
-      if ($scope.kindPojo.second === '请选择二级类目' && $scope.kindInfo[$scope.kindPojo.first].children) {
-        toaster.pop('error', '商城类目未选择');
-        return ;
-      }
-      if ($scope.kindPojo.third === '请选择三级类目' && $scope.kindInfo[$scope.kindPojo.first].children[$scope.kindPojo.second].children) {
-        toaster.pop('error', '商城类目未选择');
-        return ;
-      }
-      if ($scope.kindPojo.third !== '请选择三级类目') {
-        info = $scope.kindPojo.third
-      } else if ($scope.kindPojo.second !== '请选择二级类目') {
-        info = $scope.kindPojo.second
+      if ($scope.kindId === '') {
+        if (!$scope.keyword || $scope.keyword === '') {
+          toaster.pop('error', '品牌为必填项');
+          return;
+        }
+        if ($scope.kindPojo.first === '请选择一级类目') {
+          toaster.pop('error', '商城一级类目未选择');
+          return;
+        }
+        if ($scope.kindPojo.second === ''
+            && $scope.kindInfo[$scope.kindPojo.first].children) {
+          toaster.pop('error', '商城二级类目未选择');
+          return;
+        }
+        if ($scope.kindPojo.third === ''
+            && $scope.kindInfo[$scope.kindPojo.first].children[$scope.kindPojo.second].children) {
+          toaster.pop('error', '商城三级类目未选择');
+          return;
+        }
+        if ($scope.kindPojo.third !== '') {
+          info = $scope.kindPojo.third
+        } else if ($scope.kindPojo.second !== '') {
+          info = $scope.kindPojo.second
+        } else if ($scope.kindPojo.first !== '') {
+          info = $scope.kindPojo.first
+        }
+        $scope.item.kindId = info.id
+        $scope.item.brandId = $scope.brandId
       }
-      $scope.item.kindId = info.id
-      $scope.item.brandId = $scope.brandId
       $scope.item.spec = $scope.spec !== '' ? $scope.spec : $scope.item.product.spec
+      toaster.pop('success', '提示',  '已提交,请稍等');
       StoreAdminListInformation.auditSuccess({}, $scope.item, function(data) {
-        console.log(data)
         if (data.success) {
           $modalInstance.close(data);
         } else {

+ 8 - 2
src/main/webapp/resources/view/admin/modal/auditRegulpicpass_modal.html

@@ -81,7 +81,7 @@
     </div>
     <div class="form-group">
       <div class="col-sm-3 name"><em style="color: #ea0e0e">*</em>品牌:</div>
-      <div class="col-sm-9" style="position: relative;">
+      <div class="col-sm-9" style="position: relative;" ng-if="!item.brandId">
         <input type="text" ng-blur="onBrandBlur(keyword)"  ng-change="onBrandChange(keyword)" placeholder="请输入品牌名字" ng-model="keyword" class="form-control" style="width: 240px;height: 28px" />
         <ul class="listUl" ng-if="BrandList.value.length > 0">
           <li ng-repeat="item in BrandList.value" ng-click="setBrand(item.nameEn,item.id)">
@@ -89,10 +89,13 @@
           </li>
         </ul>
       </div>
+      <div class="col-sm-9" style="position: relative;" ng-if="item.brandId">
+        {{item.brand.nameEn}}
+      </div>
     </div>
     <div class="form-group">
       <div class="col-sm-3 name"><em style="color: #ea0e0e">*</em>商城类目:</div>
-      <div class="col-sm-9" >
+      <div class="col-sm-9" ng-if="!item.kindId">
         <div class="col-sm-4" style="padding: 0px;">
           <select class="form-control"
                   ng-model="kindPojo.first"
@@ -117,6 +120,9 @@
           </select>
         </div>
       </div>
+      <div class="col-sm-9" ng-if="item.kindId">
+        {{item.kind.nameCn}}
+      </div>
     </div>
     <div class="form-group">
       <div class="col-sm-3 name">规格:</div>