| | |
| | | userFocused: false, |
| | | codeFocused: false, |
| | | form: { |
| | | username: 'qyyh12345', |
| | | password: 'Gkhy@c413', |
| | | username: '', |
| | | password: '', |
| | | code: '', |
| | | uuid: '' |
| | | }, |
| | | isPwd: true, |
| | | isLogining: false |
| | | isLogining: false, |
| | | saveAccount: false |
| | | }, |
| | | |
| | | onShow() { |
| | | if(wx.getStorageSync('name') && wx.getStorageSync('pwd')){ |
| | | }else{ |
| | | wx.clearStorageSync(); |
| | | } |
| | | |
| | | }, |
| | | |
| | | onLoad() { |
| | | |
| | | wx.showShareMenu({ |
| | | withShareTicket: true, |
| | | menus: ['shareAppMessage', 'shareTimeline'] |
| | | }) |
| | | console.log(wx.getStorageSync('isSave'),'get1') |
| | | if(wx.getStorageSync('isSave')){ |
| | | this.setData({ |
| | | saveAccount: true, |
| | | form: { |
| | | username: wx.getStorageSync('username') || '', |
| | | password: wx.getStorageSync('pwd') || '', |
| | | code: '', |
| | | uuid: '' |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | base64Encode(e) { |
| | |
| | | [field]: e.detail.value // 动态更新对应字段 |
| | | }); |
| | | }, |
| | | |
| | | switchChange(e){ |
| | | this.setData({ saveAccount: e.detail.value }) |
| | | wx.setStorageSync('isSave',e.detail.value) |
| | | }, |
| | | Login(){ |
| | | if(this.data.form.username == ''){ |
| | | wx.showToast({ |
| | |
| | | const data = {username, password, code, uuid}; |
| | | data.password = this.base64Encode(data.password); |
| | | wx.removeStorageSync('tk'); |
| | | |
| | | // 云开发请求 |
| | | cloudApi.queryPost('userList',{username: data.username,password: data.password}).then(res=>{ |
| | | if(res.data.length>0){ |
| | | |
| | | // api请求 |
| | | api.login(data).then(res => { |
| | | console.log(res,'res') |
| | | if (res.code === 200) { |
| | | this.setData({ |
| | | isLogining: false |
| | | }); |
| | | const info = cloudApi.changeKey(res.data) |
| | | wx.setStorageSync("username", this.data.form.username); |
| | | wx.setStorageSync("pwd", this.data.form.password); |
| | | wx.setStorageSync("uid", info[0].Id); |
| | | wx.setStorageSync('user', info[0]); |
| | | wx.setStorageSync("tk", res.data.token); |
| | | wx.setStorageSync("uid", res.data.id); |
| | | wx.setStorageSync('user', res.data); |
| | | wx.switchTab({ |
| | | url: '/pages/tabBar/firstPage/firstPage' |
| | | }); |
| | | }else{ |
| | | cloudApi.queryPost('userList',{name: data.username}).then(res=>{ |
| | | if(res.data.length>0){ |
| | | wx.showToast({ |
| | | icon: "none", |
| | | title: '密码错误' |
| | | }); |
| | | this.setData({ |
| | | 'form.password': '', |
| | | isLogining: false |
| | | }); |
| | | }else{ |
| | | wx.showToast({ |
| | | icon: "none", |
| | | title: '用户不存在' |
| | | }); |
| | | this.setData({ |
| | | form: { |
| | | username: '', |
| | | password: '', |
| | | code: '', |
| | | uuid: '' |
| | | }, |
| | | isLogining: false |
| | | }); |
| | | } |
| | | }) |
| | | } else { |
| | | wx.showToast({ |
| | | icon: "none", |
| | | title: res.message |
| | | }); |
| | | this.setData({ |
| | | isLogining: false |
| | | }); |
| | | } |
| | | }) |
| | | |
| | | // api请求 |
| | | // api.login(data).then(res => { |
| | | // console.log(res,'res') |
| | | // if (res.code === 200) { |
| | | // this.setData({ |
| | | // isLogining: false |
| | | // }); |
| | | // wx.setStorageSync("name", this.data.form.username); |
| | | // wx.setStorageSync("pwd", this.data.form.password); |
| | | // wx.setStorageSync("tk", res.data.token); |
| | | // wx.setStorageSync("uid", res.data.id); |
| | | // wx.setStorageSync('user', res.data); |
| | | // wx.switchTab({ |
| | | // url: '/pages/tabBar/firstPage/firstPage' |
| | | // }); |
| | | // } else { |
| | | // wx.showToast({ |
| | | // icon: "none", |
| | | // title: res.message |
| | | // }); |
| | | // this.setData({ |
| | | // 'form.password': '', |
| | | // isLogining: false |
| | | // }); |
| | | // } |
| | | // }).catch(err => { |
| | | // this.setData({ |
| | | // 'form.password': '', |
| | | // isLogining: false |
| | | // }); |
| | | // }); |
| | | }).catch(err => { |
| | | this.setData({ |
| | | 'form.password': '', |
| | | isLogining: false |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | focusUser(){ |
| | |
| | | <text catchtap="togglePwd" class="iconfont {{isPwd?'icon-view':'icon-view-off'}}"></text> |
| | | </input> |
| | | </view> |
| | | <view class="switch-box"> |
| | | <text>记住密码</text> |
| | | <switch type="checkbox" checked="{{saveAccount}}" bindchange="switchChange"/> |
| | | </view> |
| | | <view class="form-item" style="margin-top: 10px;width: 80%;"> |
| | | <button |
| | | class="loginBtn" |
| | |
| | | </view> |
| | | </view> |
| | | <view class="footer"> |
| | | 当前版本:1.2 |
| | | 当前版本:1.0.2 |
| | | </view> |
| | | </view> |
| | |
| | | .pswInput{ |
| | | position: relative; |
| | | } |
| | | .switch-box{ |
| | | width: 75%; |
| | | margin: 20rpx 0; |
| | | } |
| | | |
| | | .switch-box text{ |
| | | margin-right: 15rpx; |
| | | } |
| | | |
| | | .iconfont { |
| | | position: absolute; |
| | |
| | | content: '是否确认退出该账号?', |
| | | success: (res) => { |
| | | if (res.confirm) { |
| | | wx.clearStorageSync(); |
| | | wx.navigateTo({ |
| | | url: '/pages/index/index' |
| | | }); |
| | | // api接口 |
| | | // api.loginOut().then(res => { |
| | | // if(res.code == 200) { |
| | | // wx.showToast({ |
| | | // title: '账户已退出', |
| | | // duration: 800 |
| | | // }); |
| | | // setTimeout(() => { |
| | | // wx.clearStorageSync(); |
| | | // wx.navigateTo({ |
| | | // url: '/pages/index/index' |
| | | // }); |
| | | // }, 800); |
| | | // } |
| | | // }); |
| | | api.loginOut().then(res => { |
| | | if(res.code == 200) { |
| | | wx.showToast({ |
| | | title: '账户已退出', |
| | | duration: 800 |
| | | }); |
| | | setTimeout(() => { |
| | | if(!wx.getStorageSync('isSave') || wx.getStorageSync('isSave') == false){ |
| | | wx.clearStorageSync(); |
| | | } |
| | | wx.navigateTo({ |
| | | url: '/pages/index/index' |
| | | }); |
| | | }, 800); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | |
| | | }); |
| | | return; |
| | | } |
| | | const Id = wx.getStorageSync("uid") |
| | | |
| | | cloudApi.updateKey('userList',Id,{password: this.base64Encode(this.data.pwdForm.password)}).then(res=>{ |
| | | if(res.result == 'success'){ |
| | | wx.showToast({ |
| | | title: '密码已修改,请重新登录', |
| | | icon: 'none', |
| | | duration: 1500 |
| | | }); |
| | | wx.clearStorageSync(); |
| | | wx.navigateTo({ |
| | | url: '/pages/index/index' |
| | | }); |
| | | }else{ |
| | | wx.showToast({ |
| | | title: 密码修改失败, |
| | | duration: 2000 |
| | | }); |
| | | } |
| | | }) |
| | | // const Id = wx.getStorageSync("uid") |
| | | // cloudApi.updateKey('userList',Id,{password: this.base64Encode(this.data.pwdForm.password)}).then(res=>{ |
| | | // if(res.result == 'success'){ |
| | | // wx.showToast({ |
| | | // title: '密码已修改,请重新登录', |
| | | // icon: 'none', |
| | | // duration: 1500 |
| | | // }); |
| | | // wx.clearStorageSync(); |
| | | // wx.navigateTo({ |
| | | // url: '/pages/index/index' |
| | | // }); |
| | | // }else{ |
| | | // wx.showToast({ |
| | | // title: 密码修改失败, |
| | | // duration: 2000 |
| | | // }); |
| | | // } |
| | | // }) |
| | | // const db = wx.cloud.database() |
| | | // db.collection('userList').doc(Id).update({ |
| | | // data: { |
| | |
| | | // }) |
| | | |
| | | // api请求 |
| | | // let data = { |
| | | // id: wx.getStorageSync("uid"), |
| | | // password: this.base64Encode(this.data.pwdForm.password) |
| | | // }; |
| | | // api.resetPwd(data).then((r) => { |
| | | // if(r.code == 200) { |
| | | // wx.showToast({ |
| | | // title: '密码已修改,请重新登录', |
| | | // icon: 'none', |
| | | // duration: 1000 |
| | | // }); |
| | | // loginOut().then(res => { |
| | | // if(res.code == 200) { |
| | | // setTimeout(() => { |
| | | // wx.clearStorageSync(); |
| | | // wx.navigateTo({ |
| | | // url: '/pages/index/index' |
| | | // }); |
| | | // }, 1000); |
| | | // } |
| | | // }); |
| | | // } else { |
| | | // wx.showToast({ |
| | | // title: r.message, |
| | | // icon: 'none' |
| | | // }); |
| | | // } |
| | | // }).catch((err) => { |
| | | // wx.showToast({ |
| | | // title: err, |
| | | // duration: 2000 |
| | | // }); |
| | | // }); |
| | | let data = { |
| | | id: wx.getStorageSync("uid"), |
| | | password: this.base64Encode(this.data.pwdForm.password) |
| | | }; |
| | | api.resetPwd(data).then((r) => { |
| | | if(r.code == 200) { |
| | | wx.showToast({ |
| | | title: '密码已修改,请重新登录', |
| | | icon: 'none', |
| | | duration: 1000 |
| | | }); |
| | | loginOut().then(res => { |
| | | if(res.code == 200) { |
| | | setTimeout(() => { |
| | | wx.clearStorageSync(); |
| | | wx.navigateTo({ |
| | | url: '/pages/index/index' |
| | | }); |
| | | }, 1000); |
| | | } |
| | | }); |
| | | } else { |
| | | wx.showToast({ |
| | | title: r.message, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }).catch((err) => { |
| | | wx.showToast({ |
| | | title: err, |
| | | duration: 2000 |
| | | }); |
| | | }); |
| | | |
| | | this.closeModal(); |
| | | }, |
| | |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | z-index: 999; |
| | | z-index: 99999; |
| | | } |
| | | |
| | | .modal-container { |
| | |
| | | |
| | | getList() { |
| | | // cloudApi |
| | | const userId = wx.getStorageSync('user').id |
| | | wx.cloud.callFunction({ |
| | | name: 'getHazmatFlowByPage', |
| | | data: {...this.data.examParams,userId: userId} |
| | | }).then(res=>{ |
| | | if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){ |
| | | let list = cloudApi.changeKey(res.result.list) |
| | | if (this.data.examParams.pageNum != 1) { |
| | | this.setData({ |
| | | examList: this.data.examList.concat(list), |
| | | totalPage: Math.ceil(res.result.total / res.result.pageSize) |
| | | }); |
| | | } else { |
| | | this.setData({ |
| | | examList: list, |
| | | totalPage: Math.ceil(res.result.total / res.result.pageSize) |
| | | }); |
| | | } |
| | | }else{ |
| | | this.setData({ |
| | | examList: [], |
| | | totalPage: 0 |
| | | }); |
| | | } |
| | | }) |
| | | |
| | | // api请求 |
| | | // api.getHazmatFlowByUser(this.data.examParams).then(res => { |
| | | // if(res.code == 200) { |
| | | // let list = res.data.list ? res.data.list : []; |
| | | // const userId = wx.getStorageSync('user').id |
| | | // wx.cloud.callFunction({ |
| | | // name: 'getHazmatFlowByPage', |
| | | // data: {...this.data.examParams,userId: userId} |
| | | // }).then(res=>{ |
| | | // if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){ |
| | | // let list = cloudApi.changeKey(res.result.list) |
| | | // console.log(list,'list') |
| | | // if (this.data.examParams.pageNum != 1) { |
| | | // this.setData({ |
| | | // examList: this.data.examList.concat(list) |
| | | // examList: this.data.examList.concat(list), |
| | | // totalPage: Math.ceil(res.result.total / res.result.pageSize) |
| | | // }); |
| | | // } else { |
| | | // this.setData({ |
| | | // examList: res.data.list, |
| | | // totalPage: res.data.totalPage |
| | | // examList: list, |
| | | // totalPage: Math.ceil(res.result.total / res.result.pageSize) |
| | | // }); |
| | | // } |
| | | // } else { |
| | | // wx.showToast({ |
| | | // title: res.message, |
| | | // icon: 'none' |
| | | // }else{ |
| | | // this.setData({ |
| | | // examList: [], |
| | | // totalPage: 0 |
| | | // }); |
| | | // } |
| | | // }); |
| | | // }) |
| | | |
| | | // api请求 |
| | | api.getHazmatFlowByUser(this.data.examParams).then(res => { |
| | | if(res.code == 200) { |
| | | let list = res.data.list ? res.data.list : []; |
| | | if (this.data.examParams.pageNum != 1) { |
| | | this.setData({ |
| | | examList: this.data.examList.concat(list) |
| | | }); |
| | | } else { |
| | | this.setData({ |
| | | examList: res.data.list, |
| | | totalPage: res.data.totalPage |
| | | }); |
| | | } |
| | | } else { |
| | | wx.showToast({ |
| | | title: res.message, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | upper(e) { |
| | |
| | | |
| | | getList() { |
| | | // cloudApi |
| | | const userId = wx.getStorageSync('user').id |
| | | wx.cloud.callFunction({ |
| | | name: 'getProductFlowByPage', |
| | | data: {...this.data.examParams,userId: userId} |
| | | }).then(res=>{ |
| | | if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){ |
| | | let list = cloudApi.changeKey(res.result.list) |
| | | if (this.data.examParams.pageNum != 1) { |
| | | this.setData({ |
| | | examList: this.data.examList.concat(list), |
| | | totalPage: Math.ceil(res.result.total / res.result.pageSize) |
| | | }); |
| | | } else { |
| | | this.setData({ |
| | | examList: list, |
| | | totalPage: Math.ceil(res.result.total / res.result.pageSize) |
| | | }); |
| | | } |
| | | }else{ |
| | | this.setData({ |
| | | examList: [], |
| | | totalPage: 0 |
| | | }); |
| | | } |
| | | }) |
| | | |
| | | // api请求 |
| | | // api.getProductFlowByUser(this.data.examParams).then(res => { |
| | | // if(res.code == 200) { |
| | | // let list = res.data.list ? res.data.list : []; |
| | | // const userId = wx.getStorageSync('user').id |
| | | // wx.cloud.callFunction({ |
| | | // name: 'getProductFlowByPage', |
| | | // data: {...this.data.examParams,userId: userId} |
| | | // }).then(res=>{ |
| | | // if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){ |
| | | // let list = cloudApi.changeKey(res.result.list) |
| | | // if (this.data.examParams.pageNum != 1) { |
| | | // this.setData({ |
| | | // examList: this.data.examList.concat(list) |
| | | // examList: this.data.examList.concat(list), |
| | | // totalPage: Math.ceil(res.result.total / res.result.pageSize) |
| | | // }); |
| | | // } else { |
| | | // this.setData({ |
| | | // examList: res.data.list, |
| | | // totalPage: res.data.totalPage |
| | | // examList: list, |
| | | // totalPage: Math.ceil(res.result.total / res.result.pageSize) |
| | | // }); |
| | | // } |
| | | // } else { |
| | | // wx.showToast({ |
| | | // title: res.message, |
| | | // icon: 'none' |
| | | // }else{ |
| | | // this.setData({ |
| | | // examList: [], |
| | | // totalPage: 0 |
| | | // }); |
| | | // } |
| | | // }); |
| | | // }) |
| | | |
| | | // api请求 |
| | | api.getProductFlowByUser(this.data.examParams).then(res => { |
| | | if(res.code == 200) { |
| | | let list = res.data.list ? res.data.list : []; |
| | | if (this.data.examParams.pageNum != 1) { |
| | | this.setData({ |
| | | examList: this.data.examList.concat(list) |
| | | }); |
| | | } else { |
| | | this.setData({ |
| | | examList: res.data.list, |
| | | totalPage: res.data.totalPage |
| | | }); |
| | | } |
| | | } else { |
| | | wx.showToast({ |
| | | title: res.message, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | upper(e) { |
| | |
| | | icon: 'none' |
| | | }); |
| | | } else { |
| | | // 云开发请求 |
| | | if(res.result.indexOf('SJ') >0){ |
| | | cloudApi.queryPost('hazmatList',{code: t.data.searchContent}).then(res=>{ |
| | | if(res.data.length>0){ |
| | | const hazmatId = cloudApi.changeKey(res.data[0]).id |
| | | wx.cloud.callFunction({ |
| | | name: 'getHazmatFlow', |
| | | data: { |
| | | hazmatId: hazmatId |
| | | } |
| | | }).then(res=>{ |
| | | if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){ |
| | | t.setData({ |
| | | dataList: cloudApi.changeKey(res.result.list) |
| | | }) |
| | | } |
| | | }) |
| | | }else { |
| | | wx.showToast({ |
| | | title: '该二维码查询不到相关信息', |
| | | icon: 'error', |
| | | duration: 2000 |
| | | }); |
| | | } |
| | | }) |
| | | }else{ |
| | | cloudApi.queryPost('productList',{code: t.data.searchContent}).then(res=>{ |
| | | if(res.data.length>0){ |
| | | const productId = cloudApi.changeKey(res.data[0]).id |
| | | wx.cloud.callFunction({ |
| | | name: 'getProductFlow', |
| | | data: { |
| | | productId: productId |
| | | } |
| | | }).then(res=>{ |
| | | if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){ |
| | | t.setData({ |
| | | dataList: cloudApi.changeKey(res.result.list) |
| | | }) |
| | | } |
| | | }) |
| | | }else { |
| | | wx.showToast({ |
| | | title: '该二维码查询不到相关信息', |
| | | icon: 'error', |
| | | duration: 2000 |
| | | }); |
| | | } |
| | | }) |
| | | } |
| | | // api请求 |
| | | // api.getHazmatFlowByCode({code: t.data.searchContent}).then(re => { |
| | | // if(re.code == 200) { |
| | | // t.setData({ |
| | | // dataList: re.data ? re.data : [] |
| | | // }); |
| | | // } else { |
| | | // wx.showToast({ |
| | | // title: re.message, |
| | | // icon: 'none' |
| | | // }); |
| | | // } |
| | | // }); |
| | | api.getHazmatFlowByCode({code: t.data.searchContent}).then(re => { |
| | | if(re.code == 200) { |
| | | t.setData({ |
| | | dataList: re.data ? re.data : [] |
| | | }); |
| | | } else { |
| | | wx.showToast({ |
| | | title: re.message, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | |
| | |
| | | {{item.updateTime}} |
| | | </view> |
| | | <view wx:if="{{item.user}}"> |
| | | <text>{{item.user.department?item.user.department.name:''}}部门的</text> |
| | | <text style="font-weight: bold;margin-right: 6rpx;">{{item.user.name}}</text> |
| | | <text wx:if="{{item.user.department}}">{{item.user.department?item.user.department.name:''}} 的 </text> |
| | | <text style="font-weight: bold;margin-right: 6rpx;color:#2979ff">{{item.user.name}}</text> |
| | | 进行了 |
| | | <span style="margin-left: 6rpx;" class="{{item.num>=0?'green':'red'}}"> |
| | | {{item.state==0?'入库':item.state==1?'取用':item.state==2?'归还':item.state==3?'标签作废':item.state==4?'用尽登记':item.state==5?'销售':item.state==6?'零头入库':'--'}} |
| | |
| | | |
| | | 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, |
| | |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | z-index: 999; |
| | | z-index: 99999; |
| | | } |
| | | |
| | | .modal-container { |
| | |
| | | } |
| | | }, |
| | | "compileType": "miniprogram", |
| | | "libVersion": "3.8.1", |
| | | "libVersion": "3.8.9", |
| | | "appid": "wx8143ce5b2f2b1ecc", |
| | | "projectname": "危化品管理", |
| | | "condition": {}, |
| | |
| | | // utils/http.js |
| | | const BASE_URL = 'http://192.168.2.58:8083'; // 替换为你的API基础地址 |
| | | |
| | | const BASE_URL = 'https://reagent.sinanoaq.cn'; |
| | | // const BASE_URL = 'http://47.108.222.15:8001'; |
| | | // 全局配置 |
| | | const config = { |
| | | showToast: true, // 默认显示Toast提示 |
| | |
| | | * 清除缓存并跳转到首页 |
| | | */ |
| | | function clearStorageAndRedirect() { |
| | | wx.clearStorageSync(); |
| | | if(!wx.getStorageSync('isSave') || wx.getStorageSync('isSave') == false){ |
| | | wx.clearStorageSync(); |
| | | } |
| | | setTimeout(() => { |
| | | wx.reLaunch({ |
| | | url: '/pages/index/index' // 替换为你的登录页路径 |