| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- // pages/stock/stockout.js
- const util = require('../../utils/util.js');
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- hotelList:{id:'', hotelName:''},
- searchParams: {
- hotelId:'',
- hotelName:'',
- },
- deviceList: {
- deviceDetail:{
- mgVmDevice:[],
- withoutScanTime:''
- },
- },
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.bindHotelList()
- this.bindDeviceList()
- },
- bindHotelPickerChange: function (e) {
- var item = this.data.hotelList[e.detail.value]
- console.log(item)
- this.setData({
- ['searchParams.hotelId']: item.id,
- ['searchParams.hotelName']: item.hotelName
- })
- this.bindDeviceList()
- },
- toDetail(e){
- wx.navigateTo({
- url: '/pages/stock/stockDeviceDetail?deviceId=' + e.currentTarget.dataset.id,
- })
- },
- bindHotelList() {
- var that = this
- util.request(util.api.hotelList, {}, "GET", false, true,app.globalData.token).then((res) => {
- if (res.code == 200) {
- that.setData({
- hotelList: res.result,
- ['searchParams.hotelId']: res.result.id,
- ['searchParams.hotelName']: res.result.hotelName
- })
- }
- }).catch((res) => {})
- },
- searchDevice(){
- console.log("11111111111")
- console.log(this.data.searchParams)
- this.bindDeviceList()
- },
- bindDeviceList() {
- var that = this
- util.request(util.api.stockWarning, that.data.searchParams, "GET", true, false, app.globalData.token).then((res) => {
- if (res.code == 200) {
- that.setData({
- deviceList: res.result
- })
- }
- }).catch((res) => {})
- },
- inputedit: function (e) {
- let _this = this;
- let dataset = e.currentTarget.dataset;
- let value = e.detail.value;
- let name = dataset.name;
- _this.data[name] = value;
- _this.setData({
- [name]: _this.data[name]
- });
- },
- })
|