1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- // pages/stock/replenishDetail.js
- const util = require('../../utils/util.js');
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- deviceSn:'',
- storeId:'',
- deviceInfo:{
- deviceDetail:{
- mgVmDevice:{},
- stockGrid:''
- },
- productList:[]
- }
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.setData({
- storeId: options.storeId
- })
- this.bindDevice()
- },
- scanCodeEvent() {
- var that = this;
- wx.scanCode({
- onlyFromCamera: true, // 只允许从相机扫码
- success(res) {
- console.log("扫码成功:" + JSON.stringify(res))
-
- that.setData({
- deviceSn: res.result
- })
- wx.navigateTo({
- url: '/pages/device/detail?deviceId=' + res.result,
- })
- }
- })
- },
- searchInfo(){
- this.bindDevice()
- },
- bindDevice(){
- var that = this
- util.request(util.api.stockDeviceList, {storeId:that.data.storeId,deviceSn:that.data.deviceSn}, "GET", false, true,app.globalData.token).then((res)=>{
- if (res.code == 200) {
- that.setData({
- deviceInfo: 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]
- });
- },
- })
|