|
@@ -82,6 +82,7 @@ Page({
|
|
|
var that = this
|
|
var that = this
|
|
|
util.request(util.api.queryByDeviceId, {id:that.data.deviceId}, "GET", true, true,app.globalData.token).then((res)=>{
|
|
util.request(util.api.queryByDeviceId, {id:that.data.deviceId}, "GET", true, true,app.globalData.token).then((res)=>{
|
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
|
|
|
+ console.log(res)
|
|
|
that.setData({
|
|
that.setData({
|
|
|
deviceInfo: res.result,
|
|
deviceInfo: res.result,
|
|
|
})
|
|
})
|
|
@@ -97,5 +98,34 @@ Page({
|
|
|
that.bindDevice()
|
|
that.bindDevice()
|
|
|
}
|
|
}
|
|
|
}).catch((res) => {})
|
|
}).catch((res) => {})
|
|
|
|
|
+ },
|
|
|
|
|
+ number: function (e) {
|
|
|
|
|
+ let value = this.validateNumber(e.detail.value)
|
|
|
|
|
+ let inx = `deviceInfo.gridList[${e.target.dataset.index}].repairNum`
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ //parseInt将数字字符串转换成数字
|
|
|
|
|
+ [inx]: parseInt(value)
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ validateNumber(val) {
|
|
|
|
|
+ //正则表达式指定字符串只能为数字
|
|
|
|
|
+ return val.replace(/\D/g, '')
|
|
|
|
|
+ },
|
|
|
|
|
+ updateSkuStock(e){
|
|
|
|
|
+ var repairnum = e.currentTarget.dataset.repairnum?e.currentTarget.dataset.repairnum:0
|
|
|
|
|
+
|
|
|
|
|
+ let data = this.data.deviceInfo.gridList[e.target.dataset.index];
|
|
|
|
|
+ var stockCount = data.stockCount?data.stockCount:0
|
|
|
|
|
+ var gridCount = data.gridCount?data.gridCount:0
|
|
|
|
|
+ if((stockCount+repairnum)>gridCount){
|
|
|
|
|
+ util.toast('超过格子可存放数量')
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ var that = this;
|
|
|
|
|
+ util.request(util.api.replenishment, {gridId:e.currentTarget.dataset.id,goodsNumber:repairnum,deviceId:that.data.deviceId}, "POST", true, true,app.globalData.token).then((res)=>{
|
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
|
+ that.bindDevice()
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch((res) => {})
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|