Browse Source

Merge branch 'dev-mysql-import' into dev-mysql

hulh 8 years ago
parent
commit
364ed01826

+ 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',

+ 6 - 4
src/main/webapp/resources/js/vendor/app.js

@@ -954,25 +954,27 @@ 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;
 			$modalInstance.dismiss();
 		};
 
-		$scope.hrefToRule = function () {
+		$scope.hrefToNext = function (url) {
 			$modalInstance.dismiss();
-			window.location.href = 'vendor#vendor_deliveryRule';
+			window.location.href = url;
 		};
 
 		/**
 		 * 监听点击的事件
 		 */
 		document.onclick = function (event) {
-			if($scope.tipModal) {
+			if ($scope.tipModal) {
 				if(event) {
 					var tag = event.target;
 					if(tag) {

+ 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

@@ -1642,6 +1642,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

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

+ 56 - 21
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,16 @@ 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;
+            }, function(response) {
+                toaster.pop('error', '获取店铺的信息失败, ' + response.data);
+            });
+        });
+
 
         //选择文件
         $scope.selectFile = function(value) {
@@ -280,6 +291,26 @@ define([ 'app/app' ], function(app) {
             });
         };
 
+        $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 true;
+                },
+                uuid: function () {
+                    return $scope.storeUuid;
+                }
+            }
+        });
+
         // 下载模板
         $scope.download = function() {
             var show = SessionService.get($scope.userInfo.userUU + "-releasetip");
@@ -302,27 +333,25 @@ 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,让前端用户不能点击
-                        $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;
-                                }
+                    $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 $scope.needShowTip;
+                            },
+                            uuid: function () {
+                                return $scope.storeUuid;
                             }
-                        });
-                        return ;
-                    }
-                    // toaster.pop("success", "提示", "发布成功 :" + data.data + "条");
-                    toaster.pop("success", "提示", "发布成功");
+                        }
+                    });
                     $scope.relTableParams.page(1);
                     $scope.relTableParams.reload();
                     $scope.result.success = 0;//设置成0,让前端用户不能点击
@@ -339,7 +368,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 +382,12 @@ define([ 'app/app' ], function(app) {
                             },
                             tipModal : function() {
                                 return true;
+                            },
+                            success : function () {
+                                return false;
+                            },
+                            uuid: function () {
+                                return null;
                             }
                         }
                     });

+ 36 - 17
src/main/webapp/resources/view/common/modal/product_upload_modal.html

@@ -6,20 +6,24 @@
         background-color: white;
         top: 55%;
         left: 50%;
-        height: 160px;
+        /*height: 160px;*/
         width: 290px;
         margin: -145px 0 0 -80px;
+        border: none;
     }
     .com-del-box{
-        height: 160px;
+        /*height: 160px;*/
         width: 290px;
     }
     .com-del-box .title {
+        width: 100%;
         height: 30px;
         background-color: #5078cb;
         text-align: right;
         padding-right: 15px;
         line-height: 30px;
+        border-top-left-radius: 5px;
+        border-top-right-radius: 5px;
     }
     .com-del-box .title a {
         color: white;
@@ -30,6 +34,7 @@
         width: 100%;
         text-align: center;
         margin: 0 auto;
+        box-shadow: 0 5px 15px rgba(0,0,0,.5);
     }
     .com-del-box .content p{
         font-size: 14px;
@@ -58,7 +63,7 @@
         text-align: center;
     }
     .com-del-box .content div a{
-        display: inline-block;
+        /*display: inline-block;*/
         margin-right: 15px ;
         width: 74px;
         height: 28px;
@@ -66,13 +71,16 @@
         text-align: center;
         font-size: 14px;
         color: #fff;
-    }
-    .com-del-box .content div a:first-child {
-        background: #c8c6c6;
-    }
-    .com-del-box .content div a:last-child {
+        padding: 3px;
         background: #5078cb;
     }
+   .com-del-box .content div a:first-child {
+        margin-right: 15px;
+    }
+    /*.com-del-box .content div a {*/
+        /*background: #5078cb;*/
+        /*border-radius: 0.5px;*/
+    /*}*/
     .modal{
         box-shadow: none!important ;
     }
@@ -95,31 +103,41 @@
         background-color: white;
         top: 55%;
         left: 50%;
-        height: 160px;
+        /*height: 160px;*/
         width: 290px;
         margin: -145px 0 0 -80px;
     }
     .com-del-box{
-        height: 160px;
+        /*height: 160px;*/
         width: 290px;
     }
     .com-del-box .product .info{
         margin: 0 auto;
         width: 100%;
         font-size: 16px;
-        font-weight: bold;
         color: #5078cb;
     }
     .com-del-box .product .info i{
         margin-right: 12px;
         font-size: 20px;
+        font-weight: bold;
+    }
+    .com-del-box .product .info span{
+        color: #333;
+    }
+    .com-del-box .product a:first-child{
+        margin-left: 14px;
+        padding: 5px 10px;
+        border-radius: 2px;
+    }
+    .com-del-box .product a:last-child{
+        padding: 5px 10px;
+        border-radius: 2px;
     }
     .com-del-box .product p{
         margin-bottom: -5px;
     }
-    .com-del-box .content div a:first-child{
-        margin-right: 0 !important;
-    }
+    /*.modal-dialog .modal-content*/
 </style>
 <div class="com-del-box" name="rule_model">
     <div class="title">
@@ -127,8 +145,9 @@
     </div>
     <!--产品导入-->
     <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>
+        <div class="info"><i class="fa fa-check-circle"></i><span>上架成功</span></div>
+        <p ng-if="success"><span>您当前尚未设置配送规则,买家将无法下单,建议尽快设置 <a name="rule_href" ng-click="hrefToNext('vendor#vendor_deliveryRule')" style="color: blue;">前往设置</a></span></p>
+        <div style="margin-top: 10px;"><a name="rule_href" ng-click="hrefToNext('vendor#/vendor_material')" class="product-btn">前往企业库</a>
+        <a name="rule_href" ng-href="{{'store/' + uuid}}" class="product-btn">前往店铺首页</a></div>
     </div>
 </div>