Explorar el Código

Merge remote-tracking branch 'origin/feature-b2b-ssr-wangcz' into feature-b2b-ssr-wangcz

shenjj hace 8 años
padre
commit
e73ef1d842

+ 267 - 1699
src/main/webapp/resources/js/vendor/controllers/b2b/saleMaketodoCtrl.js

@@ -4,1743 +4,311 @@
  */
 define(['app/app'], function (app) {
     "use strict";
-    app.register.controller('saleMaketodoCtrl', ['$scope', '$rootScope', 'Purchase', 'ngTableParams', 'BaseService', 'toaster', '$state', '$filter', 'Return', 'Change', '$modal', 'PuExProcess', 'Recommendation', 'DateUtil', 'Loading', 'bankInfoService', 'Logistics', 'Distributor', 'SessionService','Rate','StoreInfo', function ($scope, $rootScope, Purchase, ngTableParams, BaseService, toaster, $state, $filter, Return, Change, $modal, PuExProcess, Recommendation, DateUtil, Loading, bankInfoService, Logistics, Distributor, SessionService, Rate, StoreInfo) {
-        $rootScope.active = 'vendor_order';
-        $scope.tab = 'maketodo';
-        document.title = '已卖出的产品-优软商城';
-        // 加密过滤器
-        var enIdFilter = $filter('EncryptionFilter');
-        // 默认状态为所有订单
-        if (SessionService.getCookie('status')){
-            $scope.status = SessionService.getCookie('status');
-            SessionService.removeCookie('status');
-        }else {
-            $scope.status = 'all';
-        }
-        // 分页相关数据
-        $scope.pageParams = {number: 1};
-        // 下拉菜单状态
-        $scope.isShowPop = false;
-        // 搜索关键字
-        $scope.keyword = "";
-        // 订单数据条数
-        $scope.orderLength = 1;
-        // 多选操作,存在ID
-        $scope.checkedIds = {};
-        // 禁用批量确认收款操作
-        $scope.canEnsureRec = false;
-        //是商城管理员的公司
-        $scope.isYrscStore = false;
-        //是寄售店铺
-        $scope.isCONSIGNMENT = false;
-        //分页参数
-        $scope.tableParams = {
-            page: 1,
-            count: 5,
-            sorting: {
-                createtime: 'DESC'
-            }
-        };
-        $scope.startDate = null;
-        $scope.endDate = null;
-
-
-        $scope.param = {};
-        $scope.param.page = 1;
-
-        $scope.localInfo = {};
-
-        $scope.yrscStore = '33069557578d44e69bd91ad12d28a8d4';
-
-        if ($rootScope.store && ($scope.yrscStore == $rootScope.store.uuid)) {
-            $scope.isYrscStore = true;
-        }
-        StoreInfo.findShopOwnerApplyByNormalStatus({}, {}, function (result) {
-            if (!result.data) {
-                $scope.isCONSIGNMENT = true;
-                $scope.storeType = 'mall';
-            }else if (result.data.type == 'CONSIGNMENT' || result.data.status == 'PREPARE'){
-                $scope.isCONSIGNMENT = true;
-                $scope.storeType = 'mall';
-            }
-            if (!$scope.isYrscStore && !$scope.isCONSIGNMENT) {
-                $scope.storeType = 'other';
-                window.sessionStorage.setItem('storeType', $scope.storeType);
-                $scope.orderTableParams.reload();
-            }
-        }, function (error) {
-        });
-
-        var unavailableReasons = {
-            315: '已注销',
-            602: '库存不足',
-            603: '一直未付款',
-            604: '拒绝发货',
-            605: '用户全部退货',
-            606: '用户取消订单'
-        };
-
-        // 订单状态码和订单状态的映射
-        $scope.stateMap = {
-            501: '意向订单',
-            502: '待发货',
-            406: '待发货',
-            404: '待收货',
-            405: '待收款', /*已收货:卖家没有已收货状态,商城收货后,应该是待收款状态*/
-            503: '待收款',
-            524: '待收款',
-            514: '待收款',
-            520: '已完成',
-            602: '已失效',
-            603: '已失效',
-            604: '已失效',
-            605: '已失效',
-            606: '已失效',
-            315: '已失效'
-        };
-        // 币种币别符号映射
-        $scope.currencyTrans = {
-            'RMB': '¥',
-            'USD': '$'
-        };
-        //设置子状态码的映射
-        $scope.childStatus = '';
-        $scope.childStatusName = '订单状态';
-        $scope.setChildStatus = function (status,name) {
-            $scope.childStatus = status;
-            $scope.childStatusName = name;
-            $scope.param.page = 1;
-            $scope.orderTableParams.page(1);
-            $scope.orderTableParams.reload();
-        }
-        // 根据订单状态获取状态码
-        var getState = function () {
-            var state = 'get';
-            switch ($scope.status) {
-                case 'all' :
-                    state = '';
-                    break;
-                case 'tobeconfirmed' :
-                    state = '501-504-524-525';
-                    break;
-                case 'comfirmed':
-                    // TODO huxz 点击填写物流转出货单,填写完物流信息变为待收货状态
-                    state = '502-406';
-                    break;
-                case 'inbound':
-                    // TODO wangdy 待收获,包含待买家收货和售后中
-                    state = '404-511';
-                    break;
-                case 'tobepaid':
-                    // TODO huxz 平台收货后即变为待收款状态,直到买家确认收货503待付款状态
-                    state = '405-503-514-506-511';
-                    break;
-                case 'completed':
-                    // TODO huxz 平台采购单已完成,即交易完成
-                    state = '520';
-                    break;
-                case 'unavailable':
-                    // TODO huxz 平台采购单的失效状态
-                    state = '602-603-315-604-605-606';
-                    break;
-                case 'toBeReviewed':
-                    state = '404-503-520';
-                    break;
-                //下面的状态栏新增的状态
-                case 'tobepay':
-                    state = '501';
-                    break;
-                case 'tobeconfirmedpay':
-                    state = '504';
-                    break;
-                case 'inaftersales':
-                    state = '511';
-                    break;
-                case 'cancel':
-                    state = '602-603-315-604-605';
-                    break;
-                case 'tradeclose':
-                    state = '606';
-                    break;
-            }
-            return state;
-        };
-
-        // 打印
-        $scope.print = function (purchase, type) {
-            var rootPath = BaseService.getRootPath();
-            window.open(rootPath + '/report/print?reportName=' + type + '&whereCondition=' + "where trade$purchase.id=" + purchase.id);
-        };
-
-
-        $scope.setActive = function (status) {
-            window.sessionStorage.removeItem("exceptionType");
-            window.sessionStorage.setItem('purchaseState', status);
-            if ($scope.status != status) {
-                $scope.status = status;
-                $scope.orderTableParams.page(1);
-            }
-            $scope.isShowPop = false;
-            // 初始化多选记录
-            $scope.startDate = null;
-            $scope.endDate = null;
-            $scope.checkedIds = {};
-            $scope.param.page = 1;
-            $scope.childStatus ='';
-            $scope.childStatusName ='订单状态';
-            $scope.orderTableParams.reload();
-        };
-        $scope.sortingState = {
-            state: 'orderBycreatetimeDesc'
-        };
-
-        $scope.findSelectedDistributor = function () {
-            Distributor.findAllSelected({},{},function (data) {
-                if (data){
-                    $scope.companyList = data;
-                }
-            })
-        };
-        $scope.findSelectedDistributor();
-
-        //配送方式类型
-        $scope.deliveryMethod = {
-            1301: '第三方配送',
-            1302: '卖家配送',
-            1303: '上门自提'
-        };
-        // 获取已有物流配送商列表
-        $scope.initData = function () {
-            Distributor.findAllSelected({},function (data) {
-                if (data){
-                    $scope.data_list = data;
-                }
-            })
-        };
-        $scope.initData();
-        $scope.showNameUl = false;
-
-        $scope.showName = function () {
-            $scope.showNameUl = true;
-            console.log($scope.showNameUl)
-        };
-        $scope.onFocus = function () {
-            $scope.showNameUl = true;
-        };
-        $scope.onBlur = function () {
-            if ($scope.time){
-                clearTimeout($scope.time);
-            }
-            $scope.time = setTimeout(function () {
-                $scope.$apply(function () {
-                    $scope.showNameUl = false;
-                });
-            }, 200);
-        };
-        // 选中物流
-        $scope.showText = function (name) {
-            $scope.logistics.companyName = name;
-            $scope.showNameUl = false;
-        };
-        $scope.modifyLogistic = function (purchase) {
-            purchase.showLogistics = !purchase.showLogistics;
-            angular.forEach($scope.purchases, function (data) {
-                if (data.id != purchase.id){
-                    data.showLogistics = false;
+    app.register.controller('saleMaketodoCtrl', ['$scope', '$filter', 'MakeOrder', 'ngTableParams', 'toaster', 'ReportService', 'BaseService', 'B2bSearchFilter', '$http', 'B2bCurrentRole',
+        function ($scope, $filter, MakeOrder, ngTableParams, toaster, ReportService, BaseService, SearchFilter, $http, B2bCurrentRole) {
+            var b2bUrl = BaseService.getB2bUrl()
+            BaseService.scrollBackToTop();
+            /**
+             * 页面状态按钮过滤
+             */
+            var getState = function (active) {
+                var fn = 'get';
+                switch (active) {
+                    case 'done':
+                        fn = 'getDone';
+                        break;
+                    case 'todo':
+                        fn = 'getTodo';
+                        break;
+                    case 'end':
+                        fn = 'getEnd';
+                        break;
+                    case 'waiting':
+                        fn = 'getWaiting';
+                        break;
+                    case 'received':
+                        fn = 'getReceived';
+                        break;
+                    case 'invalid':
+                        fn = 'getInvalid';
+                        break;
+                    // 已采纳
+                    case 'agreed':
+                        fn = 'getAgreed';
+                        break;
+                    // 未采纳
+                    case 'refused':
+                        fn = 'getRefused';
+                        break;
+                    // 个人
+                    case 'personal':
+                        fn = 'getPersonal';
+                        break;
+                    // 集体
+                    case 'teams':
+                        fn = 'getTeams';
+                        break;
+                    // 非标准
+                    case 'nonstandard':
+                        fn = 'getNonstandard';
+                        break;
+                    // 标准
+                    case 'standard':
+                        fn = 'getStandard';
+                        break;
+                    // 变更单无需确认
+                    case 'unread':
+                        fn = 'getUnread';
+                        break;
                 }
+                return fn;
+            };
+            $scope.storeType = 'maketodo';
+            // 获取当前用户是否为普通用户
+            B2bCurrentRole.isUser({}, {}, function (data) {
+                $scope.isUser = data.isUser;
             });
-            if (purchase.showLogistics){
-                if (!purchase.lgtId){
-                    $scope.logistics = {};
-                }else {
-                    Logistics.findLogisticsById({lgtid:purchase.lgtId}, {}, function (data) {
-                        if (data){
-                            $scope.logistics = data;
-                        }
-                    })
-                }
-            }
-        };
-
-        $scope.cancelModify = function (purchase) {
-            purchase.showLogistics = false;
-        };
 
-        /**
-         * 确认修改物流信息
-         * @param purchase
-         */
-        $scope.ensureModifyLogistics = function (purchase) {
-            if (purchase.sendType == 1301){
-                if (!$scope.logistics.companyName) {
-                    toaster.pop("error", "请选择物流公司");
-                    return ;
-                }
-                if ($scope.logistics.companyName == '请选择物流公司'){
-                    toaster.pop('error', '注意', '请选择物流公司');
-                    return ;
-                }
-                if (!$scope.logistics.number) {
-                    toaster.pop("error", "请填写物流单号");
-                    return ;
-                }
-                var patt = new RegExp("^[A-Za-z0-9]+$");
-                if (!patt.test($scope.logistics.number)){
-                    toaster.pop("error", "注意", '请输入正确的物流单号');
-                    return ;
-                }
-            }else {
-                if ($scope.logistics.companyName && $scope.logistics.companyName != '请选择物流公司'){
-                    if (!$scope.logistics.number){
-                        toaster.pop("error", "注意", '请完善快递信息');
-                        return ;
-                    }
-                }
-                if ($scope.logistics.number){
-                    var patt = new RegExp("^[A-Za-z0-9]+$");
-                    if (!patt.test($scope.logistics.number)){
-                        toaster.pop("error", "注意", '请输入正确的物流单号');
-                        return ;
-                    }
-                    if (!$scope.logistics.companyName || $scope.logistics.companyName == '请选择物流公司'){
-                        toaster.pop("error", "注意", '请完善快递信息');
-                        return ;
-                    }
-                }
-            }
-            if (!purchase.lgtId){ //没有物流信息则添加物流信息
-                if ($scope.logistics.companyName && $scope.logistics.number){
-                    Logistics.addLogistics({inid : purchase.inid}, $scope.logistics, function (data) {
-                        if (data.success){
-                            $scope.orderTableParams.reload();
-                            toaster.pop("success", "保存物流信息成功");
-                            purchase.showLogistics = false;
-                        }
-                    })
-                }else {
-                    purchase.showLogistics = false;
+            $scope.active = 'todo';
+            $scope.dateZoneText = '不限';
+            $scope.condition = {dateZone: 1};
+
+            /* 时间筛选初始化*/
+            var fromDate = new Date();
+            var toDate = new Date();
+            fromDate.setMonth(fromDate.getMonth() - 1);
+            fromDate.setHours(0, 0, 0, 0);
+            toDate.setHours(23, 59, 59, 999);
+            $scope.condition.dateFrom = fromDate;
+            $scope.condition.dateTo = toDate;
+
+            $scope.changeDateZone = function (zone) {
+                $scope.condition.dateZone = zone;
+                $scope.dateZoneText = zone == 1 ? '最近一个月' : (zone == 3 ? '最近三个月' : (zone == 6 ? '最近六个月' : '自定义'));
+                $scope.condition.$dateZoneOpen = false;
+                getDateCondition(zone, $scope.condition);
+                $scope.tableParams.page(1);
+                $scope.tableParams.reload();
+            };
+            $scope.setActive = function (state) {
+                if ($scope.active != state) {
+                    $scope.active = state;
+                    if ($scope.tableParams.page() == 1)
+                        $scope.tableParams.reload();
+                    else
+                        $scope.tableParams.page(1);
                 }
-            }else { //更新物流信息
-                if ($scope.logistics.companyName && $scope.logistics.number){
-                    Logistics.updateLogistics({id : purchase.lgtId, invoiceFuid : purchase.inid}, $scope.logistics, function (data) {
-                        if (data){
-                            if(data.success){
-                                toaster.pop("success", "修改物流信息成功");
-                                purchase.showLogistics = false;
-                            }
-                        }
-                    })
-                } else {
-                    if (purchase.sendType != 1301){
-                        //没有则删除快递信息
-                        Logistics.clearLogistics({inid : purchase.inid}, {}, function (data) {
-                            if (data){
-                                if(data.success){
-                                    $scope.orderTableParams.reload();
-                                    toaster.pop("success", "修改物流信息成功");
-                                    purchase.showLogistics = false;
-                                }
-                            }
-                        })
-                    }
+            };
+            var getService = function () {
+                return MakeOrder;
+            };
+            $scope.tableParams = new ngTableParams({
+                page: 1,
+                count: 20,
+                sorting: {
+                    date: 'desc'
+                }
+            }, {
+                total: 0,
+                counts: [5, 10, 25, 50],
+                getData: function ($defer, params) {
+                    $scope.loading = true;
+                    var param = BaseService.parseParams(params.url());
+                    param.searchFilter = { // 筛选条件
+                        keyword: $scope.keyword,
+                        fromDate: SearchFilter.getDateTime($scope.condition.dateFrom),
+                        endDate: SearchFilter.getDateTime($scope.condition.dateTo)
+                    };
+                    // $scope.loading = true;
+                    // var pageParams = params.url();
+                    // pageParams.searchFilter = {
+                    //     keyword: $scope.keyword,
+                    //     fromDate: getDateTime($scope.condition.dateFrom),
+                    //     endDate: getDateTime($scope.condition.dateTo)
+                    // };
+                    param._state = $scope.active;
+                    $http({
+                        method: 'get',
+                        dataType: 'json',
+                        url: b2bUrl + "/make/orders/info/search",
+                        params: param
+                    }).success(function (data) {
+                        console.log(data)
+                        params.total(data.totalElement);
+                        $defer.resolve(data.content);
+                        $scope.searchFilterXls = angular.copy(param.searchFilter);//保存当前取值的条件
+                    }).error(function (response) {
+                        toaster.pop('error', response);
+                    });
+                    // getService()[getState($scope.active)].call(null, BaseService.parseParams(pageParams), function (page) {
+                    //     $scope.loading = false;
+                    //     if (page) {
+                    //         console.log(page)
+                    //         params.total(page.totalElement);
+                    //         $defer.resolve(page.content);
+                    //         $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的关键词
+                    //     }
+                    // }, function (response) {
+                    //     $scope.loading = false;
+                    //     toaster.pop('error', '数据加载失败', response.data);
+                    // });
                 }
-            }
-        };
-
-        $scope.changeOrderState = function (state) {
-            if ($scope.sortingState.state === state) {
-                $scope.orderTableParams.sorting({createtime: 'DESC'});
-                $scope.sortingState.state = 'orderBycreatetimeDesc';
-                $scope.orderTableParams.reload();
-                return false;
-            } else {
-                return true;
-            }
-        };
-        $scope.orderBybatchQtyDesc = function () {
-            if ($scope.changeOrderState('orderBybatchQtyDesc')) {
-                $scope.orderTableParams.sorting({batchQty: 'DESC'});
-                $scope.sortingState.state = 'orderBybatchQtyDesc';
-                $scope.orderTableParams.reload();
-            }
-        };
-        $scope.orderBybatchQtyAsc = function () {
-            if ($scope.changeOrderState('orderBybatchQtyAsc')) {
-                $scope.orderTableParams.sorting({batchQty: 'ASC'});
-                $scope.sortingState.state = 'orderBybatchQtyAsc';
-                $scope.orderTableParams.reload();
-            }
-        };
-        $scope.orderByensurePriceDesc = function () {
-            if ($scope.changeOrderState('orderByensurePriceDesc')) {
-                $scope.orderTableParams.sorting({currency: 'ASC', ensurePrice: 'DESC', createtime: 'DESC'});
-                $scope.sortingState.state = 'orderByensurePriceDesc';
-                $scope.orderTableParams.reload();
-            }
-        };
-        $scope.orderByensurePriceAsc = function () {
-            if ($scope.changeOrderState('orderByensurePriceAsc')) {
-                $scope.orderTableParams.sorting({currency: 'DESC', ensurePrice: 'ASC', createtime: 'DESC'});
-                $scope.sortingState.state = 'orderByensurePriceAsc';
-                $scope.orderTableParams.reload();
-            }
-        };
-
-        // 异常申请/异常通知/退货/换货
-        $scope.setExceptionType = function (type, active) {
-            window.sessionStorage.setItem('exceptionType', type);
-            window.sessionStorage.setItem('purchaseState', active);
-            if ($scope.status != active) {
-                $scope.status = active;
-                $scope.orderTableParams.page(1);
-            }
-            $scope.orderTableParams.page(1);
-            $scope.isShowPop = false;
-            $scope.checkedIds = {};
-            $scope.orderTableParams.reload();
-        };
-
-        var storeType = window.sessionStorage.getItem('storeType');
-        $scope.storeType = storeType ? storeType : 'mall';
-        // 设置店铺id
-        $scope.setStoreType = function (storeType) {
-            if ($scope.storeType != storeType) {
-                $scope.storeType = storeType;
-                window.sessionStorage.setItem('storeType', storeType);
-                $scope.param.page = 1;
-                $scope.orderTableParams.page(1);
-                $scope.keyword = null;
-                $scope.startDate = null;
-                $scope.endDate = null;
-                $scope.isShowPop = false;
-                $scope.checkedIds = {};
-                $scope.orderTableParams.reload();
-                getCounts();
-            }
-        };
-
-        // 获取各种状态订单的数量信息
-        var getCounts = function () {
-            if (!$scope.startDate && !$scope.endDate && !$scope.keyword){
-                Purchase.getAllStatusCounts({storeType: $scope.storeType}, function (data) {
-                    $scope.counts = angular.copy(data);
-                    $scope.counts[$scope.status] = $scope.pageParams.totalElements;
-                });
-            }
-        };
-        getCounts();
-
-        //安全设置提醒框
-        $scope.openHomeCenterModel = function() {
-            var modalInstance = $modal.open({
-                animation: true,
-                templateUrl: $rootScope.rootPath + '/static/view/usercenter/modal/homeCenter_modal.html',
-                controller:'homeModalCtrl'
             });
-            modalInstance.result.then(function(){
-            }, function(){
-            });
-        }
 
-        // 填写物流信息
-        $scope.toBeShiped = function (purchase) {
-            if(!($scope.userInfo.pwdEnable && $scope.userInfo.haveUserQuestion && $scope.userInfo.emailValidCode == 2)){
-                $scope.openHomeCenterModel();
-            } else {
-                bankInfoService.getVenderBankDefault(null, function (data) {
-                    if (data && data.length > 0) {
-                        // 如果处于406,则直接跳转到物流页面
-                        if (purchase.inid) {
-                            // 填写物流信息
-                            $state.go("vendor_delivery", {ids: enIdFilter(purchase.inid)});
-                        } else {
-                            Purchase.tobeshiped({id: purchase.id}, function (data) {
-                                toaster.pop('success', '转出货单成功');
-                                // 填写物流信息
-                                $state.go("vendor_delivery", {ids: enIdFilter(data.inId)});
-                            }, function (response) {
-                                toaster.pop('error', '失败', '转出货单失败' + response.data);
-                            });
-                        }
-                    } else {
-                        purchase.showGotoSettle = true;
-                    }
-                }, function (response) {
+            //获得各分类未阅读数量
+            var getUnreadCount = function () {
+                MakeOrder.getUnreadCount(null, function (data) {
+                    $scope.unread = data;
                 });
-            }
-        };
-
-        $scope.showDeletePurchase = function (purchase) {
-            purchase.showDelete = !purchase.showDelete;
-            var showid = purchase.id;
-            angular.forEach($scope.purchases, function (data) {
-                if(data.id != showid){
-                    data.showDelete = false;
-                }
-            });
-        };
-
-        //根据采购单号修改采购单的使用状态
-        $scope.deletePurchase = function (purchase) {
-            Purchase.changePurchaseUsed({purchaseid: purchase.purchaseid}, {}, function (data) {
-                purchase.showDelete = false;
-                $scope.orderTableParams.reload();
-            });
-        };
-
-        //更新显示状态
-        $scope.changeShow = function (purchase) {
-            purchase.showGotoSettle = false;
-            // Purchase.changeShowTip({purchaseid: purchase.purchaseid}, {}, function (data) {
-            //     purchase.showGotoSettle = false;
-            //     $scope.orderTableParams.reload();
-            // });
-        };
-        //去结算中心
-        $scope.goToSettle = function (purchase) {
-            // Purchase.changeShowTip({purchaseid: purchase.purchaseid}, {}, function (data) {
-            //     purchase.showGotoSettle = false;
-            //     $scope.orderTableParams.reload();
-            // });
-            purchase.showGotoSettle = false;
-            window.open("/sso#/gatheringAccount?tab=accountTab");
-        }
-        // 关闭操作
-        $scope.cancle = function () {
-            $scope.showGotoSettle = false;
-        }
-        // 根据状态码获取对应状态的时间信息
-        var getTimeByStatus = function (order, statushistory, statusCode, statusStr) {
-            angular.forEach(eval(statushistory), function (statushistory) {
-                if (statushistory.status === statusCode) {
-                    order[statusStr + 'Time'] = statushistory.time;
-                }
-            });
-        };
-
-        // $scope.startDateStr = '2016-05-01';
-        var tempDate = new Date();
-        tempDate.setDate(tempDate.getDate() - 30);
-        $scope.startDateStr = DateUtil.yyyyMmDd(tempDate);
-        $scope.endDateStr = DateUtil.yyyyMmDd(new Date());
-        $scope.startMils = $scope.startDateStr ? new Date(tempDate).getTime() : undefined;
-        $scope.endMils = $scope.endDateStr ? new Date(new Date()).getTime() : undefined;
-
-        // 触发订单时间筛选
-        $scope.chooseInternal = function () {
-            $scope.startMils = $scope.startDateStr ? new Date($scope.startDateStr).getTime() : undefined;
-            $scope.endMils = $scope.endDateStr ? new Date($scope.endDateStr).getTime() : undefined;
-            $scope.orderTableParams.page(1);
-            $scope.orderTableParams.reload();
-        };
-        // 重新加载数据
-        $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;
-                        $scope.currenctOrdersList = page
-                        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);
-                    }
+            };
+            getUnreadCount();
+
+            //设置单据已读
+            $scope.setOrdersRead = function (id) {
+                // 如果单据本身已读,则不发送请求修改数据
+                if (!$scope.isUnread(id)){
+                    return;
+                }
+                var sourceId = [];
+                sourceId.push(id);
+                MakeOrder.setRead({}, sourceId, function (message) {
+                    // $scope.getUnreadIds();
+                    getUnreadCount();
                 });
-            }
-        });
-
-        // 确认收款
-        // 分期明细
-        $scope.numArray = {
-            '1': '一',
-            '2': '二',
-            '3': '三',
-            '4': '四',
-            '5': '五'
-        };
-        $scope.confirmPaymentBox = false;
-        $scope.confirmPayment = function (item,id) {
-            angular.forEach($scope.purchases, function (data) {
-                if(data.id != id) {
-                    data.confirmPaymentBox = false;
-                }
-            });
-            $scope.purchaseInstallment = item;
-            $scope.purchasesId = item.id;
-            $scope.confirmPaymentBox = true;
-            // 获取分期付款进行到哪一步
-            // 存放分期详情列表
-            $scope.installmentDetails = item.installment.installmentDetails;
-            if (item.installmentId && item.installment.status == 504) {
-                $scope.currencyNAME = item.currency;
-                angular.forEach(item.installment.installmentDetails, function (list) {
-                    if (list.detno == item.installment.currentNo) {
-                        $scope.installmentDetailsList = list;
-                        $scope.changeList = '';
-                        $scope.installmentDetailsList.installmentImages = $scope.installmentDetailsList.imgs.split(",");
-                        $scope.changeList = $scope.installmentDetailsList.installmentImages;
-                    }
-                })
             };
-        };
-        $scope.cancelPayment = function () {
-            $scope.confirmPaymentBox = false;
-        };
-        // 确认收款
-        $scope.confirmPaymentOk = function (installmentDetails) {
-            var installmentDetailId = '';
-            angular.forEach(installmentDetails, function (installmentDetail) {
-                if (installmentDetail.detno == $scope.purchaseInstallment.installment.currentNo)
-                    installmentDetailId = installmentDetail.id;
-            });
-            Purchase.confirmPaymentInstallment({id: $scope.purchasesId,installmentDetailId: installmentDetailId}, null, function () {
-                toaster.pop('success', '收款成功');
-                $scope.confirmPaymentBox = false;
-                $scope.orderTableParams.reload();
-            }, function (response) {
-                toaster.pop('error', response.data);
-            });
-        };
-        // 切换效果
-        $scope.imgIndex = 0;
-        $scope.changeImg = function (installmentImg, index) {
-            $scope.imgIndex = index;
-        };
-        $scope.changePrev = function () {
-            if ($scope.imgIndex == 0) {
-                $scope.imgIndex = 0
-            }else if($scope.imgIndex > 0){
-                $scope.imgIndex -= 1;
-            }
-        };
-        $scope.changeNext = function (installmentImg) {
-            if ($scope.imgIndex == installmentImg.length-1) {
-                $scope.imgIndex = 0
-            }else {
-                $scope.imgIndex += 1;
-            }
-        };
-        /**
-         * 查看大图
-         *
-         * @param imgUrl		图片链接
-         */
-        $scope.showImg = showImg;
-        function showImg(imgUrl) {
-            var src = imgUrl, box = $('#image-box'), modal = $('.modal-content');
-            box.show();
-            box.find('img').attr('src', src);
-            box.find('a').click(function(){
-                box.hide();
-            });
-            box.dblclick(function(){
-                box.hide();
-            });
-        }
 
-        // 取消订单
-        $scope.sellerCancelOrder = function (data, purchaseid) {
-            console.log(data);
-            if(!purchaseid) {
-                return ;
-            }
-            if (data.installmentId && data.installment.status == 503) {
-                angular.forEach(data.installment.installmentDetails, function (detailslist) {
-                    var nowTime = new Date();
-                    console.log(detailslist.deadline);
-                    console.log(nowTime.getTime())
-                    if (detailslist.status == 503 && nowTime.getTime() > detailslist.deadline){
-                        Purchase.sellerCancelOrder({purchaseId : purchaseid, reason : ''}, null, function () {
-                            toaster.pop('success','取消订单成功');
-                            $scope.orderTableParams.reload();
-                            return ;
-                        });
-                    }
-                })
-            }else {
-                $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.setOrdersReadByState = function () {
+                if (!$scope.unread.replied || $scope.unread.replied == 0) {
+                    return;
+                }
+                MakeOrder.setReadByState({}, function () {
+                    getUnreadIds();
+                    getUnreadCount();
                 });
-            }
-        };
-        // 收退货
-        $scope.receivingDialogShow = {};
-        // 确认收退货:知道
-        $scope.known = function (purchase) {
-            var id = $scope.returnInfo[purchase.purchaseid].id;
-            receiving(id);
-            $scope.receivingDialogShow[id] = false
-        };
-        // 确认收退货:下次不再提示
-        $scope.notHint = function (purchase) {
-            window.localStorage.setItem('notHintEnsureReceiving', true);
-            var id = $scope.returnInfo[purchase.purchaseid].id;
-            receiving(id);
-            $scope.receivingDialogShow[id] = false
-        };
-        //确认收货
-        $scope.ensureReceiving = function (re, purchase) {
-            if (!window.localStorage.getItem('notHintEnsureReceiving')) {
-                /*var modalInstance = $modal.open({
-                 templateUrl : 'static/view/vendor/modal/ensure-receiving-modal.html',
-                 controller: 'ensureReceivingModalCtrl',
-                 /!*size: 'sm',*!/
-                 /!*windowClass: ''*!/
-                 });
-                 modalInstance.result.then(function (result) {
-                 receiving(re.id);
-                 }, function (reason) {
+            };
 
-                 })*/
-                var detailIds = [];
-                angular.forEach(re.returnDetails, function (detail) {
-                    detailIds.push(detail.puid);
+            var getUnreadIds = function () {
+                MakeOrder.getUnreadIds({}, "", function (message) {
+                    $scope.unreadCode = message.content;
                 });
-                var allUnavailable = true;
-                for (var i = 0; i < purchase.purchaseDetails.length; i++) {
-                    var puDetail = purchase.purchaseDetails[i];
-                    if (detailIds.indexOf(puDetail.detailid) != -1) {
-                        allUnavailable = false;
-                        break;
-                    }
-                }
-                // 全部明细无效才失效整张订单,从而才弹出提示
-                if (allUnavailable) {
-                    $scope.receivingDialogShow[re.id] = !$scope.receivingDialogShow[re.id];
-                }
-            } else {
-                receiving(re.id);
-            }
-        };
-        var receiving = function (id) {
-            Return.venderAccept({returnid: id}, {}, function (data) {
-                $scope.orderTableParams.reload();
-                toaster.pop('success', '处理成功', '退货单 确认收货成功');
-            }, function (error) {
-                toaster.pop('error', '退货处理失败:' + error.data);
-            })
-        };
-
-
-        //确认收退换货
-        $scope.ensureExchangeReceiving = function (purchaseId) {
-            Change.venderAcceptByPurchase({purchaseId: purchaseId}, function () {
-                $scope.orderTableParams.page(1);
-                $scope.orderTableParams.reload();
-                toaster.pop('success', '处理成功', '退货单 确认收货成功');
-            }, function (error) {
-                toaster.pop('error', '退货处理失败:' + error.data);
-            });
-        };
-
-        // 分页操作
-        $scope.topage = function (num) {
-            if ($scope.topagenum !== null) {
-                $scope.topagenum = null;
-            }
-            if (num < 1) {
-                num = 1;
-            } else if (num > $scope.pageParams.totalPages) {
-                num = $scope.pageParams.totalPages;
-            }
-            $scope.orderTableParams.page(num);
-            $scope.orderTableParams.reload();
-        };
-
-        // 搜索框内容转换成大写
-        var t;
-        var setTime = function () {
-            if ($scope.time > 0) {
-                t = setTimeout(function () {
-                    $scope.$apply(function () {
-                        $scope.time--;
-                        setTime();
-                    });
-                }, 1000);
-            } else {
-                $scope.keyword = angular.uppercase($scope.keyword);
-            }
-        };
-
-        $scope.upper = function () {
-            $scope.time = 1;
-            clearTimeout(t);
-            setTime();
-        };
-
-        // TODO huxz 打开下拉菜单
-        $scope.showPop = function () {
-            $scope.isShowPop = !$scope.isShowPop;
-        };
-
-        // 根据输入单号搜索单据
-        $scope.onSearch = function () {
-            $scope.keyword = angular.uppercase($scope.keyword);
-            $scope.orderTableParams.page(1);
-            $scope.orderTableParams.reload();
-        };
-
-        $scope.condition = {
-            startDateOpen: false,
-            endDateOpen: false
-        };
-
-        // 打开日期选择框
-        $scope.openDatePicker = function ($event, item, openParam,status) {
-            if (status != null) {
-                if (status == 1) {
-                    if ($scope.startDate != null) {
-                        return;
-                    }
-                }
-                if (status == 2) {
-                    if ($scope.endDate != null) {
-                        return;
+            };
+            getUnreadIds();
+            $scope.isUnread = function (id) {
+                for (var i in $scope.unreadCode) {
+                    if (id == $scope.unreadCode[i]) {
+                        return true;
                     }
                 }
-            }
-            $event.preventDefault();
-            $event.stopPropagation();
-            item[openParam] = !item[openParam];
-            if (openParam == 'startDateOpen'){
-                if (item['endDateOpen']){
-                    item['endDateOpen'] = !item['endDateOpen'];
-                }
-            } else if(openParam == 'endDateOpen'){
-                if (item['startDateOpen']){
-                    item['startDateOpen'] = !item['startDateOpen'];
-                }
-            }
-        };
-        $scope.changeEndDate = function () {
-            if ($scope.condition.endDateOpen) {
-                $scope.endDate = $scope.endDate.toString().replace(/[0-9]{2}:[0-9]{2}:[0-9]{2}/g, '23:59:59');//;'23.59';//DateUtil.yyyyMmDd($scope.endDate.getTime() + 86399000);
-                $scope.endDate = new Date(formatDateTime(new Date($scope.endDate.toString())));
-            }
-            $scope.vaildDate(false);
-        };
-        $scope.vaildDate = function (isStart) {
-            if ($scope.endDate !== null && $scope.startDate>$scope.endDate){
-                if (isStart){
-                    alert("开始日期大于结束日期,请重新输入!");
-                    $scope.startDate = null;
-                } else {
-                    alert("开始日期大于结束日期,请重新输入!");
-                    $scope.endDate = null;
-                }
-            }
-        };
-        var formatDateTime = function (date) {
-            var y = date.getFullYear();
-            var m = date.getMonth() + 1;
-            m = m < 10 ? ('0' + m) : m;
-            var d = date.getDate();
-            d = d < 10 ? ('0' + d) : d;
-            var h = date.getHours();
-            var minute = date.getMinutes();
-            var sec = date.getSeconds();
-            minute = minute < 10 ? ('0' + minute) : minute;
-            return y + '-' + m + '-' + d+' '+h+':'+minute+':'+sec;
-        };
-        // 选择查找日期
-        $scope.onDateCondition = function () {
-            $scope.param.page = 1;
-            $scope.orderTableParams.page(1);
-            $scope.orderTableParams.reload();
-        };
-
-        /**
-         * 订单搜索
-         */
-        $scope.search = function () {
-            $scope.param.page = 1;
-            if(typeof $scope.startDate == 'undefined' || typeof $scope.endDate == 'undefined'){
-                alert("日期格式错误,请重新输入!");
-                $scope.startDate = null;
-                $scope.endDate = null;
-                return;
-            }
-            $scope.setChildStatus('','订单状态');
-            $scope.orderTableParams.page(1);
-            $scope.orderTableParams.reload();
-        };
-
-        // 对意向订单拒绝
-        $scope.refuse = function (purchaseDetail) {
-            //为批量的拒绝留条路,ids 用-链接
-            Purchase.refusePurDetail({ids: purchaseDetail.id}, function () {
-                toaster.pop('success', '拒绝成功');
-                $scope.orderTableParams.page(1);
-                $scope.orderTableParams.reload();
-            }, function (response) {
-                toaster.pop('error', '拒绝失败  ' + response.text);
-            });
-        };
+            };
 
-        $scope.orderTake = function (purchaseDetail) {
-            //批量接单的入口
-            Purchase.orderTakeDetail({ids: purchaseDetail.id}, function () {
-                toaster.pop('success', '接单成功');
-                $scope.orderTableParams.page(1);
-                $scope.orderTableParams.reload();
-            }, function (response) {
-                toaster.pop('error', '接单失败  ' + response.text);
-            });
-        };
+            $scope.getOrderTotal = function (items) {
+                var sum = 0;
+                angular.forEach(items, function (item) {
+                    sum += item.qty * item.price;
+                });
+                return sum;
+            };
 
-        // 多选操作
-        $scope.checkOnePur = function (purchase) {
-            // 批量确认收款
-            if (purchase && purchase.id) {
-                if ($scope.checkedIds[purchase.id]) {
-                    delete $scope.checkedIds[purchase.id];
-                } else {
-                    $scope.checkedIds[purchase.id] = true;
-                }
-                var idArray = Object.getOwnPropertyNames($scope.checkedIds);
-                $scope.canEnsureRec = idArray.length > 0;
-            }
-        };
+            $scope.openDatePicker = function ($event, item, openParam) {
+                $event.preventDefault();
+                $event.stopPropagation();
+                item[openParam] = !item[openParam];
+            };
 
-        // TODO 弃用,【批量】确认收款
-        $scope.ensureReceived = function (id) {
-            var idArray = Object.getOwnPropertyNames($scope.checkedIds);
-            var ids = id || idArray.join('-');
-            Purchase.ensureReceivedMoney({ids: ids}, {}, function (data) {
-                if (data.data == 'success') {
-                    toaster.pop('success', '确认收款成功');
-                    // 初始化多选记录
-                    $scope.checkedIds = {};
-                    $scope.orderTableParams.reload();
+            $scope.openFilterDatePicker = function ($event, item, openParam) {
+                $event.preventDefault();
+                $event.stopPropagation();
+                item[openParam] = !item[openParam];
+                if ($scope.condition.dateFrom && $scope.condition.dateTo && !item[openParam]) {
+                    $scope.tableParams.reload();
                 }
-            });
-        };
-
-        /**
-         * 根据采购单号获取对应的退货单物流
-         */
-        var getReturnByPurchaseIds = function () {
-            var puids = [];
-            angular.forEach($scope.purchases, function (purchase) {
-                puids.push(purchase.purchaseid);
-            });
-            //puids = puids.slice(0, -1);
-            Return.getReturnByPurchaseIds({puids: puids}, function (data) {
-                $scope.returnInfo = data;
-            }, function (error) {
-                toaster.pop('error', '获取订单关联的退货单信息失败');
-            })
-        };
+            };
 
-        /**
-         * 获取异常消息状态
-         */
-        var getExMsgState = function () {
-            var applyIds = [], notifyIds = [];
-            angular.forEach($scope.purchases, function (purchase) {
-                if (purchase.launchPuExApplyId) {
-                    applyIds.push(purchase.launchPuExApplyId);
-                }
-                if (purchase.exApplyIdFromBuyer) {
-                    notifyIds.push(purchase.exApplyIdFromBuyer);
-                }
-            });
-        };
+            $scope.parseDate = function (dateStr) {
+                if (dateStr)
+                    return Date.parse(dateStr, 'yyyy-MM-dd');
+                return new Date();
+            };
 
-        //查看物流详情
-        $scope.listLogistics = function (lgtId) {
-            $modal.open({
-                animation: true,
-                templateUrl: 'static/view/usercenter/listLogistics.html',
-                controller: 'listLogisticsCtrl',
-                resolve: {
-                    lgtid: function () {
-                        return lgtId;
+            // 打开回复
+            $scope.openReply = function (order) {
+                if (!order.reply) {
+                    order.reply = {
+                        qty: order.qty - (order.replyQty ? order.replyQty : 0),
+                        delivery: order.delivery
                     }
                 }
-            }).result.then(function () {
-
-            }, function () {
-
-            });
-        };
-
-        // var getRecommendComps = function (userUU, usedFor, pageable) {
-        //     Recommendation.getRecommendComps({page: pageable.page, size: pageable.size}, function (data) {
-        //         $scope.recommendComps = data.content;
-        //     }, function (error) {
-        //         toaster.pop('error', '获取推荐器件失败', error);
-        //     })
-        // };
-        // getRecommendComps(null, null, {page: 0, size: 12});
-
-
-        // 根据输入单号搜索单据
-        $scope.onSearch = function () {
-            $scope.keyword = angular.uppercase($scope.keyword);
-            $scope.orderTableParams.page(1);
-            $scope.orderTableParams.reload();
-        };
+                order.$editing = true;
+            };
 
-        /**
-         * 下载当前页的订单信息
-         */
-        $scope.downPurchase = function () {
-            var listId = getDownLoadPurchaseId();
-            if (listId.length < 1) {
-                toaster.pop('warning', '当前需要下载的订单条数为0');
-                return;
-            }
-            Loading.show();
-            $scope.localInfo.ids = listId.join("-");
-            $scope.$apply();
-            var form = document.getElementById('down-load-purchase');
-            form.action = 'trade/purchase/down/ids';
-            form.submit();
-            var clockID = null;
-            var getDownLoadStatus = function () {
-                $.ajax({
-                    url: 'trade/purchase/down/ids',
-                    data: {isAjax: true, ids: $scope.localInfo.ids},
-                    method: 'GET',
-                    dataType: 'json',
-                    success: function (data) {
-                        if (data.loading) {
-                            clockID = setInterval(function () {
-                                getDownLoadStatus()
-                            }, 500);
-                        } else {
-                            $scope.$apply(function () {
-                                toaster.pop('info', '数据处理完毕,正在下载文件,请稍等。');
-                                Loading.hide();
-                            });
-                            if (!clockID) {
-                                clearInterval(clockID);
-                            }
-                        }
-                    },
-                    error: function () {
-                        Loading.hide();
-                        if (!clockID) {
-                            clearInterval(clockID);
-                        }
-                    }
-                });
+            // 关闭回复
+            $scope.closeReply = function (order) {
+                order.$editing = false;
             }
-            getDownLoadStatus();
-        }
 
-        /**
-         * 获取当前需要下载的订单信息的ID
-         */
-        var getDownLoadPurchaseId = function () {
-            var purchaseID = [];
-            angular.forEach($scope.purchases, function (pur) {
-                purchaseID.push(pur.id);
-            });
-            return purchaseID;
-        }
-
-        $scope.contactBuyer = function (purchase) {
-            purchase.active = !purchase.active;
-            var activeid = purchase.id;
-            angular.forEach($scope.purchases, function (data) {
-                if (data.id != activeid) {
-                    data.active = false;
-                }
-            });
-        }
-
-        /******************根据页数设置翻页的信息********start**************************/
-
-        //输入框监听Enter事件
-        $scope.listenEnter = function () {
-            if (event.keyCode == 13) {
-                $scope.setPage("page", $scope.param.currentPage);
-            }
-        };
+            // 搜索框回车
+            $scope.onSearch = function () {
+                $scope.tableParams.page(1);
+                $scope.tableParams.reload();
+            };
 
-        $scope.setPage = function (type, number) {
-            if (type != 'prev' && type != 'page' && type != 'next' && type != 'last' && type != 'first') {
-                return;
-            }
-            ;
-            var page = -1;
-            switch (type) {
-                case "page":
-                    if (number < 1) {
-                        page = 1;
-                    } else if (number > $scope.AllOrderInfo.totalPages) {
-                        page = $scope.AllOrderInfo.totalPages;
-                    } else {
-                        page = number;
-                    }
-                    ;
-                    break;
-                case "prev":
-                    if ($scope.param.page <= 1) {
-                        page = 1;
-                    } else {
-                        page = $scope.param.page - 1;
+            // 选择查找日期
+            $scope.onDateCondition = function () {
+                $scope.tableParams.page(1);
+                $scope.tableParams.reload();
+            };
+            // 点击回复
+            $scope.onReplyClick = function (order, inverse) {
+                if (order.reply) {
+                    if (!order.reply.qty || order.reply.qty < 0 || order.reply.qty > order.qty) {
+                        toaster.pop('warning', '提示', '请填写有效的回复数量!');
+                        return;
                     }
-                    ;
-                    break;
-                case "next":
-                    if ($scope.param.page >= $scope.AllOrderInfo.totalPages) {
-                        page = $scope.AllOrderInfo.totalPages
+                    var reply = angular.copy(order.reply);
+                    if (reply.delivery) {
+                        if (typeof reply.delivery == 'object')
+                            reply.delivery = reply.delivery.getTime();
                     } else {
-                        page = $scope.param.page + 1;
-                    }
-                    break;
-                case "first":
-                    page = 1;
-                    break;
-                case "last":
-                    page = $scope.AllOrderInfo.totalPages;
-                    break;
-            }
-            if (page == $scope.param.page || page < 1 || page > $scope.AllOrderInfo.totalPages) {
-                $scope.param.currentPage = $scope.param.page;
-                return;
-            }
-            $scope.param.page = page;
-            $scope.orderTableParams.reload();
-        };
-
-        //取消订单状态码
-        $scope.cancelOrderArray = {
-            602: true,
-            603: true,
-            315: true,
-            604: true,
-            605: true,
-            606: true
-        };
-
-        //当前页在前段的计算方式
-        $scope.frontSegment = function (currentPage, totalElementPages) {
-            angular.forEach($scope.pages, function (page) {
-                switch (page.number) {
-                    case 8:
-                        page.type = 'more';
-                        page.active = false;
-                        break;
-                    case 0:
-                        if (currentPage == 1) {
-                            page.active = false;
-                        }
-                    default : {
-                        page.current = (currentPage == page.number);
+                        reply.delivery = order.delivery;
                     }
+                    if (inverse && inverse == -1) reply.qty = -1 * reply.qty;// 取相反
+                    $scope.loading = true;
+                    MakeOrder.reply({orderId: order.id}, reply, function () {
+                        $scope.loading = false;
+                        toaster.pop('info', '提示', (inverse == -1 ? '撤销成功' : '回复成功'));
+                        $scope.tableParams.reload();
+                    }, function (response) {
+                        $scope.loading = false;
+                        toaster.pop('error', '回复失败', response.data);
+                    });
                 }
-            });
-        };
-
-        document.onclick = function (event) {
-            var element = event.srcElement;
-            if(!element) {
-                return ;
-            }
-            var elementName =  element.getAttribute("name");
-            $scope.$apply(function () {
-                for(var i = 0; i < $scope.purchases.length; i++) {
-                    var isThisTag = false;
-                    if(elementName && $scope.purchases[i].id == elementName) {
-                        isThisTag = true;
-                    }
-                    if(!isThisTag) {
-                        var parentElement = element.parentElement;
-                        while (parentElement && parentElement.tagName && parentElement.tagName != 'BODY') {
-                            var parentElementName =  parentElement.getAttribute("name");
-                            if(parentElementName && $scope.purchases[i].id == parentElementName) {
-                                isThisTag = true;
-                            }
-                            parentElement = parentElement.parentElement;
-                        }
-                    }
-                    if(!isThisTag) {
-                        $scope.purchases[i].active = false;
-                    }
-                };
-            });
-        };
-
-        // var clickClose = function () {
-        //     var myDiv = document.getElementById("linkBuyer");
-        //     document.onclick = function () {
-        //         angular.forEach($scope.purchases, function(data){
-        //             data.active = false;
-        //             console.log(data.active);
-        //         });
-        //     };
-        //     myDiv.onclick = function(event) {
-        //         event = event || window.event;
-        //         event.stopPropagation();
-        //     };
-        // };
+            };
 
+            //委外加工单
+            $scope.print = function (order) {
+                MakeOrder.printCount({id: order.id}, {});//增加打印此次
+                ReportService.print(order.enUU, 'MAKE', 'where make$orders.ma_id=' + order.id);
 
-        //当前页在后端计算方式
-        $scope.endSegment = function (currentPage, totalElementPages) {
-            angular.forEach($scope.pages, function (page) {
-                switch (page.number) {
-                    case 2:
-                        page.active = false;
-                        page.type = 'more';
-                        break;
-                    case 10:
-                        if (currentPage == totalElementPages) {
-                            page.active = false;
-                        }
-                        break;
-                    case 0:
-                    case 1:
-                        break;
-                    default:
-                        if (page.number != totalElementPages) {
-                            page.number = totalElementPages - 9 + page.number;
-                        }
-                        page.current = (currentPage == page.number);
-                        break;
-                }
-            });
-        };
-
-        //当前页在中间计算方式
-        $scope.middleSegment = function (currentPage) {
-            angular.forEach($scope.pages, function (page) {
-                switch (page.number) {
-                    case 2:
-                    case 8:
-                        page.type = 'more';
-                        page.active = false;
-                        break;
-                    case 3:
-                        page.number = currentPage - 2;
-                        break;
-                    case 4:
-                        page.number = currentPage - 1;
-                        break;
-                    case 5:
-                        page.number = currentPage;
-                        page.current = true;
-                        break;
-                    case 6:
-                        page.number = currentPage + 1;
-                        break;
-                    case 7:
-                        page.number = currentPage + 2;
-                        break;
-                }
-            });
-        }
+            };
 
-        //初始化页数信息
-        $scope.initPages = function (totalElementPages) {
-            var pageNum = [];
-            if (totalElementPages == 1) {
-                return;
-            } else if (totalElementPages < 10) {
-                for (var i = 0; i < totalElementPages + 2; i++) {
-                    pageNum.push(i);
-                }
-            } else {
-                pageNum = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
-            }
-            angular.forEach(pageNum, function (number) {
-                var page = {active: true, type: 'page', number: number};
-                if (number == 0) {
-                    page.type = 'prev';
-                } else if (number == 1) {
-                    page.type = 'first';
-                } else if (number == pageNum.length - 2) {
-                    page.type = 'last';
-                    page.number = totalElementPages;
-                } else if (number == pageNum.length - 1) {
-                    page.type = 'next';
+            // 获取回复记录
+            $scope.getReply = function (order) {
+                if (!order.replies) {
+                    MakeOrder.getReply({orderId: order.id}, function (replies) {
+                        order.replies = replies;
+                    });
                 }
-                $scope.pages.push(page);
-            });
-        }
+            };
 
-        //计算页数的方式。
-        $scope.acculatePages = function (currentPage, totalElementPages) {
-            $scope.pages = [];
-            if (totalElementPages < 1) {
-                return;
-            }
-            //初始化页面数据
-            $scope.initPages(totalElementPages);
-            if (totalElementPages < 10) {
-                angular.forEach($scope.pages, function (page) {
-                    if (page.number == currentPage) {
-                        page.current = true;
+            // 导出
+            $scope.exportXls = function () {
+                MakeOrder.exportXls({}, {}, function (data) {
+                    if (data.success){
+                        window.location.href = 'make/orders/xls?_state='+$scope.active+'&searchFilter='+encodeURIComponent(angular.toJson($scope.searchFilterXls));
                     }
-                });
-            } else if (currentPage < 6) {//当期页小于6
-                $scope.frontSegment(currentPage, totalElementPages);
-            } else if (currentPage > totalElementPages - 5) { //当期页在后面
-                $scope.endSegment(currentPage, totalElementPages);
-            } else { //当期页在中间
-                $scope.middleSegment(currentPage);
-            }
-        };
-        /******************根据页数设置翻页的信息********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;
-                Rate.getRateBuyer({orderId: $scope.rateContent.orderid},{},function (data) {
-                    $scope.rateBuyer = data.data;
-                });
-            },function (error) {
-                toaster.pop('error', '获取模板信息失败');
-            });
-            $scope.setShowRateBoxFlag(true);
-        }
-
-        //控制评论模态框的显示隐藏
-        $scope.showRateBoxFlag = false;
-
-        $scope.setShowRateBoxFlag = function (flag) {
-            $scope.showRateBoxFlag = flag;
-            if (!flag){
-                $scope.boxStatus = 2;
-                $scope.rateContent.level = 1;
-                $scope.modalTempData.rateContent = '';
-                $scope.modalTempData.modalTitle = '';
-            }
-        }
-
-        //评价类型:追评addRate/初次评价firstRate,默认初评
-        $scope.rateType = 'firstRate';
-
-        $scope.setRateType = function (type) {
-            $scope.rateType = type;
-        }
-
-
-        $scope.listenRateContent = function () {
-            var str = $scope.modalTempData.rateContent
-            if (str.length > 200) {
-                var el = angular.element('#rateContent');
-                el.blur();
-                $scope.modalTempData.rateContent = str.substring(0, 200);
-                el.focus();
-            }
-        }
-
-        /***
-         * 评价模态框状态,默认为1
-         * 1:使用模板
-         * 2:不使用模板
-         * 3:新增模板
-         * 4:修改模板
-         * ***/
-        $scope.boxStatus = 2;
-
-
-        $scope.returnStep1 = function () {
-            $scope.setBoxStatus(1);
-            $scope.modalTempData.rateContent = $scope.rateContentTemp;
-            $scope.modalTempData.modalTitle  = $scope.modalTitleTemp;
-        }
-
-        $scope.setBoxStatus = function (boxStatus) {
-            if (boxStatus == 3 || boxStatus == 4){
-                $scope.rateContentTemp = angular.copy($scope.modalTempData.rateContent);
-                $scope.modalTitleTemp = angular.copy($scope.modalTempData.modalTitle);
-            }
-            $scope.boxStatus = boxStatus;
-        }
-
-        $scope.setGo = function(){
-            if ( $scope.boxStatus == 1 ){
-                $scope.modalTempData.rateContent = '';
-                $scope.modalTempData.modalTitle = '';
-            }
-            $scope.setBoxStatus($scope.boxStatus == 1?2:1);
-        }
-
-        //控制模板列表显示
-        $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.modalTempData = {};
-        }
-
-        //选择模板
-        $scope.chooseModal = function (modal) {
-            $scope.modalTempData.rateContent = modal.rateTemplateContent;
-            $scope.modalTempData.modalTitle = modal.rateTemplateName;
-            $scope.currentModal = modal;
-            $scope.showModalListFlag = false;
-        }
-
-        $scope.listenModalTitle = function () {
-            if ($scope.modalTempData.modalTitle.length > 10) {
-                $scope.modalTempData.modalTitle = $scope.modalTempData.modalTitle.substring(0, 10);
-            }
-        }
-
-        //保存模板
-        $scope.modalTempData = {};
-        $scope.saveModal = function () {
-            if(!$scope.modalTempData.modalTitle || $scope.modalTempData.modalTitle ==''){
-                toaster.pop('error', '您还没有填写模版名称');
-                return;
-            }
-            if(!$scope.modalTempData.rateContent || $scope.modalTempData.rateContent ==''){
-                toaster.pop('error', '您还没有填写模版内容');
-                return;
-            }
-            //storeuuid: $scope.rateContent.storeid
-            if ($scope.boxStatus == 4) {
-                $scope.currentModal.rateTemplateContent = $scope.modalTempData.rateContent;
-                $scope.currentModal.rateTemplateName = $scope.modalTempData.modalTitle;
-                Rate.saveRateTemplate({storeuuid: $scope.rateContent.storeid},$scope.currentModal, function (data) {
-                    toaster.pop('success', '保存成功');
-                    $scope.boxStatus = 1;
-                }, function (error) {
-                    toaster.pop('error', '保存失败');
-                })
-            } else if ($scope.boxStatus == 3) {
-                Rate.saveRateTemplate({storeuuid: $scope.rateContent.storeid},{rateTemplateName: $scope.modalTempData.modalTitle, rateTemplateContent: $scope.modalTempData.rateContent}, function (data) {
-                    toaster.pop('success', '保存成功');
-                    $scope.currentModal = data.data;
-                    Rate.getRateTemplate({storeuuid: $scope.rateContent.storeid},{},function (data) {
-                        $scope.modalData = data.data;
-                        Rate.getRateBuyer({orderId: $scope.rateContent.orderid},{},function (data) {
-                            $scope.rateBuyer = data.data;
-                        });
-                        $scope.boxStatus = 1;
-                    },function (error) {
-                        toaster.pop('error', '获取模板信息失败');
-                    });
-                    $scope.boxStatus = 1;
-                }, 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', '评价成功');
-                    $scope.setShowRateBoxFlag(false);
-                    $scope.orderTableParams.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', '评价成功');
-                    $scope.setShowRateBoxFlag(false);
-                    $scope.orderTableParams.reload();
-                },function (error) {
-                    toaster.pop('error', '评价失败');
+                }, function (response) {
+                    toaster.pop('error', '数据加载失败', response.data);
                 });
             }
-        }
-
-
-        /***********卖家评论模块 *** end *****************************/
-
-    }]);
-
-    app.register.filter('VendorStatusFilter', function () {
-        return function (status) {
-            var result = "暂无该状态";
-            switch (status) {
-                case 501:
-                    result = '待买家付款';
-                    break;
-                case 524:
-                    result = '待买家付款';
-                    break;
-                case 525:
-                    result = '卖家发起取消,待确认';
-                    break;
-                case 504:
-                    result = '付款确认中';
-                    break;
-                case 502:
-                case 406:
-                    result = '买家已付款';
-                    break;
-                case 404:
-                    result = '待买家收货';
-                    break;
-                case 405:
-                case 514:
-                case 503:
-                case 506:
-                    result = '待商城付款';
-                    break;
-                case 602:
-                case 603:
-                case 315:
-                case 604:
-                case 605:
-                case 606:
-                    result = '已取消';
-                    break;
-                case 520:
-                    result = '交易完成';
-                    break;
-                case 522:
-                    result = '已完成评价';
-                    break;
-            }
-            return result;
-        }
-
-
-    });
-    /**
-     * 与现在的时间对比,距离多少天多少小时
-     */
-    app.register.filter('restTime', function () {
-        var day = 0, hours = 0;
-        return function (time) {
-            if(!time) {
-                return null;
-            }
-            var nowTime = new Date();
-            var s1 = time - nowTime.getTime();
-            var totalHours = s1/(1000*60*60);//算多少个小时
-            day = parseInt(totalHours) / 24;
-            hours = parseInt(totalHours) % 24;
-            return "还剩 " + parseInt(day) + "天" + parseInt(hours) + "小时";
-        }
-    });
-    app.register.controller('cancelControler', ['$scope','purchaseid', 'Purchase', '$modalInstance', 'toaster', '$window', function ($scope, purchaseid, Purchase, $modalInstance, toaster, $window) {
-        $scope.reloadRoute = function () {
-            $window.location.reload();
-        };
-        $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();
-                // $scope.reloadRoute();
-            }, function (res) {
-                console.log(res);
-                toaster.pop('error','取消订单失败,请重新操作');
-            });
-        }
-
-        /**
-         * 取消操作
-         */
-        $scope.cancel = function () {
-            $modalInstance.dismiss();
-        }
-
-    }]);
-    app.register.controller('homeModalCtrl', ['$rootScope', '$scope',  '$modalInstance', 'toaster', '$http', 'ShippingAddress','$state', function($rootScope, $scope, $modalInstance, toaster, $http, ShippingAddress,$state){
-        $rootScope.$on('$stateChangeStart',
-            function(event, toState, toParams, fromState, fromParams){
-                $modalInstance.dismiss();
-            })
-        $scope.goLink = function(op) {
-            $state.go('vendor_account_management',{op:op});
-            $modalInstance.dismiss('cancel');
-        }
-
-        $scope.cancel = function () {
-            $modalInstance.dismiss('cancel');
-        }
-    }]);
+        }]);
 });

+ 1 - 1
src/main/webapp/resources/js/vendor/controllers/b2b/saleOrderCtrl.js

@@ -119,7 +119,7 @@ define(['app/app'], function (app) {
                          param._state = $scope.active;
                         $http({
                             method: 'get',
-                            dataType: 'jsonP',
+                            dataType: 'json',
                             url: b2bUrl + "/sale/orders/info/nosearch",
                             params: param
                         }).success(function (data) {

+ 235 - 626
src/main/webapp/resources/view/vendor/b2b/sale_maketodo.html

@@ -1272,658 +1272,267 @@
 				<li ng-class="{'active': status=='inbound'}" ng-click="setActive('inbound')"><a>已结案(<em ng-class="{'color-black': !counts['inbound']}" ng-bind="counts['inbound'] || 0"></em>)</a></li>
 			</ul>
 		</div>
-		<!--<div class="screen">-->
-		<!--<div class="screen_time fl">-->
-		<!--<span>下单时间</span>-->
-		<!--<input type="text" value="2016-05-01" class="timeStart" ng-model="startDateStr">-->
-		<!-- - -->
-		<!--<input type="text" value="2016-05-31" class="timeEnd" ng-model="endDateStr">-->
-		<!--<a class="time_btn" ng-click="chooseInternal()">筛选</a>-->
-		<!--</div>-->
-		<!--<div class="sreach fr">-->
-		<!--&lt;!&ndash;<input type="text" placeholder="请输入订单信息">-->
-		<!--<a class="seek" href="###">搜索订单</a>&ndash;&gt;-->
-		<!--<input type="search" ng-model="keyword" ng-search="onSearch()" ng-change="upper()"-->
-		<!--placeholder="请输入订单信息">-->
-		<!--<a ng-click="onSearch()" class="seek">搜索</a>-->
-		<!--</div>-->
-		<!--</div>-->
-		<!--搜索时间筛选-->
 		<p class="height16">&nbsp;</p>
-		<div class="screen">
+		<!--搜索时间筛选-->
+		<div class="screen check-filter">
+			<div class="radio-block date-radio">
+				时间筛选:
+				<label class="com-check-radio">
+					<input type="radio" id="oneMonth" name="date" ng-click="autoMonth = false;changeDateZone(1);condition.$open=false" checked>
+					<label for="oneMonth"></label>
+					30天
+				</label>
+				<label class="com-check-radio">
+					<input type="radio" id="threeMonth" name="date" ng-click="autoMonth = false;changeDateZone(3);condition.$open=false">
+					<label for="threeMonth"></label>
+					90天
+				</label>
+				<label class="com-check-radio">
+					<input type="radio" id="sixMonth" name="date" ng-click="autoMonth = false;changeDateZone(6);condition.$open=false">
+					<label for="sixMonth"></label>
+					180天
+				</label>
+				<label class="com-check-radio">
+					<input type="radio" id="autoMonth" name="date" ng-click="autoMonth = true;condition.$open=!condition.$open;changeDateZone(-1)">
+					<label for="autoMonth"></label>
+					自定义
+				</label>
+			</div>
 			<div class="sreach fr">
-				<div class="date fl">
+				<div ng-show="autoMonth" class="date fl">
 					<div class="data-input">
-						<input type="text" ng-model="startDate"
-						   class="form-control select-adder" placeholder="起始时间"
-						   datepicker-popup="yyyy-MM-dd HH:mm:ss"
-						   is-open="condition.startDateOpen"
-						   max-date="endDate" current-text="今天" clear-text="清除" close-text="关闭"
-                               ng-click="openDatePicker($event, condition, 'startDateOpen',1)"
-						   datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
-							   ng-change="vaildDate(true)"
+						<input type="text" ng-model="condition.dateFrom"
+							   class="form-control select-adder" placeholder="起始时间"
+							   datepicker-popup="yyyy-MM-dd"
+							   is-open="condition.$fromOpened"
+							   max-date="condition.dateTo" current-text="今天" clear-text="清除" close-text="关闭"
+							   ng-click="openFilterDatePicker($event, condition, '$fromOpened')"
+							   ng-focus="openFilterDatePicker($event, condition, '$fromOpened')"
+							   datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
 						/>
-						<button class="open" ng-click="openDatePicker($event, condition, 'startDateOpen')"></button>
+						<button class="open" ng-click="openFilterDatePicker($event, condition, '$fromOpened')"></button>
 					</div>
 
 					<em>–</em>
 					<div class="data-input">
-						<input type="text" ng-model="endDate"
-						   class="form-control select-adder" placeholder="结束时间"
-						   datepicker-popup="yyyy-MM-dd HH:mm:ss"
-						   is-open="condition.endDateOpen"
-						   min-date="startDate" current-text="今天" clear-text="清除" close-text="关闭"
-                               ng-click="openDatePicker($event, condition, 'endDateOpen',2)"
-						   datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
-                               ng-change="changeEndDate()"
+						<input type="text" ng-model="condition.dateTo"
+							   class="form-control select-adder" placeholder="结束时间"
+							   datepicker-popup="yyyy-MM-dd"
+							   is-open="condition.$toOpened"
+							   min-date="condition.dateFrom" current-text="今天" clear-text="清除" close-text="关闭"
+							   ng-click="openFilterDatePicker($event, condition, '$toOpened')"
+							   ng-focus="openFilterDatePicker($event, condition, '$toOpened')"
+							   datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
 						/>
-						<button class="open" ng-click="openDatePicker($event, condition, 'endDateOpen')"></button>
+						<button class="open" ng-click="openFilterDatePicker($event, condition, '$toOpened')"></button>
 					</div>
 				</div>
 				<div class="sreach-input fr">
-					<input type="search" placeholder="订单号/产品信息/买家名称" class="form-control" ng-model="keyword" ng-search="search()"/>
-					<a class="seek" href="javascript:void(0)" ng-click="search()">搜索</a>
-					<a class="seek" href="javascript:void(0)" style="margin-left: 5px;display: none;">导出订单</a>
+					<input type="search" placeholder="单据编号/客户名称/物料名称" class="form-control" ng-model="keyword" ng-search="onSearch()"/>
+					<a class="seek" href="javascript:void(0)" ng-click="onSearch()">搜索</a>
 				</div>
 			</div>
 		</div>
 		<p class="height16">&nbsp;</p>
-		<div class="oder_list" style="margin-top: 0px;">
-			<!--所有订单-->
-			<dl style="display: inline-block;" class="all_oder">
-				<dt>
-					<span class="wid01">&nbsp;</span>
-					<span class="text-left wid02">产品信息</span>
-					<span style="text-align: left;">单价</span>
-					<span class="filter-i">购买数量
-						<i ng-class="{'active':sortingState.state == 'orderBybatchQtyAsc'}" class="fa fa-long-arrow-up" ng-click="orderBybatchQtyAsc()"></i>
-						<i ng-class="{'active':sortingState.state == 'orderBybatchQtyDesc'}" class="fa fa-long-arrow-down" ng-click="orderBybatchQtyDesc()"></i>
-						<!--<em class="sx">
-							<div ng-class="{'active':sortingState.state == 'orderBybatchQtyAsc'}" class="up" ng-click="orderBybatchQtyAsc()"></div>
-							<div ng-class="{'active':sortingState.state == 'orderBybatchQtyDesc'}" class="desc" ng-click="orderBybatchQtyDesc()"></div>
-						</em>-->
-					</span>
-					<span  class="filter-i">实际支付
-						<i ng-class="{'active':sortingState.state == 'orderByensurePriceAsc'}" class="fa fa-long-arrow-up" ng-click="orderByensurePriceAsc()"></i>
-						<i ng-class="{'active':sortingState.state == 'orderByensurePriceDesc'}" class="fa fa-long-arrow-down" ng-click="orderByensurePriceDesc()"></i>
-						<!--<em class="sx">
-							<div ng-class="{'active':sortingState.state == 'orderByensurePriceAsc'}" class="up" ng-click="orderByensurePriceAsc()"></div>
-							<div ng-class="{'active':sortingState.state == 'orderByensurePriceDesc'}" class="desc" ng-click="orderByensurePriceDesc()"></div>
-						</em>-->
-					</span>
-					<!--<span>物流</span>-->
-					<span class="filter">
-						<a class="filter-a" >{{childStatusName}}<i class="fa fa-angle-down fa-angle-up"></i></a>
-						<div class="hover-show">
-							<a ng-click="setChildStatus('','订单状态')">订单状态</a>
-							<a ng-if="status == 'tobeconfirmed' || status == 'all'" ng-click="setChildStatus('501','待买家付款')" title="">待买家付款</a>
-							<a ng-if="status == 'tobeconfirmed' || status == 'all'" ng-click="setChildStatus('504','付款确认中')" title="">付款确认中</a>
-							<a ng-if=" status == 'comfirmed' || status == 'all'" ng-click="setChildStatus('502-406','待发货')" title="">待发货</a>
-							<a ng-if="status == 'inbound' || status == 'all' || status == 'toBeReviewed'" ng-click="setChildStatus('404','待买家收货')" title="">待买家收货</a>
-							<a ng-if="status == 'tobepaid' || status == 'all' || status == 'toBeReviewed'" ng-click="setChildStatus('514','待商城付款')" title="">待商城付款</a>
-							<a ng-if="status == 'completed' || status == 'tobepaid' || status == 'all'" ng-click="setChildStatus('520','交易完成')" title="">交易完成</a>
-							<a ng-if="status == 'completed' || status == 'all'" ng-click="setChildStatus('606','交易关闭')" title="">交易关闭</a>
-							<a ng-if=" status == 'all'" ng-click="setChildStatus('602-603-315-604-605-606','已取消')" title=""> 已取消</a>
-							<a ng-if="status == 'inbound' || status == 'all' || status == 'tobepaid'" ng-click="setChildStatus('404-503-520','售后中')" title="">售后中</a>
-						</div>
+		<!--客户委外单-->
+		<table class="order-table block" ng-table="tableParams">
+			<thead>
+			<tr class="header">
+				<th>产品</th>
+				<th width="100">单价</th>
+				<th width="100">数量</th>
+				<th width="100">交货日期</th>
+				<th width="180">单据状态</th>
+				<th width="100">操作</th>
+			</tr>
+			<tr class="sep-row">
+				<td colspan="6"></td>
+			</tr>
+			</thead>
+			<tbody ng-repeat="order in $data track by order.id">
+			<tr class="order-hd" ng-dbclick="order.$collapsed=!order.$collapsed" ng-class="{'text-bold': order.display>0}">
+				<td class="first" colspan="4">
+					<div class="order-main">
+						<a href="javascript:void(0)" ng-if="!isUnread(order.id)">
+							<i class="fa fa-circle-thin"></i>
+						</a>
+						<a href="javascript:void(0)" ng-if="isUnread(order.id)">
+							<i class="fa fa-circle" style="color: #f40;"></i>
+						</a>&nbsp;&nbsp;
+						<span class="text-num text-bold" ng-bind="::order.date | date:'yyyy-MM-dd'"></span>
+						<span ng-bind="::order.enterprise.enName"></span>
+						<span>订单号:
+					  <a class="text-num order-detail" ng-bind="::order.code" ui-sref="sale.makeorder_detail({id:order.id})" target="_self"
+						 ng-click="setOrdersRead(order.id)" title="查看详情"></a></span>
+					</div>
+				</td>
+				<td colspan="1" class="order-sum">{{::(isUser?'':order.currency+':')}} <span
+						ng-bind="::(isUser?'-':(order.qty * order.price| number : 2))"
+						class="text-num text-bold"></span>
+				<td colspan="1" class="text-center">
+					<span ng-if="order.print" class="label ng-scope operates-status" style="margin-right: 5px;background-color: #5D6C79">已打印</span>
+					<span ng-if="!order.print" class="label ng-scope operates-status" style="margin-right: 5px;background-color: #CA3955">未打印</span>
+					<div class="operates">
+						<a ng-click="print(order)" title="打印{{order.print? '(已打印)':'(未打印)'}}" ng-class="{'unPrinted' : !order.print, 'text-muted': order.print}"><i
+								class="fa fa-print fa-lg"></i></a><a
+							ng-click="order.$collapsed=!order.$collapsed" class="text-muted"
+							title="收拢"><i class="fa fa-toggle-down fa-lg"></i></a>
+					</div>
+				</td>
+			</tr>
+			<tr class="order-bd" ng-if="!order.$collapsed">
+				<td class="product">
+					<div class="text-num text-bold" title="物料编号">
+						<span ng-bind="::order.product.code"></span>
+					</div>
+					<div title="物料名称">
+						<span ng-bind="::order.product.title"></span>
+					</div>
+					<div class="text-muted" title="物料规格"
+						 ng-bind="::order.product.spec"></div>
+					<div>
+						计划加工日期:<span class="text-num" ng-bind="::order.commence | date:'yyyy-MM-dd'"></span>
+						<i class="fa fa-arrows-h text-muted"></i>
+						<span class="text-num" ng-bind="::order.complete | date:'yyyy-MM-dd'"></span>
+					</div>
+					<div ng-if="::order.remark" class="text-muted">
+						备注:<span ng-bind="::order.remark"></span>
+					</div>
+					<div class="text-bold text-inverse" ng-if="order.factory">送货工厂:<span ng-bind="::order.factory"></span></div>
+					<div class="text-bold">平台录入日期 <span ng-bind="::order.erpDate | date:'yyyy-MM-dd'"></span></div>
+				</td>
+				<td>
+					<div class="text-num" ng-bind="::(isUser?'':(order.price | number:6))"></div>
+					<div class="text-muted">税率:{{::order.taxrate || 0}}%</div>
+				</td>
+				<td class="text-center">
+					<div class="text-num" ng-bind="::order.qty"></div>
+					<div class="text-muted" ng-bind="::order.product.unit"></div>
+					<div style="margin: 0 auto" ng-if="order.$editing">
+						<input type="number" ng-model="order.reply.qty" min="0" max="{{item.qty}}"
+							   class="form-control input-xs" placeholder="0~{{order.qty-(order.replyQty ? order.replyQty : 0)}}">
+					</div>
+				</td>
+				<td class="text-center br-l">
+					<!-- <div class="text-num" ng-bind="::order.commence | date:'yyyy-MM-dd'"></div>
+                    <div>-</div>
+                    <div class="text-num" ng-bind="::order.complete | date:'yyyy-MM-dd'"></div> -->
+					<div class="text-num" ng-bind="::order.delivery | date: 'yyyy-MM-dd'"></div>
+					<br>
+					<div style="margin: 0 auto"
+						 class="input-group input-group-xs input-trigger"
+						 ng-if="order.$editing">
+						<input type="text" ng-model="order.reply.delivery"
+							   class="form-control" placeholder="回复交期"
+							   datepicker-popup="yyyy-MM-dd" is-open="order.$opened"
+							   min-date="nowdate" ng-required="true" current-text="今天"
+							   clear-text="清除" close-text="关闭"
+							   datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
+							   ng-focus="openDatePicker($event, order, '$opened')"> <span
+							class="input-group-btn">
+						<button type="button" class="btn btn-default"
+								ng-click="openDatePicker($event, order, '$opened')">
+							<i class="fa fa-calendar"></i>
+						</button>
 					</span>
-					<span>交易操作</span>
-				</dt>
-				<p class="height16">&nbsp</p>
-				<!--点击发货-->
-				<div class="purchase border-bt-16" ng-repeat="purchase in purchases">
-					<dd class="line01">
-                        <span class="wid01">
-                            <!--<input type="checkbox" id="checkon02" name="checkbox"/><label for="checkon02"></label>-->
-                        </span>
-						<span style="    width: 16%;text-align: left;">日期:{{purchase.createtime | date: 'yyyy-MM-dd'}}</span>
-						<span style="width: 25%;text-align: left;">订单号:<a class="hover-col" href="vendor#/purchase/detail/{{purchase.purchaseid | EncryptionFilter}}" target="_blank"><em ng-bind="purchase.orderid"></em></a></span>
-						<span style="width: 30%; text-align: center;">
-                            <img src="static/img/user/images/shop_home.png">
-							<a ng-if="purchase.buyentername" ng-bind="purchase.buyentername" href="store/{{::purchase.storeid}}"></a>
-							<i ng-if="!purchase.buyentername" ng-bind="purchase.buyername"></i>&nbsp;&nbsp;
-                        </span>
-						<span style="position: relative;">
-                            <img src="static/img/common/songguo.png">
-							<div style="display: inline-block" ng-controller="ChatContactCtrl as chat">
-                            	<a name="{{purchase.id}}" href="javascript:void(0)" class="contact_btn" ng-click="chat.contactWithOther(!purchase.buyerenuu ? purchase.buyPhone : null, purchase.buyerenuu, chat.UserType.ENTERPRISE)">联系买家</a>
-								<div class="com-mall-del-box link-saler-box" ng-if="showLinkBox">
-									<div class="title">
-									  <i ng-click="setShowLinkBox(false)"></i>
-									</div>
-									<div class="content">
-									  <p><i class="fa fa-exclamation-circle"></i>抱歉,暂时无法与买家在线沟通!</p>
-									  <p>买家联系电话:<span ng-bind="phone"></span></p>
-									  <div>
-										<a ng-click="setShowLinkBox(false)">我知道了</a>
-									  </div>
-									</div>
-								  </div>
-							</div>
-							<!--<a name="{{purchase.id}}" href="javascript:void(0)" class="contact_btn" ng-click="contactBuyer(purchase)">联系买家</a>
-                             <div name="{{purchase.id}}" class="buyer-contact" ng-if="purchase.active" ng-class="{true : 'buyer-contact-info', false : 'display-none'}[purchase.active]">
-                                 <div class="contact-title">
-                                     <a ng-click="purchase.active=false"><i class="fa fa-close fa-lg" aria-hidden="true"></i></a>
-                                 </div>
-                                 <div class="contact-buyer-info">
-                                     <div class="company-name" ng-bind="::purchase.buyername || '买家姓名没获取到'"></div>
-                                     <div>
-                                         <em>手机:<em ng-bind="::purchase.buyPhone || '暂无联系电话'"></em></em>
-                                         <em style="margin-left: 60px;">邮箱:<em ng-bind="::purchase.buyEmail || '暂无电子邮箱'"></em></em>
-                                     </div>
-                                 </div>
-                                 <div style="display: none;">
-                                     <textarea class="send-message" placeholder="给买家发送站内消息"></textarea>
-                                 </div>
-                                 <div style="display: none;" class="send-button"><a class="send">发送</a></div>
-                            </div>-->
-                        </span>
-						<span class="print-icon" style="width: 8%;">
-							<a title="打印订单"><i class="fa fa-print fa-lg"></i></a>
-							<div class="print-list">
-								<a ng-click="print(purchase, 'PURCHASE')" title="打印销售单" style="position: relative"><i class="fa fa-print fa-lg"></i>打印销售单</a>
-								<a ng-click="print(purchase, 'SALESEND_ADMIN')" title="打印出货单"><i class="fa fa-print fa-lg"></i>打印出货单</a>
-							</div>
-						</span>
-						<span class="trash" ng-if="cancelOrderArray[purchase.status]" ng-click="showDeletePurchase(purchase)"><i class="fa fa-trash"></i></span>
-						<div class="com-del-box" ng-if="purchase.showDelete">
-							<div class="title">
-								<a ng-click="purchase.showDelete=false"><i class="fa fa-close fa-lg"></i></a>
-							</div>
-							<div class="content">
-								<p><i class="fa fa-exclamation-circle"></i>是否删除此订单</p>
-								<div><a ng-click="purchase.showDelete=false">取消</a><a ng-click="deletePurchase(purchase)">确认</a></div>
+					</div>
+				</td>
+				<td class="br-l">
+					<div ng-if="!order.$editing">
+						<div ng-if="!order.replyQty" class="text-muted text-center">未回复</div>
+						<div ng-if="order.replyQty > 0 && order.replyQty < order.qty">
+							<div class="progress progress-sm">
+								<div class="progress-bar progress-bar-success"
+									 ng-style="{'width': 100*order.replyQty/order.qty + '%'}">
+									<span class="sr-only"></span>
+								</div>
 							</div>
+							已回复 <span class="text-default">{{::order.replyQty}}</span> /
+							<span>{{::order.qty}}</span>
 						</div>
-					</dd>
-					<dd class="line02" ng-class="{'dot_border' : $index !== (purchase.purchaseDetails.length -1)}" ng-repeat="detail in purchase.purchaseDetails | limitTo : 3">
-						<span class="wid01">&nbsp;</span>
-						<span class="wid02">
-                            <div class="pro_xq">
-                               <a href="store/productDetail/{{::detail.batchCode}}" target="_blank"><img ng-src="{{detail.img || 'static/img/store/common/default.png'}}" width="55" height="55"/></a>
-                                <p class="componet-info">
-																		品牌:<a href="product/brand/{{::detail.branduuid}}/" target="_blank" ng-if="detail.uuid"><em ng-bind="detail.brName || '-'" title="{{::detail.brName}}"></em></a>
-                                    <a ng-if="!detail.uuid" class="unstand"><em ng-bind="detail.brName || '-'" title="{{::detail.brName}}"></em></a><br/>
-                                    物料名称:<a href="product/kind/{{::detail.kindUuid}}" target="_blank" ng-if="detail.uuid"><em ng-bind="detail.kiName || '-'" title="{{::detail.kiName}}"></em></a><br ng-if="detail.uuid"/>
-                                    <a ng-if="!detail.uuid" class="unstand"><em ng-bind="detail.kiName || '-'" title="{{::detail.kiName}}"></em></a><br ng-if="!detail.uuid"/>
-																	  型号:<a href="store/productDetail/{{::detail.batchCode}}" target="_blank"><em ng-bind="detail.cmpCode || '-'" title="{{::detail.cmpCode}}"></em></a><br />
-																		规格:<a><em ng-bind="detail.spec || '-'" title="{{::detail.spec}}"></em></a>
-                                </p>
-                            </div>
-                        </span>
-						<span style="text-align: left;" ng-bind="detail.taxUnitPrice | formateNumber : 6 | currencySysmbol : detail.currencyName"></span>
-						<span ng-bind="detail.number | number"></span>
-						<span ng-bind="detail.ensurePrice | formateNumber : 6 | currencySysmbol : detail.currencyName"></span>
-						<span class="border01 click_shop">
-                            <div ng-if="$index == 0">
-                                <a class="operate-height">
-									<!--分期付款-->
-									<em ng-bind="purchase.status | VendorStatusFilter" ng-style="{'margin-left':purchase.installment.status != 505 && purchase.installmentId && purchase.status != 606 && purchase.status != 525?'24px':'0'}">待买家付款</em>
-										  <div class="ship-btn seller-ship-tip" ng-if="purchase.installment.status != 505 && purchase.installmentId && purchase.status != 606 && purchase.status != 525" style="position: relative;left: -4px;top: -2px;height: auto">
-											 <img src="static/img/common/notice-tip.png"/>
-										  </div>
-                                  <div class="pay ship-content ship-notify">
-                                      <div class="arrow"></div>
-                                      <div class="content">
-										  <div class="title">货款共计
-											  <em ng-bind="purchase.installment.price | currencySysmbol : detail.currencyName">¥9000</em>
-											  &nbsp;&nbsp;&nbsp;&nbsp;分
-											  <em style="color: #5078cb;" ng-bind="purchase.installment.count">5</em> 期
-										  </div>
-										  <ul>
-											  <li ng-repeat="item in purchase.installment.installmentDetails">
-												  <em ng-bind="$index+1">1</em>
-												  <div class="price" ng-class="{'color333': item.status == 505}" ng-bind="item.price | currencySysmbol : detail.currencyName">¥13131</div>
-												  <div class="time" ng-class="{'color999': item.status == 505}">{{item.deadline | date : 'yyyy-MM-dd'}}前</div>
-												  <div class="color999 status" ng-if="item.status == 505">已付</div>
-												  <div class="status" ng-if="item.status != 505">待付</div>
-											  </li>
-									  </ul>
-										  <div class="tip-01" ng-if="purchase.installment.status == 503"><em class="red">*</em>若第一期款项逾期未付,卖家有权利取消订单</div>
-									 </div>
-                                  </div><br/>
-								</a>
-                                <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" target="_blank" href="vendor#/showRate/{{purchase.orderid | EncryptionFilter}}/{{purchase.buyEmail}}" style="display: block;" ng-if="purchase.isEachRate && purchase.isFirstRate">双方已评</a>
-								<div ng-if="!purchase.isEachRate && purchase.isFirstRate">我已评价</div>
-								<div ng-if="purchase.isEachRate && !purchase.isFirstRate">对方已评</div>
-                            </div>
-                        </span>
-						<span class="click_shop" style="position: relative">
-                            <div ng-if="$index == 0">
-								<!--确认收款-->
-								<a class="order-operation" href="javascript:void(0)" ng-if="purchase.installmentDetailPaid && purchase.status !=525 && purchase.status !=606" ng-click="confirmPayment(purchase,purchase.purchaseid)">确认收款</a>
-								<!--取消订单-->
-								<p style="margin-top: 10px;" ng-if="purchase.installmentId && ((purchase.installment.status == 503 && purchase.Overtime) || purchase.installment.status == 504) && purchase.status !=606 && purchase.status !=525">
-									<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>-->
-                                <a class="order-operation" href="javascript:void(0)" ng-if="purchase.status == 404 &&!purchase.uasPurcid" ng-click="modifyLogistic(purchase)" style="position: relative;">修改物流</a>
-								<a class="order-operation" href="javascript:void(0)" ng-click="getModal(purchase,'addRate')" style="position: relative;" ng-if="[405,503,514,506,511,520].indexOf(purchase.status) != -1 && !purchase.isAfterRate && purchase.isFirstRate && requestOver==purchases.length">追加评价</a>
-								<a class="order-operation" href="javascript:void(0)" style="position: relative;" ng-click="getModal(purchase,'firstRate')" ng-if="[405,503,514,506,511,520].indexOf(purchase.status) != -1 && !purchase.isFirstRate && requestOver==purchases.length">评价</a>
-								<!--<div ng-if="purchase.status == 520" class="clock-mind">
-                                  <i class="fa fa-clock-o" aria-hidden="true"></i>&nbsp; <em ng-bind="purchase.complete + 1728000000 | restTime"></em>&lt;!&ndash;暂时设定30天自动初评&ndash;&gt;
-                              </div>
-								<div ng-if="purchase.status == 523" class="clock-mind">
-                                  <i class="fa fa-clock-o" aria-hidden="true"></i>&nbsp; <em ng-bind="purchase.complete + 15552000000 | restTime"></em>&lt;!&ndash;暂时设定180天自动追评&ndash;&gt;
-                              </div>-->
-								<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">
-                                      <div class="arrow"></div>
-                                      <div class="content">若物流信息填写有误,请重新填写</div>
-                                    </div>
-                                </div>
-								<!--修改物流-->
-								<div class="edit-logistic-box" ng-if="purchase.showLogistics">
-									<div class="title"><a ng-click="cancelModify(purchase)">&times;</a></div>
-									<div class="content">
-										<div class="row">配送方式: <em>{{deliveryMethod[purchase.sendType]}}</em></div>
-										<div class="row">物流公司:
-											<em>
-												<input type="text" style="border: #5078cb 1px solid;" class="form-control select-adder" ng-model="logistics.companyName" ng-focus="onFocus()" ng-blur="onBlur()" placeholder="请选择物流公司" readonly="readonly"/>
-												<!--<em name="companyName" class="btn-position" ng-click="showName()"><i class="fa fa-caret-down"></i></em>-->
-												<ul class="dropdown-menu" ng-class="{'active': showNameUl}">
-													<li ng-click="showText('请选择物流公司')">请选择物流公司</li>
-                            						<li ng-click="showText(data.companyName)" ng-repeat="data in data_list" ng-bind="data.companyName"></li>
-                            					</ul>
-											</em>
-										</div>
-										<div class="row">物流单号: <em>
-											<input type="text" class="form-control" ng-model="logistics.number" maxlength="20" autocomplete="off"/>
-										</em></div>
-										<div class="edit-deal" style="margin-left: -18px;">
-											<a ng-click="cancelModify(purchase)" class="off">取消</a>
-											<a ng-click="ensureModifyLogistics(purchase)" class="ok">确认</a>
-										</div>
-									</div>
+						<div ng-if="order.replyQty > 0" class="dropdown" ng-class="{'text-center': item.replyQty>=item.qty}">
+							<a href="javascript:void(0);" class="dropdown-toggle text-default"
+							   ng-mouseover="getReply(order)">回复历史<i class="fa fa-fw fa-angle-down"></i></a>
+							<div class="dropdown-menu pane" style="width: 270px;">
+								<div class="pane-body">
+									<ul class="list-unstyled list-menu">
+										<li ng-if="!order.replies">正在加载...</li>
+										<li ng-repeat="reply in ::order.replies">
+											<div class="row row-sm"
+												 ng-class="{'text-inverse': $index==0}">
+												<div class="col-xs-6">
+													数量 {{::reply.qty}}
+												</div>
+												<div class="col-xs-6">交期{{::reply.delivery |
+													date:'yyyy-MM-dd'}}</div>
+											</div>
+											<div class="text-muted">{{::reply.recorder}}&nbsp;&nbsp;{{::reply.date
+												| date:'MM-dd HH:mm'}}&nbsp;回复</div>
+										</li>
+									</ul>
 								</div>
-                            </div>
-                        </span>
-					</dd>
-					<dd class="price" style="text-align: right;">
-						<b style="float: none;">总共<em ng-bind="purchase.batchQty"></em>件商品</b>
-						<b style="float: none;" class="total">总金额:<em ng-bind="purchase.ensurePrice | formateNumber : 2 | currencySysmbol : purchase.currency"></em></b>
-						<b class="freight">(含运费<em ng-bind="purchase.fare || 0 | formateNumber : 2 | currencySysmbol : purchase.currency"></em>)</b>
-					</dd>
-					<div class="com-del-box conuter-box" ng-if="purchase.showGotoSettle && purchase.showTip == 1" style="display: block;">
-						<div class="title">
-							<a ng-click="changeShow(purchase)"><i class="fa fa-close fa-lg"></i></a>
-						</div>
-						<div class="content">
-							<p>您还未填写<a target="_blank" ng-click="goToSettle(purchase)">收款账户信息&nbsp;</a>,请进行完善,<br/>否则在交易完成后,商城无法给您打款。</p>
-							<p>前往账户中心<a target="_blank" ng-click="goToSettle(purchase)">开票信息&nbsp;<i class="fa fa-arrow-right"></i></a></p>
+							</div>
 						</div>
+						<div ng-if="order.acceptQty"
+							 class="text-success text-center text-bold f14">
+							客户验收:{{::order.acceptQty}}</div>
+						<div ng-if="order.returnsqty"
+							 class="text-error text-center text-bold f14">
+							客户验退:{{::order.returnsqty}}</div>
 					</div>
-				</div>
-				<!--<div ng-if="purchases.length == 0 || !purchases" class="text-center" style="font-size: 14px;height: 180px;line-height: 50px; padding: 35px 0;">-->
-					<!--<div class="col-xs-offset-3 col-xs-2">-->
-						<!--<img src="static/img/all/empty-cart.png">-->
-					<!--</div>-->
-					<!--<div class="col-xs-4">-->
-						<!--<p class="grey f16">暂无订单信息2131</p>-->
-					<!--</div>-->
-				<!--</div>-->
-				<div ng-if="purchases.length > 0" class="text-right" style="margin: 20px 0 12px 0;padding-right:15px;" >
-					显示&nbsp;{{(currenctOrdersList.number - 1 ) * tableParams.count + 1}}-{{currenctOrdersList.all >= 10 ? (currenctOrdersList.number * tableParams.count > currenctOrdersList.all ? currenctOrdersList.all : currenctOrdersList.number * tableParams.count) : currenctOrdersList.all}}&nbsp;条,共&nbsp;{{currenctOrdersList.totalElements}}&nbsp;条
-				</div>
-				<div class="no-price" ng-if="purchases.length == 0 || !purchases">
-					<img src="static/img/all/empty-cart.png">
-					<p>
-						暂无订单信息
-						<br>
-						<a href="/">马上去逛一逛</a>
-					</p>
-				</div>
-				<!--<p class="height16" style="background: #f5f5f5;">&nbsp</p>-->
-				<div class="ng-cloak ng-table-pager" style="float: right;margin-right: 60px;" ng-if="AllOrderInfo.totalPages>1">
-					<ul class="pagination ng-table-pagination">
-						<li ng-class="{'disabled': !page.active && !page.current, 'active': page.current}" ng-repeat="page in pages" ng-switch="page.type">
-							<a ng-switch-when="prev" ng-click="setPage(page.type, -1)" href="">&laquo;</a>
-							<a ng-switch-when="first" ng-click="setPage(page.type, page.number)" href=""><span ng-bind="page.number"></span></a>
-							<a ng-switch-when="page" ng-click="setPage(page.type, page.number)" href=""><span ng-bind="page.number"></span></a>
-							<a ng-switch-when="more" ng-click="setPage(page.type, -1)" href="">&#8230;</a>
-							<a ng-switch-when="last" ng-click="setPage(page.type, page.number)" href=""><span ng-bind="page.number"></span></a>
-							<a ng-switch-when="next" ng-click="setPage(page.type, -1)" href="">&raquo;</a>
-						</li>
-					</ul>
-					<div class="page-go-block">
-						<input class="page-number" type="number" ng-model="param.currentPage" ng-keydown="listenEnter()"/>
-						<a class="page-a" ng-click="setPage('page', param.currentPage)" href="">GO</a>
-					</div>
-				</div>
-			</dl>
-		</div>
-		<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" ng-show="boxStatus == 1 || boxStatus == 2">
-				<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" ng-model="rateContent.level" value="1"/>
-                                <label for="1" class="rate-radio-label" ng-class="{'active':rateContent.level==1}"></label>
-                            </label>
-					</span>
-					<span>
-						<label class="check-act">
-                                <img src="static/img/user/images/rate2.png" alt="">
-                                <span>中评</span>
-                                <input type="radio" id="2" name="rate" ng-model="rateContent.level" value="2"/>
-                                <label for="2" class="rate-radio-label" ng-class="{'active':rateContent.level==2}"></label>
-                            </label>
-					</span>
-					<span>
-						<label class="check-act">
-                                <img src="static/img/user/images/rate3.png" alt="">
-                                <span>差评</span>
-                                <input type="radio" id="3" name="rate" ng-model="rateContent.level" value="3"/>
-                                <label for="3" class="rate-radio-label" ng-class="{'active':rateContent.level==3}"></label>
-                            </label>
-					</span>
-				</div>
-				<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/{{rateBuyer.level == 1?'rate1.png':rateBuyer.level == 2?'rate2.png':'rate3.png'}}" alt=""><span ng-bind="rateBuyer.level == 1?'好评':rateBuyer.level == 2?'中评':'差评'"></span></span>
+					<div style="margin: 0 auto" ng-if="order.$editing">
+						<br><br><input type="text" ng-model="order.reply.remark"
+									   class="form-control input-xs" placeholder="回复备注" />
 					</div>
-					<div class="rate-content" >
-						<span ng-bind="rateBuyer.vendorRate"></span>
+				</td>
+				<td class="text-center br-l">
+					<div ng-if="order.replyQty>=order.qty && !item.$editing && !item.end" class="block">
+						<span class="text-trans success">已回复</span>
 					</div>
-				</div>
-			</div>
-			<div class="vendor-modal-content">
-				<div style="position: relative;height: 30px;line-height: 30px;" ng-show="boxStatus == 1 || boxStatus == 2">
-					<label class="check-active">
-						<input type="checkbox" id="check-act" ng-click="setGo()" 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>
-					</label>
-					<input type="search" ng-model="modalTempData.modalTitle" ng-show="boxStatus == 1" class="form-control modal-select" ng-focus="setShowModalListFlag(true)" ng-blur="setShowModalListFlag(false)" readonly>
-					<div ng-show="showModalListFlag" class="modal-list" ng-mouseenter="setIsInListFlag(true)" ng-mouseleave="setIsInListFlag(false)">
-						<ul>
-							<li ng-repeat="modal in modalData" ng-bind="modal.rateTemplateName" ng-click="chooseModal(modal)"></li>
-						</ul>
-						<span ng-click="addModal()" class="add-modal"><img src="static/img/vendor/images/rate-add.png" alt="">新增模板</span>
+					<div ng-if="order.end" class="block">
+						<span class="text-trans warning">已结案</span>
 					</div>
-				</div>
-				<div>
-					<input type="text" ng-model="modalTempData.modalTitle" ng-trim="false" ng-change="listenModalTitle()" ng-if="boxStatus == 3 || boxStatus == 4" class="modal-head" placeholder="请填写模板名称">
-				</div>
-				<div class="reply-box-text">
-					<textarea id="rateContent" ng-disabled="boxStatus == 1" ng-trim="false" ng-change="listenRateContent()" placeholder="{{boxStatus==2?'请输入不超过200字的评价':boxStatus==3||boxStatus==4?'请填写模板内容':''}}" ng-class="{'active': boxStatus != 1}" ng-model="modalTempData.rateContent"></textarea>
-                    <div class="add-rate-remind" ng-show="boxStatus != 1">
-                        <span>{{modalTempData.rateContent.length || 0}}</span>
-                        <span>/200</span>
-                    </div>
-                </div>
-				<div class="reply-box-btn">
-					<span class="modal-btn modify-modal" ng-click="setBoxStatus(4)" ng-show="boxStatus == 1 && modalTempData.modalTitle">修改模板</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="returnStep1()" ng-show="boxStatus == 3 || boxStatus == 4">返回上一步</span>
-					<span class="modal-btn submit-modal" ng-show="boxStatus == 3 || boxStatus == 4" ng-click="saveModal()">保存</span>
-					<span ng-class="!modalTempData.rateContent || modalTempData.rateContent == ''?'modal-btn cancel-modal':'modal-btn submit-modal'" ng-show="boxStatus == 1 || boxStatus == 2" ng-click="!modalTempData.rateContent || modalTempData.rateContent == ''?'':submitRate()">提交</span>
-				</div>
-			</div>
-		</div>
-	</div>
-	<!--猜你喜欢-->
-	<!--<div class="love_list">
-		<div class="rt_menu"><span><img src="static/img/vendor/images/love.png"/>猜您喜欢 </span></div>
-		<ul>
-			<li ng-repeat="recommendComp in recommendComps">
-				<a ng-href="product/component/{{recommendComp.uuid}}/"><img ng-src="{{recommendComp.img}}"/><p><em ng-cloak="">{{recommendComp.code}}</em></p></a>
-				<span><a href="" ng-controller="CollectCtrl" ng-click="collect(recommendComp.id)">加入收藏</a> </span>
-			</li>
-		</ul>
-	</div>-->
-</div>
-<!--确认收款-->
-<div class="confirm-Payment-box" ng-if="confirmPaymentBox">
-	<div class="head"><a ng-click="cancelPayment()">&times;</a></div>
-	<div class="content">
-		<div class="title">
-			<i class="fa fa-exclamation-circle"></i>
-			买家于{{installmentDetailsList.paidDate | date: 'yyyy-MM-dd HH:mm:ss'}}上传新单据,<br/>
-			&nbsp;&nbsp;&nbsp;&nbsp;合计支付金额 <em ng-bind="installmentDetailsList.price | formateNumber : 2 | currencySysmbol : currencyNAME">¥452658.12</em>
-		</div>
-		<div class="payment-upload-list">
-			<div class="item">
-				<div class="img-list">
-					<div class="prev" ng-click="changePrev(changeList)"><i class="fa fa-angle-left"></i></div>
-					<div class="img">
-						<div class="number"><em>第{{numArray[installmentDetailsList.detno]}}期</em></div>
-						<div class="list" ng-repeat="img in changeList track by $index" ng-if="imgIndex == $index">
-							<span><img ng-src="{{img}}"/></span>
-							<div class="hover-show">
-								<!-- 图片预览 -->
-								<a ng-click="showImg(img)"><i class="fa fa-search"></i>查看</a>
+					<div ng-if="(!order.replyQty || order.replyQty<order.qty) && !order.end">
+						<div ng-show="!order.$editing">
+							<a ng-click="openReply(order)">回复</a>
+						</div>
+						<div ng-if="order.$editing">
+							<div>
+								<a ng-click="closeReply(order)">取消</a>
+							</div>
+							<br>
+							<div class="text-left">
+								<a ng-click="onReplyClick(order);setOrdersRead(order.id)" class="text-inverse">
+									<i class="fa fa-check-square-o"></i> 确认回复
+								</a>
 							</div>
 						</div>
 					</div>
-					<div class="next" ng-click="changeNext(changeList, $index)"><i class="fa fa-angle-right"></i></div>
-				</div>
-				<div class="small-img">
-						<span ng-class="{'active':imgIndex == $index}" ng-repeat="img in changeList track by $index">
-							<img ng-src="{{img}}" ng-click="changeImg(changeList, $index)"/>
-						</span>
-				</div>
-			</div>
-		</div>
-		<div class="tip"><em>*</em> 若未收到货款,请勿点击【确认收款】</div>
-		<div class="deal-btn-box">
-			<button class="off" ng-click="cancelPayment()">取消</button>
-			<button class="ok" ng-click="confirmPaymentOk(installmentDetails)">确认收款</button>
-		</div>
+				</td>
+			</tr>
+			<tr class="order-bd" ng-if="!order.$collapsed" style="height: 10px">
+				<td colspan="6">
+					<div class="row">
+					</div>
+				</td>
+			</tr>
+			</tbody>
+			<tbody ng-if="$data.length === 0">
+			<tr>
+				<td colspan="6">
+					<div id="empty">
+						<div class="left_img">
+							<a href="http://www.ubtob.com/" target="_blank" title="优软云首页"><img src="static/img/empty/uas_empty.png"></a>
+							<a href="#/index" title="B2B商务首页">B2B 商务</a>
+						</div>
+						<div class="right_link">
+							<p>暂无对应的单据</p>
+							<a href="javascript:location.reload()">点击重新加载<i class="load_icon"></i></a>
+						</div>
+					</div>
+				</td>
+			</tr>
+			</tbody>
+		</table>
 	</div>
-</div>
-<style>
-	.confirm-Payment-box{
-		position: fixed;
-		top: 50%;
-		left: 50%;
-		margin: -162px 0 0 -183px;
-		width: 366px;
-		height: 324px;
-		background-color: rgba(255, 255, 255, 1);
-		box-shadow: 0px 3px 7px 0px
-		rgba(0, 0, 0, 0.19);
-		border-radius: 5px 5px 5px 5px;
-	}
-	.confirm-Payment-box .head{
-		width: 100%;
-		height: 20px;
-		line-height: 20px;
-	}
-	.confirm-Payment-box .head a{
-		color: #dfdddd;
-		float: right;
-		margin-right: 6px;
-		font-size: 16px;
-	}
-	.confirm-Payment-box .content .title{
-		width: 100%;
-		height: 34px;
-		font-size: 14px;
-		line-height: 18px;
-		padding-left: 43px;
-	}
-	.confirm-Payment-box .content .title i{
-		color: #5078cb;
-		font-size: 18px;
-	}
-	.confirm-Payment-box .content .title em{
-		color: #ea1010;
-	}
-	.confirm-Payment-box .content .tip{
-		width: 100%;
-		margin: 0 auto;
-		height: 13px;
-		font-size: 12px;
-		text-align: center;
-	}
-	.confirm-Payment-box .content .tip em{
-		color: #ea1010;
-	}
-	.confirm-Payment-box .content .deal-btn-box{
-		width: 100%;
-		margin: 0 auto;
-		text-align: center;
-		margin-top: 18px;
-	}
-	.confirm-Payment-box .content .deal-btn-box button{
-		border: none;
-		background: #5078cb;
-		height:26px;
-		line-height: 26px;
-		font-size: 14px;
-		text-align: center;
-		color: #fff;
-	}
-	.confirm-Payment-box .content .deal-btn-box button:hover{
-		background: #337ab7;
-	}
-	.confirm-Payment-box .content .deal-btn-box button.off{
-		width: 60px;
-		margin-right: 10px;
-		background: #c8c8c8;
-	}
-	.confirm-Payment-box .content .deal-btn-box button.ok{
-		width: 78px;
-	}
-	/*修改扫描单*/
-	.payment-upload-list{
-		width: 100%;
-		margin: 0 auto;
-		display: inline-block;
-		margin-top: 15px;
-	}
-	.payment-upload-list .item{
-		width: 200px;
-		margin: 0 auto;
-	}
-	.payment-upload-list .item .img-list{
-		width: 100%;
-		height: 152px;
-		margin: 0 auto;
-	}
-	.payment-upload-list .item .img-list div{
-		float: left;
-	}
-	.payment-upload-list .item .img-list .img{
-		width: 152px;
-		height: 152px;
-		border: solid 1px rgb(212, 212, 212);
-		position: relative;
-		overflow: hidden;
-		background: #fff;
-	}
-	.payment-upload-list .item .img-list .number{
-		position: absolute;
-		top: 0;
-		left: 0;
-		width: 47px;
-		height: 47px;
-		display: inline-block;
-		background: url("static/img/icon/nummber-bg.png") no-repeat center;
-		z-index: 20;
-	}
-	.payment-upload-list .item .img-list .number em{
-		line-height: 30px;
-		font-size: 12px;
-		color: #fff;
-		transform: rotate(-45deg);
-		display: inline-block;
-		position: relative;
-		left: -3px;
-	}
-	.payment-upload-list .item .img-list div.prev,.payment-upload-list .item .img-list div.next{
-		width: 13px;
-		height: 25px;
-		font-size: 38px;
-		position: relative;
-		top: 48px;
-		color: #c9c9c7;
-	}
-	.payment-upload-list .item .img-list div.prev:hover,.payment-upload-list .item .img-list div.next:hover{
-		color: #5078cb;
-	}
-	.payment-upload-list .item .img-list div.prev{
-		margin-right: 6px;
-	}
-	.payment-upload-list .item .img-list div.next{
-		margin-left: 6px;
-	}
-	.payment-upload-list .item .img-list .list,.payment-upload-list .item .img-list .list img{
-		width: 152px;
-		height: 152px;
-		margin: 0 auto;
-		position: relative;
-	}
-	.payment-upload-list .item .img-list .list span{
-		width: 152px;
-		height: 152px;
-		display: inline-block;
-	}
-	.payment-upload-list .item .img-list .list:hover .hover-show{
-		top: 0;
-	}
-	.payment-upload-list .item .small-img{
-		width: 152px;
-		height: 15px;
-		margin: 4px 0 6px 20px;
-	}
-	.payment-upload-list .item  .small-img span{
-		width: 15px;
-		height: 15px;
-		display: inline-block;
-		overflow: hidden;
-		border: #e0dddd 1px solid;
-		background: #e0dddd;
-		float: left;
-		margin-left: 12px;
-	}
-	.payment-upload-list .item  .small-img span:first-child{
-		margin-left: 0;
-	}
-	.payment-upload-list .item .small-img span.active,.payment-upload-list .item .small-img span:hover{
-		border: #5078cb 1px solid;
-	}
-	.payment-upload-list .item .small-img span img{
-		width: 15px;
-		height: 15px;
-	}
-	.payment-upload-list .hover-show{
-		position: absolute;
-		width: 100%;
-		height: 100%;
-		left: 0;
-		top: 100%;
-		background: rgba(0,0,0,.35);
-	}
-	.payment-upload-list .hover-show a{
-		display: inline-block;
-		width: 100%;
-		height: 100%;
-		font-size: 14px;
-		color: #fff;
-		text-align: center;
-		line-height: 152px;
-	}
-</style>
-<script class="ng-scope">
-	$(function(){
-		//产品字数超过两行时改变样式
-		$(".love_list ul li em").each(function(){
-			var text=$(this).text().length;
-			if(text<40){
-				$(this).css("line-height","30px");
-			};
-		});
-	})
-</script>
+</div>