var _request = require('../../../../utils/request.js') var id Page({ data: { page: 1, per_page: 10, list: [], already_settle:'', not_settle:'', total_sale:'', // settle_price:[], more: true, num: '' }, onLoad: function (options) { id = options.id // var app = getApp() // new app.ToastPannel() this.getSettleList() this.getSettleStat() this.getTime() }, getSettleList () { var that = this var url = 'v1/merchant/settle/list' var params = { merchant_id: id, page: this.data.page, per_page: this.data.per_page } var success = function (res) { // var arr = [] // for(var i = 0; i that.data.list.length that.setData({ more: listMore }) } _request.$get(url, params, success, that) }, getSettleStat () { var that = this var url = 'v1/merchant/settle/stat' var params = { merchant_id: id, } var success = function (res) { var data1 = res.data console.log(data1) that.setData({ already_settle: that.formatNumber(data1.already_settle), not_settle: that.formatNumber(data1.not_settle), total_sale: that.formatNumber(data1.total_sale) }) } _request.$get(url, params, success, that) }, //千分位格式化 formatNumber (num) { var num1 = num.toFixed(2) if (isNaN(num)) { throw new TypeError("num is not a number"); } return ("" + num1).replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g, "$1,"); }, toOther () { wx.navigateTo({ url: '/pages/parse/parse?id=10' }) }, onReachBottom: function () { if (this.data.more) { var page = this.data.page + 1 this.setData({ page: page }) this.getSettleList() } }, getTime () { var that = this var date=new Date; var year=date.getFullYear(); var month=date.getMonth()+1; month =(month<10 ? "0"+month:month); var mydate = (year.toString()+'/'+month.toString()); that.setData({ num: mydate }) } })