| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- define(['app/app'], function (app) {
- "use strict";
- /**
- * 客户
- */
- app.register.controller('CustomersInfoCtrl', ['$scope', 'B2bVendorService', 'BaseService', 'AuthenticationService', 'ngTableParams', '$modal', 'toaster', 'B2bVendorInfo', function ($scope, VendorService, BaseService, AuthenticationService, ngTableParams, $modal, toaster, VendorInfo) {
- BaseService.scrollBackToTop();
- $scope.status = 'customer';
- $scope.userInfoResult = true;
- AuthenticationService.getAuthentication().success(function (data) {
- $scope.loading = false;
- $scope.thisUser = data;
- });
- $scope.customerParams = new ngTableParams({
- page: 1,
- count: 20
- }, {
- total: 0,
- counts: [],
- getData: function ($defer, params) {
- $scope.loading = true;
- var pageParams = params.url();
- pageParams.keyword = $scope.keyword;
- VendorService.customer.get.call(null, BaseService.parseParams(pageParams), function (page) {
- $scope.loading = false;
- if (page) {
- params.total(page.totalElement);
- $scope.total = page.totalElement;
- $scope.infoCommon = page
- $scope.infoCommon.all = page.content.length
- $defer.resolve(page.content);
- }
- $scope.totalCount = page.totalElement;
- }, function (response) {
- $scope.loading = false;
- toaster.pop('error', '数据加载失败', response.data);
- });
- }
- });
- // 搜索框回车
- $scope.onSearch = function (keyword) {
- $scope.customerParams.page(1);
- $scope.customerParams.reload();
- $scope.tip = keyword;
- };
- // 查看详情
- $scope.viewDetail = function (id) {
- window.location.hash = "#/sale/customer/" + id;
- }
- // 取消合作关系
- $scope.disableCust = function (id) {
- VendorInfo.disableCust({id: id}, {}, function (data) {
- if (data.success) {
- toaster.pop('success', '提示', data.success);
- }
- // $scope.customerParams.page(1);
- $scope.customerParams.reload();
- }, function (response) {
- toaster.pop('error', '提示', response.data);
- });
- }
- // 解除禁用
- $scope.activeCust = function (id) {
- VendorInfo.activeCust({id: id}, {}, function (data) {
- if (data.success) {
- toaster.pop('success', '提示', data.success);
- }
- // $scope.customerParams.page(1);
- $scope.customerParams.reload();
- }, function (response) {
- toaster.pop('error', '提示', response.data);
- });
- }
- }]);
- });
|