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

238 lines
5.0 KiB
JavaScript

// packageE/others/cloudwarehouse/pickUpArea/pickUpArea.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
inputs: "",
active: 0,
show: false,
page: 1,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {},
goback(e) {
wx.navigateBack({
delta: 1,
});
},
tapinp(e) {
this.setData({
inputs: e.detail.value,
page: 1,
});
this.getData();
},
onClick(e) {
this.init();
console.log(e);
this.setData({
active: e.detail.index,
});
this.getData();
},
closeShow(e) {
this.setData({
show: false,
});
},
init() {
this.setData({
show: false,
inputs: "",
page: 1,
});
},
togoods(e) {
console.log(e);
let id = e.currentTarget.dataset.id;
wx.navigateTo({
url: "/packageA/detail_v2/detail_v2?id=" + id,
});
},
tapDetail(e) {
console.log(e);
if (this.data.active == 0) {
let id = e.currentTarget.dataset.id;
wx.navigateTo({
url: "/packageE/others/cloudwarehouse/pickUp/pickUp?id=" + id,
});
}
// + '&active=' + (Number(this.data.active) + 1)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
try {
let language = wx.getStorageSync("langIndex");
this.setData({
language: language.en,
});
} catch (err) {
console.log(err);
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getData();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
if (this.data.current_page >= this.data.last_page) {
return;
} else {
this.getMore();
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {},
getCondition(e) {
console.log(e.currentTarget.dataset);
let kid = e.currentTarget.dataset.id;
let that = this;
let urlStr = app.getNetAddresss(
"plugin.cloud-warehouse.frontend.warehouse-goods-manage.remove-condition"
);
app._getNetWork({
url: urlStr,
data: {
goods_id: kid,
},
success: function (resdata) {
var res = resdata.data;
if (res.result == 1) {
console.log(res);
that.setData({
show: true,
info: res.data,
});
} else {
wx.showToast({
icon: "none",
title: res.msg,
duration: 1500,
});
}
},
fail: function (res) {
console.log(res);
},
});
},
getData() {
let that = this;
let urlStr = "";
let active = Number(that.data.active) + 1;
if (active == "1") {
urlStr = app.getNetAddresss(
"plugin.cloud-warehouse.frontend.warehouse-goods-manage.deposit-area"
);
} else {
urlStr = app.getNetAddresss(
"plugin.cloud-warehouse.frontend.warehouse-goods-manage.seal-area"
);
}
app._getNetWork({
url: urlStr,
data: {
name: that.data.inputs,
page: that.data.page,
},
success: function (resdata) {
var res = resdata.data;
if (res.result == 1) {
console.log(res);
that.setData({
list: res.data.data,
last_page: res.data.last_page,
current_page: res.data.last_page,
});
} else {
wx.showToast({
icon: "none",
title: res.msg,
duration: 1500,
});
}
},
fail: function (res) {
console.log(res);
},
});
},
getMore() {
let that = this;
let urlStr = "";
let pages = this.data.page + 1;
that.setData({
page: pages,
});
let active = Number(that.data.active) + 1;
if (active == "1") {
urlStr = app.getNetAddresss(
"plugin.cloud-warehouse.frontend.warehouse-goods-manage.deposit-area"
);
} else {
urlStr = app.getNetAddresss(
"plugin.cloud-warehouse.frontend.warehouse-goods-manage.seal-area"
);
}
app._getNetWork({
url: urlStr,
data: {
name: that.data.inputs,
page: that.data.page,
},
success: function (resdata) {
var res = resdata.data;
if (res.result == 1) {
console.log(res);
that.setData({
list: that.data.list.concat(res.data.data),
last_page: res.data.last_page,
current_page: res.data.last_page,
});
} else {
wx.showToast({
icon: "none",
title: res.msg,
duration: 1500,
});
}
},
fail: function (res) {
console.log(res);
},
});
},
});