index.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // pages/tabber/builds/index.js
  2. const app=getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. intval:"",
  9. data:""
  10. },
  11. bindinput(e){
  12. this.setData({
  13. intval:e.detail.value
  14. })
  15. },
  16. binsubmit(){
  17. wx.navigateTo({
  18. url:"/pages/tabber/builds/hand_desc/handDesc?pylon_no="+this.data.intval
  19. })
  20. },
  21. onLoad(){
  22. this.getdata();
  23. },
  24. onShow(){
  25. this.getdata();
  26. },
  27. onPullDownRefresh(){
  28. this.getdata();
  29. },
  30. getScancode: function () {
  31. var _this = this;
  32. // 允许从相机和相册扫码
  33. wx.scanCode({
  34. onlyFromCamera: true,
  35. scanType: ['barCode', 'qrCode', 'datamatrix', 'pdf417'],
  36. success: (res) => {
  37. console.log(res);
  38. var result = res.result;
  39. _this.setData({
  40. intval: result,
  41. })
  42. wx.navigateTo({
  43. url:"/pages/tabber/builds/hand_desc/handDesc?pylon_no="+result
  44. })
  45. },
  46. fail: (err) => {
  47. console.log(err);
  48. }
  49. })
  50. },
  51. getdata(result=""){
  52. var that = this;
  53. app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/hand", {
  54. }, "get").then(function (res) {
  55. console.log(res);
  56. wx.stopPullDownRefresh()
  57. if (res.code != 200) {
  58. wx.showLoading({
  59. title: res.message.msg,
  60. })
  61. setTimeout(function () {
  62. wx.hideLoading();
  63. }, 1000);
  64. } else {
  65. wx.hideLoading();
  66. let data = res.message.data
  67. that.setData({
  68. data
  69. })
  70. }
  71. }).catch(function (err) {
  72. console.log(222);
  73. })
  74. },
  75. gourl(e){
  76. if(e.currentTarget.dataset.sta<=0){
  77. wx.showModal({
  78. title: '提示',
  79. content: "空挂架"
  80. })
  81. }else{
  82. wx.navigateTo({
  83. url: '/pages/tabber/builds/hand_desc/handDesc?pylon_no='+ e.currentTarget.dataset.id
  84. })
  85. }}
  86. })