123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452 |
- angular.module('push')
- .controller('rewardCtrl', ['$scope', 'activitiesModuleService', '$timeout', '$q', 'UserService', 'ConfigService', '$ionicScrollDelegate', 'CommonService', '$ionicPopup', 'UtilService', 'dataToolsService', '$stateParams', 'taskModuleService', 'ResourceLibraryService', 'AccountService', function ($scope, activitiesModuleService, $timeout, $q, UserService, ConfigService, $ionicScrollDelegate, CommonService, $ionicPopup, UtilService, dataToolsService, $stateParams, taskModuleService, ResourceLibraryService, AccountService) {
- //虚拟搜索框
- $scope.isShowSearchButton = true;
- $scope.keyfilter = {
- key: ''
- }
- $scope.pagenum = 1;
- $scope.pagesize = 6;
- $scope.noData = false;
- $scope.activitiytype = 0;
- $scope.node = UserService.node;
- $scope.allData = [];
- $scope.index = 0;
- $scope.initData = [];
- $scope.userid = UserService.id;
- if ($scope.app) {
- if (device.platform != "Android") {
- $scope.isIos = true;
- } else {
- $scope.isIos = false;
- }
- }
- //获取全部兑现数据
- var getPayCashList = function () {
- dataToolsService.getPayCashList().then(function (res) {
- console.log(res)
- if (res.code == 3350) {
- $scope.paycashlist = res.data;
- $scope.allData = $scope.paycashlist;
- }
- })
- };
- getPayCashList();
- $scope.goBackWhere = function () {
- if ($stateParams.comfrom == 'homepageOfNode') {
- $scope.go('homepageOfNode');
- } else if ($stateParams.comfrom == 'tab.account') {
- $scope.go('tab.account');
- } else {
- $scope.go('tab.activityIndex');
- }
- };
- $scope.rewardHollList = [
- {title: '奖补类别', selected: true, type: 0},
- {title: '申报记录', selected: false, type: 1},
- {title: '退回情况', selected: false, type: 2},
- ]
- $scope.rewardHollLists = [
- {title: '产学研合作补助', selected: true, type: 0},
- {title: '研发后补助', selected: false, type: 1},
- ]
- $scope.addrKey = '';
- $scope.tasktype = 0;
- var policyRewardhistoryList = function (restType,demandType) {
- $scope.showLoadingToast();
- if (UserService.id) {
- dataToolsService.policyRewardhistoryList(restType,demandType).then(function (res) {
- console.log(res);
- $scope.hideLoadingToast();
- if (res.code == 3350) {
- $scope.initData = res.data;
- $scope.allData = $scope.paycashlist;
- }
- });
- }
- }
- policyRewardhistoryList(2,1111);
- $scope.policySetting = function (list) {
- $scope.go("policySetting", {list: list});
- }
- $scope.toDeclare = function (list) {
- /*$scope.go("toDeclare", {list:list});*/
- if(!UserService.id || UserService.id == 0){
- $scope.go('login');
- return;
- }
- AccountService.getAuthorizationLetterList(UserService.id,UserService.node).then(function (res) {
- console.log(res)
- if (res.data.length == 0) {
- var confirmPopup = $ionicPopup.confirm({
- title: '认证提醒',
- template: '请先认证企业身份再进行产学研合作补助申报!',
- cancelText: '取消',
- okText: '去认证',
- });
- confirmPopup.then(function (res) {
- if (res) {
- $scope.go("identifyForm", {pageTitle: "企业认证", code: 4803, type: "", id: "", action: 'submit'});
- }
- })
- } else {
- $scope.go("toDeclare", {list: JSON.stringify(list)});
- }
- })
- }
- ResourceLibraryService.judgeManager(UserService.id, 10501).then(function (res) {
- $scope.hasAuth = res.data;
- })
- $scope.changeSelecteds=function(index){
- console.log(index);
- angular.forEach($scope.rewardHollLists, function (val) {
- val.selected = false;
- })
- $scope.rewardHollLists[index].selected = true;
- if($scope.rewardHollList[2].selected == true){
- if(index==0){
- policyRewardhistoryList(2,-1);
- }else {
- policyRewardhistoryList(1611726857 ,-2);
- }
- }else {
- if(index==0){
- policyRewardhistoryList(2,1111);
- }else {
- policyRewardhistoryList(1611726857 ,1111);
- }
- }
- }
- //进入详情
- $scope.goSubsidyauditafteDetail = function (list) {
- console.log(list)
- if((list.demandstatus==-2||list.demandstatus==-1)&&$scope.rewardHollList[2].selected == true){
- $scope.go("toDeclare", {list: JSON.stringify(list)});
- }else {
- if(list.restype==2){
- $scope.go("cooperateDetail", {list: list, id: list.technicalcontractid});
- }else {
- $scope.go("SubsidyauditafteDetail", {list: list, id: list.researchCostId});
- }
- }
- }
- $scope.changeSelected = function (index) {
- $scope.index = index;
- $scope.pagenum = 1;
- $scope.showLoadMore = true;
- if ((index == 1 || index == 2) && !ConfigService.islogin) {
- if (localStorage.wxFlag == "true") {
- if (localStorage.isUserFocusXW == 0) {
- var title = localStorage.appidStr;
- $ionicPopup.alert({
- title: '提示',
- template: '请先关注微信公众号"' + title + '"!'
- });
- return;
- } else {
- if (localStorage.isUserBindWx == 0) {
- var wxFlag = JSON.parse(localStorage.params);
- if (wxFlag.weChatModel) {
- $scope.go('bindPhone', {
- params: localStorage.params,
- comfrom: 'maincontroller',
- url: window.location.href.split('#/')[1]
- });
- } else {
- $scope.go('login');
- return;
- }
- } else {
- $scope.go('login');
- return;
- }
- }
- } else {
- $scope.go('login');
- return;
- }
- return;
- }
- angular.forEach($scope.rewardHollList, function (val) {
- val.selected = false;
- })
- $scope.rewardHollList[index].selected = true;
- //待申请
- if (index == 1) {
- $scope.allData = [];
- angular.forEach($scope.initData, function (value, index) {
- if (value.demandstatus == -4) {
- $scope.allData.push(value);
- }
- })
- policyRewardhistoryList(2 ,1111);
- $scope.rewardHollLists[1].selected = false;
- $scope.rewardHollLists[0].selected = true;
- }
- //已申请
- if (index == 2) {
- $scope.allData = [];
- angular.forEach($scope.initData, function (value, index) {
- if (value.demandstatus != -4) {
- $scope.allData.push(value);
- }
- })
- policyRewardhistoryList(2 ,-2);
- $scope.rewardHollLists[1].selected = false;
- $scope.rewardHollLists[0].selected = true;
- }
- //全部兑现
- if (index == 0) {
- $scope.allData = [];
- $scope.allData = $scope.paycashlist;
- }
- $ionicScrollDelegate.$getByHandle('privateContent').scrollTop(true);
- }
- $scope.showSearchButtonLeft = function () {
- // console.log('aaa');
- $scope.isShowSearchButton = false;
- $timeout(function () {
- $(".showSearchInput").focus();
- }, 300)
- };
- $scope.clearSearch = function () {
- $scope.isShowSearchButton = true;
- $scope.keyfilter.key = "";
- $scope.getData();
- }
- $scope.rewardgoback = function(){
- $scope.go('tab.activityIndex');
- }
- $scope.goToReward = function (list) {
- if ($scope.index != 0) {
- if (!ConfigService.islogin) {
- if (localStorage.wxFlag == "true") {
- if (localStorage.isUserFocusXW == 0) {
- var title = localStorage.appidStr;
- $ionicPopup.alert({
- title: '提示',
- template: '请先关注微信公众号"' + title + '"!'
- });
- return;
- } else {
- if (localStorage.isUserBindWx == 0) {
- var wxFlag = JSON.parse(localStorage.params);
- if (wxFlag.weChatModel) {
- $scope.go('bindPhone', {
- params: localStorage.params,
- comfrom: 'maincontroller',
- url: window.location.href.split('#/')[1]
- });
- } else {
- $scope.go('login');
- return;
- }
- } else {
- $scope.go('login');
- return;
- }
- }
- } else {
- $scope.go('login');
- return;
- }
- } else {
- ResourceLibraryService.getResourceByID(list.resid).then(function (resvalue) {
- if (resvalue.code == 3350) {
- var resource = resvalue.data;
- if(!resource){
- $scope.go('cooperateDetail', {list: list, id: list.id});
- }else {
- taskModuleService.getUserPermissionCheck(resource.otherid, list.creator, UserService.id).then(function (res) {
- if (res.code == 3350) {
- $scope.isVisiableFlag = res.data;
- if (!$scope.isVisiableFlag) {
- AccountService.getUserCheckInfo(UserService.id).then(function (userres) {
- if (userres.code == 3350) {
- var user = userres.data;
- //技术经纪人正在审核中
- if (user.authenstatus == 5101) {
- $ionicPopup.confirm({
- title: '提示',
- template: '需先认证为技术经纪人,方可申请技术合作类奖励',
- okText: '去认证',
- cancelText: '取消'
- }).then(function (result) {
- if (result) {
- $scope.go('identifyStatus', {
- pageTitle: '技术经纪人',
- code: 4801,
- type: 5101,
- id: user.id,
- action: 'submit',
- comfrom: 'resubmit'
- });
- }
- })
- } else
- //技术经纪人认证失败或是退回
- if (user.authenstatus == 5103 || user.authenstatus == 5104) {
- if (list.restype == 4801) {
- $ionicPopup.confirm({
- title: '提示',
- template: '需先认证为技术经纪人,方可申请技术合作类奖励',
- okText: '去认证',
- cancelText: '取消'
- }).then(function (result) {
- if (result) {
- $scope.go('identifyStatus', {
- pageTitle: '技术经纪人',
- code: 4801,
- type: user.authenstatus,
- id: user.id,
- action: 'submit',
- comfrom: 'resubmit'
- });
- }
- })
- }
- if (list.restype == 1) {
- $ionicPopup.confirm({
- title: '提示',
- template: '需先认证为技术经纪人,方可申请技术需求类奖励',
- okText: '去认证',
- cancelText: '取消'
- }).then(function (result) {
- if (result) {
- if ($scope.node == '330122000') {
- $scope.go('identifyFormForTongLu', {
- code: 4801,
- type: user.authenstatus,
- action: 'submit',
- id: user.id,
- comfrom: 'resubmit',
- pageTitle: '技术经纪人认证'
- })
- } else {
- $scope.go('identifyForm', {
- code: 4801,
- type: user.authenstatus,
- action: 'submit',
- id: user.id,
- comfrom: 'resubmit',
- pageTitle: '技术经纪人认证'
- })
- }
- }
- })
- }
- } else {
- //没有进行过技术经纪人认证信息提交的
- if (user == null || user.authenstatus == null) {
- if (list.restype == 4801) {
- $ionicPopup.confirm({
- title: '提示',
- template: '需先认证为技术经纪人,方可申请技术合作类奖励',
- okText: '去认证',
- cancelText: '取消'
- }).then(function (result) {
- if (result) {
- if (UserService.node == '330122000') {
- $scope.go('identifyFormForTongLu', {
- pageTitle: '技术经纪人认证',
- type: 5100,
- code: 4801,
- action: 'submit'
- });
- } else {
- $scope.go('identifyForm', {
- pageTitle: '技术经纪人认证',
- type: 5100,
- code: 4801,
- action: 'submit'
- });
- }
- }
- })
- }
- if (list.restype == 1) {
- $ionicPopup.confirm({
- title: '提示',
- template: '需先认证为技术经纪人,方可申请技术需求类奖励',
- okText: '去认证',
- cancelText: '取消'
- }).then(function (result) {
- if (result) {
- if ($scope.node == "330122000") {
- $scope.go('identifyFormForTongLu', {
- pageTitle: '技术经纪人认证',
- type: 5100,
- code: 4801,
- action: 'submit'
- });
- } else {
- $scope.go('identifyForm', {
- pageTitle: '技术经纪人认证',
- type: 5100,
- code: 4801,
- action: 'submit'
- });
- }
- }
- })
- }
- } else {
- if (list.restype == 4801) {
- $scope.go('technicalawardapplication', {
- pageTitle: "技术经纪人技术合作类奖励",
- code: 4801,
- type: 5100,
- action: 'submit',
- resid: list.resid,
- restype: list.restype,
- list: list
- });
- }
- if (list.restype == 1) {
- $scope.go("demandRewardDetail", {
- resid: list.resid,
- comefrom: 'reward',
- list: list
- });
- }
- }
- }
- }
- })
- } else {
- if (list.restype == 4801) {
- $scope.go('technicalawardapplication', {
- pageTitle: "技术经纪人技术合作类奖励",
- code: 4801,
- type: 5100,
- action: 'submit',
- resid: list.resid,
- restype: list.restype,
- list: list
- });
- }
- if (list.restype == 1) {
- $scope.go("demandRewardDetail", {
- resid: list.resid,
- comefrom: 'reward',
- list: list
- });
- }
- }
- }
- })
- }
- }
- })
- }
- }
- }
- }]);
|