index.js 1.9 KB

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