approveDetail.js 2.6 KB

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