detail.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. st_stockbillid: null,
  5. detail: {},
  6. tabsActive: 0,
  7. tabsList: [{
  8. label: "产品明细",
  9. icon: "icon-tabchanpin",
  10. model: "#Product"
  11. }, {
  12. label: "操作记录",
  13. icon: "icon-tabcaozuojilu1",
  14. model: "#record"
  15. }]
  16. },
  17. onLoad(options) {
  18. this.setData({
  19. st_stockbillid: options.id
  20. })
  21. this.getDetail()
  22. },
  23. getDetail() {
  24. _Http.basic({
  25. "id": 20230719153803,
  26. "content": {
  27. "st_stockbillid": this.data.st_stockbillid
  28. }
  29. }).then(res => {
  30. console.log("到货通知详情", res)
  31. if (res.msg != '成功') return wx.showToast({
  32. title: res.msg,
  33. icon: "none"
  34. })
  35. this.setData({
  36. detail: res.data
  37. })
  38. this.partialRenewal()
  39. })
  40. }, //局部数据更新 tabs
  41. partialRenewal(init = false) {
  42. let model = this.data.tabsList[this.data.tabsActive].model;
  43. if (model) {
  44. let Component = this.selectComponent(model),
  45. {
  46. total,
  47. pageNumber,
  48. pageTotal
  49. } = Component.data.content,
  50. id = this.data.st_stockbillid;
  51. if (total == null || init) {
  52. Component.getList(id, init);
  53. } else if (pageNumber <= pageTotal) {
  54. Component.getList(id, false);
  55. }
  56. }
  57. }, //tabs 切换
  58. tabsChange({
  59. detail
  60. }) {
  61. this.setData({
  62. tabsActive: detail
  63. });
  64. this.partialRenewal();
  65. },
  66. ConfirmReceiptOfGoods() {
  67. let that = this,
  68. isreceiver = this.data.detail.isreceiver;
  69. wx.showModal({
  70. content: '是否确定' + (isreceiver ? '收货反确认' : '收货确认') + '?',
  71. complete: (res) => {
  72. if (res.confirm) _Http.basic({
  73. id: "2025061311223103",
  74. content: {
  75. st_stockbillid: that.data.st_stockbillid,
  76. isreceiver: isreceiver ? 0 : 1
  77. }
  78. }).then(res => {
  79. wx.showToast({
  80. title: res.msg != '成功' ? res.msg : "操作成功",
  81. icon: "none"
  82. })
  83. if (res.msg != '成功') return
  84. that.setData({
  85. "detail.isreceiver": isreceiver ? 0 : 1
  86. })
  87. let page = getCurrentPages()[getCurrentPages().length - 2]
  88. if (page) {
  89. let index = page.data.list.findIndex(v => v.st_stockbillid == that.data.st_stockbillid);
  90. if (index != -1) {
  91. page.setData({
  92. [`list[${index}].isreceiver`]: that.data.detail.isreceiver
  93. })
  94. }
  95. }
  96. })
  97. }
  98. })
  99. },
  100. onReachBottom() {
  101. this.partialRenewal();
  102. },
  103. })