storage.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. // pages/tabber/news/index.js
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. isselect: false,
  9. selectitem: '',
  10. selectInfo: "",
  11. show:false,
  12. networkid: 0,
  13. ordernum: 0,
  14. sealno: '',
  15. cftext: '',
  16. externalcabinet: 0,
  17. spotid: 0,
  18. },
  19. /**
  20. * 生命周期函数--监听页面加载
  21. */
  22. onLoad: function (options) {
  23. this.setData({
  24. networkid:options.networkid,ordernum:options.ordernum
  25. })
  26. class Select {
  27. in = 1
  28. getSelet(){
  29. console.log(2);
  30. return 10
  31. }
  32. }
  33. var b = new Select();
  34. console.log(b.getSelet());
  35. },
  36. onShow(){
  37. this.getinfo()
  38. },
  39. /**
  40. * 生命周期函数--监听页面初次渲染完成
  41. */
  42. onReady: function () {
  43. },
  44. gonext(){
  45. let that = this
  46. console.log(that.data.cftext)
  47. wx.navigateTo({
  48. url: '/pages/signFor/storagenext?network_id='+that.data.selectitem.id+'&device_id='+that.data.ordernum+'&seal_no='+that.data.sealno+'&spout_device_id='+that.data.spotid+'&remark='+that.data.cftext,
  49. })
  50. },
  51. goshow:function(){
  52. let that = this
  53. if(this.data.show){
  54. this.setData({
  55. show:false
  56. })
  57. }else{
  58. wx.showLoading()
  59. if(that.data.selectitem!=''){
  60. app.api.useApi(app.globalData.baseAppUrl + "api/admin/temporary", {
  61. device_id: that.data.ordernum,
  62. seal_no:that.data.sealno,
  63. network_id:that.data.selectitem.id
  64. }, "post").then(function (res) {
  65. wx.hideLoading();
  66. wx.showToast({
  67. title: res.message.msg,
  68. icon: 'none'
  69. })
  70. if (res.code== 200) {
  71. that.setData({
  72. show:true
  73. })
  74. that.setData({externalcabinet: res.message.data.external_cabinet,spotid:res.message.data.spot_id})
  75. }
  76. }).catch(function (err) {
  77. console.log(222);
  78. })
  79. }else{
  80. wx.showToast({
  81. title: '请选择目的地',
  82. icon: 'none'
  83. })
  84. }
  85. }
  86. },
  87. changeisselect(){
  88. this.setData({isselect: !this.data.isselect})
  89. },
  90. chooseselect(e){
  91. this.setData({selectitem: e.currentTarget.dataset.item})
  92. this.changeisselect()
  93. },
  94. changesealno(e){
  95. this.setData({sealno:e.detail.value})
  96. },
  97. changecftext(e){
  98. this.setData({cftext:e.detail.value})
  99. },
  100. getinfo(){
  101. let that = this
  102. app.api.useApi(app.globalData.baseAppUrl + "api/admin/shop_list", {}, "get").then(function (res) {
  103. wx.hideLoading();
  104. if (res.code== 200) {
  105. that.setData({selectInfo:res.message.data})
  106. }else{
  107. }
  108. }).catch(function (err) {
  109. console.log(222);
  110. })
  111. },
  112. })