approveDetail.js 2.5 KB

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