123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- // pages/stock/stockout.js
- const util = require('../../utils/util.js');
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- storeList:{id:'', storeName:''},
- searchParams: {
- storeId:'',
- storeName:'',
- },
- deviceList: {
- deviceDetail:{
- mgVmDevice:[],
- withoutScanTime:''
- },
- },
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.bindStoreList()
- this.bindDeviceList()
- },
- bindStorePickerChange: function (e) {
- var item = this.data.storeList[e.detail.value]
- console.log(item)
- this.setData({
- ['searchParams.storeId']: item.id,
- ['searchParams.storeName']: item.storeName
- })
- this.bindDeviceList()
- },
- toDetail(e){
- wx.navigateTo({
- url: '/pages/stock/stockDeviceDetail?deviceId=' + e.currentTarget.dataset.id,
- })
- },
- bindStoreList() {
- var that = this
- util.request(util.api.storeList, {}, "GET", false, true,app.globalData.token).then((res) => {
- if (res.code == 200) {
- that.setData({
- storeList: res.result,
- ['searchParams.storeId']: res.result.id,
- ['searchParams.storeName']: res.result.storeName
- })
- }
- }).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]
- });
- },
- })
|