index.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. // pages/yichangchuli/index.js
  2. const app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. id: 0,
  9. info: '',
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad: function (options) {
  15. this.setData({id: options.id})
  16. },
  17. /**
  18. * 生命周期函数--监听页面显示
  19. */
  20. onShow: function () {
  21. this.getinfo()
  22. },
  23. getinfo() {
  24. let that = this;
  25. app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry/abnormal_details", {id:that.data.id}, "get").then(function (res) {
  26. if (res.code != 200) {
  27. console.log(res.message.msg)
  28. wx.showLoading({
  29. title: res.message.msg,
  30. })
  31. } else {
  32. that.setData({
  33. info: res.message.data,
  34. })
  35. }
  36. wx.hideLoading();
  37. }).catch(function (err) {
  38. console.log(222);
  39. })
  40. },
  41. changeabnormal(e){
  42. let id = e.currentTarget.dataset.id
  43. let status = e.currentTarget.dataset.status
  44. let that = this;
  45. app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry/abnormal_status", {id:id,status:status}, "post").then(function (res) {
  46. wx.showToast({
  47. title: res.message.msg,
  48. icon: 'none',
  49. duration: 1100
  50. })
  51. that.getinfo()
  52. }).catch(function (err) {
  53. console.log(222);
  54. })
  55. },
  56. gofj(){
  57. // wx.navigateTo({
  58. // url: '../../sorting/enter/enter?seal_no='+this.data.info.seal_no,
  59. // })
  60. },
  61. submit(e){
  62. var that = this;
  63. app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry/submit", {
  64. seal_no: that.data.info.seal_no,
  65. }, "post").then(function (res) {
  66. console.log(res);
  67. if (res.code != 200) {
  68. wx.showLoading({
  69. title: res.message.msg,
  70. })
  71. setTimeout(function () {
  72. wx.hideLoading();
  73. }, 1000);
  74. } else {
  75. wx.hideLoading();
  76. wx.showLoading({
  77. title: res.message.msg,
  78. })
  79. setTimeout(function () {
  80. wx.hideLoading();
  81. wx.navigateBack()
  82. // wx.navigateTo({
  83. // url: '/pages/sorting/enternext/enternext?status='+res.message.data.status+'&id='+res.message.data.id,
  84. // })
  85. }, 500);
  86. }
  87. }).catch(function (err) {
  88. console.log(222);
  89. })
  90. },
  91. goback(){
  92. wx.navigateBack()
  93. },
  94. gophone(){
  95. wx.makePhoneCall({
  96. phoneNumber: this.data.info.phone
  97. })
  98. },
  99. /**
  100. * 生命周期函数--监听页面初次渲染完成
  101. */
  102. onReady: function () {
  103. },
  104. /**
  105. * 生命周期函数--监听页面隐藏
  106. */
  107. onHide: function () {
  108. },
  109. /**
  110. * 生命周期函数--监听页面卸载
  111. */
  112. onUnload: function () {
  113. },
  114. /**
  115. * 页面相关事件处理函数--监听用户下拉动作
  116. */
  117. onPullDownRefresh: function () {
  118. },
  119. /**
  120. * 页面上拉触底事件的处理函数
  121. */
  122. onReachBottom: function () {
  123. },
  124. /**
  125. * 用户点击右上角分享
  126. */
  127. onShareAppMessage: function () {
  128. }
  129. })