index.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. // pages/orderDetail/index.js
  2. const app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. textareaValue:'',
  9. btnLoading:false,
  10. activeType: 1,
  11. longitude:0,
  12. latitude:0,
  13. recordData: {},
  14. orderStatusStrList: [{
  15. color: '#346BE6',
  16. text: '待处理'
  17. },
  18. {
  19. color: '#00C777',
  20. text: '已处理'
  21. },
  22. {
  23. color: '#333333',
  24. text: '忽略'
  25. },
  26. ],
  27. },
  28. submit(){
  29. if (this.data.activeType==2&&!this.data.textareaValue) {
  30. wx.showToast({
  31. title: '请先输入忽略原因',
  32. icon:'none'
  33. })
  34. return
  35. }
  36. let parmas={
  37. ids:[this.data.recordData.id],
  38. reason:this.data.textareaValue,
  39. status:this.data.activeType
  40. }
  41. this.setData({
  42. btnLoading:true
  43. })
  44. app.request('/dock/manage/troubleUpload/handle','post',parmas).then(res=>{
  45. console.log(res);
  46. wx.showToast({
  47. title: '操作成功',
  48. icon: "none"
  49. })
  50. setTimeout(() => {
  51. wx.navigateBack()
  52. that.setData({
  53. btnLoading:false
  54. })
  55. }, 1500);
  56. }).catch(err=>{
  57. this.setData({
  58. btnLoading:false
  59. })
  60. })
  61. },
  62. textareaInput(e){
  63. this.setData({
  64. textareaValue: e.detail.value
  65. })
  66. },
  67. chooseType(e) {
  68. console.log(e);
  69. this.setData({
  70. activeType: e.currentTarget.dataset.type
  71. })
  72. },
  73. /**
  74. * 生命周期函数--监听页面加载
  75. */
  76. onLoad(options) {
  77. console.log(options.id);
  78. this.mapCtx = wx.createMapContext('map')
  79. app.request('/dock/manage/troubleUpload/queryById', 'get', {
  80. id: '1838869204518350849'
  81. }).then(res => {
  82. console.log(res);
  83. this.setData({
  84. recordData: res,
  85. longitude: res.longitude,
  86. latitude: res.latitude,
  87. })
  88. })
  89. },
  90. /**
  91. * 生命周期函数--监听页面初次渲染完成
  92. */
  93. onReady() {
  94. },
  95. /**
  96. * 生命周期函数--监听页面显示
  97. */
  98. onShow() {
  99. },
  100. /**
  101. * 生命周期函数--监听页面隐藏
  102. */
  103. onHide() {
  104. },
  105. /**
  106. * 生命周期函数--监听页面卸载
  107. */
  108. onUnload() {
  109. },
  110. /**
  111. * 页面相关事件处理函数--监听用户下拉动作
  112. */
  113. onPullDownRefresh() {
  114. },
  115. /**
  116. * 页面上拉触底事件的处理函数
  117. */
  118. onReachBottom() {
  119. },
  120. /**
  121. * 用户点击右上角分享
  122. */
  123. onShareAppMessage() {
  124. }
  125. })