| | |
| | | |
| | | getUserInfo() { |
| | | // 云开发 |
| | | const companyId = wx.getStorageSync('user').companyId |
| | | cloudApi.queryPost('userInfoList',{company_id: companyId}).then(res=>{ |
| | | if(res.data.length>0){ |
| | | this.setData({ |
| | | user: cloudApi.changeKey(res.data)[0] |
| | | }); |
| | | wx.setStorageSync('userSet', cloudApi.changeKey(res.data)[0]) |
| | | } |
| | | }) |
| | | // api |
| | | // api.getUserInfo().then(res => { |
| | | // if(res.code == 200) { |
| | | // const companyId = wx.getStorageSync('user').companyId |
| | | // cloudApi.queryPost('userInfoList',{company_id: companyId}).then(res=>{ |
| | | // if(res.data.length>0){ |
| | | // this.setData({ |
| | | // user: res.data |
| | | // user: cloudApi.changeKey(res.data)[0] |
| | | // }); |
| | | // wx.setStorageSync('userSet', res.data); |
| | | // } else { |
| | | // wx.showToast({ |
| | | // title: res.message, |
| | | // icon: 'none' |
| | | // }); |
| | | // wx.setStorageSync('userSet', cloudApi.changeKey(res.data)[0]) |
| | | // } |
| | | // }); |
| | | // }) |
| | | // api |
| | | api.getUserInfo().then(res => { |
| | | if(res.code == 200) { |
| | | this.setData({ |
| | | user: res.data |
| | | }); |
| | | wx.setStorageSync('userSet', res.data); |
| | | } else { |
| | | wx.showToast({ |
| | | title: res.message, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | closeModal(){ |
| | | this.setData({ |
| | |
| | | } |
| | | if(t.data.tabNum == 1) { |
| | | // 云开发请求 |
| | | wx.cloud.callFunction({ |
| | | name: 'getHazmatInfo', |
| | | data: { |
| | | code: res.result |
| | | } |
| | | }).then(res=>{ |
| | | if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){ |
| | | t.setData({ |
| | | hazmat: cloudApi.changeKey(res.result.list[0]), |
| | | showModal: true |
| | | }) |
| | | }else{ |
| | | wx.showToast({ |
| | | title: '无条码信息', |
| | | icon: 'error', |
| | | duration: 2000 |
| | | }); |
| | | } |
| | | }) |
| | | // api请求 |
| | | // api.getHazmatByCode({code: res.result}).then((re) => { |
| | | // if(re.code == 200) { |
| | | // wx.cloud.callFunction({ |
| | | // name: 'getHazmatInfo', |
| | | // data: { |
| | | // code: 'SJ08202502250003' |
| | | // } |
| | | // }).then(res=>{ |
| | | // if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){ |
| | | // t.setData({ |
| | | // hazmat: re.data, |
| | | // hazmat: cloudApi.changeKey(res.result.list[0]), |
| | | // showModal: true |
| | | // }); |
| | | // } else { |
| | | // }) |
| | | // }else{ |
| | | // wx.showToast({ |
| | | // title: re.message, |
| | | // title: '无条码信息', |
| | | // icon: 'error', |
| | | // duration: 2000 |
| | | // }); |
| | | // } |
| | | // }).catch(err => { |
| | | // wx.showToast({ |
| | | // title: err, |
| | | // duration: 2000 |
| | | // }); |
| | | // }); |
| | | // }) |
| | | // api请求 |
| | | api.getHazmatByCode({code: res.result}).then((re) => { |
| | | if(re.code == 200) { |
| | | t.setData({ |
| | | hazmat: re.data, |
| | | showModal: true |
| | | }); |
| | | } else { |
| | | wx.showToast({ |
| | | title: re.message, |
| | | icon: 'error', |
| | | duration: 2000 |
| | | }); |
| | | } |
| | | }).catch(err => { |
| | | wx.showToast({ |
| | | title: err, |
| | | duration: 2000 |
| | | }); |
| | | }); |
| | | } else { |
| | | // 云开发请求 |
| | | wx.cloud.callFunction({ |
| | | name: 'getProductInfo', |
| | | data: { |
| | | code: res.result |
| | | } |
| | | }).then(res=>{ |
| | | if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){ |
| | | t.setData({ |
| | | product: cloudApi.changeKey(res.result.list[0]), |
| | | showModal: true |
| | | }) |
| | | }else{ |
| | | wx.showToast({ |
| | | title: '无条码信息', |
| | | icon: 'error', |
| | | duration: 2000 |
| | | }); |
| | | } |
| | | }) |
| | | // api请求 |
| | | // api.getProductByCode({code: res.result}).then((re) => { |
| | | // if(re.code == 200) { |
| | | // wx.cloud.callFunction({ |
| | | // name: 'getProductInfo', |
| | | // data: { |
| | | // code: res.result |
| | | // } |
| | | // }).then(res=>{ |
| | | // if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){ |
| | | // t.setData({ |
| | | // product: re.data, |
| | | // product: cloudApi.changeKey(res.result.list[0]), |
| | | // showModal: true |
| | | // }); |
| | | // } else { |
| | | // }) |
| | | // }else{ |
| | | // wx.showToast({ |
| | | // title: re.message, |
| | | // title: '无条码信息', |
| | | // icon: 'error', |
| | | // duration: 2000 |
| | | // }); |
| | | // } |
| | | // }).catch(err => { |
| | | // wx.showToast({ |
| | | // title: err, |
| | | // duration: 2000 |
| | | // }); |
| | | // }); |
| | | // }) |
| | | // api请求 |
| | | api.getProductByCode({code: res.result}).then((re) => { |
| | | if(re.code == 200) { |
| | | t.setData({ |
| | | product: re.data, |
| | | showModal: true |
| | | }); |
| | | } else { |
| | | wx.showToast({ |
| | | title: re.message, |
| | | icon: 'error', |
| | | duration: 2000 |
| | | }); |
| | | } |
| | | }).catch(err => { |
| | | wx.showToast({ |
| | | title: err, |
| | | duration: 2000 |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | |
| | | } else { |
| | | wx.showToast({ |
| | | title: '该二维码已失效或不包含条码信息', |
| | |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | }, |
| | | |
| | | confirmTake1() { |
| | | const t = this; |
| | | |
| | | // 云服务请求 |
| | | // wx.cloud.callFunction({ |
| | | // name: 'hazmatUsing', |
| | | // data: { |
| | | // warehouseId: t.data.hazmat.warehouseId, |
| | | // basicId: t.data.hazmat.basicId, |
| | | // companyId: t.data.hazmat.companyId, |
| | | // cupboardId: t.data.hazmat.cupboardId, |
| | | // hazmatId: t.data.hazmat.id, |
| | | // uid: wx.getStorageSync('user').id, |
| | | // id: t.data.hazmat.Id, |
| | | // remaining: t.data.hazmat.remaining, |
| | | // status: 0 |
| | | // } |
| | | // }).then(res=>{ |
| | | // if(res.result.code == 200){ |
| | | // wx.showToast({ |
| | | // title: '取用成功', |
| | | // icon: 'success', |
| | | // duration: 2000 |
| | | // }); |
| | | // } |
| | | // }) |
| | | |
| | | |
| | | // api请求 |
| | | api.postHazmatUse(t.data.hazmat.id, 0).then((r) => { |
| | | wx.showToast({ |
| | | title: r.message, |
| | |
| | | |
| | | confirmTake2() { |
| | | const t = this; |
| | | |
| | | // 云服务请求 |
| | | // wx.cloud.callFunction({ |
| | | // name: 'hazmatUsing', |
| | | // data: { |
| | | // warehouseId: t.data.hazmat.warehouseId, |
| | | // basicId: t.data.hazmat.basicId, |
| | | // companyId: t.data.hazmat.companyId, |
| | | // cupboardId: t.data.hazmat.cupboardId, |
| | | // hazmatId: t.data.hazmat.id, |
| | | // uid: wx.getStorageSync('user').id, |
| | | // id: t.data.hazmat.Id, |
| | | // remaining: t.data.hazmat.remaining, |
| | | // status: 1 |
| | | // } |
| | | // }).then(res=>{ |
| | | // if(res.result.code == 200){ |
| | | // wx.showToast({ |
| | | // title: '取用成功', |
| | | // icon: 'success', |
| | | // duration: 2000 |
| | | // }); |
| | | // } |
| | | // }) |
| | | |
| | | // api请求 |
| | | api.postHazmatUse(t.data.hazmat.id, 1).then((r) => { |
| | | wx.showToast({ |
| | | title: r.message, |