index.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. properties: {},
  4. data: {
  5. show: false,
  6. endreason: ""
  7. },
  8. methods: {
  9. onClick(sa_projectid) {
  10. this.setData({
  11. show: true
  12. })
  13. let Dialog = this.selectComponent("#Dialog");
  14. Dialog.data.beforeClose = (action) => new Promise((resolve) => {
  15. if (action === 'confirm') {
  16. if (!this.data.endreason) {
  17. Dialog.setData({
  18. "loading.confirm": false
  19. })
  20. wx.showToast({
  21. title: '还未填写结案原因',
  22. icon: "none"
  23. })
  24. } else {
  25. _Http.basic({
  26. "id": 20221215163702,
  27. "content": {
  28. sa_projectid,
  29. endreason: this.data.endreason
  30. }
  31. }).then(res => {
  32. console.log('结案', res)
  33. wx.showToast({
  34. title: res.msg == '成功' ? '已结案' : res.msg,
  35. icon: "none"
  36. });
  37. resolve(true);
  38. let page = getCurrentPages()[getCurrentPages().length - 1];
  39. page.getDetail();
  40. })
  41. }
  42. } else {
  43. resolve(false);
  44. this.setData({
  45. show: false
  46. })
  47. }
  48. });
  49. },
  50. onChange(e) {
  51. this.data.endreason = e.detail.value;
  52. }
  53. }
  54. })