2023-03-14 06:28:27 +00:00
|
|
|
|
// pagesA/bills/index.js
|
|
|
|
|
require('../common/vendor.js');
|
|
|
|
|
const app = getApp(); //全局app
|
|
|
|
|
|
|
|
|
|
Page({
|
|
|
|
|
/**
|
|
|
|
|
* 页面的初始数据
|
|
|
|
|
*/
|
|
|
|
|
data: {
|
|
|
|
|
BASE_IMG_URL: app.globalData.BASE_IMG_URL,
|
|
|
|
|
BASE_URL:app.globalData.BASE_URL,
|
|
|
|
|
page: 1,
|
2023-03-15 04:59:31 +00:00
|
|
|
|
total: '',
|
|
|
|
|
list: [],
|
2023-03-14 06:28:27 +00:00
|
|
|
|
queryParams: {},
|
|
|
|
|
moneyInfo: {}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
|
*/
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
|
*/
|
|
|
|
|
onReady() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
|
*/
|
2023-03-15 04:59:31 +00:00
|
|
|
|
|
2023-03-14 06:28:27 +00:00
|
|
|
|
onShow() {
|
2023-03-15 04:59:31 +00:00
|
|
|
|
this.data.page = 1;
|
|
|
|
|
this.getBillList();
|
2023-03-14 06:28:27 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
|
*/
|
|
|
|
|
onHide() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
|
*/
|
|
|
|
|
onUnload() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
|
*/
|
|
|
|
|
onPullDownRefresh() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
|
*/
|
|
|
|
|
onReachBottom() {
|
2023-03-15 04:59:31 +00:00
|
|
|
|
let that = this;
|
|
|
|
|
let page = that.data.page;
|
|
|
|
|
that.setData({
|
|
|
|
|
page: page + 1
|
|
|
|
|
});
|
|
|
|
|
console.log(that.data.page)
|
|
|
|
|
that.getBillList();
|
|
|
|
|
},
|
2023-03-14 06:28:27 +00:00
|
|
|
|
|
2023-03-15 04:59:31 +00:00
|
|
|
|
getBillList() {
|
|
|
|
|
let that = this;
|
|
|
|
|
wx.request({
|
|
|
|
|
url: this.data.BASE_URL + '/addons/crmx/bill/getBillList',
|
|
|
|
|
data: {
|
|
|
|
|
page: that.data.page
|
|
|
|
|
},
|
|
|
|
|
header: {
|
|
|
|
|
'content-type': 'application/json', // 默认值
|
|
|
|
|
'token': wx.getStorageSync('token'),
|
|
|
|
|
},
|
|
|
|
|
success (res) {
|
|
|
|
|
if(res.data.code == 1) {
|
|
|
|
|
console.log(res.data)
|
|
|
|
|
let total = res.data.data.total;
|
|
|
|
|
if(that.data.page == 1) {
|
|
|
|
|
that.setData({
|
|
|
|
|
list:[]
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if(res.data.data.list && total > that.data.list.length) {
|
|
|
|
|
let list = that.data.list;
|
|
|
|
|
list = list.concat(res.data.data.list);
|
|
|
|
|
that.setData({
|
|
|
|
|
list:list
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
2023-03-14 06:28:27 +00:00
|
|
|
|
},
|
|
|
|
|
|
2023-03-15 04:59:31 +00:00
|
|
|
|
addBills() {
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: '/pages/index/groupCompany/bills/addBills',
|
|
|
|
|
})
|
|
|
|
|
},
|
2023-03-14 06:28:27 +00:00
|
|
|
|
|
2023-03-15 04:59:31 +00:00
|
|
|
|
// 修改
|
|
|
|
|
revise(e) {
|
|
|
|
|
console.log(e);
|
|
|
|
|
let id = e.currentTarget.dataset.id;
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: '/pages/index/groupCompany/bills/addBills?id=' + id,
|
|
|
|
|
})
|
2023-03-14 06:28:27 +00:00
|
|
|
|
},
|
|
|
|
|
|
2023-03-15 04:59:31 +00:00
|
|
|
|
//删除
|
|
|
|
|
delete(e) {
|
|
|
|
|
let that = this;
|
|
|
|
|
let id = e.currentTarget.dataset.id;
|
2023-03-14 06:28:27 +00:00
|
|
|
|
wx.request({
|
2023-03-15 04:59:31 +00:00
|
|
|
|
url: this.data.BASE_URL + '/addons/crmx/bill/delBill',
|
2023-03-14 06:28:27 +00:00
|
|
|
|
data: {
|
2023-03-15 04:59:31 +00:00
|
|
|
|
id: id
|
2023-03-14 06:28:27 +00:00
|
|
|
|
},
|
|
|
|
|
header: {
|
|
|
|
|
'content-type': 'application/json', // 默认值
|
|
|
|
|
'token': wx.getStorageSync('token'),
|
|
|
|
|
},
|
|
|
|
|
success (res) {
|
2023-03-15 04:59:31 +00:00
|
|
|
|
console.log(res.data,'删除成功')
|
|
|
|
|
wx.showToast({
|
|
|
|
|
title:"删除成功",
|
|
|
|
|
icon: 'success',//图标,支持"success"、"loading"
|
|
|
|
|
duration: 1200,//提示的延迟时间,单位毫秒,默认:1500
|
|
|
|
|
mask: false,//是否显示透明蒙层,防止触摸穿透,默认:false
|
|
|
|
|
})
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
that.setData({
|
|
|
|
|
page:1
|
|
|
|
|
})
|
|
|
|
|
that.getBillList();
|
|
|
|
|
},1400)
|
2023-03-14 06:28:27 +00:00
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|