editOrder.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. const app = getApp();
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. transportName:null,
  8. transport:null,
  9. driverName:null,
  10. plateNum:null,
  11. //运输类型id 10 汽车 20船 30火车 40飞机 50其他
  12. transportType:[
  13. {name:'汽车',type:'10'},
  14. {name:'船运',type:'20'},
  15. {name:'火车',type:'30'},
  16. {name:'飞机',type:'40'},
  17. {name:'其他',type:'50'},
  18. ],
  19. },
  20. setTransportName(e){
  21. this.setData({
  22. transportName:e.detail.value
  23. })
  24. },
  25. setDriverName(e){
  26. this.setData({
  27. driverName:e.detail.value
  28. })
  29. },
  30. setPlateNum(e){
  31. this.setData({
  32. plateNum:e.detail.value
  33. })
  34. },
  35. /**
  36. * 生命周期函数--监听页面加载
  37. */
  38. onLoad: function (options) {
  39. const {transportName,transport,driverName,plateNum,code,uid} = options;
  40. this.setData({
  41. transportName,driverName,plateNum,code,uid
  42. })
  43. this.setOptonsType(transport)
  44. },
  45. setOptonsType(transport){
  46. var transportType = this.data.transportType;
  47. for(var i=0;i<transportType.length;i++){
  48. if(transport == transportType[i].name){
  49. this.setData({
  50. transport:i
  51. })
  52. break;
  53. }
  54. }
  55. },
  56. setTransportType(e){
  57. var value = e.detail.value;
  58. this.setData({
  59. transport:value+''
  60. })
  61. },
  62. addLabel(){
  63. const {transportName,transport,driverName,plateNum,code,uid} = this.data;
  64. this.updteVvmTransportOrder({transportName,transport,driverName,plateNum,code,uid})
  65. },
  66. updteVvmTransportOrder(form){
  67. var that = this;
  68. app.requestP({
  69. url: '/transport/updteVvmTransportOrder',
  70. method: 'post',
  71. contentType: 'application/json',
  72. data: form
  73. }).then(res=>{
  74. app.showToptip(that, 'success', res.data.msg);
  75. wx.navigateBack({
  76. delta: 1,
  77. })
  78. }).catch(err=>{
  79. app.showToptip(that, 'error', err.data.msg)
  80. })
  81. },
  82. /**
  83. * 生命周期函数--监听页面初次渲染完成
  84. */
  85. onReady: function () {
  86. },
  87. /**
  88. * 生命周期函数--监听页面显示
  89. */
  90. onShow: function () {
  91. },
  92. /**
  93. * 生命周期函数--监听页面隐藏
  94. */
  95. onHide: function () {
  96. },
  97. /**
  98. * 生命周期函数--监听页面卸载
  99. */
  100. onUnload: function () {
  101. },
  102. /**
  103. * 页面相关事件处理函数--监听用户下拉动作
  104. */
  105. onPullDownRefresh: function () {
  106. },
  107. /**
  108. * 页面上拉触底事件的处理函数
  109. */
  110. onReachBottom: function () {
  111. },
  112. /**
  113. * 用户点击右上角分享
  114. */
  115. onShareAppMessage: function () {
  116. }
  117. })