Browse Source

Merge remote-tracking branch 'origin/feature-wangdy-rate-v1.0' into feature-wangdy-rate-v1.0

wangdy 8 years ago
parent
commit
bc800b5e43

+ 1 - 1
src/main/webapp/resources/js/common/query/rate.js

@@ -24,7 +24,7 @@ define([ 'ngResource' ], function() {
             // 查询该企业下的所有模版信息
             getRateTemplate : {
                 url : 'rate/rateTemplate/:storeuuid',
-                method : 'POST'
+                method : 'GET'
             },
 
             // 买家评价卖家店铺

+ 2 - 2
src/main/webapp/resources/js/vendor/app.js

@@ -1,4 +1,4 @@
-define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'common/query/brand', 'common/query/kind', 'common/query/component', 'common/query/goods', 'common/query/cart', 'common/query/order', 'common/query/address', 'common/query/invoice', 'common/query/property', 'common/query/kindAdvice', 'common/query/propertyAdvice', 'common/query/return' , 'common/query/change', 'common/query/logistics', 'ui.router', 'ui-bootstrap', 'ui-form', 'ui-jquery', 'angular-toaster', 'ngDraggable', 'angular-sanitize', 'ngTable', 'dynamicInput', 'jquery-imagezoom', 'file-upload', 'file-upload-shim', 'common/query/urlencryption' , 'common/query/purchase', 'common/query/vendor', 'common/query/goods', 'common/query/bankTransfer', 'common/query/enterprise', 'common/query/bill', 'common/query/receipt', 'common/query/collection', 'common/query/express', 'common/query/bankInfo','common/query/charge', 'common/query/statistics', 'common/query/currency', 'jquery-chart', 'common/query/responseLogistics', 'common/query/goodsPrice', 'common/query/address' , 'common/query/search', 'common/query/urlencryption', 'common/query/releaseProInfo', 'common/query/makerDemand', 'common/query/afterSale', 'common/query/messageBoard', 'common/query/logistics', 'common/query/storeInfo', 'common/query/recommendation', 'common/query/user', 'common/query/logisticsPort', 'common/query/cms', 'common/query/material', 'common/query/storeCms', 'common/query/productImport', 'common/query/stockInOut', 'common/module/store_recommend_product', 'common/module/chat_web_module', 'common/query/standardPutOnAdmin', 'common/query/storeViolations', 'common/query/internalMessage'], function(angularAMD) {
+define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'common/query/brand', 'common/query/kind', 'common/query/component', 'common/query/goods','common/query/rate', 'common/query/cart', 'common/query/order', 'common/query/address', 'common/query/invoice', 'common/query/property', 'common/query/kindAdvice', 'common/query/propertyAdvice', 'common/query/return' , 'common/query/change', 'common/query/logistics', 'ui.router', 'ui-bootstrap', 'ui-form', 'ui-jquery', 'angular-toaster', 'ngDraggable', 'angular-sanitize', 'ngTable', 'dynamicInput', 'jquery-imagezoom', 'file-upload', 'file-upload-shim', 'common/query/urlencryption' , 'common/query/purchase', 'common/query/vendor', 'common/query/goods', 'common/query/bankTransfer', 'common/query/enterprise', 'common/query/bill', 'common/query/receipt', 'common/query/collection', 'common/query/express', 'common/query/bankInfo','common/query/charge', 'common/query/statistics', 'common/query/currency', 'jquery-chart', 'common/query/responseLogistics', 'common/query/goodsPrice', 'common/query/address' , 'common/query/search', 'common/query/urlencryption', 'common/query/releaseProInfo', 'common/query/makerDemand', 'common/query/afterSale', 'common/query/messageBoard', 'common/query/logistics', 'common/query/storeInfo', 'common/query/recommendation', 'common/query/user', 'common/query/logisticsPort', 'common/query/cms', 'common/query/material', 'common/query/storeCms', 'common/query/productImport', 'common/query/stockInOut', 'common/module/store_recommend_product', 'common/module/chat_web_module', 'common/query/standardPutOnAdmin', 'common/query/storeViolations', 'common/query/internalMessage'], function(angularAMD) {
 	'use strict';
 	/**
 	 * 自定义Array对象的属性last 方法
@@ -8,7 +8,7 @@ define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'commo
 		return this.length > 0 ? this[this.length - 1] : null;
 	};
 
-	var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ng.local', 'ui.form', 'ui.jquery', 'toaster', 'ngDraggable', 'tool.directives', 'ngSanitize', 'common.query.kind', 'common.services', 'brandServices', 'componentServices', 'goodsServices', 'cartServices', 'orderServices', 'addressServices', 'invoiceServices', 'common.query.propertyAdvice', 'propertyServices', 'returnServices' , 'changeServices',  'logisticsServices', 'common.query.kindAdvice', 'ngTable', 'ngDynamicInput', 'common.directives', 'angularFileUpload', 'urlencryptionServices', 'purchaseServices', 'vendorServices', 'goodsServices', 'bankTransfer', 'common.query.enterprise', 'billServices', 'receiptServices', 'collection', 'expressServices', 'bankInfo','Charge', 'statisticsServices', 'currencyService', 'responseLogisticsService', 'PriceServices', 'addressServices', 'searchService', 'urlencryptionServices', 'ReleaseProductByBatchService', 'makerDemand', 'afterSaleService', 'messageBoardServices', 'logisticsServices', 'table.directives', 'storeInfoServices', 'recommendation', 'common.query.user', 'logisticsPortService', 'cmsService', 'materialServices', 'StoreCmsServices', 'productImportModule', 'stockInOutModule', 'StoreCmsModule', 'WebChatModule', 'StandardPutOnAdminModule', 'StoreViolationsServices', 'internalMessageServices']);
+	var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ng.local', 'ui.form', 'ui.jquery', 'toaster', 'ngDraggable', 'tool.directives', 'ngSanitize', 'common.query.kind', 'common.services', 'brandServices', 'componentServices', 'goodsServices',  'rateServices','cartServices', 'orderServices', 'addressServices', 'invoiceServices', 'common.query.propertyAdvice', 'propertyServices', 'returnServices' , 'changeServices',  'logisticsServices', 'common.query.kindAdvice', 'ngTable', 'ngDynamicInput', 'common.directives', 'angularFileUpload', 'urlencryptionServices', 'purchaseServices', 'vendorServices', 'goodsServices', 'bankTransfer', 'common.query.enterprise', 'billServices', 'receiptServices', 'collection', 'expressServices', 'bankInfo','Charge', 'statisticsServices', 'currencyService', 'responseLogisticsService', 'PriceServices', 'addressServices', 'searchService', 'urlencryptionServices', 'ReleaseProductByBatchService', 'makerDemand', 'afterSaleService', 'messageBoardServices', 'logisticsServices', 'table.directives', 'storeInfoServices', 'recommendation', 'common.query.user', 'logisticsPortService', 'cmsService', 'materialServices', 'StoreCmsServices', 'productImportModule', 'stockInOutModule', 'StoreCmsModule', 'WebChatModule', 'StandardPutOnAdminModule', 'StoreViolationsServices', 'internalMessageServices']);
 	//初始化,启动时载入app
 	app.init = function() {
 		angularAMD.bootstrap(app);

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

@@ -1,6 +1,6 @@
 define(['app/app'], function(app) {
     app.register.controller('showRateCtrl', ['$scope', '$rootScope', '$stateParams', function ($scope, $rootScope, $stateParams) {
 
-        $scope.showRateBoxFlag = false;
+        $scope.showRateBoxFlag = true;
     }]);
 });

+ 120 - 3
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_order_ctrl.js

@@ -4,7 +4,7 @@
  */
 define(['app/app'], function (app) {
     "use strict";
-    app.register.controller('vendorOrderCtrl', ['$scope', '$rootScope', 'Purchase', 'ngTableParams', 'BaseService', 'toaster', '$state', '$filter', 'Return', 'Change', '$modal', 'PuExProcess', 'Recommendation', 'DateUtil', 'Loading', 'bankInfoService', function ($scope, $rootScope, Purchase, ngTableParams, BaseService, toaster, $state, $filter, Return, Change, $modal, PuExProcess, Recommendation, DateUtil, Loading, bankInfoService) {
+    app.register.controller('vendorOrderCtrl', ['$scope', '$rootScope', 'Purchase', 'ngTableParams', 'BaseService', 'toaster', '$state', '$filter', 'Return', 'Change', '$modal', 'PuExProcess', 'Recommendation', 'DateUtil', 'Loading', 'bankInfoService','Rate', function ($scope, $rootScope, Purchase, ngTableParams, BaseService, toaster, $state, $filter, Return, Change, $modal, PuExProcess, Recommendation, DateUtil, Loading, bankInfoService, Rate) {
         $rootScope.active = 'vendor_order';
 
         // 加密过滤器
@@ -1022,6 +1022,125 @@ define(['app/app'], function (app) {
             }
         };
         /******************根据页数设置翻页的信息********end**************************/
+
+        /***********卖家评论模块 *** start *****************************/
+
+        $scope.modalData = [];
+
+        $scope.getModal = function (purchase, type) {
+            $scope.rateContent.storeid = purchase.storeid;
+            $scope.rateContent.purchaseid = purchase.purchaseid;
+            $scope.rateContent.orderid = purchase.orderid;
+            $scope.rateType = type;
+            Rate.getRateTemplate({storeuuid: $scope.rateContent.storeid},{},function (data) {
+                $scope.modalData = data.data;
+            },function (error) {
+               toaster.pop('error', '获取模板信息失败');
+            });
+            $scope.setShowRateBoxFlag(true);
+        }
+
+        //控制评论模态框的显示隐藏
+        $scope.showRateBoxFlag = false;
+
+        $scope.setShowRateBoxFlag = function (flag) {
+            $scope.showRateBoxFlag = flag;
+        }
+
+        //评价类型:追评addRate/初次评价firstRate,默认初评
+        $scope.rateType = 'firstRate';
+
+        $scope.setRateType = function (type) {
+            $scope.rateType = type;
+        }
+
+        /***
+         * 评价模态框状态,默认为1
+         * 1:使用模板
+         * 2:不使用模板
+         * 3:新增模板
+         * 4:修改模板
+         * ***/
+        $scope.boxStatus = 1;
+
+        $scope.setBoxStatus = function (boxStatus) {
+            $scope.boxStatus = boxStatus;
+        }
+
+        //控制模板列表显示
+        $scope.showModalListFlag = false;
+
+        $scope.setShowModalListFlag = function (flag) {
+            if (!($scope.isInListFlag && !flag)) {
+                $scope.showModalListFlag = flag;
+            }
+        }
+
+        //鼠标是否在模板列表中
+        $scope.isInListFlag = false;
+        $scope.setIsInListFlag = function (flag) {
+            $scope.isInListFlag = flag;
+        }
+
+        $scope.addModal = function () {
+            $scope.showModalListFlag = false;
+            $scope.setBoxStatus(3);
+        }
+
+        //选择模板
+        $scope.chooseModal = function (modal) {
+            $scope.modalTempData.rateContent = modal.rateTemplateContent;
+            $scope.modalTempData.modalTitle = modal.rateTemplateName;
+            $scope.showModalListFlag = false;
+        }
+
+        //保存模板
+        $scope.modalTempData = {};
+        $scope.saveModal = function () {
+            Rate.saveRateTemplate({storeuuid: $scope.rateContent.storeid},{rateTemplateName: $scope.modalTempData.modalTitle, rateTemplateContent: $scope.modalTempData.rateContent}, function (data) {
+                toaster.pop('success', '保存成功');
+                $state.reload();
+            }, function (error) {
+                toaster.pop('error', '保存失败');
+            })
+        }
+        
+        //提交评论
+        $scope.rateContent = {
+            level: 1
+        };
+        /* $scope.rateContent.storeid = purchase.storeid;
+         $scope.rateContent.purchaseid = purchase.purchaseid;
+         $scope.rateContent.orderid = purchase.orderid;*/
+        $scope.submitRate = function () {
+            var param = {
+                orderId: $scope.rateContent.orderid,
+                purchaseId: $scope.rateContent.purchaseid,
+                storeId: $scope.rateContent.storeid,
+                level: $scope.rateContent.level
+            };
+            if ($scope.rateType == "firstRate") {
+                param.vendorRate = $scope.modalTempData.rateContent;
+                Rate.saveRateBuyer({purchaseId: $scope.rateContent.purchaseid},param,function (data) {
+                    toaster.pop('success', '评价成功');
+                    $state.reload();
+                },function (error) {
+                    toaster.pop('error', '评价失败');
+                });
+            } else if ($scope.rateType == "addRate") {
+                param.vendorAfterRate = $scope.modalTempData.rateContent;
+                Rate.saveAfterRateBuyer({purchaseId: $scope.rateContent.purchaseid},param,function (data) {
+                    toaster.pop('success', '评价成功');
+                    $state.reload();
+                },function (error) {
+                    toaster.pop('error', '评价失败');
+                });
+            }
+        }
+        
+
+        /***********卖家评论模块 *** end *****************************/
+
     }]);
 
     app.register.filter('VendorStatusFilter', function () {
@@ -1063,7 +1182,5 @@ define(['app/app'], function (app) {
         }
 
 
-        /***********卖家评论模块 *************/
-        $scope.showRateBoxFlag = false;
     });
 });

+ 44 - 30
src/main/webapp/resources/view/vendor/forstore/vendor_order.html

@@ -611,7 +611,6 @@
 	.sellOder .reply-box {
 		position: fixed;
 		width: 391px;
-		min-height: 282px;
 		background: #fff;
 		top: 187px;
 		left: 650px;
@@ -636,7 +635,7 @@
 	}
 	.sellOder .reply-box ul {
 		position: absolute;
-		right:44px;
+		right:35px;
 	}
 	.sellOder .reply-box ul li {
 		width: 200px;
@@ -678,12 +677,22 @@
 		padding-top: 10px;
 		padding-left: 10px;
 		overflow: scroll;
-		border: 1px solid #f9f9f9;
+		border: 1px solid rgb( 233, 233, 233 );
+	}
+	.sellOder .reply-box .reply-box-text >textarea.active{
+		background: #fff;
+		color: #333;
 	}
 	.sellOder .reply-box .reply-box-btn {
 		text-align: center;
-		margin-top: 15px;
+		margin: 20px 0;
+		width: 324px;
+	}
+	.sellOder .reply-box .modal-head {
 		width: 324px;
+		height: 30px;
+		border: 1px solid rgb( 233, 233, 233 );
+		padding-left: 10px;
 	}
 	.sellOder .reply-box .reply-box-btn .modal-btn {
 		float: none;
@@ -712,7 +721,8 @@
 		padding: 10px 24px;
 	}
 	.sellOder .reply-box .vendor-modal-header .modal-first-rate {
-		padding: 10px 24px;
+		padding-top: 24px;
+		padding-left: 24px;
 	}
 	.sellOder .reply-box .vendor-modal-header .modal-first-rate >span {
 		font-size: 14px;
@@ -741,7 +751,9 @@
 	.sellOder .reply-box .vendor-modal-header .modal-add-rate .rate-content {
 		width: 243px;
 		display: inline-block;
+		overflow: hidden;
 		float: right;
+		height: 50px;
 	}
 	.sellOder .reply-box .vendor-modal-header .modal-add-rate .rate-content span {
 		word-break: break-all;
@@ -942,7 +954,7 @@
                                 <a href="vendor#/purchase/detail/{{purchase.purchaseid | EncryptionFilter}}" class="oder_d action-link" target="_blank">订单详情</a><br/>
                                 <em ng-if="purchase.buyerNotifyShip && (purchase.status == 502 || purchase.status == 406)" style="display: block;">买家催促发货</em>
                                 <a class="oder_d action-link" href="vendor#/logistics/query/{{purchase.purchaseid | EncryptionFilter}}" ng-if="purchase.status == 404 || purchase.status == 520 || purchase.status == 405 || purchase.status == 503 || purchase.status == 514" target="_blank">查看物流</a>
-                           		<a class="oder_d action-link" ng-if="purchase.status == 522" target="_blank" href="vendor#/showRate/1" style="display: block;">双方已评</a>
+                           		<a class="oder_d action-link" target="_blank" href="vendor#/showRate/1" style="display: block;">双方已评</a>
                             </div>
                         </span>
 						<span class="click_shop">
@@ -950,8 +962,8 @@
                                 <a class="order-operation" href="javascript:void(0)" ng-if="(purchase.status == 502 || purchase.status == 406)&&(purchase.uasPurcid == null)" ng-click="toBeShiped(purchase)">点击发货</a>
 								<a ng-if="purchase.uasPurcid" style="text-decoration: none;color: #323232;">来源UAS</a>
                                 <a class="order-operation" href="javascript:void(0)" ng-if="purchase.status == 404 && purchase.lgtId&&!purchase.uasPurcid" ng-click="toBeShiped(purchase)" style="position: relative;">修改物流</a>
-								<a class="order-operation" ng-if="purchase.status == 523" href="javascript:void(0)" style="position: relative;">追加评价</a>
-								<a class="order-operation" ng-if="purchase.status == 520" href="javascript:void(0)" style="position: relative;">评价</a>
+								<a class="order-operation" href="javascript:void(0)" ng-click="getModal(purchase,'addRate')" style="position: relative;">追加评价</a>
+								<a class="order-operation" href="javascript:void(0)" style="position: relative;" ng-click="getModal(purchase,'firstRate')">评价</a>
 								<div class="seller-ship-tip" ng-if="purchase.status == 404 && purchase.lgtId &&!purchase.uasPurcid" style="position: relative;">
                                     <img src="static/img/common/notice-tip.png" ng-mouseover="purchase.noticeTip = true" ng-mouseleave="purchase.noticeTip = false"/>
                                     <div class="ship-notify" ng-if="purchase.noticeTip">
@@ -1003,15 +1015,15 @@
 				</div>
 			</dl>
 		</div>
-		<div class="reply-box" ng-if="showRateBoxFlag">
-			<img src="static/img/vendor/images/rate-box-del.png" alt="">
+		<div class="reply-box" ng-show="showRateBoxFlag">
+			<img src="static/img/vendor/images/rate-box-del.png" ng-click="setShowRateBoxFlag(false)" alt="">
 			<div class="vendor-modal-header">
-				<div class="modal-first-rate">
+				<div class="modal-first-rate" ng-show="rateType == 'firstRate'">
 					<span>
 						<label class="check-act">
                                 <img src="static/img/user/images/rate1.png" alt="">
                                 <span>好评</span>
-                                <input type="radio" id="1" name="rate"/>
+                                <input type="radio" id="1" name="rate" ng-model="rateContent.level" value="1"/>
                                 <label for="1"></label>
                             </label>
 					</span>
@@ -1019,7 +1031,7 @@
 						<label class="check-act">
                                 <img src="static/img/user/images/rate2.png" alt="">
                                 <span>中评</span>
-                                <input type="radio" id="2" name="rate"/>
+                                <input type="radio" id="2" name="rate" ng-model="rateContent.level" value="2"/>
                                 <label for="2"></label>
                             </label>
 					</span>
@@ -1027,12 +1039,12 @@
 						<label class="check-act">
                                 <img src="static/img/user/images/rate3.png" alt="">
                                 <span>差评</span>
-                                <input type="radio" id="3" name="rate"/>
+                                <input type="radio" id="3" name="rate" ng-model="rateContent.level" value="3"/>
                                 <label for="3"></label>
                             </label>
 					</span>
 				</div>
-				<div class="modal-add-rate">
+				<div class="modal-add-rate" ng-show="rateType == 'addRate'">
 					<div style="width: 70px;display: inline-block;">
 						<span class="rate-item">初次评价:</span>
 						<span><img src="static/img/user/images/rate2.png" alt="">中评</span>
@@ -1043,28 +1055,30 @@
 				</div>
 			</div>
 			<div class="vendor-modal-content">
-				<div style="position: relative;">
-					<label class="check-active">
-						<input ng-model="isSetTop" type="checkbox" id="check-act" class="ng-pristine ng-untouched ng-valid" checked="checked">
+				<div style="position: relative;height: 30px;line-height: 30px;">
+					<label class="check-active" ng-show="boxStatus == 1 || boxStatus == 2">
+						<input type="checkbox" id="check-act" ng-click="setBoxStatus(boxStatus == 1?2:1)" ng-checked="boxStatus == 1" class="ng-pristine ng-untouched ng-valid">
 						<label for="check-act"></label>
-						<span style="font-size: 14px; color: black; font-weight: normal">使用模板</span>
+						<span style="font-size: 14px; color: black; font-weight: normal" >使用模板</span>
 					</label>
-					<input type="search" class="form-control modal-select" readonly>
-					<ul>
-						<li>aaa</li>
-						<li>bbb</li>
-						<li>ccc</li>
-						<li class="add-modal"><img src="static/img/vendor/images/rate-add.png" alt="">新增模板</li>
+					<input type="search" ng-show="boxStatus == 1" class="form-control modal-select" ng-focus="setShowModalListFlag(true)" ng-blur="setShowModalListFlag(false)" readonly>
+					<ul ng-show="showModalListFlag" ng-mouseenter="setIsInListFlag(true)" ng-mouseleave="setIsInListFlag(false)">
+						<li ng-repeat="modal in modalData" ng-bind="modalData.rateTemplateName" ng-click="chooseModal(modal)"></li>
+						<li ng-click="addModal()" class="add-modal"><img src="static/img/vendor/images/rate-add.png" alt="">新增模板</li>
 					</ul>
 				</div>
+				<div>
+					<input type="text" ng-model="modalTempData.modalTitle" ng-if="boxStatus == 3 || boxStatus == 4" class="modal-head" placeholder="请填写模板名称">
+				</div>
 				<div class="reply-box-text">
-					<textarea readonly>谢谢亲的好评</textarea>
+					<textarea ng-readonly="boxStatus == 1" ng-class="{'active': boxStatus != 1}" ng-model="modalTempData.rateContent"></textarea>
 				</div>
 				<div class="reply-box-btn">
-					<span class="modal-btn modify-modal">修改模板</span>
-					<span class="modal-btn cancel-modal">取消</span>
-					<span class="modal-btn cancel-modal">返回上一步</span>
-					<span class="modal-btn submit-modal">提交</span>
+					<span class="modal-btn modify-modal" ng-click="setBoxStatus(4)" ng-show="boxStatus == 1">修改模板</span>
+					<span class="modal-btn cancel-modal" ng-click="setShowRateBoxFlag(false)" ng-show="boxStatus == 1 || boxStatus == 2">取消</span>
+					<span class="modal-btn cancel-modal" ng-click="setBoxStatus(1)" ng-show="boxStatus == 3 || boxStatus == 4">返回上一步</span>
+					<span class="modal-btn submit-modal" ng-show="boxStatus == 3 || boxStatus == 4" ng-click="saveModal()">保存</span>
+					<span class="modal-btn submit-modal" ng-show="boxStatus == 1 || boxStatus == 2" ng-click="submitRate()">提交</span>
 				</div>
 			</div>
 		</div>