approveDetail.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. let corpId = that.data.corpId ? that.data.corpId : app.globalData.corpId
  31. app.login(corpId, function (is) {
  32. if (is) {
  33. dd.hideLoading();
  34. that.setData({userData: app.globalData.userData });
  35. that.getData();
  36. } else {
  37. dd.reLaunch({
  38. url: '../noJurisdiction/noJurisdiction'
  39. })
  40. }
  41. }, function () { })
  42. }
  43. },
  44. showImg(e) {
  45. var index = e.target.dataset.index;
  46. var item = e.target.dataset.item
  47. dd.previewImage({
  48. current: index,
  49. urls: item
  50. });
  51. },
  52. submit() {
  53. dd.navigateTo({
  54. url: '../approve/approve?id=' + that.data.dataDetail.id
  55. })
  56. },
  57. bindTextAreaBlur(e) {
  58. this.setData({
  59. textArea: e.detail.value
  60. });
  61. },
  62. openBh(e) {
  63. this.setData({ isBh: !this.data.isBh, textArea: '' })
  64. },
  65. confirmBh() {
  66. if (!that.data.textArea) {
  67. app.globalData.showToast("请输入审批意见");
  68. return;
  69. }
  70. this.setData({ disabled: true });
  71. app.$post("api/integral/review", { review_id: that.data.review_id, remark: that.data.textArea, action: "refuse", ticket_count: 0 }).then((res) => {
  72. app.globalData.showToast("已驳回");
  73. that.setData({ disabled: false });
  74. var pages = getCurrentPages();//当上一页的page不等于一时,执行上一页的方法
  75. var active = pages[pages.length - 2];
  76. if (active) {
  77. if (active.data.page != 1) {
  78. active.refreshData(that.data.review_id);
  79. }
  80. setTimeout(() => {
  81. dd.navigateBack({ delta: 1 });
  82. }, 1000);
  83. } else {
  84. setTimeout(() => {
  85. dd.reLaunch({
  86. url: '/pages/workbench/index/index'
  87. })
  88. }, 1000);
  89. }
  90. })
  91. },
  92. openCx() {
  93. dd.confirm({
  94. title: '撤掉审批',
  95. content: '您确定撤掉此项吗?',
  96. confirmButtonText: '确定',
  97. cancelButtonText: '取消',
  98. success: (result) => {
  99. if (result.confirm) {
  100. app.$post("api/integral/review/destroy", { review_id: that.data.review_id }).then((res) => {
  101. app.globalData.showToast("已撤掉");
  102. var pages = getCurrentPages();//当上一页的page不等于一时,执行上一页的方法
  103. var active = pages[pages.length - 2];
  104. if (active) {
  105. if (active.data.page != 1) {
  106. active.refreshData(that.data.review_id);
  107. active.filtrationList(2, item.review_id);
  108. }
  109. setTimeout(() => {
  110. dd.navigateBack({delta: 1})
  111. }, 1000);
  112. } else {
  113. setTimeout(() => {
  114. dd.reLaunch({
  115. url: '/pages/workbench/index/index'
  116. })
  117. }, 1000);
  118. }
  119. })
  120. }
  121. },
  122. });
  123. },
  124. getData() {
  125. app.$get("api/integral/review", { review_id: that.data.review_id }).then((res) => {
  126. var data = res.data.data;
  127. data.typeName = app.getTypesItem(data.pt_id).name;
  128. this.setData({
  129. dataDetail: data
  130. })
  131. })
  132. },
  133. });