replenishDetail.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // pages/stock/replenishDetail.js
  2. const util = require('../../utils/util.js');
  3. const app = getApp();
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. deviceSn:'',
  10. storeId:'',
  11. deviceInfo:{
  12. deviceDetail:{
  13. mgVmDevice:{},
  14. stockGrid:''
  15. },
  16. productList:[]
  17. }
  18. },
  19. /**
  20. * 生命周期函数--监听页面加载
  21. */
  22. onLoad: function (options) {
  23. this.setData({
  24. storeId: options.storeId
  25. })
  26. this.bindDevice()
  27. },
  28. scanCodeEvent() {
  29. var that = this;
  30. wx.scanCode({
  31. onlyFromCamera: true, // 只允许从相机扫码
  32. success(res) {
  33. console.log("扫码成功:" + JSON.stringify(res))
  34. that.setData({
  35. deviceSn: res.result
  36. })
  37.  wx.navigateTo({
  38.       url: '/pages/device/detail?deviceId=' + res.result,
  39.     })
  40. }
  41. })
  42. },
  43. searchInfo(){
  44. this.bindDevice()
  45. },
  46. bindDevice(){
  47. var that = this
  48. util.request(util.api.stockDeviceList, {storeId:that.data.storeId,deviceSn:that.data.deviceSn}, "GET", false, true,app.globalData.token).then((res)=>{
  49. if (res.code == 200) {
  50. that.setData({
  51. deviceInfo: res.result,
  52. })
  53. }
  54. }).catch((res) => {})
  55. },
  56. inputedit: function (e) {
  57. let _this = this;
  58. let dataset = e.currentTarget.dataset;
  59. let value = e.detail.value;
  60. let name = dataset.name;
  61. _this.data[name] = value;
  62. _this.setData({
  63. [name]: _this.data[name]
  64. });
  65. },
  66. })