wangcz 7 лет назад
Родитель
Сommit
f5bf2b1cf6

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

@@ -281,6 +281,17 @@ define([ 'ngResource' ], function() {
 				method : 'GET'
 			},
 
+			// 查看出入库记录
+			getLoadStorageData: {
+				url: '/CommodityInOutbound/page',
+				method: 'GET'
+			},
+            // 采购入库销售出库列表
+            getOrderData: {
+                url: '/CommodityInOutbound/page',
+                method: 'GET'
+            },
+
 		    // 库存管理其它出入库,根据联想词得到产品库数据
             getKeywordToProductId : {
                 url : 'trade/products/code/keyword',
@@ -291,7 +302,18 @@ define([ 'ngResource' ], function() {
 			saveOtherProductData : {
 				url: 'CommodityInOutbound/:storage_tab/other?enName=:enName',
 				method: 'POST'
-			}
+			},
+            // 销售出库接口对应销售订单的待发货
+            getByStatusAndInternal: {
+                url : 'trade/purchase/status/createtime',
+                method: 'GET'
+            },
+            // 获取物流公司信息
+            findAllSelected : {
+                url: 'trade/distributor/selected',
+                method: 'GET',
+                isArray : true
+            }
 		});
 	}]).factory('GoodsModifyInfo', ['$resource', function ($resource) {
 		return $resource('goods/modifyInfo', {}, {

+ 456 - 1888
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_storageCtrl.js

@@ -1,13 +1,15 @@
 define([ 'app/app' ], function(app) {
     'use strict';
-    app.register.controller('vendor_storageCtrl', ['$scope', '$rootScope', 'Goods', '$modal', 'toaster', 'Loading', 'StoreInfo', 'AuthenticationService', '$q', 'StoreCms', 'NumberService', 'Enterprise', 'ByteCountService', 'DistributionRule', '$upload', '$http', function ($scope, $rootScope, Goods, $modal, toaster, Loading, StoreInfo, AuthenticationService, $q, StoreCms, NumberService, Enterprise, ByteCountService, DistributionRule, $upload, $http) {
+    app.register.controller('vendor_storageCtrl', ['$scope', '$rootScope', 'BaseService', 'Goods', 'KdnLogistics', '$modal', 'toaster', 'Loading', 'AuthenticationService', '$q', '$upload', '$http', 'ngTableParams',function ($scope, $rootScope, BaseService, Goods, KdnLogistics, $modal, toaster, Loading, AuthenticationService, $q, $upload, $http, ngTableParams) {
         $rootScope.active = 'vendor_storage';
         $scope.keyword = '';
+        $scope.type = '';
         $scope.tab = 'storage';
         $scope.isInt = /^[0-9]*[1-9][0-9]*$/;
         document.title = '卖家出入库-优软商城';
-        $scope.storage_tab = 'inBound';
+        $scope.storage_tab = 'outBound';
         $scope.countData = 10;
+        $scope.userInfo = $rootScope.userInfo || {}
 
         // 更多操作数据和记录
         $scope.handleLink = [
@@ -17,26 +19,24 @@ define([ 'app/app' ], function(app) {
             {name: '查看出库记录', tab: 'outBound', id: 0},
             {name: '其它出库', tab: 'outBound', id: 1},
             {name: '销售出库', tab: 'outBound', id: 2}];
-        // $scope.handleItem = $scope.storage_tab === 'inPut'? $scope.handleLink[0].id : $scope.handleLink[3].id;
-        $scope.handleItem = 1;
-
+        // $scope.handleItem = $scope.storage_tab === 'inBound'? $scope.handleLink[0].id : $scope.handleLink[3].id;
+        $scope.handleItem = 2;
 
         $scope.lockData = [
-            {seleted: false, maiName: '324134', selfSupport: '腌肉入库', uuid: '张三1', date: 340325435434535, content: [{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'}]},
-            {seleted: false, maiName: '324134', selfSupport: '腌肉入库', uuid: '张三2', date: 34032545354325432, content: [{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'}]},
-            {seleted: false, maiName: '324134', selfSupport: '腌肉入库', uuid: '张三3', date: 340324535454325432, content: [{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'}]},
-            {seleted: false, maiName: '324134', selfSupport: '腌肉入库', uuid: '张三4', date: 340323554325432, content: [{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'}]}
+            {id: 1,seleted: false, maiName: '324134', selfSupport: '腌肉入库', uuid: '张三1', date: 340325435434535, content: [{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'}]},
+            {id: 11,seleted: false, maiName: '324134', selfSupport: '腌肉入库', uuid: '张三2', date: 34032545354325432, content: [{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'}]},
+            {id: 111,seleted: false, maiName: '324134', selfSupport: '腌肉入库', uuid: '张三3', date: 340324535454325432, content: [{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'}]},
+            {id: 1111,seleted: false, maiName: '324134', selfSupport: '腌肉入库', uuid: '张三4', date: 340323554325432, content: [{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'}]}
         ];
-
-        //数字的正则表达式
-        var intPattern = /^[1-9]+$/;
-
-        $scope.packageArray = ["Bulk-散装", "Reel-卷装", "Tape/Reel-编带", "Tray-盘装",
-            "Tube-管装", "盒装", "袋装", "罐装", "瓶装", "桶装", "箱装", "其他"];
-
-        //只包含中文和英文的字符
-        var pattern = /^[\u4e00-\u9fa5a-zA-Z]+$/;
-
+        // 销售方式数据
+        $scope.boundType = {
+            INBOUND: '全部类型',
+            OTHER_INBOUND: '其它入库',
+            PURCHASE_INBOUND: '采购入库',
+            OUTBOUND: '全部类型',
+            OTHER_OUTBOUND: '其它出库',
+            SELL_OUTBOUND: '销售出库'
+        };
         // 时间格式化
         var _formatDate = function (date, fmt) {
             if(!date) {
@@ -63,28 +63,31 @@ define([ 'app/app' ], function(app) {
                 }
             }
             return fmt;
-        }
+        };
 
         var _getClearDay = function (date) {
             return new Date(_formatDate(date, 'yyyy-MM-dd')).getTime() - 8 * 60 * 60 * 1000
-        }
+        };
 
-        $scope.param = {
-            page : 1,
-            count : 10,
-            sorting : {
-                createdDate: 'DESC'
-            },
-            status : "601-602"
+        // 清空数据初始化数据
+        var clearRecordParams = function () {
+            $scope.dateArea = 'oneMonth'
+            $scope.keyword = null;
+            $scope.type = $scope.storage_tab === 'inBound'? 'INBOUND' : 'OUTBOUND'
+            $scope.selfSupport = $scope.storage_tab === 'inBound'? $scope.boundType.INBOUND : $scope.boundType.OUTBOUND;
+            var currentTime = _getClearDay(new Date());
+            var endDate = new Date(currentTime + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000);
+            $scope.startDate = new Date(currentTime - 30 * 24 * 60 * 60 * 1000);
+            $scope.endDate = endDate;
         };
+        clearRecordParams();
 
+        // 其它出入库默认数据
         $scope.othenParam = {
             enName: '',
             detail: []
-        }
-
-        // 其它出入库默认数据
-        var initData = function () {
+        };
+        var initOtherData = function () {
             $scope.othenParam = {
                 enName: '',
                 detail: []
@@ -95,53 +98,29 @@ define([ 'app/app' ], function(app) {
                 $scope.otherData.push({qty: '', id: i, price: '', key: '', show: false, productId: ''})
             }
         }
-        initData();
-
-
-        /**
-         * 最大
-         * @type {number}
-         */
-        $scope.maxReserve = 999999999;
-        /**
-         * 最小包装量的最大值
-         */
-        $scope.maxPackQty = 999999;
-        $scope.minReserve = 1;
-
-        // 商品分页数据
-        $scope.goodsPageParams = {};
-        $scope.selfSupportType = {
-            ALL: '全部类型',
-            SELF_SUPPORT: '其它入库',
-            CONSIGNMENT: '采购入库'
-        };
-
-        // 时间域选择
-        $scope.dateArea = 'All'
-
-        $scope.selfSupport = $scope.selfSupportType.ALL;
-
-        $scope.onsale = {};
-
-        // 清空数据
-        var clearRecordParams = function () {
-            $scope.dateArea = 'All'
-            $scope.keyword = null;
-            $scope.startDate = null;
-            $scope.endDate = null;
-        };
+        initOtherData();
 
         //出入库切换
         $scope.toggleStorage = function (type) {
-            $scope.storage_tab = type
+            $scope.storage_tab = type;
+            $scope.type = $scope.storage_tab === 'inBound'? 'INBOUND' : 'OUTBOUND';
+            getLoadStorageData();
         };
 
-
         // 操作类型切换
         $scope.toggleType = function (type) {
             $scope.handleItem = type.id;
-            clearRecordParams()
+            if(type.id !== 1) {
+                getLoadStorageData();
+            }
+            clearRecordParams();
+        };
+        // 销售方式筛选
+        $scope.changeSupportType = function (type) {
+            if (!type) return ;
+            $scope.selfSupport = $scope.boundType[type];
+            $scope.type = type;
+            getLoadStorageData();
         };
 
         // 时间选择操作
@@ -151,10 +130,7 @@ define([ 'app/app' ], function(app) {
                 // 时间筛选
                 var currentTime = _getClearDay(new Date());
                 var endDate = new Date(currentTime + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000);
-                if (val === 'All' || val === 'autoMonth') {
-                    $scope.startDate = null;
-                    $scope.endDate = null;
-                } else if (val === 'oneMonth') {
+                if (val === 'oneMonth') {
                     $scope.startDate = new Date(currentTime - 30 * 24 * 60 * 60 * 1000);
                     $scope.endDate = endDate;
                 } else if (val === 'threeMonth') {
@@ -168,6 +144,9 @@ define([ 'app/app' ], function(app) {
                     $scope.endDate = null;
                 }
             }
+            if(val !== 'autoMonth') {
+                getLoadStorageData();
+            }
         };
 
         // 初始化时间变量
@@ -205,6 +184,70 @@ define([ 'app/app' ], function(app) {
           if ($scope.endDate && bool === 2) {
               $scope.endDate = new Date($scope.endDate.getTime() + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000);
           }
+            getLoadStorageData();
+        };
+
+        // 获取查看出入库记录
+        var getUrl = function() {
+            if($scope.handleItem === 0) {
+                return 'getLoadStorageData'
+            } else if($scope.handleItem === 2) {
+                if($scope.storage_tab === 'inBound') {
+                    return 'getOrderData'
+                } else {
+                    return 'getByStatusAndInternal'
+                }
+            }
+        };
+        var getLoadStorageData = function () {
+            $scope.storageTableParams = new ngTableParams({
+                page: 1,
+                count:10
+            }, {
+                total: 0,
+                getData: function ($defer, params) {
+                    var param = BaseService.parseParams(params.url())
+                    if($scope.keyword){
+                        param.keyword = $scope.keyword
+                    }
+                    if($scope.storage_tab === 'outBound' && $scope.handleItem === 2) {
+                        param.sorting = {"createtime":"DESC"};
+                        param.status = '502-406';
+                        param.storeType = 'mall';
+                        param.startMils = $scope.startDate ? $scope.startDate.getTime() : null;
+                        param.endMils = $scope.endDate ? $scope.endDate.getTime() : null;
+                    } else {
+                        param.type = $scope.type;
+                        param.fromDate = $scope.startDate ? $scope.startDate.getTime() : null;
+                        param.toDate = $scope.endDate ? $scope.endDate.getTime() : null;
+                    }
+                    Goods[getUrl()](param, function(data) {
+                        $scope.storageList = data.content
+                        console.log(data.content, ';data')
+                        params.total(data.totalElements);
+                        $defer.resolve(data.content);
+                    }, function(err) {
+                        toaster.pop('error', '获取信息失败')
+                    })
+                }
+            })
+        };
+        getLoadStorageData();
+
+        // 搜索功能
+        $scope.onSearch = function () {
+            getLoadStorageData();
+        };
+
+        // 展开收起
+        $scope.unfoldClick = function (data, type) {
+            angular.forEach(data, function(key) {
+                if(type.id !== key.id) {
+                    key.seleted = false;
+                } else {
+                    key.seleted = true;
+                }
+            })
         };
 
         $scope.onChange = function (type) {
@@ -228,7 +271,7 @@ define([ 'app/app' ], function(app) {
 
         $scope.addOneTable = function (type) {
             if(type === 'clear') {
-                initData()
+                initOtherData()
             } else if(type === 'one') {
                 $scope.otherData.push({qty: '', id: i, price: '', key: '', show: false, productId: ''});
             } else if(type === 'ten') {
@@ -239,7 +282,11 @@ define([ 'app/app' ], function(app) {
         };
 
         // 确认提交
-        $scope.otherAddClick = function () {
+        $scope.otherAddClick = function (type) {
+            if(type === 'clear'){
+                window.history.go(-1)
+                return false
+            }
             $scope.othenParam.detail = [];
             console.log($scope.otherData)
             if(!$scope.othenParam.enName) {
@@ -256,17 +303,127 @@ define([ 'app/app' ], function(app) {
             })
         };
 
-        //获取币别信息
-        Enterprise.getCurrencyByRegisterAddress(null, function (data) {
-            if(data.code == 1) {
-                $scope.onsale.currency = data.data;
-            }else {
-                toaster.pop('info', '提示', '您公司的注册地址为空,无法确定币别,系统默认为人民币');
-                $scope.onsale.currency = 'RMB';
+        // 获取物流公司信息
+        $scope.initData = function () {
+            Goods.findAllSelected({},function (data) {
+                if (data){
+                    $scope.data_list = data;
+                }
+                angular.forEach($scope.data_list, function (data) {
+                    data.isOpen = false;
+                })
+            })
+        };
+        $scope.initData();
+
+        $scope.findAllKdnList = function () {
+            KdnLogistics.getCompanyName({}, function (data) {
+                if (data){
+                    $scope.allKdnList = data;
+                }
+                angular.forEach($scope.allKdnList, function (data) {
+                    data.isChoosed = false;
+                });
+            }, function (error) {
+
+            })
+        };
+        $scope.findAllKdnList();
+        $scope.logistics = {};
+        $scope.showText = function (data) {
+            console.log(data, 'data')
+            $scope.logistics.companyName = data.companyName;
+            $scope.companyObject = data;
+            $scope.showCompanyName = false;
+        };
+
+        //显示默认的选项
+        $scope.showDefaultText = function () {
+            $scope.logistics.companyName = '请选择物流公司';
+            $scope.companyObject = {};
+        };
+
+        // 物流管理公司选择功能部分
+        var initIndex = function () {
+            $scope.selectIndex = -1;
+            $scope.downIndex = 0;
+        };
+
+        // 表单获取焦点,显示下拉框
+        $scope.getItemFocus = function() {
+            $scope.showCompanyName = true;
+            initIndex();
+        };
+
+        //表单失去焦点
+        $scope.onItemBlur = function() {
+            if($scope.time) {
+                clearTimeout($scope.time);
             }
-        }, function (response) {
-            toaster.pop('info', '提示', '获取不到公司的币别信息');
-        });
+            $scope.time = setTimeout(function() {
+                $scope.$apply(function() {
+                    $scope.showCompanyName = false;
+                })
+            }, 200)
+        };
+
+        // 按键操作功能
+        $scope.onKeyup = function() {
+            var dom = document.getElementById("ulContent");
+            if($scope.showCompanyName){
+                if(event.keyCode === 40){
+                    $scope.selectIndex++;
+                    if($scope.downIndex === 5){
+                        dom.scrollTop += 23;
+                    } else if($scope.downIndex <=4){
+                        $scope.selectIndex++;
+                    } else if($scope.selectIndex >= $scope.data_list.length){
+                        $scope.selectIndex = 0;
+                        $scope.downIndex =1;
+                        dom.scrollTop = 0;
+                    }
+                    $scope.logistics.companyName = $scope.data_list[$scope.selectIndex].companyName;
+                } else if(event.keyCode === 38) {
+                    $scope.selectIndex --;
+                    if ($scope.downIndex === 1){
+                        dom.scrollTop -= 22.67;
+                    }
+                    if ($scope.downIndex >= 2){
+                        $scope.downIndex--;
+                    }
+                    if($scope.selectIndex < 0){
+                        $scope.selectIndex = $scope.data_list.length - 1;
+                        dom.scrollTop = 2400;
+                        $scope.downIndex = 5;
+                    }
+                    $scope.logistics.companyName = $scope.data_list[$scope.selectIndex].companyName;
+                } else if(event.keyCode === 13){
+                    $scope.showCompanyName = false;
+                }
+            }
+        };
+        $scope.addDistributor = function () {
+            $modal.open({
+                templateUrl : $rootScope.rootPath + '/static/view/vendor/modal/vendor_distributor_manage.html',
+                controller : 'vendorDistributorModalCtrl',
+                size : 'lg',
+                resolve : {
+                    allKdnList : function () {
+                        return $scope.allKdnList;
+                    },
+                    selectedList : function () {
+                        return $scope.data_list;
+                    }
+                }
+            }).result.then(function(data){
+                if (data) {
+                    $scope.initData();
+                }
+            }, function(){
+                // toaster.pop('info', '提示 ' + '您已取消配送商的编辑');
+            });
+        };
+
 
         //获取登录的信息
         var getAuthentication = function () {
@@ -288,1873 +445,284 @@ define([ 'app/app' ], function(app) {
             }).error(function(response) {
                 toaster.pop('info', '获取定单的信息' + response);
             });
-        }
-
-        //判断是否是商城管理公司,是否可以选择自营。
-        $q.all([getAuthentication()]).then(function() {
-            //获取店铺的信息
-            StoreInfo.getStoreInfoByEnuu({enUU : $rootScope.userInfo.enterprise.uu}, function(data) {
-                $scope.storeInfo = data;
-            }, function(response) {
-                toaster.pop('error', '获取店铺的信息失败, ' + response.data);
-            });
-        });
-
-        //初始化页数信息
-        $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.pages.push(page);
-            });
         };
 
-        //当前页在前段的计算方式
-        $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);
-                    }
-                }
-            });
-        };
+          var getRealLen = function(str) {
+            var len = 0;
+            for (var i = 0; i < str.length; i++) {
+              if (str.charCodeAt(i) > 127 || str.charCodeAt(i) === 94) {
+                len += 2;
+              } else {
+                len++;
+              }
+            }
+            return len;
+          }
+    }]);
 
-        //当前页在后端计算方式
-        $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;
-                }
+    // 设置物流公司
+    app.register.controller('vendorDistributorModalCtrl', ['$scope','$rootScope','$modal','toaster','KdnLogistics','Distributor','BaseService','ngTableParams','$modalInstance','$q','selectedList','allKdnList', function ($scope, $rootScope, $modal, toaster, KdnLogistics, Distributor, BaseService, ngTableParams, $modalInstance, $q, selectedList, allKdnList) {
+        //获取快递鸟信息
+        $scope.$$kdnData = {};
+        $scope.selectedList = selectedList;
+        $scope.allKdnList = allKdnList;
+        $scope.chooseList = [];
+        $scope.selectFlag = [];
+
+        $scope.initArrayData = function () {
+            angular.forEach(allKdnList, function (data) {
+                $scope.selectFlag[data.code] = {};
+                $scope.selectFlag[data.code].isChoosed = false;
             });
-        };
-
-        //当前页在中间计算方式
-        $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;
+            angular.forEach(selectedList, function (data, index) {
+                $scope.chooseList[index] = {};
+                if (data.code){
+                    $scope.chooseList[index].code = data.code;
+                    $scope.selectFlag[data.code].isChoosed = true;
                 }
+                $scope.chooseList[index].companyName = data.companyName;
             });
         };
+        $scope.initArrayData();
 
-        //输入框监听Enter事件
-        $scope.listenEnter = function () {
-            if($scope.param.currentPage) {
-                if(!intPattern.test($scope.param.currentPage)) {
-                    $scope.param.currentPage = $scope.param.page;
-                    return ;
-                }
-            }
-            if(event.keyCode == 13) {
-                $scope.setPage("page", $scope.param.currentPage);
-            }
-        };
-
-        $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.goodsAll.totalPages) {
-                        page = $scope.goodsAll.totalPages;
-                    }else {
-                        page = number;
-                    };
-                    break;
-                case "prev":
-                    if($scope.param.page <= 1) {
-                        page = 1;
-                    }else {
-                        page =$scope.param.page - 1;
-                    };
-                    break;
-                case "next":
-                    if($scope.param.page >= $scope.goodsAll.totalPages) {
-                        page = $scope.goodsAll.totalPages
+        $scope.distributorTableParams = new ngTableParams({
+            page : 1,
+            count : 30
+        },{
+            total : 0,
+            getData : function ($defer, params) {
+                var param = BaseService.parseParams(params.url());
+                KdnLogistics.findKdnPage(param, function (page) {
+                    $scope.$$kdnData.totalElements = page.totalElements;
+                    if(Number(page.totalElements) > 0) {
+                        $scope.$$kdnData.start = Number(page.size) * (Number(page.number) - 1) + 1;
                     }else {
-                        page =$scope.param.page + 1;
+                        $scope.$$kdnData.start = 0;
                     }
-                    break;
-                case "first":
-                    page = 1;
-                    break;
-                case "last":
-                    page = $scope.goodsAll.totalPages;
-                    break;
-            }
-            if(page == $scope.param.page || page < 1 || page > $scope.goodsAll.totalPages) {
-                $scope.param.currentPage = $scope.param.page;
-                return ;
-            }
-            $scope.param.page = page;
-            loadData();
-        };
-
-        //计算页数的方式。
-        $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.$$kdnData.end = Number(page.size) * (Number(page.number) - 1) + Number(page.numberOfElements);
+                    $scope.pageList = page.content;
+                    params.total(page.totalElements);
+                    $defer.resolve(page.content);
+                    //划分数据
+                    var row = Math.ceil(page.numberOfElements/6.0);
+                    $scope.showList = [];
+                    var count = 0;
+                    for (var i = 0; i<row; i++){
+                        $scope.showList[i] = [];
+                        for (var j = 0; j<6; j++){
+                            // var code = $scope.pageList[count].code;
+                            // $scope.pageList[count].isChoosed = $scope.selectFlag[code].isChoosed;
+                            $scope.showList[i].push($scope.pageList[count]);
+                            count++;
+                            if (count == page.numberOfElements){
+                                return;
+                            }
+                        }
                     }
+                }, function () {
+                    toaster.pop('error', '获取快递鸟信息失败');
                 });
-            }else if(currentPage < 6) {//当期页小于6
-                $scope.frontSegment(currentPage, totalElementPages);
-            }else if(currentPage > totalElementPages - 5) { //当期页在后面
-                $scope.endSegment(currentPage, totalElementPages);
-            }else { //当期页在中间
-                $scope.middleSegment(currentPage);
             }
-        };
+        });
 
-        $scope.onSearch = function () {
-            loadDataReload();
+        var countLength = function (string) {
+            return string.replace(/[^x00-xFF]/g,'**').length;
         };
 
-        var loadData = function () {
-            if ($scope.selfSupport === $scope.selfSupportType.SELF_SUPPORT) {
-                $scope.param.isSelfSupport = true;
-            } else if ($scope.selfSupport === $scope.selfSupportType.CONSIGNMENT) {
-                $scope.param.isSelfSupport = false;
-            } else {
-                $scope.param.isSelfSupport = null;
-            }
-            $scope.param.keyword = $scope.keyword;
-            Goods.getGoodsByPageAndStatus($scope.param, function (data) {
-                $scope.goodsAll = data;
-                $scope.currenctGoods = data.content;
-                if ($scope.currenctGoods.length == 0) {
-                    $scope.chooseAllPage = false;
-                }
-                $scope.param.currentPage = data.number;
-                if ($scope.param.currentPage == data.totalPages) {
-                    $scope.endNumber = data.totalElements;
-                } else {
-                    $scope.endNumber = data.number * data.size;
-                }
-                $scope.acculatePages(data.number, data.totalPages);
-                if($scope.currenctGoods.length > 0) {
-                    //防止默认选择的RMB不是用户上传的币别信息
-                    if($scope.currenctGoods[0].currencyName == 'USD') {
-                        $scope.onsale.currency = 'USD';
-                    }else {
-                        $scope.onsale.currency = 'RMB';
-                    }
-                    angular.forEach($scope.currenctGoods, function (goods) {
-                        if ($scope.chooseAllPage) {
-                            goods.isChoosed = true;
-                        } else {
-                            goods.isChoosed = false;
-                        }
-                    });
+        $scope.inputContent = function () {
+            for (var i=0; i<$scope.keyword.length;i++){
+                if (countLength($scope.keyword.substr(0, i)) >= 26){
+                    $scope.keyword = $scope.keyword.substr(0, i);
+                    break;
                 }
-                $scope.chooseAll = false;
-            });
-        };
-
-        // 全选
-        $scope.chooseAllItem = function () {
-            $scope.chooseAll = !$scope.chooseAll;
-            angular.forEach($scope.currenctGoods, function (goods) {
-                goods.isChoosed = $scope.chooseAll;
-            });
-            if (!$scope.chooseAll) {
-                $scope.chooseAllPage = false;
             }
+            var addrPatt = new RegExp("^[A-Za-z0-9\u4e00-\u9fa5]+$");
+            if (!addrPatt.test($scope.keyword) && $scope.keyword.length > 0){
+                $scope.companyError = true;
+            }else {
+                $scope.companyError = false;
+            }
+            initIndex();
+            $scope.showDownFrame = true;
+            matchArray();
+            $scope.containsAttr($scope.keyword);
         };
 
-        $scope.turnAllPage = function () {
-            if ($scope.chooseAll) {
-                $scope.chooseAllPage = true;
-            }
+        var initIndex = function () {
+            $scope.selectIndex = -1;
+            $scope.downIndex = 0;
         };
 
-        $scope.cancelAllPage = function () {
-            $scope.chooseAllPage = false;
-            $scope.chooseAll = false;
-            angular.forEach($scope.currenctGoods, function (goods) {
-                goods.isChoosed = false;
-            });
+        $scope.getFocus = function() {
+            initIndex();
         };
 
-        // 检查是否全选
-        var checkChoosedAll = function () {
-            $scope.chooseAll = true;
-            angular.forEach($scope.currenctGoods, function (goods) {
-                if (!goods.isChoosed) {
-                    $scope.chooseAll = false;
+        /**
+         * 根据输入内容获取匹配数据的长度
+         */
+        var matchArray = function () {
+            $scope.resultList = $scope.allKdnList.filter(function (data) {
+                if (data.companyName.indexOf($scope.keyword) >= 0){
+                    return data;
                 }
             });
-            if (!$scope.chooseAll) {
-                $scope.chooseAllPage = false;
+            if ($scope.resultList.length > 0){
+                $scope.matchData = true;
+            }else{
+                $scope.matchData = false;
             }
         };
 
-        $scope.isDoubleChecked = false;
-        // 单选
-        $scope.chooseOne = function (event, goods) {
-            if (event) {
-                event.preventDefault();
-                event.stopPropagation();
-                $scope.isDoubleChecked = true;
-            }
-            if (typeof goods.isChoosed == 'undefined' || !goods.isChoosed) {
-                goods.isChoosed = true;
-            } else {
-                goods.isChoosed = false;
-            }
-            if ($scope.isDoubleChecked) {
-                goods.isChoosed = !goods.isChoosed;
-                $scope.isDoubleChecked = false;
-            }
-            checkChoosedAll();
-        };
-
-        //获取选中之后的信息
-        var getChooseBatch = function () {
-            $scope.choosedBatch = [];
-            angular.forEach($scope.currenctGoods, function (goods) {
-                if (goods.isChoosed) {
-                    $scope.choosedBatch.push(goods.batchCode);
-                }
-            });
+        $scope.onBlur = function () {
+            setTimeout(function () {
+                $scope.showDownFrame = false;
+            }, 120);
         };
 
-        //获取选中之后的信息
-        var getChooseInfo = function () {
-            $scope.choosedIds = [];
-            angular.forEach($scope.currenctGoods, function (goods) {
-                if (goods.isChoosed) {
-                    $scope.choosedIds.push(goods.id);
+        $scope.onKeyDown = function () {
+            var dom = document.getElementById("ulContent");
+            // console.log(dom.scrollTop);
+            if ($scope.showDownFrame && $scope.matchData){
+                if(event.keyCode == 40) { //监听到按下键
+                    $scope.selectIndex ++;
+                    if ($scope.downIndex == 5){
+                        dom.scrollTop += 23;
+                    }
+                    if ($scope.downIndex <= 4){
+                        $scope.downIndex++;
+                    }
+                    if($scope.selectIndex >= $scope.resultList.length){
+                        $scope.selectIndex = 0;
+                        dom.scrollTop = 0;
+                        $scope.downIndex = 1;
+                    }
+                    $scope.inputObject = $scope.resultList[$scope.selectIndex];
+                    $scope.keyword = $scope.inputObject.companyName;
+                    $scope.containsAttr($scope.keyword);
+                } else if(event.keyCode == 38) { //监听到按上键
+                    $scope.selectIndex --;
+                    if ($scope.downIndex == 1){
+                        dom.scrollTop -= 22.67 ;
+                    }
+                    if ($scope.downIndex >= 2){
+                        $scope.downIndex--;
+                    }
+                    if($scope.selectIndex < 0){
+                        $scope.selectIndex = $scope.resultList.length - 1;
+                        dom.scrollTop = 2400;
+                        $scope.downIndex = 5;
+                    }
+                    $scope.inputObject = $scope.resultList[$scope.selectIndex];
+                    $scope.keyword = $scope.inputObject.companyName;
+                    $scope.containsAttr($scope.keyword);
+                } else if(event.keyCode == 13) { //确定键
+                    $scope.showDownFrame = false;
                 }
-            });
-        };
-
-        $scope.cancelBatch = function (event) {
-            if (event) {
-                event.stopPropagation();
             }
-            $scope.batchStatus = false;
         };
 
-        $scope.batchOperation = function (num) {
-            getChooseInfo();
-            if (!$scope.choosedIds || $scope.choosedIds.length == 0) {
-                toaster.pop('info', '您尚未选中任何产品');
-                return ;
-            }
-            $scope.batchStatus = true;
-            $scope.batchType = num;
-            if (num == 1) {
-                $scope.batchTitle = '是否要删除选中的产品?'
-            } else {
-                $scope.batchTitle = '是否要下架选中的产品?'
-            }
+        $scope.clickItem = function (data) {
+            // $scope.inputObject = data;
+            $scope.keyword = data.companyName;
+            $scope.containsAttr($scope.keyword);
+            $scope.showDownFrame = false;
         };
 
         /**
-         * 批量删除
+         * 判断快递鸟是否包含输入的快递
+         * @param value
          */
-        $scope.batchDelete = function () {
-            if ($scope.chooseAllPage) {
-                Goods.deleteGoodsByEnUU({}, {}, function (result) {
-                    if (result.success) {
-                        var message = "成功删除"+ result.data.success +"个产品,另有"
-                            + result.data.fail + "个产品无法删除";
-                        toaster.pop('success', message);
-                        $scope.batchStatus = false;
-                        loadDataReload();
-                    } else {
-                        toaster.pop('error', result.message);
+        $scope.containsAttr = function (value) {
+            var key = 1;
+            if (value){
+                angular.forEach($scope.allKdnList, function (data) {
+                    if (data.companyName == value){
+                        key = 0;
+                        return;
                     }
-                })
-            } else {
-                getChooseInfo();
-                if (!$scope.choosedIds || $scope.choosedIds.length == 0) {
-                    toaster.pop("info", "您尚未选中任何产品");
-                    return ;
+                });
+                if (key == 1){
+                    $scope.containsItem = false;
+                }else {
+                    $scope.containsItem = true;
                 }
-                Goods.deleteGoodsByIdList({}, $scope.choosedIds, function (result) {
-                    if (result.success) {
-                        var message = "成功删除"+ result.data.success +"个产品,另有"
-                            + result.data.fail + "个产品无法删除";
-                        toaster.pop('success', message);
-                        $scope.batchStatus = false;
-                        loadDataReload();
-                    } else {
-                        toaster.pop('error', result.message);
-                    }
-                })
             }
         };
 
-        $scope.batchDown = function () {
-            if ($scope.chooseAllPage) {
-                Goods.downNowEnterpriseGoods({}, {}, function(result) {
-                    if (result.success) {
-                        toaster.pop('success', '下架成功');
-                        $scope.batchStatus = false;
-                        loadDataReload();
-                    } else {
-                        toaster.pop('error', result.message);
+        $scope.addItemInSelected = function () {
+            if ($scope.containsItem){
+                angular.forEach($scope.allKdnList, function (data) {
+                    if (data.companyName == $scope.keyword){
+                        if ($scope.selectFlag[data.code].isChoosed){
+                            var indexItem = null;
+                            if ($scope.chooseList){
+                                angular.forEach($scope.chooseList, function (item, index) {
+                                    if (item.code == data.code){
+                                        indexItem = index;
+                                    }
+                                });
+                            }
+                            $scope.chooseList.splice(indexItem, 1);
+                            $scope.selectFlag[data.code].isChoosed = !$scope.selectFlag[data.code].isChoosed;
+                        }
+                        $scope.ChooseDistributor(data);
                     }
                 });
-            } else {
-                getChooseBatch();
-                if (!$scope.choosedBatch || $scope.choosedBatch.length == 0) {
-                    toaster.pop("info", "您尚未选中任何产品");
-                    return ;
-                }
-                var batchs = $scope.choosedBatch.join(",");
-                Goods.offShelfGoodsByProvider({batchCodes : batchs}, {}, function(map){
-                    if (map.success) {
-                        toaster.pop('success', '下架成功');
-                        $scope.batchStatus = false;
-                        loadDataReload();
-                    } else {
-                        toaster.pop('error', map.message);
+            }else {
+                var indexItem = null;
+                angular.forEach($scope.chooseList, function (item, index) {
+                    if (item.companyName == $scope.keyword){
+                        indexItem = index;
                     }
-                }, function(err){
-                    toaster.pop('error', err.data || '下架失败');
                 });
-            }
-        };
-
-        $scope.updateCommodityInfo = function (commodity) {
-            Goods.offShelfGoodsByProvider({batchCodes : commodity.batchCode}, {}, function(map){
-                if (map.success) {
-                    toaster.pop('success', '下架成功');
-                    $scope.isSoldOut = false;
-                    loadDataReload();
-                } else {
-                    toaster.pop('error', map.message);
-                }
-            }, function(err){
-                toaster.pop('error', err.data || '下架失败');
-            });
-        };
-
-        /*查看大图*/
-        $scope.showImg = function(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();
-            });
-        }
-
-        /*******************************编辑库存信息 start****************************************/
-
-        var countLength = function (string) {
-            return string.replace(/[^\x00-\xff]/g,'**').length;
-        };
-
-        var cutOutString = function (str, length) {
-            for (var i = 1; i <= str.length; i++) {
-                if (countLength(str.substr(0, i)) > length){
-                    str = str.substr(0, i-1);
-                    break;
-                }
-            }
-            return str;
-        };
-
-        /**
-         * 编辑包装方式的信息
-         * @param goods
-         * @param edit
-         */
-        $scope.editPackaging = function(goods) {
-            if (goods.editPackaging) {
-                if (!pattern.test(goods.editPackaging)) {
-                    if (!$scope.enterSaveButton) {
-                        goods.editPackagingInvalid = true;
-                        toaster.pop('warning', '提示', '包装方式只能填写中英文');
-                        return ;
-                    }
+                if (indexItem){
+                    $scope.chooseList.splice(indexItem, 1);
                 }
+                var item = {};
+                item.companyName = $scope.keyword;
+                $scope.chooseList.push(item);
             }
-            goods.editPackagingInvalid = false;
+            $scope.keyword = "";
         };
 
-        $scope.changePackaging = function (goods) {
-            if (goods.editPackaging) {
-                goods.editPackaging = cutOutString(goods.editPackaging, 10);
+        $scope.removeDistributor = function (data, index) {
+            $scope.chooseList.splice(index, 1);
+            if (data.code){
+                $scope.selectFlag[data.code].isChoosed = !$scope.selectFlag[data.code].isChoosed;
             }
         };
 
-        $scope.editProduceDateFa = function(commodity) {
-            if($scope.enterSaveButton) {
-                return ;
-            }
-            commodity.editProduceDateInvalid = false;
-            if(commodity.editProduceDate) {
-                commodity.editProduceDate = cutOutString(commodity.editProduceDate, 12);
-                // if(goods.editProduceDate.length > 11) {
-                //     goods.editProduceDateInvalid = true;
-                //     toaster.pop('warning', '提示', '生产日期不能超过十一个字符');
-                // }
-            }
-        }
-
-        /**
-         * 自定义标签的判断逻辑
-         * @param commodity
-         */
-        $scope.editTag = function (commodity) {
-            if (!commodity.editTag) {
-                toaster.pop("warning", "自定义标签不能为空");
-            }
-            if (commodity.editTag) {
-                Goods.getRepeatByTagAndProductId({goodId:commodity.id, productId:commodity.productid, tag:commodity.editTag}, function (data) {
-                    if (data.success) {
-                        if (data.data) {
-                            toaster.pop("warning", "该产品下已存在相同的自定义标签");
+        $scope.ChooseDistributor = function (data) {
+            if ($scope.selectFlag[data.code].isChoosed){
+                if ($scope.chooseList){
+                    angular.forEach($scope.chooseList, function (item, index) {
+                        if (item.code == data.code){
+                            $scope.index = index;
                         }
-                    } else {
-                        toaster.pop("error", data.message);
-                    }
-                }, function (error) {
-                    toaster.pop("error","判断标签重复请求错误" + error.date);
-                })
-            }
-        }
-
-        /**
-         * 修改字符串信息
-         */
-        $scope.changeTag = function (commodity) {
-            var length = ByteCountService.strByteLength(commodity.editTag);
-            if (length > 20) {
-                commodity.editTag = commodity.editTagPre;
-            } else {
-                commodity.editTagPre = commodity.editTag;
-            }
-        }
-        /**
-         * 增加对应的分段。
-         * @param commodity
-         */
-        $scope.addFragment = function (commodity) {
-            if(commodity.editPrices.length > 2) {
-                toaster.pop('warning', "提示", "批次最多只能有三个分段");
-                return ;
-            }
-            var price = {};
-            price.start = null;
-            price.startPre = null;
-            price.end = commodity.editPrices[commodity.editPrices.length - 1].end;
-            price.endPre = price.end;
-            price.uSDPrice = null;
-            price.uSDPricePre = null;
-            price.rMBPrice = null;
-            price.rMBPricePre = null;
-            commodity.editPrices[commodity.editPrices.length - 1].end = null;
-            commodity.editPrices[commodity.editPrices.length - 1].endPre = null;
-            commodity.editPrices.push(price);
-        }
-
-        /**
-         * 删除对应的分段.
-         * @param commodity
-         */
-        $scope.deleteFragment = function(commodity, index) {
-            if (index > -1 && index < commodity.editPrices.length) {
-                if (commodity.editPrices.length < 2) {
-                    toaster.pop('warning', "提示", "商品至少需要一个分段");
-                    return ;
-                }
-                if (index < commodity.editPrices.length - 1) { //不是最后一个分段
-                    var price = commodity.editPrices.splice(index, 1);
-                    commodity.editPrices[index].start = price[0].start;
-                } else if (index == commodity.editPrices.length - 1) { //如果删除的是最后一个分段,
-                    var price = commodity.editPrices.splice(index, 1);
-                    commodity.editPrices[index -1].end = price[0].end;
-                }
-                if (commodity.editMinBuyQty && $scope.isInt.test(commodity.editMinBuyQty) &&
-                    parseInt(commodity.editPrices[0].end) >= parseInt(commodity.editMinBuyQty)) {
-                    if (commodity.editMinBuyQtyInValid) {
-                        commodity.editMinBuyQtyInValid = false;
-                        commodity.editPrices[0].start = commodity.editMinBuyQty;
-                    }
+                    });
                 }
+                $scope.chooseList.splice($scope.index, 1);
+            }else {
+                $scope.chooseList.push(data);
             }
+            $scope.selectFlag[data.code].isChoosed = !$scope.selectFlag[data.code].isChoosed;
         };
 
-        /**
-         * 去对应的批次信息
-         */
-        $scope.goToBatchDetail = function (event, commodity) {
-            event.stopPropagation();
-            if(!commodity || !event || commodity.edit) {
-                return ;
-            };
-            var tag = event.target;
-            if(tag) {
-                while((tag != null) && (tag.nodeName != 'BODY')) {
-                    var name = tag.getAttribute('name');
-                    if(name != null &&(name == 'edit-a' || name == 'down-a'
-                        || name == 'img-a' || name == 'kind-a' || name == 'brand-a'
-                        || name == 'cancle-a' || name == 'save-a' || name == 'reduce-a'
-                        || name == 'add-a' || name == 'check-one')) {
-                        return ;
-                    }
-                    tag = tag.parentElement;
+        $scope.saveChooseList = function () {
+            Distributor.saveDistributor({}, $scope.chooseList ,function (data) {
+                if(data){
+                    toaster.pop('success', '成功', '保存配送商成功');
                 }
-            };
-            window.open("/store/productDetail/" + commodity.batchCode);
-        };
-
-        /**
-         * 取消修改订单
-         */
-        $scope.cancleEdit = function (commodity) {
-            if(!commodity) {
-                return ;
-            }
-            for(var i = 0; i < $scope.currenctGoods.length; i++) {
-                if($scope.currenctGoods[i].id == commodity.id) {
-                    $scope.currenctGoods.splice(i, 1, $scope.onsale.editGoods);
-                }
-            };
-        };
-
-        /**
-         * 编辑库存信息,
-         * 将需要编辑的信息增加一个备份
-         * @param commodity
-         */
-        $scope.editCommodity = function (commodity, e) {
-            e.stopPropagation();
-            if(commodity == null) {
-                true;
-            }
-            $scope.onsale.editGoods = angular.copy(commodity);
-            angular.forEach($scope.currenctGoods, function (goods) {
-                goods.edit = false;
+                $modalInstance.close(data);
+            },function (error) {
+                toaster.pop('error', '成功', '保存配送商失败 '+ error);
             });
-            commodity.edit = true;
-
-            commodity.editPrices = angular.copy(commodity.prices);
-            angular.forEach(commodity.editPrices, function (price) {
-                price.startPre = price.start;
-                price.startDirty = false;
-
-                price.endPre = price.end;
-                price.endDirty = false;
-
-                price.rMBPricePre = price.rMBPrice;
-                price.rMBPriceDirty = false;
-
-                price.uSDPricePre = price.uSDPrice;
-                price.uSDPriceDirty = false;
-            });
-
-            commodity.editTagInvalid = false;
-            commodity.editTag = commodity.tag;
-            commodity.editTagPre = commodity.tag;
-            commodity.editTagDirty = false;
-
-            commodity.editPrices[commodity.editPrices.length - 1].end = $scope.maxReserve;
-            commodity.editPrices[commodity.editPrices.length - 1].endPre = $scope.maxReserve;
-            // commodity.editPrices[0].start = $scope.minReserve;
-            // commodity.editPrices[0].startPre = $scope.minReserve;
-
-            commodity.editReserve = commodity.reserve;
-            commodity.editReservePre = commodity.reserve;
-            commodity.editReserveDirty = false;
-            commodity.editReserveInvalid = false;
-
-            commodity.editMinBuyQty = commodity.minBuyQty;
-            commodity.editMinBuyQtyPre = commodity.minBuyQty;
-            commodity.editMinBuyQtyDirty = false;
-            commodity.editMinBuyQtyInValid = false;
-
-            commodity.editMinPackQty = commodity.minPackQty;
-            commodity.editMinPackQtyPre = commodity.minPackQty;
-            commodity.editMinPackQtyDirty = false;
-            commodity.editMinPackQtyInValid = false;
-            commodity.editspec = commodity.spec;
-
-            commodity.editBreakUp = commodity.breakUp;
-            commodity.editBreakUpPre = commodity.breakUp;
-            commodity.editBreakUpDirty = false;
-
-            commodity.editPackaging = commodity.packaging;
-            commodity.editPackagingPre = commodity.packaging;
-            commodity.editPackagingDirty = false;
-            commodity.editPackagingInvalid = false;
-
-            commodity.editProduceDate = new String(commodity.produceDate || '');
-            commodity.editProduceDatePre = commodity.produceDate;
-            commodity.editProduceDateDirty = false;
-            commodity.editProduceDateInvalid = false;
-
-            commodity.editSelfDeliveryHKMinTime = commodity.selfDeliveryHKMinTime;
-            commodity.editSelfDeliveryHKMinTimePre = commodity.selfDeliveryHKMinTime;
-            commodity.editSelfDeliveryHKMinTimeDirty = false;
-
-            commodity.editSelfDeliveryHKMaxTime = commodity.selfDeliveryHKMaxTime;
-            commodity.editSelfDeliveryHKMaxTimePre = commodity.selfDeliveryHKMaxTime;
-            commodity.editSelfDeliveryHKMaxTimeDirty = false;
-
-            commodity.editSelfDeliveryDemMinTime = commodity.selfDeliveryDemMinTime;
-            commodity.editSelfDeliveryDemMinTimePre = commodity.selfDeliveryDemMinTime;
-            commodity.editSelfDeliveryDemMinTimeDirty = false;
-
-            commodity.editSelfDeliveryDemMaxTime = commodity.selfDeliveryDemMaxTime;
-            commodity.editSelfDeliveryDemMaxTimePre = commodity.selfDeliveryDemMaxTime;
-            commodity.editSelfDeliveryDemMaxTimeDirty = false;
-
-            commodity.editMinDelivery = commodity.minDelivery;
-            commodity.editMinDeliveryPre = commodity.minDelivery;
-            commodity.editMinDeliveryDirty = false;
-            commodity.editMinDeliveryinValid = false;
-
-            commodity.editMaxDelivery = commodity.maxDelivery;
-            commodity.editMaxDeliveryPre = commodity.maxDelivery;
-            commodity.editMaxDeliveryDirty = false;
-            commodity.editMaxDeliveryinValid = false;
-            commodity.editPic = commodity.img;
-
-            commodity.editSelfSale = $scope.storeInfo.uuid != 'undefind' && commodity.storeid == $scope.storeInfo.uuid && $scope.storeInfo.storeName.indexOf('优软测试二') < 0 && $scope.storeInfo.storeName.indexOf('优软商城') < 0 ? 1 : 2;
-        };
-
-        /**
-         * 是否可拆卖
-         * @param commodity
-         */
-        $scope.toggleIsBreadUp = function (commodity) {
-            commodity.editBreakUp = !commodity.editBreakUp;
-            if(!commodity.editBreakUp) {
-                $scope.isNotBreakUp(commodity);
-            }
-        };
-
-        /**
-         * 修改commodity的系列的dirty属性 为true;
-         * @param commodity
-         */
-        $scope.initDirtyTrue = function(commodity) {
-            angular.forEach(commodity.editPrices, function (price) {
-                price.startDirty = false;
-                price.endDirty = false;
-                price.rMBPriceDirty = false;
-                price.uSDPriceDirty = false;
-            });
-            commodity.editReserveDirty = false;
-            commodity.editMinBuyQtyDirty = false;
-            commodity.editMinPackQtyDirty = false;
-            commodity.editPackagingDirty = false;
-            commodity.editProduceDateDirty = false;
-            commodity.editSelfDeliveryHKMinTimeDirty = false;
-            commodity.editSelfDeliveryHKMaxTimeDirty = false;
-            commodity.editSelfDeliveryDemMinTimeDirty = false;
-            commodity.editSelfDeliveryDemMaxTimeDirty = false;
-        };
-
-        /**
-         * 修改分段的数量
-         * @param commodity 批次信息
-         * @param index 索引值
-         * @param isEnd 是否是结束值
-         */
-        $scope.editQty = function (commodity, index, isEnd, num) {
-            commodity.editPrices[index].endInValid = false;
-            commodity.editPrices[index].startInValid = false;
-            if(commodity.editPrices.length < index || index < 0) {
-                return ;
-            }
-            if(!num) {
-                return ;
-            }
-            if (!$scope.isInt.test(num)) {
-                if(!$scope.enterSaveButton) {
-                    if (isEnd) {
-                        delete commodity.editPrices[index].end;
-                        //commodity.editPrices[index].end = commodity.editPrices[index].endPre;
-                    } else {
-                        delete commodity.editPrices[index].start;
-                        //commodity.editPrices[index].start = commodity.editPrices[index].startPre;
-                    }
-                    toaster.pop('warning', '提示', '分段数量必须为正整数');
-                }
-                return ;
-            }
-            if (isEnd) {
-                if (index < commodity.editPrices.length - 1) {
-                    if (parseInt(commodity.editPrices[index].end) < parseInt(commodity.editPrices[index].start)) {
-                        if(!$scope.enterSaveButton) {
-                            toaster.pop('warning', '提示', '输入值必须大于' +  commodity.editPrices[index].start);
-                            delete commodity.editPrices[index].end;
-                        }
-                        //commodity.editPrices[index].end = commodity.editPrices[index].endPre;
-                    } else if ((commodity.editPrices[index + 1].end) && (parseInt(commodity.editPrices[index].end) + 1) >= parseInt(commodity.editPrices[index + 1].end)) {
-                        if(!$scope.enterSaveButton) {
-                            toaster.pop('warning', '提示', '输入的值必须小于'+(parseInt(commodity.editPrices[index].end) - 1));
-                            delete commodity.editPrices[index].end;
-                        }
-                        //commodity.editPrices[index].end = commodity.editPrices[index].endPre;
-                    } else {
-                        commodity.editPrices[index + 1].start = parseInt(commodity.editPrices[index].end) + 1;
-                        commodity.editPrices[index].endPre = commodity.editPrices[index].end;
-                        commodity.editPrices[index + 1].startPre = commodity.editPrices[index + 1].start;
-                    }
-                }
-                // else {
-                //     if(commodity.editPrices[index].end > commodity.editMinBuyQty) {
-                //         if(commodity.editPrices[index].end > commodity.reserve) {
-                //             toaster.pop('warning', '提示', '修改最后一个分段的结束值之后,新的库存量大于原有的库存量');
-                //             commodity.editPrices[index].end = commodity.editPrices[index].endPre;
-                //         }else {
-                //             commodity.editReserve = commodity.editPrices[index].end;
-                //             commodity.editPrices[index].endPre = commodity.editPrices[index].end;
-                //             commodity.editReservePre = commodity.editReserve;
-                //         }
-                //     }else {
-                //         toaster.pop('warning', '提示', '修改最后一个分段的结束值之后导致库存量小于起拍量');
-                //         commodity.editPrices[index].end = commodity.editPrices[index].endPre;
-                //     }
-                // }
-            } else {
-                if (index != 0) {
-                    if (parseInt(commodity.editPrices[index].start) > parseInt(commodity.editPrices[index].end)) {
-                        // toaster.pop('warning', '提示', '修改本分段之后,会导致分段的起始值' + commodity.editPrices[index ].start + '大于结束值' + parseInt(commodity.editPrices[index].end));
-                        //commodity.editPrices[index].start = commodity.editPrices[index].startPre;
-                        if(!$scope.enterSaveButton) {
-                            toaster.pop('warning', '提示', '输入值必须小于'+ + commodity.editPrices[index].end);
-                            delete commodity.editPrices[index].start;
-                        }
-                    } else if ((parseInt(commodity.editPrices[index].start) - 1) < commodity.editPrices[index - 1].start) {
-                        // toaster.pop('warning', '提示', '修改本分段之后,会导致前一个分段的起始值' + commodity.editPrices[index - 1].start + '大于结束值' + (parseInt(commodity.editPrices[index].start) - 1));
-                        // commodity.editPrices[index].start = commodity.editPrices[index].startPre;
-                        if(!$scope.enterSaveButton) {
-                            toaster.pop('warning', '提示', '输入值会导致梯度重叠,请重新修改');
-                            delete commodity.editPrices[index].start;
-                        }
-                    } else {
-                        commodity.editPrices[index - 1].end = parseInt(commodity.editPrices[index].start) - 1;
-                        commodity.editPrices[index].startPre = commodity.editPrices[index].start;
-                        commodity.editPrices[index - 1].endPre = commodity.editPrices[index - 1].end;
-                    }
-                 }//else {
-                //     if(commodity.editMinPackQty) {
-                //         if(commodity.editPrices[index].start % commodity.editMinPackQty != 0) {
-                //             commodity.editPrices[index].startInValid = false;
-                //             commodity.editPrices[index].start = commodity.editMinBuyQty;
-                //             commodity.editPrices[index].startPre = commodity.editMinBuyQty;
-                //             toaster.pop('warning', '提示', '第一个分段的起始量必须是倍数(' + commodity.editMinPackQty + ")的整数倍");
-                //         }else {
-                //             commodity.editMinBuyQty = commodity.editPrices[index].start;
-                //             commodity.editMinBuyQtyPre = commodity.editPrices[index].start;
-                //             commodity.editMinBuyQtyInValid = false;
-                //         }
-                //     }else {
-                //         commodity.editMinBuyQty = commodity.editPrices[index].start;
-                //         commodity.editMinBuyQtyPre = commodity.editMinBuyQty;
-                //         commodity.editPrices[index].startPre = commodity.editPrices[index].start;
-                //         commodity.editMinBuyQtyInValid = false;
-                //     }
-                // }
-            }
         };
 
-        /**
-         * @param commodity 需要验证的批次的信息
-         * @returns {boolean}
-         */
-        var changeQtyPrice = function(commodity) {
-            var price = commodity.editPrices;
-            var previousEnd = -1;
-            for(var i = 0; i < price.length; i++){
-                price[i].startInValid = false;
-                price[i].endInValid = false;
-                if(isNaN(price[i].start)) {
-                    price[i].startInValid = true;
-                    toaster.pop('warning', "提示", "分段数量必须是数字");
-                    return false;
-                }
-                if(parseInt(price[i].start) <= previousEnd) {
-                    price[i].startInValid = true;
-                    toaster.pop('warning', "提示", "存在上一个分段的结束值大于下一个分段的起始值");
-                    return false;
-                }
-                if(isNaN(price[i].end)) {
-                    price[i].endInValid = true;
-                    toaster.pop('warning', "提示", "分段数量必须是数字");
-                    return false;
-                }
-                if(parseInt(price[i].start) > parseInt(price[i].end)) {
-                    price[i].startInValid = true;
-                    toaster.pop('warning', "提示", "存在分段的起始值大于分段的结束值");
-                    return false;
-                }
-                previousEnd = price[i].end;
-            }
-            return true;
-        };
-
-        /**
-         * commodity,
-         * 验证库存量是否大于原有的库存量
-         */
-        $scope.changeReserve = function (commodity) {
-            commodity.editReserveInvalid = true;
-            if (typeof commodity.editReserve == 'undefined') {
-                return;
-            }
-            if (!commodity.editReserve) {
-                //commodity.editReserve = commodity.editReservePre;
-                if (!$scope.enterSaveButton) {
-                    commodity.editReserveInvalid = true;
-                    toaster.pop('warning', '提示', '库存须填写小于10亿的正整数');
-                }
-                return false;
-            }
-            if (!$scope.isInt.test(commodity.editReserve)) {
-                //commodity.editReserve = commodity.editReservePre;
-                if (!$scope.enterSaveButton) {
-                    toaster.pop('warning', '提示', '库存须填写小于10亿的正整数');
-                    commodity.editReserveInvalid = true;
-                }
-                return false;
-            }
-            // if (parseInt(commodity.editReserve) < parseInt(commodity.editMinBuyQty)) {
-            //     //commodity.editReserve = commodity.editReservePre;
-            //     commodity.editReserveInvalid = true;
-            //     toaster.pop('warning', '提示', '库存必须是大于等于起订量的整数');
-            //     return false;
-            // }
-            if (parseInt(commodity.editReserve) > $scope.maxReserve || commodity.editReserve < $scope.minReserve) {
-                //commodity.editReserve = commodity.editReservePre;
-                if (!$scope.enterSaveButton) {
-                    toaster.pop('warning', '提示', '库存须填写小于10亿的正整数');
-                    commodity.editReserveInvalid = true;
-                }
-                return false;
-            }
-            commodity.editReservePre = commodity.editReserve;
-            commodity.editReserveInvalid = false;
-            if (!commodity.breakUp) {
-                $scope.isNotBreakUp(commodity);
-            }
-            return true;
-
-        }
-
-        var initRuleCount = function () {
-            return DistributionRule.findCountOfActiveRule({},{},function (data) {
-                if (data.success){
-                    $scope.needShowTip = data.data;
-                }
-            }, function (error) {
-                toaster.pop("error", error.data);
-            })
+        $scope.cancel = function() {
+            $modalInstance.dismiss();
         };
-        initRuleCount();
-
-        $q.all([initRuleCount().$promise]).then(function (data) {
-            if (data){
-                if ($scope.needShowTip){
-                    $modal.open({
-                        animation: true,
-                        templateUrl: 'static/view/common/modal/delivery_rule_modal.html',
-                        controller: 'rule_tip_ctrl',
-                        resolve : {
-                            type : function() {
-                                return 'product';
-                            },
-                            tipModal : function() {
-                                return true;
-                            },
-                            success : function () {
-                                return false;
-                            },
-                            uuid: function () {
-                                return null;
-                            }
-                        }
-                    });
-                }
-            }
-        });
-
-        /**
-         *
-         * @param commodity
-         * 验证库存的最小起订量是否大于库存量
-         */
-        $scope.changeMinBuyQty = function (commodity) {
-            // commodity.editMinBuyQtyInValid = false;
-            // if (typeof commodity.editMinBuyQty == 'undefined') {
-            //     commodity.editMinBuyQtyInValid = true;
-            //     return false;
-            // }
-            if (!$scope.isInt.test(commodity.editMinBuyQty) || parseInt(commodity.editMinBuyQty) < 1) {
-                // goods.editMinBuyQtyInValid = true;
-                if (commodity.editBreakUp) {
-                    commodity.editMinBuyQty = 1;
-                    commodity.editPrices[0].start = commodity.editMinBuyQty;
-                } else {
-                    if (commodity.editMinPackQty) {
-                        commodity.editMinBuyQty = commodity.editMinPackQty;
-                        commodity.editPrices[0].start = commodity.editMinBuyQty;
-                    }
-                }
-                if (!$scope.enterSaveButton) {
-                    toaster.pop('warning', '提示', '起订量必须是大于0的整数');
-                    return false;
-                }
-                return false;
-            }
-            commodity.editMinBuyQtyPre = commodity.editMinBuyQty;
-            if (!commodity.editBreakUp) {
-                $scope.isNotBreakUp(commodity);
-            }
-        };
-
-        $scope.updateStartNumber = function (commodity) {
-            commodity.editPrices[0].start = commodity.editMinBuyQty;
-        };
-
-        /**
-         * 修改批次信息的包装个数
-         * @param commodity
-         */
-        $scope.changeMinPackQty = function(commodity) {
-            if(typeof commodity.editMinPackQty == 'undefined') {
-                return;
-            }
-            if(!$scope.isInt.test(commodity.editMinPackQty)) {
-                if(!$scope.enterSaveButton) {
-                    commodity.editMinPackQtyInValid = true;
-                    toaster.pop('warning', '提示', '包装数必须是大于0的整数');
-                }
-                return false;
-            }
-            if(commodity.editMinPackQty < 1) {
-                if(!$scope.enterSaveButton) {
-                    commodity.editMinPackQtyInValid = true;
-                    toaster.pop('warning', '提示', '包装数必须是大于0的整数');
-                }
-                return false;
-            }
-            // if(commodity.editMinPackQty > commodity.editReserve) {
-            //     toaster.pop('warning', '提示', '包装数必须小于等于库存量。');
-            //     return false;
-            // }
-            if(parseInt(commodity.editMinPackQty) > $scope.maxPackQty) {
-                if(!$scope.enterSaveButton) {
-                    commodity.editMinPackQtyInValid = true;
-                    toaster.pop('warning', '提示', '包装数量必须小于等于' + $scope.maxPackQty);
-                }
-                return false;
-            }
-            if(commodity.editMinBuyQty) {
-                if(!commodity.editBreakUp) {
-                    $scope.isNotBreakUp(commodity);
-                }
-            }
-            commodity.editMinPackQtyPre = commodity.editMinPackQty;
-            commodity.editMinPackQtyInValid = false;
-        }
-
-        /**
-         * 比较交货周期的大小
-         * @param min 本来是最小值
-         * @param max 本来是最大值
-         * @param type 2 表示当前验证的香港交期, 1表示当前验证的是大陆交期
-         * @param commodity 批次信息
-         * @returns {boolean} true 表示验证通过,false 表示验证失败。
-         */
-        $scope.compareNum = function(min, max, type, commodity) {
-            if(!min) {
-                commodity.editMinDeliveryinValid = true;
-                toaster.pop('warning', '提示', '交期存在空值,请重新操作');
-                return false;
-            }else if(!max) {
-                commodity.editMaxDeliveryinValid = true;
-                toaster.pop('warning', '提示', '交期存在空值,请重新操作');
-                return false;
-            }
-            if(!$scope.isInt.test(min)) {
-                commodity.editMinDeliveryinValid = true;
-                toaster.pop('warning', '提示', '交期只能填写1-999之间的整数值');
-                return false;
-            }
-            if(!$scope.isInt.test(max)) {
-                commodity.editMaxDeliveryinValid = true;
-                toaster.pop('warning', '提示', '交期只能填写1-999之间的整数值');
-                return false;
-            }
-            if(min < 1 || min > 999) {
-                commodity.editMinDeliveryinValid = true;
-                toaster.pop('warning', '提示', '交期只能填写1-999之间的值');
-                return false;
-            }
-            if(max < 1 || max > 999) {
-                commodity.editMaxDeliveryinValid = true;
-                toaster.pop('warning', '提示', '交期的时间必须是1-999之内');
-                return false;
-            }
-            if(Number(min) > Number(max)) {
-                commodity.editMaxDeliveryinValid = true;
-                commodity.editMinDeliveryinValid = true;
-                toaster.pop('warning', '提示', '最短交期应小于等于最长交期');
-                return false;
-            }
-            return true;
-        }
-
-        /**
-         * @param min 最小值
-         * @param max 最大值
-         * @param isMin 传入的是否是最小值
-         * @param isHk 是否是香港交货周期
-         * @param commodity 批次信息
-         */
-        $scope.changeDelivery = function(min, max, isMin, isHk, commodity) {
-            if(isMin) {
-                commodity.editMinDeliveryinValid = false;
-            }else {
-                commodity.editMaxDeliveryinValid = false;
-            }
-            var day = -1;
-            if(isMin) {
-                if(min && $scope.isInt.test(min)) {
-                    day = min;
-                }else {
-                    if(!min) {
-                        return ;
-                    }
-                    if(!$scope.isInt.test(min)) {
-                        if(!$scope.enterSaveButton) {
-                            commodity.editMinDeliveryinValid = true;
-                            toaster.pop('warning', '提示', '交期只能填写1-999之间的整数值');
-                        }
-                    }
-                    return ;
-                }
-            }else {
-                if(max && $scope.isInt.test(max)) {
-                    day = max;
-                }else {
-                    if(!max) {
-                        return ;
-                    }
-                    if(!$scope.isInt.test(max)) {
-                        if (!$scope.enterSaveButton) {
-                            commodity.editMaxDeliveryinValid = true;
-                            toaster.pop('warning', '提示', '交期只能填写1-999之间的整数值');
-                        }
-                    }
-                    return ;
-                }
-
-            }
-            if(day > 999 || day < 1) {
-                if(!$scope.enterSaveButton) {
-                    toaster.pop('warning', '提示', '交期只能填写1-999之间的整数值');
-                    if(isMin) {
-                        commodity.editMinDeliveryinValid = true;
-                    }else {
-                        commodity.editMaxDeliveryinValid = true;
-                    }
-                }
-                return ;
-            }
-            if(Number(min) > Number(max)) {
-                if(!$scope.enterSaveButton) {
-                    toaster.pop('warning', '提示', '最短交期应小于等于最长交期');
-                    commodity.editMinDeliveryinValid = true;
-                    commodity.editMaxDeliveryinValid = true;
-                }
-                return ;
-            }
-
-            commodity.editMinDeliveryinValid = false;
-            commodity.editMaxDeliveryinValid = false;
-        }
-
-        /**
-         * 鼠标移入到保存按钮
-         */
-        $scope.impedeBlur = function () {
-            $scope.enterSaveButton = true;
-        }
-
-        /**
-         * 鼠标移出保存按钮
-         */
-        $scope.recoveryBlur = function () {
-            $scope.enterSaveButton = false;
-        }
-
-        /**
-         * 判断价格是否合理,只设置验证的结果
-         * @param prices 分段价格
-         * @param price 对应的价格
-         * @param index 索引
-         */
-        $scope.changePrices = function (prices, price, index) {
-            prices[index].priceInvalid = false;
-            if(!prices || !prices[index] || !price) {
-                return ;
-            }
-            if(isNaN(price)) {
-                if (!$scope.enterSaveButton) {
-                    toaster.pop('warning', '提示', '单价必须是大于0的数字');
-                    prices[index].priceInvalid = true;
-                    return;
-                }
-            }
-            if(new Number(price) <= 0) {
-                if (!$scope.enterSaveButton) {
-                    toaster.pop('warning', '提示', '单价必须是大于0的数字');
-                    prices[index].priceInvalid = true;
-                }
-                return;
-            }
-            if(price.indexOf('.') > -1) {
-                var arr = price.split(".");
-                if(arr[0].length > 4 || arr[1].length > 6) {
-                    prices[index].priceInvalid = true;
-                    return ;
-                }
-            }else {
-                if(price.toString().length > 4) {
-                    prices[index].priceInvalid = true;
-                    return ;
-                }
-            }
-        };
-
-        /**
-         * 	验证库存信息的正确性,
-         * @param goods 需要验证的GOODS信息
-         * @returns {boolean}
-         * 返回false 代表验证不通过。
-         * 返回true  代表验证成功。
-         */
-        $scope.checkGoodsInfo = function (goods) {
-            var result = false;
-            if (!goods) {
-                toaster.pop('warning', '提示', '库存信息丢失,请重新操作');
-                return result;
-            }
-            if (!goods.editTag) {
-                goods.editTagInvalid = true;
-                toaster.pop('warning', '提示', '请填写标签信息');
-                return result;
-            }
-            if (goods.editTag.length > 20) {
-                goods.editTagInvalid = true;
-                toaster.pop('warning', '提示', '标签信息超过了20个字符');
-                return result;
-            }
-            if (!goods.editPackaging) {
-                goods.editPackagingInvalid = true;
-                toaster.pop('warning', '提示', '请填写包装方式');
-                return result;
-            }
-            // if (!pattern.test(goods.editPackaging)) {
-            //     goods.editPackagingInvalid = true;
-            //     toaster.pop('warning', '提示', '包装方式仅能包含中文和英文字符');
-            //     return result;
-            // }
-            // if (goods.editPackaging.length > 10) {
-            //     goods.editPackagingInvalid = true;
-            //     toaster.pop('warning', '提示', '包装方式不能超过10个字符');
-            //     return result;
-            // }
-            if (!goods.editProduceDate) {
-                goods.editProduceDateInvalid = true;
-                toaster.pop('warning', '提示', '请填写生产日期');
-                return result;
-            }
-            if (goods.editProduceDate.length > 12) {
-                goods.editProduceDateInvalid = true;
-                toaster.pop('warning', '提示', '生产日期不能超过12个字符');
-                return result;
-            }
-            if (!goods.editReserve) {
-                goods.editReserveInvalid  = true;
-                toaster.pop('warning', '提示', '库存须填写小于10亿的正整数');
-                return result;
-            }
-            if (isNaN(goods.editReserve)) {
-                goods.editReserveInvalid  = true;
-                toaster.pop('warning', '提示', '库存须填写小于10亿的正整数');
-                return result;
-            }
-            if (goods.editReserve < $scope.minReserve) {
-                goods.editReserveInvalid  = true;
-                toaster.pop('warning', '提示', '库存须填写小于10亿的正整数');
-                return result;
-            }
-            if (goods.editReserve > $scope.maxReserve) {
-                goods.editReserveInvalid  = true;
-                toaster.pop('warning', '库存须填写小于10亿的正整数');
-                return result;
-            }
-            if (typeof goods.editMinBuyQty == 'undefined') {
-                goods.editMinBuyQtyInValid  = true;
-                toaster.pop('warning', '提示', '起订量不能为空');
-                return result;
-            }
-            // if(!goods.editMinBuyQty) {
-            //     goods.editMinBuyQtyInValid  = true;
-            //     toaster.pop('warning', '提示', '起订量必须填写');
-            //     return result;
-            // }
-            if (!$scope.isInt.test(goods.editMinBuyQty)) {
-                goods.editMinBuyQtyInValid  = true;
-                toaster.pop('warning', '提示', '起订量必须是大于0的整数');
-                return result;
-            }
-            // if(goods.editReserve < goods.editMinBuyQty) {
-            //     goods.editReserveInvalid  = true;
-            //     goods.editMinBuyQtyInValid = true;
-            //     toaster.pop('warning', '提示', '库存必须是大于等于起订量的整数');
-            //     return result;
-            // }
-            if (!goods.editMinPackQty) {
-                goods.editMinPackQtyInValid = true;
-                toaster.pop('warning', '提示', '包装数量必须填写');
-                return result;
-            }
-            if (!$scope.isInt.test(goods.editMinPackQty)) {
-                goods.editMinPackQtyInValid  = true;
-                toaster.pop('warning', '提示', '包装数必须是正整数');
-                return result;
-            }
-            if (Number(goods.editMinPackQty) > $scope.maxPackQty) {
-                goods.editMinPackQtyInValid = true;
-                toaster.pop('warning', '提示', '包装量数量必须小于' + $scope.maxPackQty);
-                return result;
-            }
-            if (!goods.editBreakUp) {
-                $scope.isNotBreakUp(goods);
-            }
-            var lastEnd = -1;
-            for (var i = 0; i < goods.editPrices.length; i++) {
-                if (isNaN(goods.editPrices[i].start)) {
-                    goods.editPrices[i].startInValid = true;
-                    toaster.pop('warning', '提示', '分段数量必须是数字');
-                    return result;
-                }
-                if (goods.editPrices[i].start <= lastEnd) {
-                    goods.editPrices[i].startInValid = true;
-                    toaster.pop('warning', '提示', "存在分段的起始值小于等于上一个分段的结束值");
-                    return result;
-                }
-                if (!goods.editPrices[i].end) {
-                    goods.editPrices[i].endInValid = true;
-                    toaster.pop('warning', '提示', '分段数量必须填写');
-                    return result;
-                }
-                if (isNaN(goods.editPrices[i].end)) {
-                    goods.editPrices[i].endInValid = true;
-                    toaster.pop('warning', '提示', '分段数量必须是数字');
-                    return result;
-                }
-                if (goods.editPrices[i].start > goods.editPrices[i].end) {
-                    goods.editPrices[i].startInValid = true;
-                    goods.editPrices[i].endInValid = true;
-                    toaster.pop('warning', '提示', "存在分段的起始值大于分段的结束值");
-                    return result;
-                }
-                if (goods.currencyName.indexOf('USD') > -1) {
-                    if (!goods.editPrices[i].uSDPrice) {
-                        goods.editPrices[i].priceInvalid = true;
-                        toaster.pop('warning', '提示', "单价必须是大于0的数字");
-                        return result;
-                    } else if (isNaN(goods.editPrices[i].uSDPrice)) {
-                        goods.editPrices[i].priceInvalid = true;
-                        toaster.pop('warning', '提示', "单价必须是大于0的数字");
-                        return result;
-                    } else if (Number(goods.editPrices[i].uSDPrice) <= 0) {
-                        goods.editPrices[i].priceInvalid = true;
-                        toaster.pop('warning', '提示', "单价必须是大于0的数字");
-                        return result;
-                    }
-                }
-                if (goods.currencyName.indexOf('RMB') > -1) {
-                    if (!goods.editPrices[i].rMBPrice) {
-                        goods.editPrices[i].priceInvalid = true;
-                        toaster.pop('warning', '提示', "单价必须是大于0的数字");
-                        return result;
-                    } else if (isNaN(goods.editPrices[i].rMBPrice)) {
-                        goods.editPrices[i].priceInvalid = true;
-                        toaster.pop('warning', '提示', "单价必须是大于0的数字");
-                        return result;
-                    } else if (Number(goods.editPrices[i].rMBPrice) <= 0) {
-                        goods.editPrices[i].priceInvalid = true;
-                        toaster.pop('warning', '提示', "单价必须是大于0的数字");
-                        return result;
-                    }
-                }
-            }
-            if (goods.currencyName.indexOf('USD') > -1 && !$scope.compareNum(goods.editMinDelivery, goods.editMaxDelivery, 2, goods)) {
-                return result;
-            }
-
-            if (goods.currencyName.indexOf('RMB') > -1 && !$scope.compareNum(goods.editMinDelivery, goods.editMaxDelivery, 1, goods)) {
-                return result;
-            }
-
-            result = true;
-            return result;
-        }
-
-        /**
-         * 更新库存的信息
-         * @param commodity
-         */
-        $scope.updateGoods = function(commodity, index){
-            //验证库存信息
-            if(!$scope.checkGoodsInfo(commodity)) {
-                return ;
-            }
-            //更新分段信息
-            if(!changeQtyPrice(commodity)) {
-                return ;
-            };
-
-
-
-            //将修改的信息映射到对应的字段
-            inserseCommodity(commodity);
-            Goods.updateGoods(null, commodity, function(data){
-                if(data.code == 1) {
-                    toaster.pop('success', '修改成功');
-                    loadData()
-                    // $scope.currenctGoods.splice(index, 1, data.data);
-                }else {
-                    toaster.pop('error', '失败', data.message);
-                }
-            }, function(response){
-                toaster.pop('error', '失败', response.data);
-            });
-        };
-
-        var inserseCommodity = function (commodity) {
-            commodity.packaging = commodity.editPackaging;
-            commodity.produceDate = commodity.editProduceDate;
-            commodity.oldReserve =  commodity.reserve;
-            commodity.reserve =  commodity.editReserve;
-            commodity.minBuyQty = commodity.editMinBuyQty;
-            commodity.prices = commodity.editPrices;
-            commodity.selfDeliveryHKMinTime = commodity.editSelfDeliveryHKMinTime;
-            commodity.selfDeliveryHKMaxTime = commodity.editSelfDeliveryHKMaxTime;
-            commodity.selfDeliveryDemMinTime = commodity.editSelfDeliveryDemMinTime;
-            commodity.selfDeliveryDemMaxTime = commodity.editSelfDeliveryDemMaxTime;
-            commodity.minDelivery = commodity.editMinDelivery;
-            commodity.maxDelivery = commodity.editMaxDelivery;
-            commodity.selfSale = commodity.editSelfSale;
-            commodity.minPackQty = commodity.editMinPackQty;
-            commodity.img = commodity.editPic;
-            commodity.breakUp = typeof commodity.editBreakUp == 'undefined' ? false : commodity.editBreakUp;
-            commodity.tag = commodity.editTag;
-        };
-
-        /**
-         * 修改批次信息的图片
-         */
-        $scope.editGoodsPicture = function(pic, commodity) {
-            var modalInstance = $modal.open({
-                templateUrl : 'static/view/vendor/modal/edit_goods_modal.html',
-                size : 'md',
-                controller : 'editPictureCtrl',
-                resolve : {
-                    pic : function() {
-                        return pic;
-                    }
-                }
-            });
-            modalInstance.result.then(function (editPic) {
-                if(editPic) {
-                    commodity.editPic = editPic;
-                }
-            }, function() {
-
-            });
-        }
-
-        /**
-        * 修改规格书
-        */
-        $scope.editRegulPicture = function(Regulpic, commodity) {
-          var modalInstance = $modal.open({
-            templateUrl : 'static/view/vendor/modal/edit_regul_modal.html',
-            size : 'md',
-            controller : 'editRegulationCtrl',
-            resolve : {
-              Regulpic : function() {
-                return Regulpic;
-              },
-              showAction: function() {
-                return false
-              },
-              ChooseItem: function() {
-                commodity.standard = !commodity.uuid ? 0 : 1
-                commodity.pbranden = commodity.brandNameEn
-                commodity.kind = commodity.kindNameCn
-                commodity.pcmpcode = commodity.code
-                return commodity
-              }
-            }
-          });
-          modalInstance.result.then(function (Regulpic) {
-            if(Regulpic) {
-              commodity.attach = Regulpic.url;
-            }
-          }, function() {
-
-          });
-        }
-
-      /**
-         * 切换销售模式
-         */
-        $scope.changeSaleMode = function (commodity) {
-            StoreCms.validCommdityisAdvantageCommodity({batchcode : commodity.batchCode}, function (data) {
-                if(data.code != 1) {
-                    toaster.pop('warning', '提示', data.message);
-                }
-            }, function (response) {
-            });
-
-        };
-
-        /*******************************编辑库存信息 end****************************************/
-
-        /**
-         * 获取当前需要下载的在售产品信息的ID
-         */
-        var getDownLoadGoodsId = function() {
-            var goodsID = [];
-            angular.forEach($scope.currenctGoods, function (good) {
-                goodsID.push(good.id);
-            });
-            return goodsID;
-        };
-
-        function downloadByJs(url, keyword, type) {
-            $http({
-                method: 'get',
-                dataType: 'json',
-                url: url,
-                params: {
-                    keyword: keyword,
-                    isSelfSupport: type
-                }
-            }).success(function (data) {
-                var form = $("<form>");   //定义一个form表单
-                form.attr('style', 'display:none');   //在form表单中添加查询参数
-                form.attr('target', '');
-                form.attr('method', 'get');
-                form.attr('action', url);
-
-                var input1 = $('<input>');
-                input1.attr('type', 'hidden');
-                input1.attr('name', 'keyword');
-                input1.attr('value', keyword);
-
-                var input2 = $('<input>');
-                input1.attr('type', 'hidden');
-                input1.attr('name', 'isSelfSupport');
-                input1.attr('value', type);
-
-                $('body').append(form);  //将表单放置在web中
-                form.append(input1);   //将查询参数控件提交到表单上
-                form.append(input2);
-                form.submit();
-            }).error(function (response) {
-                toaster.pop('error', response);
-            });
-        }
-
-        function downloadSelectedByJs(url, idList) {
-            $http({
-                method: 'get',
-                dataType: 'json',
-                url: url,
-                params: {
-                    ids: idList
-                }
-            }).success(function (data) {
-                var form = $("<form>");   //定义一个form表单
-                form.attr('style', 'display:none');   //在form表单中添加查询参数
-                form.attr('target', '');
-                form.attr('method', 'get');
-                form.attr('action', url);
-
-                var input1 = $('<input>');
-                input1.attr('type', 'hidden');
-                input1.attr('name', 'ids');
-                input1.attr('value', idList);
-
-                $('body').append(form);  //将表单放置在web中
-                form.append(input1);   //将查询参数控件提交到表单上
-                form.submit();
-            }).error(function (response) {
-                toaster.pop('error', response);
-            });
-        }
-
-        // 下载模板
-        $scope.download = function() {
-            if ($scope.currenctGoods && $scope.currenctGoods.length == 0) {
-                toaster.pop('info', '当前产品列表为空,无法下载');
-                return;
-            }
-            if ($scope.chooseAllPage) {
-                if ($scope.selfSupport === $scope.selfSupportType.SELF_SUPPORT) {
-                    $scope.param.isSelfSupport = true;
-                } else if ($scope.selfSupport === $scope.selfSupportType.CONSIGNMENT) {
-                    $scope.param.isSelfSupport = false;
-                } else {
-                    $scope.param.isSelfSupport = null;
-                }
-                downloadByJs('trade/goods/down/goods', $scope.param.keyword, $scope.param.isSelfSupport);
-            } else {
-                getChooseInfo();
-                if (!$scope.choosedIds || $scope.choosedIds.length == 0) {
-                    toaster.pop("info", "您尚未选中任何产品");
-                    return ;
-                }
-                var idStr = $scope.choosedIds.join('-');
-                downloadSelectedByJs('trade/goods/down/ids', idStr);
-            }
-        };
-
-        /**
-         * 下载当前页的订单信息
-         */
-        $scope.localInfo = {};
-        $scope.downGoods = function () {
-            var listId = getDownLoadGoodsId();
-            if(listId.length < 1) {
-                toaster.pop('warning', '提示', '当前需要下载的订单条数为0');
-                return ;
-            }
-            Loading.show();
-            $scope.localInfo.ids = listId.join("-");
-            $scope.$apply();
-            var form = document.getElementById('down-load-goods');
-            form.action = 'trade/goods/down/ids';
-            form.submit();
-            var clockID = null;
-            var getDownLoadStatus = function () {
-                $.ajax({
-                    url : 'trade/goods/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);
-                        }
-                    }
-                });
-            };
-            getDownLoadStatus();
-        };
-
-        // 点击下架操作
-        $scope.soldOut = function (commodity) {
-            $scope.isSoldOut = true;
-            $scope.soldOutCommodity = commodity;
-        };
-
-        // 取消删除的操作
-        $scope.cancleSoldOut = function (event) {
-            if (event) {
-                event.stopPropagation();
-            }
-            $scope.isSoldOut = false;
-            $scope.soldOutCommodity = null;
-        };
-
-        // 点击下架操作
-        $scope.soldOut = function (event, commodity) {
-            if (event) {
-                event.stopPropagation();
-            }
-            $scope.isSoldOut = true;
-            $scope.soldOutCommodity = commodity;
-        };
-
-        var loadDataReload = function () {
-            $scope.param = {
-                page : 1,
-                count : 10,
-                sorting : {
-                    createdDate: 'DESC'
-                },
-                status : "601-602"
-            };
-            loadData();
-        };
-
-        loadData();
-
-        /**
-         * 筛选商品类型
-         *
-         * @param type		商品上架类型
-         */
-        $scope.selfSupport = '销售方式';
-        $scope.changeSupportType = function (type) {
-            if (!type) return ;
-            $scope.selfSupport = type;
-            loadDataReload();
-        };
-
-        /**
-         * 如果不拆分需要重新计算最小起订量的信息
-         * @param goods
-         */
-        $scope.isNotBreakUp = function (commodity) {
-            if (commodity.editMinPackQty&&commodity.editMinBuyQty) {
-                var remainder = commodity.editMinBuyQty % commodity.editMinPackQty;
-                if (remainder != 0) {
-                    toaster.pop('warning', '提示', '不可拆卖时,起订量必须是包装数量的倍数');
-                    if (parseInt(commodity.editMinBuyQty) > parseInt(commodity.editMinPackQty)) {
-                        commodity.editMinBuyQty = Number(NumberService.sub(commodity.editMinBuyQty, remainder));
-                    } else {
-                        commodity.editMinBuyQty = commodity.editMinPackQty;
-                    }
-                    commodity.editPrices[0].start = commodity.editMinBuyQty;
-                }
-            }
-        }
-
-        $scope.batchModify = false;
-        $scope.modifyResult = false;
-        $scope.modifyBatch = function () {
-            $scope.batchModify = true;
-        };
-
-        $scope.importExcel = function () {
-            if(($scope.myFile == null) || ($scope.myFile.length == 0)) {
-                return ;
-            }
-            var file = $scope.myFile[0];
-            if (!file) {
-                toaster.pop('info', '请选择需要上传的文件');
-                return;
-            }
-            $upload.upload({
-                url: 'release/product/modify/excel',
-                file: file,
-                method: 'POST'
-            }).success(function(data) {
-                $scope.selectFile(' ');
-                $scope.myFile = [];
-                $scope.modifyData = data;
-                $scope.batchModify = false;
-                $scope.modifyResult = true;
-                if ($scope.modifyData.success > 0) {
-                    loadData();
-                }
-            }).error(function(response) {
-                $scope.selectFile(' ');
-                $scope.myFile = [];
-                toaster.pop('error', response.data || response);
-            });
-        };
-
-        //选择文件
-        $scope.selectFile = function(value) {
-            if(value != null) {
-                upload_text.value = value;
-            }else {
-                var fileInput = angular.element('#uploadCommodity')[0];
-                upload_text.value = fileInput.value;
-            }
-        };
-
-        // 下载未修改成功的数据
-        $scope.downloadExcel = function(){
-            var param = {isAjax : true, batch : $scope.modifyData.batch};
-            if ($scope.modifyData && $scope.modifyData.batch && ($scope.modifyData.fail || $scope.modifyData.filter)) {
-                var form = document.getElementById('load-error');
-                form.action= 'release/product/modify/failure';
-                form.submit();
-                Loading.show();
-                var intervalId = null;
-                var getDownLoadStatus = function () {
-                    $.ajax({
-                        type: 'GET',
-                        url: 'release/product/modify/failure',
-                        data : param,
-                        dataType : 'json',
-                        success: function (data) {
-                            if (!data.load) {
-                                $scope.$apply(function () {
-                                    Loading.hide();
-                                    /*toaster.pop('success', '数据处理完毕,正在下载文件,请稍等。');*/
-                                });
-                                clearInterval(intervalId);
-                            }
-                        },
-                        error: function () {
-                            Loading.hide();
-                            clearInterval(intervalId);
-                        }
-                    });
-                };
-                intervalId= setInterval(function () {
-                    getDownLoadStatus();
-                }, 500);
-            } else {
-                if (!$scope.modifyData.fail && !$scope.modifyData.filter) {
-                    toaster.pop('info', '提示', '您没有修改不成功的数据');
-                }
-            }
-        };
-      $scope.onCodeChange = function(code) {
-        if ((/[^\x00-\xff]/g).test(code)) {
-          var chineseIndex = -1;
-          for (var i = 0; i < code.length; i++) {
-            if ((/[^\x00-\xff]/g).test(code.charAt(i))) {
-              chineseIndex = i;
-              break;
-            }
-          }
-          $scope.commodity.kindNameCn = cutOutString(code, chineseIndex);
-        } else if (code && getRealLen(code) > 100) {
-          $scope.commodity.kindNameCn = cutOutString(code, 100);
-        }
-      }
-      $scope.onBrandChange = function(brand) {
-        if (brand && getRealLen(brand) > 50) {
-          $scope.commodity.brandNameEn = cutOutString(brand, 50);
-        } else if ((/[^\x00-\xff]/g).test(brand)) {
-          var chineseIndex = -1;
-          for (var i = 0; i < brand.length; i++) {
-            if ((/[^\x00-\xff]/g).test(brand.charAt(i)) && !(/[\u4e00-\u9fa5]/).test(brand.charAt(i))) {
-              chineseIndex = i;
-              break;
-            }
-          }
-          if (chineseIndex > -1) {
-            $scope.commodity.brandNameEn = brand.substring(0, chineseIndex);
-          }
-        }
-      }
-
-      var getRealLen = function(str) {
-        var len = 0;
-        for (var i = 0; i < str.length; i++) {
-          if (str.charCodeAt(i) > 127 || str.charCodeAt(i) === 94) {
-            len += 2;
-          } else {
-            len++;
-          }
-        }
-        return len;
-      }
     }]);
-
     // 上传批次图片
     app.register.controller('editPictureCtrl', ['$scope', 'pic', '$modalInstance', function ($scope, pic, $modalInstance) {
         $scope.pic = pic;

+ 186 - 126
src/main/webapp/resources/view/vendor/forstore/vendor_storage.html

@@ -212,9 +212,6 @@
     .wanted_list .pagination{
         margin: 0;
     }
-    .ng-table-pager{
-        padding-bottom: 20px;
-    }
 
     /*编辑*/
     .vendor-tab .img{
@@ -939,18 +936,12 @@
         text-align: center;
         font-size: 14px;
         border-bottom: 1px solid #e9e9e9;
+        white-space: nowrap;
     }
     .wanted_list .wanted-tab tbody>tr>td input{
         width:90%;
         margin: 0 auto;
     }
-    .wanted_list .wanted-tab tbody>tr>td input.form-control[readonly]{
-        border: 0 !important;
-        background: none;
-        box-shadow: none;
-        padding:0;
-        margin:0;
-    }
     .wanted_list .table>tbody+tbody {
          border:none;
     }
@@ -996,33 +987,34 @@
         display:inline-block;
         padding: 0 10px;
         vertical-align:middle;
-    }
-    .down-form .down-key ul li span:nth-child(1){width:20%;}
-    .down-form .down-key ul li span:nth-child(2){width:20%;}
-    .down-form .down-key ul li span:nth-child(3){width: 30%;}
-    .down-form .down-key ul li span:nth-child(4){
-        width:25%;
         overflow: hidden;
         text-overflow: ellipsis;
         white-space: nowrap;
     }
+    .down-form .down-key ul li span:nth-child(1){width:20%;}
+    .down-form .down-key ul li span:nth-child(2){width:20%;}
+    .down-form .down-key ul li span:nth-child(3){width: 30%;}
+    .down-form .down-key ul li span:nth-child(4){width:25%;}
     .wanted_list .wanted-sub-tab{
         margin: 0 auto;
         width: 98%;
+        table-layout: fixed;
     }
-    .wanted_list .wanted-sub-tab caption{}
     .wanted_list .wanted-sub-tab caption span{
         float:right;
         margin-right:20px;
     }
-    .wanted_list .wanted-sub-tab thead{}
-    .wanted_list .wanted-sub-tab thead tr{}
     .wanted_list .wanted-sub-tab thead tr th{
         font-weight: normal;
     }
-    .wanted_list .wanted-sub-tab tbody{}
-    .wanted_list .wanted-sub-tab tbody tr{}
-    .wanted_list .wanted-sub-tab tbody tr td{}
+    .wanted_list .wanted-sub-tab tbody tr td span{
+        display:inline-block;
+        width:100%;
+        overflow: hidden;
+        white-space: nowrap;
+        text-overflow:ellipsis;
+        vertical-align: middle;
+    }
 
     .down-word{
         height:400px;
@@ -1052,15 +1044,86 @@
         display:inline-block;
         padding: 0 10px;
         vertical-align:middle;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        white-space: nowrap;
     }
     .down-word ul li span:nth-child(1){width:20%;}
     .down-word ul li span:nth-child(2){width:20%;}
     .down-word ul li span:nth-child(3){width: 30%;}
-    .down-word ul li span:nth-child(4){
-        width:25%;
-        overflow: hidden;
-        text-overflow: ellipsis;
-        white-space: nowrap;
+    .down-word ul li span:nth-child(4){width:25%;}
+    .wanted_list .logistics-info{
+        text-align: left;
+        padding-left:20px;
+    }
+    .wanted_list .logistics-info span{
+        text-align: left;
+        margin-right:10px;
+    }
+    .wanted_list .logistics-info span.input-ul {
+        position:relative;
+        display:inline-block;
+        width: 170px;
+    }
+
+    .wanted_list .logistics-info span.input-ul input {
+        vertical-align: middle;
+        width: 170px;
+        margin-top: -1px;
+        height: 28px;
+    }
+
+    .wanted_list .logistics-info span.input-ul>div {
+        position: absolute;
+        top:99%;
+        left:0;
+        -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
+        box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
+    }
+
+    .wanted_list .logistics-info span.input-ul>div>a {
+        width: 170px;
+        background: #e8e8e8;
+        color: #666 !important;
+        display: block;
+        padding: 0 10px;
+        line-height: 40px;
+    }
+    .wanted_list .logistics-info .input-ul .dropdown-menu {
+        position: unset;
+        float: none;
+        line-height: 23px;
+        max-height: 120px;
+        overflow-y: auto;
+        width: 170px;
+        display: block;
+        overflow-x: hidden;
+        border-radius: 0;
+        box-shadow: none;
+        margin-top: 1px;
+        border: none;
+    }
+
+    .wanted_list .logistics-info .input-ul .dropdown-menu li {
+        font-size: 14px;
+        cursor: pointer;
+        padding-left: 13px;
+    }
+
+    .wanted_list .logistics-info .input-ul .dropdown-menu li:hover,
+    .wanted_list .logistics-info .input-ul .dropdown-menu li.active {
+        color: #fff;
+        background: #5078cb;
+    }
+    .input-ul ::-webkit-scrollbar {
+        padding-left: 0 !important;
+        background-color: #c1c1c1;
+        width: 8px;
+    }
+
+    .input-ul ::-webkit-scrollbar-thumb {
+        -webkit-border-radius: 5px !important;
+        border-radius: 5px !important;
     }
 </style>
 <div class="user_right fr" ng-click="">
@@ -1088,11 +1151,6 @@
         <div class="search-check">
             <div class="radio-block" ng-if="handleItem !== 1">
                 更多筛选:
-                <label class="com-check-radio">
-                    <input type="radio" id="dateAll" name="date" ng-click="setFilters('dateArea', 'All')" ng-checked="dateArea == 'All'">
-                    <label for="dateAll"></label>
-                    全部
-                </label>
                 <label class="com-check-radio">
                     <input type="radio" id="oneMonth" name="date" ng-click="setFilters('dateArea', 'oneMonth')" ng-checked="dateArea == 'oneMonth'">
                     <label for="oneMonth"></label>
@@ -1116,18 +1174,6 @@
                 <div class="search fr check">
                     <input type="text" class="form-control" ng-model="keyword" ng-search="onSearch()" placeholder="发货单/卖家"/>
                     <button ng-click="onSearch()" style="float: left;">搜索</button>
-                    <!--<div class="operate-btn more-operate">-->
-                        <!--<span>更多操作</span>-->
-                        <!--<span class="expander">-->
-                        <!--<span ng-click="download()">导出选中</span>-->
-                        <!--<span ng-click="batchOperation(1)" name="delete-material">删除选中</span>-->
-                        <!--<span ng-click="batchOperation(2)">下架选中</span>-->
-                        <!--<span ng-click="modifyBatch()">批量修改</span>-->
-                    <!--</span>-->
-                    <!--</div>-->
-                    <form style="display: none;" id="down-load-goods" method="get">
-                        <input type="hidden" name="ids" ng-value="localInfo.ids">
-                    </form>
                 </div>
             </div>
             <div class="radio-block">
@@ -1169,19 +1215,24 @@
         </div>
 
         <div class="wanted_list">
-            <table class="wanted-tab table">
+            <table class="wanted-tab table" ng-table="storageTableParams">
                 <thead>
                 <tr>
                     <th width="120" ng-bind="storage_tab === 'inBound' ? '入库单号' : '出库单号'"></th>
                     <th width="180" ng-bind="storage_tab === 'inBound' ? '*发货单' : '*订单号'" ng-if="handleItem === 2"></th>
                     <th width="180" ng-bind="storage_tab === 'inBound' ? '卖家名称' : '买家名称'"></th>
-                    <th class="filter" width="110" ng-if="handleItem === 1">类型</th>
-                    <th class="filter" width="110" ng-if="handleItem !== 1">
+                    <th class="filter" width="110" ng-if="handleItem !== 0">类型</th>
+                    <th class="filter" width="110" ng-if="handleItem === 0">
                         <a ng-bind="selfSupport">全部类型</a> <i class="fa fa-angle-down fa-angle-up"></i>
-                        <div class="hover-show">
-                            <a ng-click="changeSupportType(selfSupportType.ALL)">全部类型</a>
-                            <a ng-click="changeSupportType(selfSupportType.SELF_SUPPORT)" ng-bind="storage_tab === 'inBound' ? '其它入库' : '其它出库'"></a>
-                            <a ng-click="changeSupportType(selfSupportType.CONSIGNMENT)" ng-bind="storage_tab === 'inBound' ? '销售入库' : '销售出库'"></a>
+                        <div class="hover-show" ng-if="storage_tab === 'inBound'">
+                            <a ng-click="changeSupportType(INBOUND)" ng-bind="boundType.INBOUND">全部类型</a>
+                            <a ng-click="changeSupportType(OTHER_INBOUND)" ng-bind="boundType.OTHER_INBOUND">其它入库</a>
+                            <a ng-click="changeSupportType(PURCHASE_INBOUND)" ng-bind="boundType.PURCHASE_INBOUND">销售入库</a>
+                        </div>
+                        <div class="hover-show" ng-if="storage_tab === 'outBound'">
+                            <a ng-click="changeSupportType(OUTBOUND)" ng-bind="boundType.OUTBOUND">全部类型</a>
+                            <a ng-click="changeSupportType(OTHER_OUTBOUND)" ng-bind="boundType.OTHER_OUTBOUND">其它出库</a>
+                            <a ng-click="changeSupportType(SELL_OUTBOUND)" ng-bind="boundType.SELL_OUTBOUND">销售出库</a>
                         </div>
                     </th>
                     <th width="90">录入人</th>
@@ -1191,22 +1242,22 @@
                 </thead>
 
                 <!--查看出入库-->
-                <tbody ng-if="handleItem === 0" ng-repeat="item in lockData" ng-class="{'toggle-mode': item.seleted}">
+                <tbody ng-if="handleItem === 0" ng-repeat="item in storageList" ng-class="{'toggle-mode': item.seleted}">
                 <tr>
-                    <td>系统自动生成</td>
-                    <td ng-bind="item.maiName">深圳有陵县什么 翁一搂的</td>
-                    <td ng-bind="item.selfSupport">腌肉入库</td>
-                    <td ng-bind="item.uuid">张三</td>
-                    <td ng-bind="item.date">2018-12-12 12:!@:</td>
-                    <td><span class="btn-toggle" ng-show="item.seleted" ng-click="item.seleted = !item.seleted">收起 <i class="fa fa-angle-up"></i></span><span ng-click="item.seleted = !item.seleted" class="btn-toggle" ng-show="!item.seleted">展开 <i class="fa fa-angle-down"></i></span></td>
+                    <td ng-bind="item.inOutId">系统自动生成</td>
+                    <td ng-bind="item.affiliatedEnterprise">深圳有陵县什么 翁一搂的</td>
+                    <td ng-bind="item.opertatorType">腌肉入库</td>
+                    <td ng-bind="item.operaterUserName">张三</td>
+                    <td ng-bind="item.createTime | date : 'yyyy-MM-dd: hh:mm:ss'">2018-12-12 12:!@:</td>
+                    <td><span class="btn-toggle" ng-show="item.seleted" ng-click="item.seleted = !item.seleted">收起 <i class="fa fa-angle-up"></i></span><span ng-click="unfoldClick(storageList,item)" class="btn-toggle" ng-show="!item.seleted">展开 <i class="fa fa-angle-down"></i></span></td>
                 </tr>
                 <tr ng-show="item.seleted">
                     <td colspan="6">
                         <div class="sub-table-head">
                             <table class="wanted-sub-tab table">
-                                <caption>
+                                <caption ng-if="item.associateOrderid">
                                     明细列表:
-                                    <span>所属订单:1231243243243543534543</span>
+                                    <span>所属订单:<span ng-bind="item.associateOrderid"></span></span>
                                 </caption>
                                 <thead>
                                 <tr>
@@ -1221,16 +1272,16 @@
                                 </thead>
                             </table>
                         </div>
-                        <div style="height:300px;overflow-y: auto;">
+                        <div style="max-height:300px;overflow-y: auto;">
                             <table class="wanted-sub-tab table">
-                                <tr ng-repeat="(index, list) in item.content">
-                                    <td width="60" ng-bind="index + 1">45325</td>
-                                    <td width="110" ng-bind="list.code">45325</td>
-                                    <td width="130" ng-bind="list.code1">45325</td>
-                                    <td ng-bind="list.code2">45325</td>
-                                    <td width="210" ng-bind="list.code3">45325</td>
-                                    <td width="130" ng-bind="list.code4">45325</td>
-                                    <td width="130" ng-bind="list.code5">45325</td>
+                                <tr ng-repeat="(index, list) in item.inOutboundDetails">
+                                    <td width="60" ng-bind="index + 1"></td>
+                                    <td width="110"><span ng-bind="list.cmpCode" title="{{list.cmpCode}}"></span></td>
+                                    <td width="130"><span ng-bind="list.brandEn" title="{{list.brandEn}}"></span></td>
+                                    <td><span ng-bind="list.kindName" title="{{list.kindName}}"></span></td>
+                                    <td width="210"><span ng-bind="list.spec" title="{{list.spec}}"></span></td>
+                                    <td width="130"><span ng-bind="list.qty" title="{{list.qty}}"></span></td>
+                                    <td width="130"><span ng-bind="list.price" title="{{list.price}}"></span></td>
                                 </tr>
                             </table>
                         </div>
@@ -1244,9 +1295,9 @@
                     <td>系统自动生成</td>
                     <td><input type="text" class="form-control" ng-model="othenParam.enName"></td>
                     <td ng-bind="storage_tab === 'inBound' ? '其它入库' : '其它出库'">其它入库</td>
-                    <td>张三</td>
+                    <td ng-bind="userInfo.userName">张三</td>
                     <td ng-bind="newDate">2018-12-12</td>
-                    <td><span class="btn-click" ng-click="otherAddClick()">确认</span><span class="btn-click" ng-click="addOneTable('clear')">取消</span></td>
+                    <td><a class="btn-click" ng-click="otherAddClick()">确认</a><a class="btn-click" ng-click="otherAddClick('clear')">取消</a></td>
                 </tr>
                 <tr>
                     <td colspan="6">
@@ -1274,26 +1325,26 @@
                                         <div ng-show="item.show" class="down-key" ng-mouseenter="item.show = true">
                                             <ul class="list-unstyled">
                                                 <li ng-repeat="list in listData" ng-click="addProductId(list, item)">
-                                                    <span ng-bind="list.pcmpcode">-01k</span>
-                                                    <span ng-bind="list.pbranden || '-'"></span>
-                                                    <span ng-bind="list.kind || '-'"></span>
-                                                    <span ng-bind="list.spec || '-'"></span>
+                                                    <span ng-bind="list.pcmpcode" title="{{list.pcmpcode}}">-01k</span>
+                                                    <span ng-bind="list.pbranden || '-'" title="{{list.pbranden}}"></span>
+                                                    <span ng-bind="list.kind || '-'" title="{{list.kind}}"></span>
+                                                    <span ng-bind="list.spec || '-'" title="{{list.spec}}"></span>
                                                 </li>
                                             </ul>
                                         </div>
                                     </div>
                                 </td>
-                                <td><span ng-bind="item.pbranden || '-'"></span></td>
-                                <td><span ng-bind="item.kind || '-'"></span></td>
-                                <td><span ng-bind="item.spec || '-'"></span></td>
+                                <td><span ng-bind="item.pbranden || '-'" title="{{item.pbranden}}"></span></td>
+                                <td><span ng-bind="item.kind || '-'" title="{{item.kind}}"></span></td>
+                                <td><span ng-bind="item.spec || '-'" title="{{item.spec}}"></span></td>
                                 <td><input type="text" class="form-control" ng-model="item.qty"></td>
                                 <td><input type="text" class="form-control" ng-model="item.price"></td>
                             </tr>
                             <tr>
                                 <td colspan="7">
-                                    <span class="btn-click" ng-click="addOneTable('one')">增加一</span>
-                                    <span class="btn-click" ng-click="addOneTable('ten')">增加十条</span>
-                                    <span class="btn-click" ng-click="addOneTable('clear')">清空</span>
+                                    <a class="btn-click" ng-click="addOneTable('one')">增加一</a>
+                                    <a class="btn-click" ng-click="addOneTable('ten')">增加十条</a>
+                                    <a class="btn-click" ng-click="addOneTable('clear')">清空</a>
                                 </td>
                             </tr>
                             </tbody>
@@ -1302,49 +1353,76 @@
                 </tr>
                 </tbody>
 
-                <!--采购入库-->
-                <tbody ng-if="handleItem === 2" ng-repeat="item in lockData" ng-class="{'toggle-mode': item.seleted}">
+                <!--采购入库和销售出库-->
+                <tbody ng-if="handleItem === 2" ng-repeat="item in storageList" ng-class="{'toggle-mode': item.seleted}">
                 <tr>
                     <td>系统自动生成</td>
-                    <td>HFH32543256438403685</td>
-                    <td ng-bind="item.maiName">深圳有陵县什么 翁一搂的</td>
-                    <td ng-bind="item.selfSupport">腌肉入库</td>
-                    <td ng-bind="item.uuid">张三</td>
-                    <td ng-bind="item.date">2018-12-12 12:!@:</td>
-                    <td ng-if="!item.seleted"><span class="btn-click" ng-click="item.seleted = !item.seleted" ng-bind="storage_tab === 'inPut' ? '收货入库' : '发货出库'"></span></td>
-                    <td ng-if="item.seleted"><span class="btn-click">确定</span><span class="btn-click">取消</span></td>
+                    <td ng-bind="item.purchaseid">H</td>
+                    <td ng-bind="item.maiName">深</td>
+                    <td ng-bind="storage_tab === 'outBound' ? '销售出库' : '采购入库'">腌肉入库</td>
+                    <td ng-bind="item.buyentername || item.buyername">张三</td>
+                    <td ng-bind="item.createtime | date: 'yyyy-MM-dd'">2018-12-12</td>
+                    <td ng-if="!item.seleted"><a class="btn-click" ng-click="item.seleted = !item.seleted;unfoldClick(storageList, item)" ng-bind="storage_tab === 'inPut' ? '收货入库' : '发货出库'"></a></td>
+                    <td ng-if="item.seleted"><a class="btn-click">确定</a><a class="btn-click">取消</a></td>
+                </tr>
+                <tr ng-if="item.seleted && storage_tab === 'outBound'">
+                    <td colspan="7" style="background:#f5f5f5;">
+                        <div class="logistics-info">
+                            <span>物流公司 :&nbsp;</span>
+                            <span class="input-ul">
+                                <input id="logistics-input" type="text" class="form-control select-adder" ng-focus="getItemFocus()"
+                                        ng-blur="onItemBlur()" ng-keydown="onKeyup()" ng-model="logistics.companyName" placeholder="请选择物流公司" autocomplete="off"
+                                        maxlength="15" readonly="readonly">
+                                <div ng-if="showCompanyName">
+                                  <ul id="ulContent" class="dropdown-menu">
+                                    <li ng-click="showDefaultText()">请选择物流公司</li>
+                                    <li ng-click="showText(data)" ng-repeat="data in data_list" ng-class="{'active': $index==selectIndex}" ng-bind="data.companyName"></li>
+                                  </ul>
+                                  <a ng-click="addDistributor()">+&nbsp;新增配送商</a>
+                                </div>
+                              </span>
+                            <span style="width: 10%;"> 物流单号 :&nbsp;</span>
+                            <span style="margin-right: 20px; width: 160px;">
+                            <form name="myForm" style="display:inline-block;width:140px;">
+                              <!--ng-pattern="/^[A-Za-z0-9]+$/"-->
+                              <input name="number" type="text" class="form-control" style="height: 28px" ng-model="logistics.number" placeholder="请输入物流单号"
+                                     maxlength="20" autocomplete="off" />
+                            </form>
+                          </span>
+                        </div>
+                    </td>
                 </tr>
                 <tr ng-show="item.seleted">
                     <td colspan="7">
                         <div class="sub-table-head">
                             <table class="wanted-sub-tab table">
-                                <caption>
-                                    明细列表:
-                                    <span>所属订单:1231243243243543534543</span>
-                                </caption>
                                 <thead>
                                 <tr>
                                     <th width="60">序号</th>
-                                    <th width="110">型号</th>
-                                    <th width="130">品牌</th>
+                                    <th width="150">型号</th>
+                                    <th width="110">品牌</th>
                                     <th>物料名称</th>
-                                    <th width="210">规格</th>
-                                    <th width="130">数量(PCS)</th>
-                                    <th width="130">单价</th>
+                                    <th width="180">规格</th>
+                                    <th width="100" ng-if="storage_tab === 'outBound'">应出库PCS</th>
+                                    <th width="100" ng-if="storage_tab === 'outBound'">已出库PCS</th>
+                                    <th width="100">数量(PCS)</th>
+                                    <th width="80">单价</th>
                                 </tr>
                                 </thead>
                             </table>
                         </div>
-                        <div style="height:300px;overflow-y: auto;">
+                        <div style="max-height:300px;overflow-y: auto;">
                             <table class="wanted-sub-tab table">
-                                <tr ng-repeat="(index, list) in item.content">
-                                    <td width="60" ng-bind="index + 1">45325</td>
-                                    <td width="110" ng-bind="list.code">45325</td>
-                                    <td width="130" ng-bind="list.code1">45325</td>
-                                    <td ng-bind="list.code2">45325</td>
-                                    <td width="210" ng-bind="list.code3">45325</td>
-                                    <td width="130"><input type="text" class="form-control"></td>
-                                    <td width="130" ng-bind="list.code5">45325</td>
+                                <tr ng-repeat="(index, list) in item.purchaseDetails">
+                                    <td width="60" ng-bind="index + 1"></td>
+                                    <td width="150"><span ng-bind="list.batchCode || '-'" title="{{list.batchCode}}"></span></td>
+                                    <td width="110"><span ng-bind="list.brName || '-'" title="{{list.brName}}"></span></td>
+                                    <td><span ng-bind="list.kiName || '-'" title="{{list.kiName}}"></span></td>
+                                    <td width="180"><span ng-bind="list.spec || '-'" title="{{list.spec}}"></span></td>
+                                    <td width="100" ng-if="storage_tab === 'outBound'"><span ng-bind="list.number || '-'" title="{{list.number}}"></span></td>
+                                    <td width="100" ng-if="storage_tab === 'outBound'"><span ng-bind="list.shipQty || '-'" title="{{list.shipQty}}"></span></td>
+                                    <td width="100"><span ng-if="list.number === list.shipQty">-</span><input type="text" ng-if="list.number !== list.shipQty" class="form-control"></td>
+                                    <td width="80"><span ng-bind="list.price || '-'" title="{{list.price}}"></span></td>
                                 </tr>
                             </table>
                         </div>
@@ -1356,24 +1434,6 @@
     </div>
 </div>
 
-<!-- 搜索联想词定位和搜索 -->
-<!--<div class="down-word">-->
-    <!--<ul>-->
-        <!--<li>-->
-            <!--<span>464it655-01k</span>-->
-            <!--<span>panasonic</span>-->
-            <!--<span>panasonic</span>-->
-            <!--<span>panasonic</span>-->
-        <!--</li>-->
-        <!--<li>-->
-            <!--<span>464it655-01k</span>-->
-            <!--<span>panasonic</span>-->
-            <!--<span>panasonic</span>-->
-            <!--<span>panasonic</span>-->
-        <!--</li>-->
-    <!--</ul>-->
-<!--</div>-->
-
 <!--下架操作-->
 <div class="com-modal-wrap" ng-if="isSoldOut" ng-click="cancleSoldOut($event)" style="display:none">
     <div class="com-out-box">