| xqd
@@ -76,14 +76,150 @@
|
|
|
|
|
|
}]);
|
|
|
|
|
|
- app.controller('myTruckCtrl', ['$scope', function ($scope) {
|
|
|
-
|
|
|
+ app.controller('myTruckCtrl', ['$scope', '$state', 'myService', 'msg', function ($scope, $state, myService, msg) {
|
|
|
+ $scope.filter = {
|
|
|
+ hasMore: false,
|
|
|
+ page: 0,
|
|
|
+ pageSize: 10,
|
|
|
+ }
|
|
|
+ $scope.items = [];
|
|
|
+ $scope.load = function (init) {
|
|
|
+ if (init) {
|
|
|
+ $scope.filter.pageIndex = 1;
|
|
|
+ $scope.items = [];
|
|
|
+ }
|
|
|
+ myService.listTrucks($scope.filter).then(function (result) {
|
|
|
+ $scope.filter.pageIndex++;
|
|
|
+ var more = (result.data.data.length >= $scope.filter.pageSize);
|
|
|
+ $scope.filter.hasMore = more;
|
|
|
+ $scope.items = $scope.items.concat(result.data.data);
|
|
|
+ if (init) {
|
|
|
+ $scope.$broadcast('scroll.refreshComplete');
|
|
|
+ } else {
|
|
|
+ $scope.$broadcast('scroll.infiniteScrollComplete');
|
|
|
+ }
|
|
|
+ }, function (erro) {
|
|
|
+ msg.error(JSON.stringify(erro.data));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ $scope.add = function () {
|
|
|
+ $state.go('wl.my_truck_add', { item: {}});
|
|
|
+ }
|
|
|
+ $scope.detail = function (item) {
|
|
|
+ $state.go('wl.my_truck_add', {item:item});
|
|
|
+ }
|
|
|
+ $scope.load(true);
|
|
|
}]);
|
|
|
- app.controller('myTruckAddCtrl', ['$scope', function ($scope) {
|
|
|
-
|
|
|
+ app.controller('myTruckAddCtrl', ['$scope', 'myService', 'msg', '$state', '$stateParams', function ($scope, myService, msg, $state, $stateParams) {
|
|
|
+ $scope.vm = {};
|
|
|
+ if ($stateParams.item) {
|
|
|
+ $scope.vm = $stateParams.item;
|
|
|
+ }
|
|
|
+ $scope.typeOpt = [
|
|
|
+ { name: '厢式货车', value: '厢式货车' },
|
|
|
+ { name: '面包车', value: '面包车' },
|
|
|
+ { name: '金杯车', value: '金杯车' },
|
|
|
+ { name: '中巴货车', value: '中巴货车' },
|
|
|
+ { name: '高栏车', value: '高栏车' },
|
|
|
+ { name: '低栏车', value: '低栏车' },
|
|
|
+ { name: '平板车', value: '平板车' },
|
|
|
+ { name: '高低板车', value: '高低板车' },
|
|
|
+ { name: '半挂车', value: '半挂车' },
|
|
|
+ { name: '自卸车', value: '自卸车' },
|
|
|
+ { name: '冷藏车', value: '冷藏车' },
|
|
|
+ { name: '保温车', value: '保温车' },
|
|
|
+ { name: '罐式车', value: '罐式车' },
|
|
|
+ { name: '铁笼车', value: '铁笼车' },
|
|
|
+ { name: '集装箱运输车', value: '集装箱运输车' },
|
|
|
+ { name: '大件运输车', value: '大件运输车' },
|
|
|
+ { name: '危险品车', value: '危险品车' },
|
|
|
+ { name: '全挂车', value: '全挂车' },
|
|
|
+ { name: '加长挂车', value: '加长挂车' },
|
|
|
+ { name: '其他', value: '其他' }];
|
|
|
+ $scope.save = function () {
|
|
|
+ msg.loading('保存中...')
|
|
|
+ myService.addTruck($scope.vm).then(function (result) {
|
|
|
+ msg.hide();
|
|
|
+ $state.go('wl.my_truck');
|
|
|
+ }, function (erro) {
|
|
|
+ msg.hide();
|
|
|
+ msg.error(JSON.stringify(erro.data));
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
}]);
|
|
|
app.controller('myTruckDetailCtrl', ['$scope', function ($scope) {
|
|
|
|
|
|
}]);
|
|
|
-
|
|
|
+ app.controller('myMessageCtrl', ['$scope', 'myService', 'msg', function ($scope, myService, msg) {
|
|
|
+ $scope.filter = {
|
|
|
+ hasMore: false,
|
|
|
+ page: 0,
|
|
|
+ pageSize: 10,
|
|
|
+ }
|
|
|
+ $scope.items = [];
|
|
|
+ $scope.load = function (init) {
|
|
|
+ if (init) {
|
|
|
+ $scope.filter.pageIndex = 1;
|
|
|
+ $scope.items = [];
|
|
|
+ }
|
|
|
+ myService.listMessages($scope.filter).then(function (result) {
|
|
|
+ $scope.filter.pageIndex++;
|
|
|
+ var more = (result.data.data.length >= $scope.filter.pageSize);
|
|
|
+ $scope.filter.hasMore = more;
|
|
|
+ $scope.items = $scope.items.concat(result.data.data);
|
|
|
+ if (init) {
|
|
|
+ $scope.$broadcast('scroll.refreshComplete');
|
|
|
+ } else {
|
|
|
+ $scope.$broadcast('scroll.infiniteScrollComplete');
|
|
|
+ }
|
|
|
+ }, function (erro) {
|
|
|
+ msg.error(JSON.stringify(erro.data));
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.detail = function (item) {
|
|
|
+ $state.go('wl.my_message_detail', { item: item });
|
|
|
+ }
|
|
|
+ $scope.load(true);
|
|
|
+ }]);
|
|
|
+ app.controller('myMessageDetailCtrl', ['$scope', '$stateParams', function ($scope, $stateParams) {
|
|
|
+ $scope.vm = $stateParams.item;
|
|
|
+
|
|
|
+ }]);
|
|
|
+ app.controller('myOrderCtrl', ['$scope', 'myService', 'msg', '$state', function ($scope, myService, msg, $state) {
|
|
|
+ $scope.filter = {
|
|
|
+ hasMore: false,
|
|
|
+ page: 0,
|
|
|
+ pageSize: 10,
|
|
|
+ }
|
|
|
+ $scope.items = [];
|
|
|
+ $scope.load = function (init) {
|
|
|
+ if (init) {
|
|
|
+ $scope.filter.pageIndex = 1;
|
|
|
+ $scope.items = [];
|
|
|
+ }
|
|
|
+ myService.listOrders($scope.filter).then(function (result) {
|
|
|
+ $scope.filter.pageIndex++;
|
|
|
+ var more = (result.data.data.length >= $scope.filter.pageSize);
|
|
|
+ $scope.filter.hasMore = more;
|
|
|
+ $scope.items = $scope.items.concat(result.data.data);
|
|
|
+ if (init) {
|
|
|
+ $scope.$broadcast('scroll.refreshComplete');
|
|
|
+ } else {
|
|
|
+ $scope.$broadcast('scroll.infiniteScrollComplete');
|
|
|
+ }
|
|
|
+ }, function (erro) {
|
|
|
+ msg.error(JSON.stringify(erro.data));
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.detail = function (item) {
|
|
|
+ $state.go('wl.my_order_detail', { item: item });
|
|
|
+ }
|
|
|
+ $scope.load(true);
|
|
|
+ }]);
|
|
|
+ app.controller('myOrderDetailCtrl', ['$scope', '$stateParams', function ($scope, $stateParams) {
|
|
|
+ $scope.vm = $stateParams.item;
|
|
|
+ }]);
|
|
|
})(angular.module('app.controllers'));
|