|
|
@@ -7,10 +7,10 @@ define([ 'app/app' ], function(app) {
|
|
|
|
|
|
// 开票申请
|
|
|
$scope.applyInvoice = function () {
|
|
|
- var applyItem = []
|
|
|
+ var applyItem = [];
|
|
|
angular.forEach($scope.orderData, function (item) {
|
|
|
if (item.checked) {
|
|
|
- applyItem.push(item)
|
|
|
+ applyItem.push(item);
|
|
|
}
|
|
|
})
|
|
|
// console.log(applyItem)
|
|
|
@@ -25,15 +25,15 @@ define([ 'app/app' ], function(app) {
|
|
|
return applyItem;
|
|
|
},
|
|
|
invoiceData: function () {
|
|
|
- return $scope.invoices
|
|
|
+ return $scope.invoices;
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
- toaster.pop('error','请前往开票信息页面新增发票')
|
|
|
+ toaster.pop('error','请前往开票信息页面新增发票');
|
|
|
}
|
|
|
} else {
|
|
|
- toaster.pop('error','请勾选未开票订单')
|
|
|
+ toaster.pop('error','请勾选未开票订单');
|
|
|
}
|
|
|
};
|
|
|
var initDataRule = function () {
|
|
|
@@ -94,7 +94,7 @@ define([ 'app/app' ], function(app) {
|
|
|
$scope.orderData = page.content;
|
|
|
//初始化选中状态
|
|
|
angular.forEach($scope.orderData, function (item) {
|
|
|
- item.checked = false
|
|
|
+ item.checked = false;
|
|
|
})
|
|
|
}, function () {
|
|
|
toaster.pop('error', '获取未开票订单信息失败');
|
|
|
@@ -105,102 +105,102 @@ define([ 'app/app' ], function(app) {
|
|
|
initTable();
|
|
|
|
|
|
$scope.searchByKeyword = function () {
|
|
|
- $scope.param.keyword = $scope.keyword
|
|
|
+ $scope.param.keyword = $scope.keyword;
|
|
|
initTable();
|
|
|
}
|
|
|
|
|
|
//全选状态
|
|
|
- $scope.isAllCheck = false
|
|
|
+ $scope.isAllCheck = false;
|
|
|
//全选
|
|
|
$scope.onAllChecked = function () {
|
|
|
if (!$scope.isAllCheck) {
|
|
|
angular.forEach($scope.orderData, function (item, index) {
|
|
|
- item.checked = true
|
|
|
+ item.checked = true;
|
|
|
})
|
|
|
} else {
|
|
|
angular.forEach($scope.orderData, function (item, index) {
|
|
|
- item.checked = false
|
|
|
+ item.checked = false;
|
|
|
})
|
|
|
}
|
|
|
- $scope.isAllCheck = !$scope.isAllCheck
|
|
|
+ $scope.isAllCheck = !$scope.isAllCheck;
|
|
|
}
|
|
|
|
|
|
|
|
|
//单选
|
|
|
$scope.checkInvoice = function (item) {
|
|
|
- var temAllCheck = true
|
|
|
- item.checked = !item.checked
|
|
|
+ var temAllCheck = true;
|
|
|
+ item.checked = !item.checked;
|
|
|
angular.forEach($scope.orderData, function (itemss) {
|
|
|
if (!itemss.checked) {
|
|
|
- temAllCheck = false
|
|
|
+ temAllCheck = false;
|
|
|
}
|
|
|
})
|
|
|
- $scope.isAllCheck = temAllCheck
|
|
|
+ $scope.isAllCheck = temAllCheck;
|
|
|
}
|
|
|
|
|
|
}]);
|
|
|
- app.register.controller('NoInvoiceSubmitCtrl', ['$scope','$rootScope','$modal', 'Order', 'toaster', 'submitInvoice', '$modalInstance','invoiceData','BillSubmit', function ($scope, $rootScope, $modal, Order, toaster, submitInvoice, $modalInstance, invoiceData, BillSubmit) {
|
|
|
+ app.register.controller('NoInvoiceSubmitCtrl', ['$scope','$rootScope','$modal', 'Order', 'toaster', 'submitInvoice', '$modalInstance','invoiceData','BillSubmit','$state', function ($scope, $rootScope, $modal, Order, toaster, submitInvoice, $modalInstance, invoiceData, BillSubmit, $state) {
|
|
|
//公司列表
|
|
|
- $scope.submitInvoice = []
|
|
|
+ $scope.submitInvoice = [];
|
|
|
|
|
|
//订单数
|
|
|
- $scope.orderCount = submitInvoice.length || 0
|
|
|
+ $scope.orderCount = submitInvoice.length || 0;
|
|
|
|
|
|
//总金额
|
|
|
- $scope.allPrice = 0
|
|
|
+ $scope.allPrice = 0;
|
|
|
|
|
|
//发票信息
|
|
|
- $scope.invoiceData = {}
|
|
|
+ $scope.invoiceData = {};
|
|
|
|
|
|
// 数据处理
|
|
|
$scope.dealData = function () {
|
|
|
- var submitItem = submitInvoice
|
|
|
- var temStoreIdArr = []
|
|
|
- var tmpPriceArr = []
|
|
|
+ var submitItem = submitInvoice;
|
|
|
+ var temStoreIdArr = [];
|
|
|
+ var tmpPriceArr = [];
|
|
|
angular.forEach(submitItem, function (item) {
|
|
|
- var index = temStoreIdArr.indexOf(item.storeid)
|
|
|
+ var index = temStoreIdArr.indexOf(item.storeid);
|
|
|
if (index == -1) {
|
|
|
- temStoreIdArr.push(item.storeid)
|
|
|
- tmpPriceArr.push({price: item.price, storeName: item.storeName, orderid: item.orderid})
|
|
|
+ temStoreIdArr.push(item.storeid);
|
|
|
+ tmpPriceArr.push({price: item.price, storeName: item.storeName, orderid: item.orderid});
|
|
|
} else {
|
|
|
- tmpPriceArr[index].price += item.price
|
|
|
+ tmpPriceArr[index].price += item.price;
|
|
|
}
|
|
|
})
|
|
|
angular.forEach(tmpPriceArr, function (item, index) {
|
|
|
- $scope.submitInvoice.push(tmpPriceArr[index])
|
|
|
- $scope.allPrice += tmpPriceArr[index].price
|
|
|
+ $scope.submitInvoice.push(tmpPriceArr[index]);
|
|
|
+ $scope.allPrice += tmpPriceArr[index].price;
|
|
|
})
|
|
|
}
|
|
|
- $scope.dealData()
|
|
|
+ $scope.dealData();
|
|
|
|
|
|
- $scope.hasSpecial = false
|
|
|
- $scope.hasNormal = false
|
|
|
+ $scope.hasSpecial = false;
|
|
|
+ $scope.hasNormal = false;
|
|
|
|
|
|
$scope.getInvoiceData = function (invoiceKind) {
|
|
|
- var tmpInvoice = invoiceData
|
|
|
+ var tmpInvoice = invoiceData;
|
|
|
if (!invoiceKind) {
|
|
|
if (tmpInvoice.length == 1) {
|
|
|
- $scope.invoiceData = tmpInvoice[0]
|
|
|
+ $scope.invoiceData = tmpInvoice[0];
|
|
|
if (tmpInvoice[0].kind == 1205) {
|
|
|
- $scope.hasSpecial = true
|
|
|
+ $scope.hasSpecial = true;
|
|
|
} else if (tmpInvoice[0].kind == 1206) {
|
|
|
- $scope.hasNormal = true
|
|
|
+ $scope.hasNormal = true;
|
|
|
}
|
|
|
} else if (tmpInvoice.length > 1) {
|
|
|
- $scope.getInvoiceData(1206)
|
|
|
+ $scope.getInvoiceData(1206);
|
|
|
}
|
|
|
} else {
|
|
|
angular.forEach(tmpInvoice, function (item) {
|
|
|
if (item.kind == 1205) {
|
|
|
- $scope.hasSpecial = true
|
|
|
+ $scope.hasSpecial = true;
|
|
|
}
|
|
|
|
|
|
if (item.kind == 1206) {
|
|
|
- $scope.hasNormal = true
|
|
|
+ $scope.hasNormal = true;
|
|
|
}
|
|
|
|
|
|
if (item.kind == invoiceKind) {
|
|
|
- $scope.invoiceData = item
|
|
|
+ $scope.invoiceData = item;
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
@@ -208,25 +208,27 @@ define([ 'app/app' ], function(app) {
|
|
|
// return {}
|
|
|
}
|
|
|
|
|
|
- $scope.getInvoiceData()
|
|
|
+ $scope.getInvoiceData();
|
|
|
+ // console.log($scope.invoiceData);
|
|
|
|
|
|
//关闭模态框
|
|
|
$scope.closeModal = function () {
|
|
|
- $modalInstance.dismiss()
|
|
|
+ $modalInstance.dismiss();
|
|
|
}
|
|
|
|
|
|
//提交申请
|
|
|
$scope.apply = function () {
|
|
|
- var orderids = ''
|
|
|
+ var orderids = '';
|
|
|
angular.forEach($scope.submitInvoice, function (item) {
|
|
|
- orderids += item.orderid + ','
|
|
|
+ orderids += item.orderid + ',';
|
|
|
})
|
|
|
orderids = orderids.substring(0, orderids.length-1)
|
|
|
BillSubmit.submitBillApply(null, {orderids: orderids, invoiceid: $scope.invoiceData.id}, function (data) {
|
|
|
- toaster.pop('success', '申请发票成功')
|
|
|
- $scope.closeModal()
|
|
|
+ toaster.pop('success', '申请发票成功');
|
|
|
+ $scope.closeModal();
|
|
|
+ $state.reload();
|
|
|
},function (error) {
|
|
|
- toaster.pop('error', '申请发票失败')
|
|
|
+ toaster.pop('error', '申请发票失败');
|
|
|
})
|
|
|
}
|
|
|
|