Browse Source

产品导入弹框调整

hulh 8 years ago
parent
commit
69927b3a6b

+ 11 - 0
src/main/java/com/uas/platform/b2c/prod/store/controller/StoreInController.java

@@ -60,6 +60,17 @@ public class StoreInController {
 		return storeService.findByEnUU(enUU);
 	}
 
+	/**
+	 * 根据所属公司获取店铺信息
+	 *
+	 * @param enUU	所属公司UU
+	 */
+	@RequestMapping(value = "/byEnUU/uuid", method = RequestMethod.GET)
+	public String findUUidByEnUU(Long enUU) {
+		logger.info(String.format("Find uuid of store by enUU %d.", enUU));
+		return storeService.findUUidByEnUU(enUU);
+	}
+
 	/**
 	 * 依据店铺编号UUID获取店铺信息
 	 *

+ 7 - 0
src/main/java/com/uas/platform/b2c/prod/store/service/StoreInService.java

@@ -38,6 +38,13 @@ public interface StoreInService {
 	 */
 	StoreIn findByEnUU(Long enUU);
 
+	/**
+	 * 根据enuu返回店铺的uuid
+	 * @param enUU	企业enuu
+	 * @return
+	 */
+	String findUUidByEnUU(Long enUU);
+
 	/**
 	 * 依据店铺编号UUID获取店铺信息
 	 *

+ 19 - 0
src/main/java/com/uas/platform/b2c/prod/store/service/impl/StoreInServiceImpl.java

@@ -184,6 +184,25 @@ public class StoreInServiceImpl implements StoreInService {
 		}
 	}
 
+	@Override
+	public String findUUidByEnUU(Long enUU) {
+		if (enUU == null) {
+			return sysConf.getStoreid();
+		}
+
+		List<StoreIn> storeIns = storeDao.findByEnUU(enUU);
+		if (CollectionUtils.isEmpty(storeIns)) {
+			return sysConf.getStoreid();
+		} else {
+			StoreIn store = storeIns.get(0);
+			if (StoreStatus.OPENED.equals(store.getStatus())) {
+				return store.getUuid();
+			} else {
+				return sysConf.getStoreid();
+			}
+		}
+	}
+
 	@Override
 	public StoreIn findByUuid(String uuid) {
 		logger.info("Start to execute find.");

+ 4 - 0
src/main/webapp/resources/js/common/query/storeInfo.js

@@ -88,6 +88,10 @@ define([ 'ngResource' ], function() {
                     filter : 'enUU'
                 }
             },
+			getUuidByEnuu: {
+				url: 'store-service/byEnUU/uuid',
+				method: 'GET'
+			},
             // 分页获取店铺信息
             findStoresByPage : {
                 url : 'api/store-service/stores',

+ 3 - 1
src/main/webapp/resources/js/vendor/app.js

@@ -954,9 +954,11 @@ define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'commo
 	/**
 	 * 配送规则提示共用控制器
 	 */
-	app.controller('rule_tip_ctrl', ['$scope', 'toaster', '$modalInstance', 'type', 'tipModal', function ($scope, toaster, $modalInstance, type, tipModal) {
+	app.controller('rule_tip_ctrl', ['$scope', 'toaster', '$modalInstance', 'type', 'tipModal', 'success', 'uuid', function ($scope, toaster, $modalInstance, type, tipModal, success, uuid) {
 		$scope.tipModal = tipModal;
 		$scope.type = type;
+		$scope.success = success;
+		$scope.uuid = uuid;
 
 		$scope.cancelDelete = function () {
 			$scope.tipModal = false;

+ 6 - 0
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_index_ctrl.js

@@ -120,6 +120,12 @@ define(['app/app', 'calendar'], function(app) {
                                 },
                                 tipModal : function() {
                                     return true;
+                                },
+                                success : function () {
+                                    return false;
+                                },
+                                uuid: function () {
+                                    return null;
                                 }
                             }
                         });

+ 6 - 0
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_materialCtrl.js

@@ -1630,6 +1630,12 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
 								},
 								tipModal : function() {
 									return true;
+								},
+								success : function () {
+									return false;
+								},
+								uuid: function () {
+									return null;
 								}
 							}
 						});

+ 7 - 1
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_materialPersonCtrl.js

@@ -1453,7 +1453,13 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
 								},
 								tipModal : function() {
 									return true;
-								}
+								},
+                                success : function () {
+                                    return false;
+                                },
+                                uuid: function () {
+                                    return null;
+                                }
 							}
 						});
 						return ;

+ 6 - 0
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_onSaleCtrl.js

