|
|
@@ -141,6 +141,16 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
url : "/evaluation/:id",
|
|
|
templateUrl : "static/tpl/index/purc/tender_evaluation.html",
|
|
|
controller : 'PurcEvaluationCtrl'
|
|
|
+ /* 采购供应商资料 */
|
|
|
+ }).state('purc.vendor', {
|
|
|
+ url : "/vendor",
|
|
|
+ templateUrl : "static/tpl/index/purc/vendor.html",
|
|
|
+ controller : 'PurcVendorCtrl'
|
|
|
+ /* 采购供应商资料 */
|
|
|
+ }).state('purc.vendordetail', {
|
|
|
+ url : "/vendor/:id",
|
|
|
+ templateUrl : "static/tpl/index/purc/vendor_detail.html",
|
|
|
+ controller : 'PurcVendorDetailCtrl'
|
|
|
/* 客户指定招标列表 */
|
|
|
}).state('sale.tenderlist', {
|
|
|
url : "/tender",
|
|
|
@@ -773,7 +783,9 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
}
|
|
|
}]);
|
|
|
|
|
|
- // TODO
|
|
|
+ /**
|
|
|
+ * 顶部搜索
|
|
|
+ */
|
|
|
app.controller('TopSearchCtrl', ['$scope', '$rootScope', 'getAccountUserSpace', 'ngTableParams', 'toaster', 'BaseService', 'AddPartner', '$filter', '$stateParams', 'SearchProd', '$sce', function($scope, $rootScope, getAccountUserSpace, ngTableParams, toaster, BaseService, AddPartner, $filter, $stateParams, SearchProd, $sce) {
|
|
|
$scope.active = 'all';
|
|
|
$scope.tip = $rootScope.searchKeyword;
|
|
|
@@ -7933,7 +7945,14 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
/**
|
|
|
* 新增采购单
|
|
|
*/
|
|
|
- app.controller('PurcNewOrderCtrl',['$scope', '$modal', 'toaster', '$filter', 'addtoCart', '$rootScope', 'VendorInfo', 'ngTableParams', 'BaseService', 'Product', 'newPurcOrder', 'cartOperation', function($scope, $modal, toaster, $filter, addtoCart, $rootScope, VendorInfo, ngTableParams, BaseService, Product, newPurcOrder, cartOperation) {
|
|
|
+ app.controller('PurcNewOrderCtrl',['$scope', '$modal', 'toaster', '$filter', 'addtoCart', '$rootScope', 'VendorInfo', 'ngTableParams', 'BaseService', 'Product', 'newPurcOrder', 'cartOperation', 'ShipAddress', 'Vendor', function($scope, $modal, toaster, $filter, addtoCart, $rootScope, VendorInfo, ngTableParams, BaseService, Product, newPurcOrder, cartOperation, ShipAddress, Vendor) {
|
|
|
+
|
|
|
+ // 获取收货地址列表
|
|
|
+ ShipAddress.shipAddList({}, function(data) {
|
|
|
+ $scope.ships = data;
|
|
|
+ $scope.order.shipadd = $scope.ships[0];
|
|
|
+ });
|
|
|
+
|
|
|
$scope.order = {
|
|
|
date : new Date(),
|
|
|
cust : {
|
|
|
@@ -7945,13 +7964,11 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
code : $filter('date')(new Date(), 'yyMMddHHmmss_sss'),
|
|
|
orderItems : {
|
|
|
product : {},
|
|
|
- $endDateOpen: false
|
|
|
},
|
|
|
};
|
|
|
|
|
|
// 获取供应商列表
|
|
|
cartOperation.vendorInfo({}, function(data) {
|
|
|
- console.log(data);
|
|
|
});
|
|
|
|
|
|
if($rootScope.businessCode) {
|
|
|
@@ -7959,8 +7976,10 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
$scope.order.cust.enName = data.vendorEnterprise.enName;
|
|
|
$scope.order.cust.enAddress = data.vendorEnterprise.enAddress;
|
|
|
$scope.order.cust.uu = data.vendorEnterprise.uu;
|
|
|
- $scope.order.custUser.userName = data.vendorUser.userName;
|
|
|
- $scope.order.custUser.userTel = data.vendorUser.userTel;
|
|
|
+ Vendor.contacts({venduu: $scope.order.cust.uu}, {}, function(data) {
|
|
|
+ $scope.contacts = data;
|
|
|
+ $scope.order.vendor = $scope.contacts[0];
|
|
|
+ });
|
|
|
}, function(response) {
|
|
|
|
|
|
});
|
|
|
@@ -7992,6 +8011,10 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
delivery: null,
|
|
|
};
|
|
|
// $scope.order.orderItems.push(item);
|
|
|
+ Vendor.contacts({venduu: $scope.order.cust.uu}, {}, function(data) {
|
|
|
+ $scope.contacts = data;
|
|
|
+ $scope.order.vendor = $scope.contacts[0];
|
|
|
+ });
|
|
|
|
|
|
}, function(){
|
|
|
|
|
|
@@ -8011,7 +8034,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
price: null,
|
|
|
remark: null,
|
|
|
delivery: null,
|
|
|
- id: null
|
|
|
+ id: null,
|
|
|
};
|
|
|
// $scope.order.orderItems.push(item);
|
|
|
if($rootScope.prodId) {
|
|
|
@@ -8031,7 +8054,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
if($scope.order.orderItems[index].code == null) {
|
|
|
toaster.pop('info', '提示', '请先选择商品');
|
|
|
} else {
|
|
|
- $scope.order.orderItems.push({code: null, title: null, spec: null, unit: null, qty: null, price: null, remark: null, delivery: null});
|
|
|
+ $scope.order.orderItems.push({code: null, title: null, spec: null, unit: null, qty: null, price: null, remark: null, delivery: null, $endDateOpen: false});
|
|
|
}
|
|
|
};
|
|
|
//删除商品
|
|
|
@@ -8039,6 +8062,13 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
$scope.order.orderItems.splice(index, 1);
|
|
|
};
|
|
|
|
|
|
+ // 搜索框回车
|
|
|
+ $scope.onSearch = function(keyword) {
|
|
|
+ $scope.keyword = keyword;
|
|
|
+ $scope.tableParams.page(1);
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ };
|
|
|
+
|
|
|
$scope.tableParams = new ngTableParams({
|
|
|
page : 1,
|
|
|
count : 10
|
|
|
@@ -8072,12 +8102,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
$scope.order.orderItems.push({code: data.code, title: data.title, spec: data.spec, unit: data.unit, qty: null, price: null, remark: null, delivery: null, id: data.id});
|
|
|
};
|
|
|
|
|
|
- // 搜索框回车
|
|
|
- $scope.onSearch = function() {
|
|
|
- $scope.tableParams.page(1);
|
|
|
- $scope.tableParams.reload();
|
|
|
- };
|
|
|
-
|
|
|
+ // 监听custuu发生变化,重新加载物料信息
|
|
|
$scope.$watch('order.cust.uu', function(n, o) {
|
|
|
if(n==o) {
|
|
|
return;
|
|
|
@@ -8128,8 +8153,9 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
|
|
|
// 添加到购物车
|
|
|
$scope.addToCart = function(order) {
|
|
|
- console.log(order);
|
|
|
$scope.loading = true;
|
|
|
+ $scope.order.venduser = order.vendor.venduser + '' + order.vendor.tel;
|
|
|
+ $scope.order.shipaddress = order.shipadd.addressdet + '' + order.shipadd.receiver + '' + order.shipadd.usertel;
|
|
|
$scope.order.custUU = $scope.order.cust.uu;
|
|
|
$scope.order.custUserUU = $scope.order.custUser.userUU;
|
|
|
if($scope.order.date instanceof Date) {
|
|
|
@@ -8154,6 +8180,8 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
// 立即购买
|
|
|
$scope.addToOrder = function(order) {
|
|
|
$scope.loading = true;
|
|
|
+ $scope.order.venduser = order.vendor.venduser + '' + order.vendor.tel;
|
|
|
+ $scope.order.shipaddress = order.shipadd.addressdet + '' + order.shipadd.receiver + '' + order.shipadd.usertel;
|
|
|
$scope.order.custUU = $scope.order.cust.uu;
|
|
|
$scope.order.custUserUU = $scope.order.custUser.userUU;
|
|
|
if($scope.order.date instanceof Date) {
|
|
|
@@ -8173,6 +8201,18 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
toaster.pop('error', '保存失败', response.data);
|
|
|
});
|
|
|
};
|
|
|
+
|
|
|
+ // 新增收货地址保存
|
|
|
+ $scope.saveShipAddress = function(ship) {
|
|
|
+ ShipAddress.saveAddress( {}, ship, function(data) {
|
|
|
+ if(data.success) {
|
|
|
+ toaster.pop('success', '提示', data.success);
|
|
|
+ }
|
|
|
+ if(data.error) {
|
|
|
+ toaster.pop('error', '提示', data.error);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}]);
|
|
|
|
|
|
/**
|
|
|
@@ -8279,80 +8319,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
/**
|
|
|
* 我的供应商
|
|
|
*/
|
|
|
- app.controller('MySupplierCtrl', ['$scope', 'VendorService', 'BaseService','AuthenticationService', 'ngTableParams', '$modal','toaster', function($scope, VendorService, BaseService, AuthenticationService,ngTableParams,$modal, toaster){
|
|
|
- $scope.userInfoResult = true;
|
|
|
- AuthenticationService.getAuthentication().success(function(data) {
|
|
|
- $scope.loading = false;
|
|
|
- $scope.thisUser = data;
|
|
|
- });
|
|
|
- var getCustInfos = function(custuu) {
|
|
|
- if(custuu) {
|
|
|
- VendorService.userInfo.query({uu:custuu},null,function(data) {
|
|
|
- $scope.custInfos = data;
|
|
|
- var getPage = function(page, size){
|
|
|
- if($scope.custInfos) {
|
|
|
- var result = {};
|
|
|
- result.totalCount = $scope.custInfos.length;
|
|
|
- result.content = $scope.custInfos.slice((page - 1)*size, page * size);
|
|
|
- if($scope.custInfos.length % size == 0) {
|
|
|
- result.totalPage = ($scope.custInfos.length - $scope.custInfos.length % size) / size;
|
|
|
- }else {
|
|
|
- result.totalPage = ($scope.custInfos.length - $scope.custInfos.length % size) / size + 1;
|
|
|
- }
|
|
|
- result.first = page == 1;
|
|
|
- result.last = page == result.totalPage;
|
|
|
- result.page = page;
|
|
|
- result.next = page - 0 + 1;
|
|
|
- result.pre = page - 1;
|
|
|
- return result;
|
|
|
- }
|
|
|
- }
|
|
|
- $scope.userdata = getPage(1,4);
|
|
|
- $scope.first = function (){
|
|
|
- $scope.userdata = getPage($scope.userdata.pre,4);
|
|
|
- }
|
|
|
- $scope.last = function (){
|
|
|
- $scope.userdata = getPage($scope.userdata.next,4);
|
|
|
- }
|
|
|
- }, function(response){
|
|
|
- $scope.loading = false;
|
|
|
- toaster.pop('error', '数据加载失败', response.data);
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- $scope.addUserInfo = function(customer) {
|
|
|
- //TODO
|
|
|
- if ($scope.thisUser.sys) {
|
|
|
- var modalInstance = $modal.open({
|
|
|
- animation: true,
|
|
|
- templateUrl: 'static/tpl/index/account/add_userInfo.html',
|
|
|
- controller: 'AddUserInfoCtrl',
|
|
|
- resolve: {
|
|
|
- customer: function() {
|
|
|
- return customer;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- modalInstance.result.then(function(changed, checked){
|
|
|
- if(changed) {
|
|
|
- if(checked)
|
|
|
- $scope.newUser.roles = checked;
|
|
|
- else
|
|
|
- loadUsers();
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- } else {
|
|
|
- toaster.pop('error', '您不是管理员,无权限分配用户!');
|
|
|
- }
|
|
|
- }
|
|
|
- $scope.showUserInfo = function(customer,boo) {
|
|
|
- $scope.custInfo = customer;
|
|
|
- if(boo) {
|
|
|
- getCustInfos(customer.myEnterprise.uu);
|
|
|
- $scope.userInfoResult = true;
|
|
|
- }
|
|
|
- }
|
|
|
+ app.controller('PurcVendorCtrl', ['$scope', 'Vendor', 'BaseService','AuthenticationService', 'ngTableParams', '$modal','toaster', '$rootScope', function($scope, Vendor, BaseService, AuthenticationService,ngTableParams,$modal, toaster, $rootScope){
|
|
|
$scope.customerParams = new ngTableParams({
|
|
|
page : 1,
|
|
|
count : 10
|
|
|
@@ -8361,7 +8328,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
counts: [5, 10, 25, 50],
|
|
|
getData : function($defer, params) {
|
|
|
$scope.loading = true;
|
|
|
- VendorService.customer.get(BaseService.parseParams(params.url()), function(page){
|
|
|
+ Vendor.getVendor(BaseService.parseParams(params.url()), function(page){
|
|
|
$scope.loading = false;
|
|
|
if(page) {
|
|
|
params.total(page.totalElements);
|
|
|
@@ -8374,6 +8341,116 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ // 查看供应商详情
|
|
|
+ $scope.VendorDetail = function(id) {
|
|
|
+ console.log(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 向企业购买
|
|
|
+ $scope.purcByEn = function(businessCode) {
|
|
|
+ console.log(businessCode);
|
|
|
+ $rootScope.businessCode = businessCode;
|
|
|
+ window.location.hash = "#/purc/addOrder";
|
|
|
+ }
|
|
|
+ }]);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 供应商详情
|
|
|
+ */
|
|
|
+ app.controller('PurcVendorDetailCtrl', ['$scope', 'toaster', '$stateParams', 'Vendor', '$modal', function($scope, toaster, $stateParams, Vendor, $modal) {
|
|
|
+ $scope.vendorContacts = [];
|
|
|
+ var loadData = function() {
|
|
|
+ Vendor.getVendorDetail({id: $stateParams.id}, {}, function(data) {
|
|
|
+ $scope.vendor = data.vendorEnterprise;
|
|
|
+ Vendor.contacts({venduu: $scope.vendor.uu}, {}, function(data) {
|
|
|
+ $scope.vendorContacts = data;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ // 新增供应商联系人
|
|
|
+ $scope.addContact = function(uu) {
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ animation: true,
|
|
|
+ templateUrl: 'static/tpl/index/purc/modal/contact_person_modal.html',
|
|
|
+ controller: 'AddContacCtrl',
|
|
|
+ resolve: {
|
|
|
+ }
|
|
|
+ });
|
|
|
+ modalInstance.result.then(function(data) {
|
|
|
+ $scope.contact = data;
|
|
|
+ $scope.contact.venduu = uu;
|
|
|
+ Vendor.saveContact({}, $scope.contact, function(data) {
|
|
|
+ toaster.pop('success', '提示', '联系人保存成功');
|
|
|
+ $scope.vendorContacts.push(data);
|
|
|
+ }, function(response) {
|
|
|
+ toaster.pop('error', '失败', response.data);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 编辑供应商联系人
|
|
|
+ $scope.edit = function(contact) {
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ animation: true,
|
|
|
+ templateUrl: 'static/tpl/index/purc/modal/contact_person_modal.html',
|
|
|
+ controller: 'EditContacCtrl',
|
|
|
+ resolve: {
|
|
|
+ contact: function() {
|
|
|
+ return contact;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ modalInstance.result.then(function(data) {
|
|
|
+ $scope.contact = data;
|
|
|
+ Vendor.saveContact({}, $scope.contact, function(data) {
|
|
|
+ toaster.pop('success', '提示', '联系人修改成功');
|
|
|
+ }, function(response) {
|
|
|
+ toaster.pop('error', '失败', response.data);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 删除供应商联系人
|
|
|
+ $scope.deleteById = function(id, index) {
|
|
|
+ Vendor.deleteContact({id: id}, {}, function(data) {
|
|
|
+ toaster.pop('success', '提示', '供应商联系人删除成功');
|
|
|
+ $scope.vendorContacts.splice(1, index);
|
|
|
+ }, function(response) {
|
|
|
+ toaster.pop('error', '提示', response.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ loadData();
|
|
|
+ }]);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑供应商联系人
|
|
|
+ */
|
|
|
+ app.controller('EditContacCtrl', ['$scope', 'toaster', '$modalInstance', 'contact', function($scope, toaster, $modalInstance, contact) {
|
|
|
+
|
|
|
+ $scope.contact = contact;
|
|
|
+
|
|
|
+ $scope.save = function(contact) {
|
|
|
+ $modalInstance.close(contact);
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.cancel = function() {
|
|
|
+ $modalInstance.dismiss();
|
|
|
+ }
|
|
|
+ }]);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增供应商联系人
|
|
|
+ */
|
|
|
+ app.controller('AddContacCtrl', ['$scope', 'toaster', '$modalInstance', function($scope, toaster, $modalInstance) {
|
|
|
+ $scope.save = function(contact) {
|
|
|
+ $modalInstance.close(contact);
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.cancel = function() {
|
|
|
+ $modalInstance.dismiss();
|
|
|
+ }
|
|
|
}]);
|
|
|
|
|
|
/**
|
|
|
@@ -9961,5 +10038,6 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
item[openParam] = !item[openParam];
|
|
|
};
|
|
|
}]);
|
|
|
+
|
|
|
return app;
|
|
|
});
|