yuminge-app/yun-min-program-plugin-master/packageE/others/cloudwarehouse/pickUp/pickUp.js

158 lines
3.1 KiB
JavaScript

// packageE/others/cloudwarehouse/pickUp/pickUp.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
sum:1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if(options.id){
this.setData({
goods_id:options.id
});
}
this.getData();
},
onChange(e){
console.log(e);
this.setData({
sum : e.detail
});
},
goOrder(e){
let id = e.currentTarget.dataset.id;
let key = e.currentTarget.dataset.key;
let ind = e.currentTarget.dataset.ind;
if(this.data.sum > this.data.info.deposit_stock){
wx.showToast({
title: '库存不足',
icon:'none',
duration:1000
});
return;
}
wx.navigateTo({
url: '/packageE/others/cloudwarehouse/cloudOrder/cloudOrder?tag='+key+'&goodsId='+id+'&optionsId='+'&total='+this.data.sum + '&is_selected='+ind,
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
getData(){
let that = this;
let urlStr = app.getNetAddresss("plugin.cloud-warehouse.frontend.warehouse-goods-manage.warehouse-goods-info");
app._getNetWork({
url: urlStr,
data: {
goods_id: that.data.goods_id
},
success: function (resdata) {
var res = resdata.data;
if (res.result == 1) {
console.log(res);
that.setData({
info:res.data
});
} else {
wx.showToast({
icon: 'none',
title: res.msg,
duration: 1500
});
}
},
fail: function (res) {
console.log(res);
}
});
},
shiftTo(){
let that = this;
let urlStr = app.getNetAddresss("plugin.cloud-warehouse.frontend.warehouse-goods-manage.moving-to-seal");
app._getNetWork({
url: urlStr,
data: {
goods_id: that.data.goods_id,
sum:that.data.sum
},
success: function (resdata) {
var res = resdata.data;
if (res.result == 1) {
console.log(res);
wx.showToast({
title: res.msg,
icon:'none',
duration:1000,
success:function(){
wx.navigateBack({
delta: 1,
});
}
});
} else {
wx.showToast({
icon: 'none',
title: res.msg,
duration: 1500
});
}
},
fail: function (res) {
console.log(res);
}
});
},
});