123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- 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:1,
- storeName:""
- },
- dataStr: '',
- totalAmount:0,
- loadding: false,
- pullUpOn: true,
- list:[],
- values: {
- storeId: '',
- storeName: '',
- },
- storeList: [],
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- this.setData({
- ["searchParams.pageNo"]: 1,
- pullUpOn: true,
- loadding: false,
- list: []
- })
- this.btnsearch()
- 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.btnsearch()
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.bindStoreList()
- this.btnsearch();
-
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- },
- bindStorePickerChange: function (e) {
- var item = this.data.storeList[e.detail.value]
- this.setData({
- ['values.storeId']: item.id,
- ['values.storeName']: item.storeName,
- ['searchParams.storeId']: item.id,
- list:[]
- })
- this.btnsearch();
- },
- bindStoreList() {
- var that = this
- utils.request(utils.api.storeList, {}, "GET", false, true,app.globalData.token).then((res) => {
- if (res.code == 200) {
- that.setData({
- storeList: res.result
- })
- }
- }).catch((res) => {})
- },
- timePickerShow: function () {
- this.setData({
- isPickerShow: true,
- isPickerRender: true,
- chartHide: true
- });
- },
- pickerHide: function () {
- this.setData({
- isPickerShow: false,
- chartHide: false
- });
- },
- setPickerTime: function (val) {
- console.log(111111)
- console.log(this.data.searchParams.storeName)
- let data = val.detail;
- let startTime = utils.formatDate(data.startTime,'yyyy-MM-dd')
- let endTime = utils.formatDate(data.endTime,'yyyy-MM-dd')
- var et = endTime.split(" ");
- var entt = et[0]+" 23:59:59"
- this.setData({
- ["searchParams.startTime"]: data.startTime,
- ["searchParams.endTime"]: entt,
- dataStr: startTime +" ~ "+ endTime,
- ["searchParams.createTime_begin"]: data.startTime,
- ["searchParams.createTime_end"]: entt,
- ["searchParams.storeName"]: this.data.searchParams.storeName,
- list:[]
- });
- this.btnsearch();
- },
- btnsearch() {
- var that = this
- utils.request(utils.api.mgVmBillList, that.data.searchParams, "GET", true, false, app.globalData.token).then((res) => {
- if (res.code == 200) {
- console.log(res)
- that.setData({
- totalAmount: res.result.allMoney,
- })
- if (res.result.list.records.length > 0) {
- if (that.data.searchParams.pageNo > 1) {
- let list = that.data.list
- res.result.list.records.forEach((e)=>{
- list.push(e)
- })
- that.setData({
- list: list
- })
- }else{
- that.setData({
- list: res.result.list.records
- })
- }
- } else {
- that.setData({
- loadding: false,
- pullUpOn: false,
- ["searchParams.pageNo"]:that.data.searchParams.pageNo-1
- })
- }
- }
- }).catch((res) => {})
- },
- inputeditStoreName: function (e) {
- let _this = this;
- let value = e.detail.value;
- _this.setData({
- ["searchParams.storeName"]: value
- });
- },
- })
|