stockout.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // pages/stock/stockout.js
  2. const util = require('../../utils/util.js');
  3. const app = getApp();
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. storeList:{id:'', storeName:''},
  10. searchParams: {
  11. storeId:'',
  12. storeName:'',
  13. },
  14. deviceList: {
  15. deviceDetail:{
  16. mgVmDevice:[],
  17. withoutScanTime:''
  18. },
  19. },
  20. },
  21. /**
  22. * 生命周期函数--监听页面加载
  23. */
  24. onLoad: function (options) {
  25. this.bindStoreList()
  26. this.bindDeviceList()
  27. },
  28. bindStorePickerChange: function (e) {
  29. var item = this.data.storeList[e.detail.value]
  30. console.log(item)
  31. this.setData({
  32. ['searchParams.storeId']: item.id,
  33. ['searchParams.storeName']: item.storeName
  34. })
  35. this.bindDeviceList()
  36. },
  37. toDetail(e){
  38. wx.navigateTo({
  39. url: '/pages/stock/stockDeviceDetail?deviceId=' + e.currentTarget.dataset.id,
  40. })
  41. },
  42. bindStoreList() {
  43. var that = this
  44. util.request(util.api.storeList, {}, "GET", false, true,app.globalData.token).then((res) => {
  45. if (res.code == 200) {
  46. that.setData({
  47. storeList: res.result,
  48. ['searchParams.storeId']: res.result.id,
  49. ['searchParams.storeName']: res.result.storeName
  50. })
  51. }
  52. }).catch((res) => {})
  53. },
  54. searchDevice(){
  55. console.log("11111111111")
  56. console.log(this.data.searchParams)
  57. this.bindDeviceList()
  58. },
  59. bindDeviceList() {
  60. var that = this
  61. util.request(util.api.stockWarning, that.data.searchParams, "GET", true, false, app.globalData.token).then((res) => {
  62. if (res.code == 200) {
  63. that.setData({
  64. deviceList: res.result
  65. })
  66. }
  67. }).catch((res) => {})
  68. },
  69. inputedit: function (e) {
  70. let _this = this;
  71. let dataset = e.currentTarget.dataset;
  72. let value = e.detail.value;
  73. let name = dataset.name;
  74. _this.data[name] = value;
  75. _this.setData({
  76. [name]: _this.data[name]
  77. });
  78. },
  79. })