Jelajahi Sumber

Merge branch 'dev-mysql' into feature_release-tomysql

yangc 7 tahun lalu
induk
melakukan
06cfd1e522

+ 21 - 22
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_no_invoice_ctrl.js

@@ -12,23 +12,28 @@ define([ 'app/app' ], function(app) {
                 }
             })
             if (applyItem.length > 0) {
-                if ($scope.invoices.length > 0) {
-                    $modal.open({
-                        templateUrl : $rootScope.rootPath + '/static/view/usercenter/modal/apply-invoice.html',
-                        size : 'lg',
-                        controller : 'NoInvoiceSubmitCtrl',
-                        resolve : {
-                            submitInvoice : function () {
-                                return applyItem;
-                            },
-                            invoiceData: function () {
-                                return $scope.invoices;
+                Bill.getListPersonal(null, function(data) {
+                    $scope.invoices = data;
+                    if ($scope.invoices.length > 0) {
+                        $modal.open({
+                            templateUrl : $rootScope.rootPath + '/static/view/usercenter/modal/apply-invoice.html',
+                            size : 'lg',
+                            controller : 'NoInvoiceSubmitCtrl',
+                            resolve : {
+                                submitInvoice : function () {
+                                    return applyItem;
+                                },
+                                invoiceData: function () {
+                                    return $scope.invoices;
+                                }
                             }
-                        }
-                    })
-                } else {
-                    toaster.pop('error','请前往开票信息页面新增发票');
-                }
+                        })
+                    } else {
+                        toaster.pop('error','请前往开票信息页面新增发票');
+                    }
+                }, function(response) {
+                    toaster.pop('error', '获取发票信息失败 ' + response.data);
+                });
             } else {
                 toaster.pop('error','请勾选未开票订单');
             }
@@ -42,12 +47,6 @@ define([ 'app/app' ], function(app) {
                 keyword : ''
             };
             $scope.keyword = '';
-
-            Bill.getListPersonal(null, function(data) {
-                $scope.invoices = data;
-            }, function(response) {
-                toaster.pop('error', '获取发票信息失败 ' + response.data);
-            });
         }
         initDataRule();