@@ -876,6 +876,12 @@ define([ 'app/app' ], function(app) {
                             },
                             tipModal : function() {
                                 return true;
+                            },
+                            success : function () {
+                                return false;
+                            },
+                            uuid: function () {
+                                return null;
                             }
                         }
                     });

+ 46 - 8
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_upload_ctrl.js

@@ -15,6 +15,7 @@ define([ 'app/app' ], function(app) {
                 $state.reload();
             }
         };
+
         if ($location.$$search.type && $location.$$search.type == 'self') {
             $rootScope.$$productOn.tab = 'bathOnPerson';
         } else if ($location.$$search.type && $location.$$search.type == 'company'){
@@ -205,6 +206,35 @@ define([ 'app/app' ], function(app) {
             });
         });
 
+        // 返回店铺的uuid,未开店则返回寄售uuid
+        $q.all([getAuthentication()]).then(function() {
+            //获取店铺的信息
+            StoreInfo.getUuidByEnuu({enUU : $rootScope.userInfo.enterprise.uu}, function(data) {
+                $scope.storeUuid = data.data;
+                $modal.open({
+                    animation : true,
+                    templateUrl : 'static/view/common/modal/product_upload_modal.html',
+                    controller : 'rule_tip_ctrl',
+                    resolve : {
+                        type : function() {
+                            return 'upload';
+                        },
+                        tipModal : function() {
+                            return true;
+                        },
+                        success : function () {
+                            return false;
+                        },
+                        uuid: function () {
+                            return $scope.storeUuid;
+                        }
+                    }
+                });
+            }, function(response) {
+                toaster.pop('error', '获取店铺的信息失败, ' + response.data);
+            });
+        });
+
 
         //选择文件
         $scope.selectFile = function(value) {
@@ -302,10 +332,7 @@ define([ 'app/app' ], function(app) {
         $scope.publish = function(event) {
             if ($scope.pageParams.totalElements > 0) {
                 ReleaseProductByBatch.batchRelease({batch : $scope.result.batch}, null, function(data) {
-                    if ($scope.needShowTip){
-                        $scope.relTableParams.page(1);
-                        $scope.relTableParams.reload();
-                        $scope.result.success = 0;//设置成0,让前端用户不能点击
+                    if ($scope.needShowTip) {
                         $modal.open({
                             animation : true,
                             templateUrl : 'static/view/common/modal/product_upload_modal.html',
@@ -316,13 +343,18 @@ define([ 'app/app' ], function(app) {
                                 },
                                 tipModal : function() {
                                     return true;
+                                },
+                                success : function () {
+                                    return false;
+                                },
+                                uuid: function () {
+                                    return null;
                                 }
                             }
                         });
-                        return ;
+                    } else {
+
                     }
-                    // toaster.pop("success", "提示", "发布成功 :" + data.data + "条");
-                    toaster.pop("success", "提示", "发布成功");
                     $scope.relTableParams.page(1);
                     $scope.relTableParams.reload();
                     $scope.result.success = 0;//设置成0,让前端用户不能点击
@@ -339,7 +371,7 @@ define([ 'app/app' ], function(app) {
 
         function publicPersonProduct() {
             ReleaseProductByBatch.batchReleasePerson({batch : $scope.result.batch}, null, function(data) {
-                if ($scope.needShowTip){
+                if ($scope.needShowTip) {
                     $scope.relTableParams.page(1);
                     $scope.relTableParams.reload();
                     //$scope.result.success = 0;//设置成0,让前端用户不能点击
@@ -353,6 +385,12 @@ define([ 'app/app' ], function(app) {
                             },
                             tipModal : function() {
                                 return true;
+                            },
+                            success : function () {
+                                return false;
+                            },
+                            uuid: function () {
+                                return null;
                             }
                         }
                     });

+ 6 - 2
src/main/webapp/resources/view/common/modal/product_upload_modal.html

@@ -128,7 +128,11 @@
     <!--产品导入-->
     <div class="content product">
         <div class="info"><i class="fa fa-check-circle"></i>上架成功</div>
-        <p><span>您当前尚未设置配送规则,买家将无法下单,建议尽快设置!</span></p>
-        <div><a name="rule_href" ng-click="hrefToRule()">立即设置</a></div>
+        <p ng-if="!success"><span>您当前尚未设置配送规则,买家将无法下单,建议尽快设置!</span></p>
+        <div ng-if="!success"><a name="rule_href" ng-click="hrefToNext('vendor#vendor_deliveryRule')">立即设置</a></div>
+        <div>
+            <a name="rule_cancel" ng-click="hrefToNext('vendor#/vendor_material')">前往企业库</a>
+            <a name="rule_href" ng-href="{{'store/' + uuid}}">前往店铺首页</a>
+        </div>
     </div>
 </div>