delete.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. deletereason: "",
  5. },
  6. onLoad(options) {
  7. if (options.item) this.setData({
  8. ...JSON.parse(options.item)
  9. })
  10. },
  11. onInput(e) {
  12. this.setData({
  13. deletereason: e.detail.value
  14. })
  15. },
  16. handleDetele() {
  17. if (!this.data.deletereason) return;
  18. _Http.basic({
  19. "id": 20220930121701,
  20. "content": {
  21. ...this.data
  22. }
  23. }).then(res => {
  24. console.log("删除", res);
  25. if (res.msg != '成功') return wx.showToast({
  26. title: res.data,
  27. icon: "none"
  28. });
  29. wx.showToast({
  30. title: '作废成功',
  31. icon: "none"
  32. })
  33. getCurrentPages().forEach(v => {
  34. //如果页面历史有详情,退出详情
  35. if (['packageA/setclient/modules/trace/detail/index'].includes(v.__route__)) wx.navigateBack();
  36. //如果页面历史有列表页 刷新列表
  37. if (v.selectComponent("#Trace")) {
  38. let page = v.selectComponent("#Trace")
  39. page.setData({
  40. list: page.data.list.filter(s => s.sys_datafollowupid != this.data.sys_datafollowupid)
  41. })
  42. page.changeTotal()
  43. }
  44. });
  45. wx.navigateBack();
  46. })
  47. }
  48. })