delete.js 1.4 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. _Http.basic({
  18. "id": 20221010164402,
  19. "content": {
  20. ...this.data
  21. }
  22. }).then(res => {
  23. console.log("作废", res);
  24. if (res.msg != '成功') return wx.showToast({
  25. title: res.data,
  26. icon: "none"
  27. });
  28. wx.showToast({
  29. title: '作废成功',
  30. icon: "none"
  31. })
  32. setTimeout(() => {
  33. getCurrentPages().forEach(v => {
  34. if (['packageA/setclient/detail'].includes(v.__route__)) {
  35. wx.navigateBack();
  36. } else if (['packageA/setclient/index', 'packageA/setclient/search'].includes(v.__route__)) {
  37. v.setData({
  38. list: v.data.list.filter(s => s.sa_customersid != this.data.sa_customersids[0]),
  39. 'content.total': v.data.content.total - 1
  40. })
  41. }
  42. });
  43. wx.navigateBack();
  44. }, 300)
  45. })
  46. }
  47. })