Przeglądaj źródła

卖家订单自营店铺优先选择

yangc 7 lat temu
rodzic
commit
7af99b05f4

+ 149 - 143
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_order_ctrl.js

@@ -61,7 +61,155 @@ define(['app/app'], function (app) {
             }else if (result.data.type == 'CONSIGNMENT' || result.data.status == 'PREPARE'){
                 $scope.isCONSIGNMENT = true;
                 $scope.storeType = 'mall';
-            }}, function (error) {
+            }
+            if (!$scope.isYrscStore && !$scope.isCONSIGNMENT) {
+                $scope.storeType = 'other';
+                window.sessionStorage.setItem('storeType', $scope.storeType);
+                $scope.orderTableParams = new ngTableParams($scope.tableParams, {
+                    total: 0,
+                    getData: function ($defer, params) {
+                        $scope.loading = true;
+                        $scope.paginationParams = params;
+                        var param = BaseService.parseParams(params.url());
+                        param.keyword = $scope.keyword ? $scope.keyword : null;
+                        if ($scope.childStatus!==''){
+                            param.status = $scope.childStatus;
+                        }else{
+                            param.status = getState();
+                        }
+                        param.page = $scope.param.page;
+                        // param.startMils = $scope.startMils;
+                        // param.endMils = $scope.endMils;
+                        param.exceptionType = window.sessionStorage.getItem('exceptionType');
+                        param.storeType = $scope.storeType;
+
+                        param.startMils = $scope.startDate ? $scope.startDate.getTime() : null;
+                        param.endMils = $scope.endDate ? $scope.endDate.getTime() : null;
+                        if (param.startMils != null && param.endMils != null){
+                            if (param.startMils > param.endMils){
+                                alert("开始时间不得超过结束时间!");
+                                return;
+                            }
+                        }
+
+                        Purchase.getByStatusAndInternal(param, function (page) {
+                            if (page) {
+                                if (!$scope.startDate && !$scope.endDate && !$scope.keyword) {
+                                    if ($scope.childStatus == '') {
+                                        if (page.content) {
+                                            angular.forEach(page, function (value, key) {
+                                                if (key == 'all' || key == 'tobeconfirmed' || key == 'comfirmed' || key == 'inbound'
+                                                    || key == 'tobepaid' || key == 'completed' || key == 'unavailable' || key == 'toBeReviewed') {
+                                                    if (!$scope.counts) {
+                                                        $scope.counts = {};
+                                                    }
+                                                    $scope.counts[key] = value;
+                                                }
+                                                $scope.counts[$scope.status] = page.totalElements;
+                                            });
+                                        } else {
+                                            $scope.counts = {};
+                                        }
+                                    }
+                                }
+
+                                $scope.purchases = page.content;
+                                angular.forEach($scope.purchases, function (data) {
+                                    if (data.installmentId && data.installment.status == 504) {
+                                        angular.forEach(data.installment.installmentDetails, function (list) {
+                                            if (list.detno == data.installment.currentNo) {
+                                                if (list.status == 504) {
+                                                    data.installmentDetailPaid = true;
+                                                }
+                                            }
+                                        })
+                                    }
+                                    // 循环判断一期都没有付款并且延期的
+                                    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;
+                                            }
+                                        })
+                                    }
+                                    // 循环判断已付款未收款卖家可取消的
+
+                                });
+                                $scope.requestOver = 0;
+                                angular.forEach($scope.purchases, function (order) {
+                                    Rate.getRateVendor({orderId:order.orderid},{},function (data) {
+                                        if (data.data){
+                                            order.isEachRate = true;
+                                        }
+                                    });
+                                    Rate.getRateBuyer({orderId:order.orderid},{},function (data) {
+                                        if(data.data){
+                                            if (data.data.vendorRateTime){
+                                                order.isFirstRate = true; // 是否完成初评
+                                            }
+                                            if (data.data.vendorAfterRateTime){
+                                                order.isAfterRate = true; // 是否完成追评
+                                            }
+                                        }
+                                        $scope.requestOver += 1;
+                                    });
+                                    angular.forEach(JSON.parse(order.statushistory),function (data) {
+                                        if (data.status == 520){
+                                            order.complete = data.time;
+                                        }
+                                    });
+                                });
+                                getExMsgState(); // 获取异常消息状态
+                                getReturnByPurchaseIds(); // 获取退货单信息
+
+                                $scope.orderLength = page.numberOfElements;
+                                $scope.pageParams.content = page.content;
+                                $scope.pageParams.number = page.number;
+                                // 分页部分有关内容
+                                $scope.param.currentPage = page.number;
+                                $scope.AllOrderInfo = page;
+                                $scope.acculatePages(page.number, page.totalPages);
+
+                                $scope.pageParams.totalElements = page.totalElements;
+                                $scope.pageParams.totalPages = page.totalPages;
+                                params.total(page.totalElements);
+                                $defer.resolve(page.content);
+                                $scope.orderLength = page.content.length;
+
+                                angular.forEach(page.content, function (order) {
+                                    var purchaseDetails = angular.copy(order.purchaseDetails);
+                                    // 获取型号数量
+                                    var components = {};
+                                    angular.forEach(purchaseDetails, function (purchaseDetail) {
+                                        components[purchaseDetail.uuid]++;
+                                    });
+                                    order.codeNum = Object.getOwnPropertyNames(components).length;
+                                    // TODO huxz 获取付款到账时间[已付款时间]
+                                    // 获取订单发货时间
+                                    getTimeByStatus(order, order.statushistory, 406, 'inbound');
+                                    // 获取订单收货时间
+                                    getTimeByStatus(order, order.statushistory, 405, 'receivedGoods');
+                                    // 当订单状态码为失效状态时
+                                    var statusCode = order.status;
+                                    if (statusCode == 602 || statusCode == 603 || statusCode == 604 || statusCode == 315 || statusCode == 605 || statusCode == 606) {
+                                        getTimeByStatus(order, order.statushistory, statusCode, 'unavailable');
+                                        order.unavailableReason = unavailableReasons[statusCode];
+                                    }
+                                });
+                            }
+                        }, function (reponse) {
+                            if ("系统错误".indexOf(reponse.data) > -1) {
+                                toaster.pop('error', '不好意思,系统出错,请联系客服。');
+                            } else {
+                                toaster.pop('info', reponse.data);
+                            }
+                        });
+                    }
+                });
+                $scope.orderTableParams.reload();
+            }
+        }, function (error) {
         });
 
         var unavailableReasons = {
@@ -514,149 +662,7 @@ define(['app/app'], function (app) {
         $scope.reload = function () {
             $scope.orderTableParams.reload();
         };
-        $scope.orderTableParams = new ngTableParams($scope.tableParams, {
-            total: 0,
-            getData: function ($defer, params) {
-                $scope.loading = true;
-                $scope.paginationParams = params;
-                var param = BaseService.parseParams(params.url());
-                param.keyword = $scope.keyword ? $scope.keyword : null;
-                if ($scope.childStatus!==''){
-                    param.status = $scope.childStatus;
-                }else{
-                    param.status = getState();
-                }
-                param.page = $scope.param.page;
-                // param.startMils = $scope.startMils;
-                // param.endMils = $scope.endMils;
-                param.exceptionType = window.sessionStorage.getItem('exceptionType');
-                param.storeType = $scope.storeType;
-
-                param.startMils = $scope.startDate ? $scope.startDate.getTime() : null;
-                param.endMils = $scope.endDate ? $scope.endDate.getTime() : null;
-                if (param.startMils != null && param.endMils != null){
-                    if (param.startMils > param.endMils){
-                        alert("开始时间不得超过结束时间!");
-                        return;
-                    }
-                }
-
-                Purchase.getByStatusAndInternal(param, function (page) {
-                    if (page) {
-                        if (!$scope.startDate && !$scope.endDate && !$scope.keyword) {
-                            if ($scope.childStatus == '') {
-                                if (page.content) {
-                                    angular.forEach(page, function (value, key) {
-                                        if (key == 'all' || key == 'tobeconfirmed' || key == 'comfirmed' || key == 'inbound'
-                                            || key == 'tobepaid' || key == 'completed' || key == 'unavailable' || key == 'toBeReviewed') {
-                                            if (!$scope.counts) {
-                                                $scope.counts = {};
-                                            }
-                                            $scope.counts[key] = value;
-                                        }
-                                        $scope.counts[$scope.status] = page.totalElements;
-                                    });
-                                } else {
-                                    $scope.counts = {};
-                                }
-                            }
-                        }
 
-                        $scope.purchases = page.content;
-                        angular.forEach($scope.purchases, function (data) {
-                            if (data.installmentId && data.installment.status == 504) {
-                                angular.forEach(data.installment.installmentDetails, function (list) {
-                                    if (list.detno == data.installment.currentNo) {
-                                        if (list.status == 504) {
-                                            data.installmentDetailPaid = true;
-                                        }
-                                    }
-                                })
-                            }
-                            // 循环判断一期都没有付款并且延期的
-                            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;
-                                    }
-                                })
-                            }
-                            // 循环判断已付款未收款卖家可取消的
-
-                        });
-                        $scope.requestOver = 0;
-                        angular.forEach($scope.purchases, function (order) {
-                            Rate.getRateVendor({orderId:order.orderid},{},function (data) {
-                               if (data.data){
-                                   order.isEachRate = true;
-                               }
-                            });
-                            Rate.getRateBuyer({orderId:order.orderid},{},function (data) {
-                                if(data.data){
-                                    if (data.data.vendorRateTime){
-                                        order.isFirstRate = true; // 是否完成初评
-                                    }
-                                    if (data.data.vendorAfterRateTime){
-                                        order.isAfterRate = true; // 是否完成追评
-                                    }
-                                }
-                                $scope.requestOver += 1;
-                            });
-                            angular.forEach(JSON.parse(order.statushistory),function (data) {
-                                if (data.status == 520){
-                                    order.complete = data.time;
-                                }
-                            });
-                        });
-                        getExMsgState(); // 获取异常消息状态
-                        getReturnByPurchaseIds(); // 获取退货单信息
-
-                        $scope.orderLength = page.numberOfElements;
-                        $scope.pageParams.content = page.content;
-                        $scope.pageParams.number = page.number;
-                        // 分页部分有关内容
-                        $scope.param.currentPage = page.number;
-                        $scope.AllOrderInfo = page;
-                        $scope.acculatePages(page.number, page.totalPages);
-
-                        $scope.pageParams.totalElements = page.totalElements;
-                        $scope.pageParams.totalPages = page.totalPages;
-                        params.total(page.totalElements);
-                        $defer.resolve(page.content);
-                        $scope.orderLength = page.content.length;
-
-                        angular.forEach(page.content, function (order) {
-                            var purchaseDetails = angular.copy(order.purchaseDetails);
-                            // 获取型号数量
-                            var components = {};
-                            angular.forEach(purchaseDetails, function (purchaseDetail) {
-                                components[purchaseDetail.uuid]++;
-                            });
-                            order.codeNum = Object.getOwnPropertyNames(components).length;
-                            // TODO huxz 获取付款到账时间[已付款时间]
-                            // 获取订单发货时间
-                            getTimeByStatus(order, order.statushistory, 406, 'inbound');
-                            // 获取订单收货时间
-                            getTimeByStatus(order, order.statushistory, 405, 'receivedGoods');
-                            // 当订单状态码为失效状态时
-                            var statusCode = order.status;
-                            if (statusCode == 602 || statusCode == 603 || statusCode == 604 || statusCode == 315 || statusCode == 605 || statusCode == 606) {
-                                getTimeByStatus(order, order.statushistory, statusCode, 'unavailable');
-                                order.unavailableReason = unavailableReasons[statusCode];
-                            }
-                        });
-                    }
-                }, function (reponse) {
-                    if ("系统错误".indexOf(reponse.data) > -1) {
-                        toaster.pop('error', '不好意思,系统出错,请联系客服。');
-                    } else {
-                        toaster.pop('info', reponse.data);
-                    }
-                });
-            }
-        });
-        $scope.orderTableParams.reload();
         // 确认收款
         // 分期明细
         $scope.numArray = {