Browse Source

新增卖家取消订单

ouxq 8 years ago
parent
commit
e5bfcce446

+ 5 - 0
src/main/webapp/resources/js/common/query/purchase.js

@@ -232,6 +232,11 @@ define([ 'ngResource' ], function() {
 			confirmPaymentInstallment : {
 				url : rootPath +'/trade/purchase/:id/ensurePaid',
 				method : 'PUT'
+			},
+			// 取消订单
+			sellerCancelOrder : {
+				url : rootPath +'/trade/purchase-simpleinfo/ones/:purchaseId/release',
+				method : 'PUT'
 			}
 		});
 	}]);

+ 1 - 1
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_down_payment_ctrl.js

@@ -124,7 +124,7 @@ define([ 'app/app' ], function(app) {
             day = parseInt(totalHours) / 24;
             hours = parseInt(totalHours) % 24;
             minute = parseInt(hours)% 60;
-            return parseInt(day) + "天" + parseInt(hours) + "小时" + parseInt(minute) + '分';
+            return parseInt(day) + "天" + parseInt(hours) + "小时";
         }
     });
 

+ 5 - 1
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_transfer_ctrl.js

@@ -62,6 +62,10 @@ define([ 'app/app' ], function(app) {
 		}else {
 			$state.go('buyer_order');
 		}
+		// 取消
+        $scope.loadPage = function () {
+            $state.go('buyer_order');
+        };
 		// 分期付款功能开发
 		$scope.loadPersonal = function () {
 			bankInfoService.getBuyPersonalBank('', function(data) {
@@ -73,7 +77,7 @@ define([ 'app/app' ], function(app) {
 			}, function(error) {
 				toaster.pop('error', '错误', '提取个人账户信息失败');
 			});
-		}
+		};
 		$scope.loadPersonal();
 		// 更换账户
 		$scope.changebuyAccountBox = false;

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

@@ -394,7 +394,18 @@ define(['app/app'], function (app) {
                                     }
                                 })
                             }
-                        })
+                            // 循环判断一期都没有付款并且延期的
+                            if (data.installmentId && data.installment.status == 503) {
+                                angular.forEach(data.installment.installmentDetails, function (detailslist) {
+                                    var nowTime = new Date();
+                                    if (detailslist.status == 503 && nowTime.getTime() > detailslist.deadline){
+                                        data.Overtime = true;
+                                    }
+                                })
+                            }
+                            // 循环判断已付款未收款卖家可取消的
+
+                        });
                         getExMsgState(); // 获取异常消息状态
                         getReturnByPurchaseIds(); // 获取退货单信息
 
@@ -531,6 +542,38 @@ define(['app/app'], function (app) {
                 box.hide();
             });
         }
+        
+        // 取消订单
+        $scope.sellerCancelOrder = function (data, purchaseid) {
+            if(!purchaseid) {
+                return ;
+            }
+            // if (data.installmentId && data.installment.status == 503) {
+            //     angular.forEach(data.installment.installmentDetails, function (detailslist) {
+            //         var nowTime = new Date();
+            //         if (detailslist.status == 503 && nowTime.getTime() > detailslist.deadline){
+            //             Purchase.sellerCancelOrder({purchaseId : purchaseid, reason : ''}, null, function () {
+            //                 toaster.pop('success','取消订单成功');
+            //             });
+            //             return ;
+            //         }
+            //     })
+            // }
+            $modal.open({
+                templateUrl: 'static/view/vendor/modal/cancelOrder_modal.html',
+                size : 'md',
+                controller : 'cancelControler',
+                resolve : {
+                    purchaseid : function () {
+                        return purchaseid;
+                    }
+                }
+            }).result.then(function () {
+                $scope.reload();
+            }, function () {
+                toaster.pop('info', '提示 ' + '您取消了对订单的操作');
+            });
+        };
         // 收退货
         $scope.receivingDialogShow = {};
         // 确认收退货:知道
@@ -1140,6 +1183,9 @@ define(['app/app'], function (app) {
                 case 501:
                     result = '待买家付款';
                     break;
+                case 524:
+                    result = '待买家付款';
+                    break;
                 case 504:
                     result = '付款确认中';
                     break;
@@ -1171,4 +1217,34 @@ define(['app/app'], function (app) {
             return result;
         }
     });
+    app.register.controller('cancelControler', ['$scope','purchaseid', 'Purchase', '$modalInstance', 'toaster', function ($scope, purchaseid, Purchase, $modalInstance, toaster) {
+
+        $scope.purchase = {};
+        $scope.purchaseid = purchaseid;
+
+        /**
+         * 确认取消订单
+         */
+        $scope.confirm = function () {
+            if(!$scope.purchase.reason) {
+                toaster.pop('info','请选择取消订单的原因');
+                return ;
+            }
+            Purchase.sellerCancelOrder({purchaseId : purchaseid, reason : $scope.purchase.reason}, null, function () {
+                toaster.pop('success','取消订单成功');
+                $modalInstance.close();
+            }, function (res) {
+                console.log(res);
+                toaster.pop('error','取消订单失败,请重新操作');
+            });
+        }
+
+        /**
+         * 取消操作
+         */
+        $scope.cancel = function () {
+            $modalInstance.dismiss();
+        }
+
+    }]);
 });

