approveDetail.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. var app = getApp()
  2. var that;
  3. Page({
  4. data: {
  5. review_id: '',
  6. isBh: false,//是否显示驳回弹窗
  7. textArea: "",
  8. disabled: false,
  9. corpId:'',
  10. },
  11. onLoad(e) {
  12. that = this;
  13. dd.setNavigationBar({ title: "详情" });
  14. if (e.id) {
  15. that.setData({ review_id: parseInt(e.id),userData:app.globalData.userData });
  16. }
  17. if (e.is) {
  18. that.setData({ is: e.is });
  19. }
  20. if(e.corpId){
  21. that.setData({ corpId:e.corpId });
  22. app.globalData.corpId=e.corpId
  23. }
  24. },
  25. onShow() {
  26. if (app.globalData.userData) {
  27. dd.hideLoading();
  28. that.getData();
  29. } else {
  30. app.login(that.data.corpId, function (is) {
  31. if (is) {
  32. dd.hideLoading();
  33. that.getData();
  34. } else {
  35. dd.reLaunch({
  36. url: '../noJurisdiction/noJurisdiction'
  37. })
  38. }
  39. },function(){})
  40. }
  41. },
  42. showImg(e) {
  43. var index = e.target.dataset.index;
  44. var item = e.target.dataset.item
  45. dd.previewImage({
  46. current: index,
  47. urls: item
  48. });
  49. },
  50. submit() {
  51. dd.navigateTo({
  52. url: '../approve/approve?id=' + that.data.dataDetail.id
  53. })
  54. },
  55. bindTextAreaBlur(e) {
  56. this.setData({
  57. textArea: e.detail.value
  58. });
  59. },
  60. openBh(e) {
  61. this.setData({ isBh: !this.data.isBh, textArea: '' })
  62. },
  63. confirmBh() {
  64. if (!that.data.textArea) {
  65. app.globalData.showToast("请输入审批意见");
  66. return;
  67. }
  68. this.setData({disabled:true});
  69. app.$post("api/integral/review", { review_id: that.data.review_id, remark: that.data.textArea, action: "refuse", ticket_count: 0 }).then((res) => {
  70. app.globalData.showToast("已驳回");
  71. that.setData({disabled:false});
  72. var pages=getCurrentPages();//当上一页的page不等于一时,执行上一页的方法
  73. var active=pages[pages.length-2];
  74. if(active.data.page!=1){
  75. active.refreshData(that.data.review_id);
  76. }
  77. setTimeout(() => {
  78. dd.navigateBack({ delta: 1 });
  79. }, 1000);
  80. })
  81. },
  82. openCx() {
  83. dd.confirm({
  84. title: '撤掉审批',
  85. content: '您确定撤掉此项吗?',
  86. confirmButtonText: '确定',
  87. cancelButtonText: '取消',
  88. success: (result) => {
  89. if (result.confirm) {
  90. app.$post("api/integral/review/destroy", { review_id: that.data.review_id }).then((res) => {
  91. app.globalData.showToast("已撤掉");
  92. var pages=getCurrentPages();//当上一页的page不等于一时,执行上一页的方法
  93. var active=pages[pages.length-2];
  94. if(active.data.page!=1){
  95. active.refreshData(that.data.review_id);
  96. }
  97. setTimeout(() => {
  98. dd.navigateBack({
  99. delta: 1
  100. })
  101. }, 1000);
  102. })
  103. }
  104. },
  105. });
  106. },
  107. getData() {
  108. // that.data.review_id
  109. app.$get("api/integral/review", { review_id: that.data.review_id }).then((res) => {
  110. var data = res.data.data;
  111. data.typeName = app.getTypesItem(data.pt_id).name;
  112. this.setData({
  113. dataDetail: data
  114. })
  115. })
  116. },
  117. });