yuminge-app/yun-min-program-plugin-master/packageI/independenceBalance/storeBalanceDetail/storeBalanceDetail.js

154 lines
3.2 KiB
JavaScript

// packageI/independenceBalance/storeBalanceDetail/storeBalanceDetail.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
active: "0",
title: "",
page: 1,
recordsList: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
store_id: options.store_id
});
this.getData();
},
// packageA/member/balance/details/details
goDetail(e) {
console.log(e);
let id = e.currentTarget.dataset.id;
let name = e.currentTarget.dataset.name;
wx.navigateTo({
url: '/packageA/member/balance/details/details?id=' + id + '&name=' + name,
});
},
swichTabTItem(e) {
console.log(e);
this.setData({
active: e.detail.index,
page: 1,
recordsList: []
});
this.getData();
},
getData() {
let istype = this.data.active == "0" ? "0" : this.data.active == "1" ? "1" : "-1";
let urlStr = app.getNetAddresss("plugin.store-cashier.frontend.store.balance.log.index");
app._postNetWork({
url: urlStr,
data: {
store_id: this.data.store_id,
log_type: istype
},
success: (resdata) => {
let res = resdata.data;
console.log(res);
this.setData({
recordsList: res.data.list.data,
last_page: res.data.list.last_page,
title: res.data.title
});
wx.setNavigationBarTitle({
title: `${res.data.title}明细`,
});
},
fail: function (res) {
wx.showToast({
title: res.data.msg,
duration: 1000,
icon: 'none'
});
}
});
},
getMoreData(){
let istype = this.data.active == "0" ? "0" : this.data.active == "1" ? "1" : "-1";
let urlStr = app.getNetAddresss("plugin.store-cashier.frontend.store.balance.log.index");
app._postNetWork({
url: urlStr,
data: {
store_id: this.data.store_id,
log_type: istype,
page:this.data.page
},
success: (resdata) => {
let res = resdata.data;
console.log(res);
this.setData({
recordsList: this.data.recordsList.concat(res.data.list.data),
last_page: res.data.list.last_page,
});
},
fail: function (res) {
wx.showToast({
title: res.data.msg,
duration: 1000,
icon: 'none'
});
}
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
if(this.data.page >= this.data.last_page){
return;
}else{
this.setData({
page : this.data.page + 1
});
this.getMoreData();
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
});