rewardCtrl.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. angular.module('push')
  2. .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) {
  3. //虚拟搜索框
  4. $scope.isShowSearchButton = true;
  5. $scope.keyfilter = {
  6. key: ''
  7. }
  8. $scope.pagenum = 1;
  9. $scope.pagesize = 6;
  10. $scope.noData = false;
  11. $scope.activitiytype = 0;
  12. $scope.node = UserService.node;
  13. $scope.allData = [];
  14. $scope.index = 0;
  15. $scope.initData = [];
  16. $scope.userid = UserService.id;
  17. if ($scope.app) {
  18. if (device.platform != "Android") {
  19. $scope.isIos = true;
  20. } else {
  21. $scope.isIos = false;
  22. }
  23. }
  24. //获取全部兑现数据
  25. var getPayCashList = function () {
  26. dataToolsService.getPayCashList().then(function (res) {
  27. console.log(res)
  28. if (res.code == 3350) {
  29. $scope.paycashlist = res.data;
  30. $scope.allData = $scope.paycashlist;
  31. }
  32. })
  33. };
  34. getPayCashList();
  35. $scope.goBackWhere = function () {
  36. if ($stateParams.comfrom == 'homepageOfNode') {
  37. $scope.go('homepageOfNode');
  38. } else if ($stateParams.comfrom == 'tab.account') {
  39. $scope.go('tab.account');
  40. } else {
  41. $scope.go('tab.activityIndex');
  42. }
  43. };
  44. $scope.rewardHollList = [
  45. {title: '奖补类别', selected: true, type: 0},
  46. {title: '申报记录', selected: false, type: 1},
  47. {title: '退回情况', selected: false, type: 2},
  48. ]
  49. $scope.rewardHollLists = [
  50. {title: '产学研合作补助', selected: true, type: 0},
  51. {title: '研发后补助', selected: false, type: 1},
  52. ]
  53. $scope.addrKey = '';
  54. $scope.tasktype = 0;
  55. var policyRewardhistoryList = function (restType,demandType) {
  56. $scope.showLoadingToast();
  57. if (UserService.id) {
  58. dataToolsService.policyRewardhistoryList(restType,demandType).then(function (res) {
  59. console.log(res);
  60. $scope.hideLoadingToast();
  61. if (res.code == 3350) {
  62. $scope.initData = res.data;
  63. $scope.allData = $scope.paycashlist;
  64. }
  65. });
  66. }
  67. }
  68. policyRewardhistoryList(2,1111);
  69. $scope.policySetting = function (list) {
  70. $scope.go("policySetting", {list: list});
  71. }
  72. $scope.toDeclare = function (list) {
  73. /*$scope.go("toDeclare", {list:list});*/
  74. if(!UserService.id || UserService.id == 0){
  75. $scope.go('login');
  76. return;
  77. }
  78. AccountService.getAuthorizationLetterList(UserService.id,UserService.node).then(function (res) {
  79. console.log(res)
  80. if (res.data.length == 0) {
  81. var confirmPopup = $ionicPopup.confirm({
  82. title: '认证提醒',
  83. template: '请先认证企业身份再进行产学研合作补助申报!',
  84. cancelText: '取消',
  85. okText: '去认证',
  86. });
  87. confirmPopup.then(function (res) {
  88. if (res) {
  89. $scope.go("identifyForm", {pageTitle: "企业认证", code: 4803, type: "", id: "", action: 'submit'});
  90. }
  91. })
  92. } else {
  93. $scope.go("toDeclare", {list: JSON.stringify(list)});
  94. }
  95. })
  96. }
  97. ResourceLibraryService.judgeManager(UserService.id, 10501).then(function (res) {
  98. $scope.hasAuth = res.data;
  99. })
  100. $scope.changeSelecteds=function(index){
  101. console.log(index);
  102. angular.forEach($scope.rewardHollLists, function (val) {
  103. val.selected = false;
  104. })
  105. $scope.rewardHollLists[index].selected = true;
  106. if($scope.rewardHollList[2].selected == true){
  107. if(index==0){
  108. policyRewardhistoryList(2,-1);
  109. }else {
  110. policyRewardhistoryList(1611726857 ,-2);
  111. }
  112. }else {
  113. if(index==0){
  114. policyRewardhistoryList(2,1111);
  115. }else {
  116. policyRewardhistoryList(1611726857 ,1111);
  117. }
  118. }
  119. }
  120. //进入详情
  121. $scope.goSubsidyauditafteDetail = function (list) {
  122. console.log(list)
  123. if((list.demandstatus==-2||list.demandstatus==-1)&&$scope.rewardHollList[2].selected == true){
  124. $scope.go("toDeclare", {list: JSON.stringify(list)});
  125. }else {
  126. if(list.restype==2){
  127. $scope.go("cooperateDetail", {list: list, id: list.technicalcontractid});
  128. }else {
  129. $scope.go("SubsidyauditafteDetail", {list: list, id: list.researchCostId});
  130. }
  131. }
  132. }
  133. $scope.changeSelected = function (index) {
  134. $scope.index = index;
  135. $scope.pagenum = 1;
  136. $scope.showLoadMore = true;
  137. if ((index == 1 || index == 2) && !ConfigService.islogin) {
  138. if (localStorage.wxFlag == "true") {
  139. if (localStorage.isUserFocusXW == 0) {
  140. var title = localStorage.appidStr;
  141. $ionicPopup.alert({
  142. title: '提示',
  143. template: '请先关注微信公众号"' + title + '"!'
  144. });
  145. return;
  146. } else {
  147. if (localStorage.isUserBindWx == 0) {
  148. var wxFlag = JSON.parse(localStorage.params);
  149. if (wxFlag.weChatModel) {
  150. $scope.go('bindPhone', {
  151. params: localStorage.params,
  152. comfrom: 'maincontroller',
  153. url: window.location.href.split('#/')[1]
  154. });
  155. } else {
  156. $scope.go('login');
  157. return;
  158. }
  159. } else {
  160. $scope.go('login');
  161. return;
  162. }
  163. }
  164. } else {
  165. $scope.go('login');
  166. return;
  167. }
  168. return;
  169. }
  170. angular.forEach($scope.rewardHollList, function (val) {
  171. val.selected = false;
  172. })
  173. $scope.rewardHollList[index].selected = true;
  174. //待申请
  175. if (index == 1) {
  176. $scope.allData = [];
  177. angular.forEach($scope.initData, function (value, index) {
  178. if (value.demandstatus == -4) {
  179. $scope.allData.push(value);
  180. }
  181. })
  182. policyRewardhistoryList(2 ,1111);
  183. $scope.rewardHollLists[1].selected = false;
  184. $scope.rewardHollLists[0].selected = true;
  185. }
  186. //已申请
  187. if (index == 2) {
  188. $scope.allData = [];
  189. angular.forEach($scope.initData, function (value, index) {
  190. if (value.demandstatus != -4) {
  191. $scope.allData.push(value);
  192. }
  193. })
  194. policyRewardhistoryList(2 ,-2);
  195. $scope.rewardHollLists[1].selected = false;
  196. $scope.rewardHollLists[0].selected = true;
  197. }
  198. //全部兑现
  199. if (index == 0) {
  200. $scope.allData = [];
  201. $scope.allData = $scope.paycashlist;
  202. }
  203. $ionicScrollDelegate.$getByHandle('privateContent').scrollTop(true);
  204. }
  205. $scope.showSearchButtonLeft = function () {
  206. // console.log('aaa');
  207. $scope.isShowSearchButton = false;
  208. $timeout(function () {
  209. $(".showSearchInput").focus();
  210. }, 300)
  211. };
  212. $scope.clearSearch = function () {
  213. $scope.isShowSearchButton = true;
  214. $scope.keyfilter.key = "";
  215. $scope.getData();
  216. }
  217. $scope.rewardgoback = function(){
  218. $scope.go('tab.activityIndex');
  219. }
  220. $scope.goToReward = function (list) {
  221. if ($scope.index != 0) {
  222. if (!ConfigService.islogin) {
  223. if (localStorage.wxFlag == "true") {
  224. if (localStorage.isUserFocusXW == 0) {
  225. var title = localStorage.appidStr;
  226. $ionicPopup.alert({
  227. title: '提示',
  228. template: '请先关注微信公众号"' + title + '"!'
  229. });
  230. return;
  231. } else {
  232. if (localStorage.isUserBindWx == 0) {
  233. var wxFlag = JSON.parse(localStorage.params);
  234. if (wxFlag.weChatModel) {
  235. $scope.go('bindPhone', {
  236. params: localStorage.params,
  237. comfrom: 'maincontroller',
  238. url: window.location.href.split('#/')[1]
  239. });
  240. } else {
  241. $scope.go('login');
  242. return;
  243. }
  244. } else {
  245. $scope.go('login');
  246. return;
  247. }
  248. }
  249. } else {
  250. $scope.go('login');
  251. return;
  252. }
  253. } else {
  254. ResourceLibraryService.getResourceByID(list.resid).then(function (resvalue) {
  255. if (resvalue.code == 3350) {
  256. var resource = resvalue.data;
  257. if(!resource){
  258. $scope.go('cooperateDetail', {list: list, id: list.id});
  259. }else {
  260. taskModuleService.getUserPermissionCheck(resource.otherid, list.creator, UserService.id).then(function (res) {
  261. if (res.code == 3350) {
  262. $scope.isVisiableFlag = res.data;
  263. if (!$scope.isVisiableFlag) {
  264. AccountService.getUserCheckInfo(UserService.id).then(function (userres) {
  265. if (userres.code == 3350) {
  266. var user = userres.data;
  267. //技术经纪人正在审核中
  268. if (user.authenstatus == 5101) {
  269. $ionicPopup.confirm({
  270. title: '提示',
  271. template: '需先认证为技术经纪人,方可申请技术合作类奖励',
  272. okText: '去认证',
  273. cancelText: '取消'
  274. }).then(function (result) {
  275. if (result) {
  276. $scope.go('identifyStatus', {
  277. pageTitle: '技术经纪人',
  278. code: 4801,
  279. type: 5101,
  280. id: user.id,
  281. action: 'submit',
  282. comfrom: 'resubmit'
  283. });
  284. }
  285. })
  286. } else
  287. //技术经纪人认证失败或是退回
  288. if (user.authenstatus == 5103 || user.authenstatus == 5104) {
  289. if (list.restype == 4801) {
  290. $ionicPopup.confirm({
  291. title: '提示',
  292. template: '需先认证为技术经纪人,方可申请技术合作类奖励',
  293. okText: '去认证',
  294. cancelText: '取消'
  295. }).then(function (result) {
  296. if (result) {
  297. $scope.go('identifyStatus', {
  298. pageTitle: '技术经纪人',
  299. code: 4801,
  300. type: user.authenstatus,
  301. id: user.id,
  302. action: 'submit',
  303. comfrom: 'resubmit'
  304. });
  305. }
  306. })
  307. }
  308. if (list.restype == 1) {
  309. $ionicPopup.confirm({
  310. title: '提示',
  311. template: '需先认证为技术经纪人,方可申请技术需求类奖励',
  312. okText: '去认证',
  313. cancelText: '取消'
  314. }).then(function (result) {
  315. if (result) {
  316. if ($scope.node == '330122000') {
  317. $scope.go('identifyFormForTongLu', {
  318. code: 4801,
  319. type: user.authenstatus,
  320. action: 'submit',
  321. id: user.id,
  322. comfrom: 'resubmit',
  323. pageTitle: '技术经纪人认证'
  324. })
  325. } else {
  326. $scope.go('identifyForm', {
  327. code: 4801,
  328. type: user.authenstatus,
  329. action: 'submit',
  330. id: user.id,
  331. comfrom: 'resubmit',
  332. pageTitle: '技术经纪人认证'
  333. })
  334. }
  335. }
  336. })
  337. }
  338. } else {
  339. //没有进行过技术经纪人认证信息提交的
  340. if (user == null || user.authenstatus == null) {
  341. if (list.restype == 4801) {
  342. $ionicPopup.confirm({
  343. title: '提示',
  344. template: '需先认证为技术经纪人,方可申请技术合作类奖励',
  345. okText: '去认证',
  346. cancelText: '取消'
  347. }).then(function (result) {
  348. if (result) {
  349. if (UserService.node == '330122000') {
  350. $scope.go('identifyFormForTongLu', {
  351. pageTitle: '技术经纪人认证',
  352. type: 5100,
  353. code: 4801,
  354. action: 'submit'
  355. });
  356. } else {
  357. $scope.go('identifyForm', {
  358. pageTitle: '技术经纪人认证',
  359. type: 5100,
  360. code: 4801,
  361. action: 'submit'
  362. });
  363. }
  364. }
  365. })
  366. }
  367. if (list.restype == 1) {
  368. $ionicPopup.confirm({
  369. title: '提示',
  370. template: '需先认证为技术经纪人,方可申请技术需求类奖励',
  371. okText: '去认证',
  372. cancelText: '取消'
  373. }).then(function (result) {
  374. if (result) {
  375. if ($scope.node == "330122000") {
  376. $scope.go('identifyFormForTongLu', {
  377. pageTitle: '技术经纪人认证',
  378. type: 5100,
  379. code: 4801,
  380. action: 'submit'
  381. });
  382. } else {
  383. $scope.go('identifyForm', {
  384. pageTitle: '技术经纪人认证',
  385. type: 5100,
  386. code: 4801,
  387. action: 'submit'
  388. });
  389. }
  390. }
  391. })
  392. }
  393. } else {
  394. if (list.restype == 4801) {
  395. $scope.go('technicalawardapplication', {
  396. pageTitle: "技术经纪人技术合作类奖励",
  397. code: 4801,
  398. type: 5100,
  399. action: 'submit',
  400. resid: list.resid,
  401. restype: list.restype,
  402. list: list
  403. });
  404. }
  405. if (list.restype == 1) {
  406. $scope.go("demandRewardDetail", {
  407. resid: list.resid,
  408. comefrom: 'reward',
  409. list: list
  410. });
  411. }
  412. }
  413. }
  414. }
  415. })
  416. } else {
  417. if (list.restype == 4801) {
  418. $scope.go('technicalawardapplication', {
  419. pageTitle: "技术经纪人技术合作类奖励",
  420. code: 4801,
  421. type: 5100,
  422. action: 'submit',
  423. resid: list.resid,
  424. restype: list.restype,
  425. list: list
  426. });
  427. }
  428. if (list.restype == 1) {
  429. $scope.go("demandRewardDetail", {
  430. resid: list.resid,
  431. comefrom: 'reward',
  432. list: list
  433. });
  434. }
  435. }
  436. }
  437. })
  438. }
  439. }
  440. })
  441. }
  442. }
  443. }
  444. }]);