AccountOrderCheckingRefundController.js 3.8 KB
"use strict";
var AccountOrderCheckingRefundController = angular.module('AccountOrderCheckingRefundController',[]);

//退单列表
AccountOrderCheckingRefundController.controller('AccountOrderCheckingRefundController', [
 	'$rootScope',
	'$scope',
	'AccountOrderCheckingRefundService',
	function($rootScope, $scope, AccountOrderCheckingRefundService) {
        var orderCheckingId=$rootScope.$stateParams.orderCheckingId;
        $scope.currentPage = 1;
        $scope.refundOrders=[];
        $scope.refundOrderQuery={
            pageNow:$scope.currentPage,
            pageSize:20,
            refundStatus:'',
            refundType:'',
            startCreateDt:'',
            endCreateDt:'',
            refundCode:'',
            orderCode:'',
            orderCheckingId:orderCheckingId
        };
        //获取退款订单列表
        AccountOrderCheckingRefundService.orderPagerList($scope.refundOrderQuery);
        $scope.$on('refundOrders.list', function(){
            $scope.refundOrders = AccountOrderCheckingRefundService.refundOrders.datas;
            $scope.numPages = AccountOrderCheckingRefundService.refundOrders.totalPage;
            $scope.totalRecord = AccountOrderCheckingRefundService.refundOrders.totalRecord;

        });
        //选当前页
        $scope.onSelectPage = function(page) {
            $scope.refundOrderQuery.pageNow=page;
            $scope.currentPage=page;
            AccountOrderCheckingRefundService.orderPagerList($scope.refundOrderQuery);
        };
        //搜索退款订单
        $scope.searchOrder=function(){
            $scope.refundOrderQuery.pageNow=1;
            $scope.refundOrderQuery.startCreateDt = $('#receiveStartDate').val();
            $scope.refundOrderQuery.endCreateDt   = $('#receiveEndDate').val();
            AccountOrderCheckingRefundService.orderPagerList($scope.refundOrderQuery);
        };
        //导出退款订单
        $scope.exportOrderRefundExcel=function() {
            window.open("../template/exportOrderCheckingRefundExcel?refundStatus="+$scope.refundOrderQuery.refundStatus+
                "&refundType="+$scope.refundOrderQuery.refundType+
                "&orderCheckingId="+orderCheckingId+
                "&refundCode="+$scope.refundOrderQuery.refundCode+"&orderCode="+$scope.refundOrderQuery.orderCode+
                "&startCreateDt="+$scope.refundOrderQuery.startCreateDt+"&endCreateDt="+$scope.refundOrderQuery.endCreateDt);
        };

    }
]);

//退单详情
AccountOrderCheckingRefundController.controller("AccountOrderCheckingRefundDetailController",[
    '$state',
    '$rootScope',
    '$scope',
    'OrderService',
    'RefundOrderService',
    'AccountOrderCheckingRefundService',
    function($state,$rootScope, $scope, OrderService,RefundOrderService,AccountOrderCheckingRefundService) {
        var orderCode=$rootScope.$stateParams.orderCode;
        var refundId=$rootScope.$stateParams.refundId;
        $scope.refundOrderImageGoods=[];
        $scope.refundOrderItems=[];
        $scope.type=$rootScope.$stateParams.type;

        //退款单详情&&退货商品
        AccountOrderCheckingRefundService.refundOrderDetail(refundId);
        $scope.$on('refundOrders.detail', function(){
            $scope.refundOrderDetail = AccountOrderCheckingRefundService.refundOrdersDetailBean;
            $scope.refundOrderItems=$scope.refundOrderDetail.accountOrderCheckingRefundDetailList;
        });
        //订单基本信息
        OrderService.orderDetail(orderCode);
        $scope.$on('orders.detail', function(){
            $scope.orderDetailBean = OrderService.orderDetailBean;
        });
        //获取退款退货凭证
        RefundOrderService.listRefundOrderImageByGoods(refundId,0);
        $scope.$on('refundOrderImageGoods.list', function(){
            $scope.refundOrderImageGoods = RefundOrderService.refundOrderImageGoods;
        });
    }
]);