+ 1 - 1
src/main/webapp/resources/view/usercenter/forstore/buyer_transfer.html

@@ -166,7 +166,7 @@
 			<div class="row" style="margin-top: 0;">
 				<div class="deal-btn">
 					<a ng-click="confirm()" class="ok">确认</a>
-					<a ng-click="" class="off">取消</a>
+					<a ng-click="loadPage()" class="off">取消</a>
 				</div>
 			</div>
 		</div>

+ 4 - 0
src/main/webapp/resources/view/vendor/forstore/vendor_order.html

@@ -938,6 +938,10 @@
                             <div ng-if="$index == 0">
 								<!--确认收款-->
 								<a class="order-operation" href="javascript:void(0)" ng-if="purchase.installmentDetailPaid" ng-click="confirmPayment(purchase,purchase.purchaseid)">确认收款</a>
+								<!--取消订单-->
+								<p style="margin-top: 10px;" ng-if="purchase.Overtime || (purchase.installmentId && purchase.installment.status != 505)">
+									<a style="color: #333;" ng-click="sellerCancelOrder(purchase, purchase.purchaseid)">取消订单</a>
+								</p>
                                 <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>

+ 94 - 0
src/main/webapp/resources/view/vendor/modal/cancelOrder_modal.html

@@ -0,0 +1,94 @@
+<style>
+	#reason {
+		margin: 15px auto;
+	}
+
+	#reason label.col-md-4{
+		margin: auto 0;
+		height: 34px;
+		line-height: 34px;
+		text-align: right;
+		font-size: 16px;
+	}
+
+	#choice {
+		width: 290px;
+		margin-left: 100px;
+	}
+
+	div.modal-dialog.modal-md {
+		width: 500px !important;
+		position: fixed !important;
+		top: 150px !important;
+		left: 400px !important;
+	}
+
+	a.cancle-close {
+		float: right;
+		color: white;
+		padding-right: 10px;
+		font-size: 23px;
+		line-height: 31px;
+		height: 31px
+	}
+
+	.modal-backdrop {
+		background-color: transparent !important;
+	}
+
+	.modal-header {
+		background-color: #3A76E4;
+		line-height: 31px;
+		padding: 0px !important;
+		height: 31px;
+	}
+
+	.attention {
+		font-size: 14px;
+		text-align: center;
+		line-height: 31px;
+		height: 31px;
+	}
+
+	.modal-footer .confirm {
+		width: 90px;
+		padding: 5px 10px;
+		background-color: #3A76E4;
+		border: none;
+		color: white;
+		font-size: 14px;
+	}
+
+	.modal-footer .cancle-button {
+		width: 90px;
+		padding: 5px 10px;
+		background-color: #D9D5CE;
+		border: none;
+		color: #333333;
+		font-size: 14px;
+	}
+	.select-adder {
+		background: url(static/img/user/images/xiala.png) right no-repeat;
+		background-position-x: 265px;
+	}
+</style>
+<div class="modal-header">
+	<a title="关闭" class="cancle-close" ng-click="cancel()">×</a>
+</div>
+<div class="modal-body" style="height: 240px">
+	<div class="row" >
+		<div class="text-inverse attention"><img src="static/img/common/pay-attention.png" style="margin-right: 5px;"/>您确认需要取消该订单吗?取消订单后,不能恢复!</div>
+		<div id="reason" class="col-md-12 form-inline">
+			<select id="choice" class="select-adder col-md-10 col-md-offset-2 form-control" ng-model="purchase.reason" style="opacity: 1;">
+				<option value="">请选择取消订单的理由</option>
+				<option value="这个产品正在下架中">这个产品正在下架中</option>
+				<option value="你付款有问题">你付款有问题</option>
+				<option value="其他原因">其他原因</option>
+			</select>
+		</div>
+	</div>
+</div>
+<div class="modal-footer" style="text-align: center;">
+	<button class="confirm" ng-click="confirm()" type="button">确定</button>
+	<button class="cancle-button" ng-click="cancel()" type="button" style="margin-left: 15px;">关闭</button>
+</div>