123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- const utils = require('../../utils/util')
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- isPickerRender: false,
- isPickerShow: false,
- pickerConfig: {
- endDate: true,
- dateLimit: true,
- initStartTime: "2020-01-01",
- initEndTime: "2020-12-01",
- limitStartTime: "2015-01-01",
- limitEndTime: "2095-01-01",
- },
- searchParams: {
- startTime: "2019-01-01 ",
- endTime: "2019-12-01",
- pageNo: 1,
- pageSize: 10,
- createTime_begin:"",
- createTime_end:"",
- tradingStatus:0,
- storeName:""
- },
- dataStr: '',
- totalAmount:0,
- loadding: false,
- pullUpOn: true,
- list:[],
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- this.setData({
- ["searchParams.pageNo"]: 1,
- pullUpOn: true,
- loadding: false,
- list: []
- })
- this.getList()
- setTimeout(() => {
- wx.stopPullDownRefresh()
- }, 300);
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- //只是测试效果,逻辑以实际数据为准
- let that = this;
- this.setData({
- loadding: true,
- pullUpOn: true
- })
- this.setData({
- ["searchParams.pageNo"]: that.data.searchParams.pageNo + 1
- })
- this.getList()
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.getList();
-
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- },
- timePickerShow: function () {
- this.setData({
- isPickerShow: true,
- isPickerRender: true,
- chartHide: true
- });
- },
- pickerHide: function () {
- this.setData({
- isPickerShow: false,
- chartHide: false
- });
- },
- setPickerTime: function (val) {
- let data = val.detail;
- let startTime = utils.formatDate(data.startTime,'yyyy-MM-dd')
- let endTime = utils.formatDate(data.endTime,'yyyy-MM-dd')
- this.setData({
- ["searchParams.startTime"]: data.startTime,
- ["searchParams.endTime"]: data.endTime,
- dataStr: startTime +" ~ "+ endTime,
- ["searchParams.createTime_begin"]: data.startTime,
- ["searchParams.createTime_end"]: data.endTime,
- list:[]
- });
- this.getList();
- },
- getList() {
- var that = this
- utils.request(utils.api.withdrawList, that.data.searchParams, "GET", true, false, app.globalData.token).then((res) => {
- if (res.code == 200) {
- console.log(res)
- if (res.result.records.length > 0) {
- if (that.data.searchParams.pageNo > 0) {
- let list = that.data.list
- res.result.records.forEach((e)=>{
- list.push(e)
- })
- that.setData({
- list: list
- })
- }else{
- that.setData({
- list: res.result.records
- })
- }
- } else {
- that.setData({
- loadding: false,
- pullUpOn: false,
- ["searchParams.pageNo"]:that.data.searchParams.pageNo-1
- })
- }
- var allList = that.data.list;
- var allNumber = 0;
- for (let i = 0; i < allList.length; i++) {
- allNumber+=allList[i].number==null?0:allList[i].number;
- }
- that.setData({
- totalAmount: allNumber.toFixed(2),
- })
- }
- }).catch((res) => {})
- },
- })
|