| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- let _Http = getApp().globalData.http,
- currency = require("../../utils/currency"),
- CNY = value => currency(value, {
- symbol: "¥",
- precision: 2
- }).format();
- Page({
- data: {
- admin: true,
- showFiltrate: false,
- content: {
- baseonproject: 1, //1项目预测,0出货开票预测
- pageNumber: 1,
- pageTotal: 1,
- pagesize: 20,
- sort: [],
- where: {
- condition: "",
- begindate: "",
- enddate: ""
- }
- },
- navList: [{
- label: "排序",
- icon: "icon-jiangxu1",
- color: "",
- width: "",
- id: "sort"
- }, {
- label: "筛选",
- icon: "icon-shaixuan",
- color: "",
- width: "",
- id: "2"
- }]
- },
- onLoad(options) {
- this.getList();
- },
- /* 获取列表 */
- getList(init = false) {
- if (init.detail != undefined) init = init.detail;
- let content = this.data.content;
- if (init) content.pageNumber = 1;
- if (content.pageNumber > content.pageTotal) return;
- _Http.basic({
- "id": 20230705144604,
- content
- }).then(res => {
- console.log("项目成交预测", res)
- this.selectComponent('#ListBox').RefreshToComplete();
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- })
- res.data = res.data.map(v => {
- v.showAmount = CNY(v.projectamount)
- return v
- })
- this.setData({
- 'content.pageNumber': res.pageNumber + 1,
- 'content.pageTotal': res.pageTotal,
- 'content.total': res.total,
- 'content.sort': res.sort,
- list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
- });
- this.setListHeight();
- })
- },
- /* 处理搜索 */
- onSearch({
- detail
- }) {
- this.setData({
- "content.where.condition": detail
- });
- this.getList(true);
- },
- onReady() {
- this.setListHeight();
- },
- setListHeight() {
- this.selectComponent("#ListBox").setHeight(".head", this);
- },
- /* 顶部条件导航回调 */
- navClick({
- detail
- }) {
- this.setData({
- showFiltrate: true
- })
- },
- handleFilter({
- detail
- }) {
- if (detail.startdate) {
- this.setData({
- 'content.where.begindate': detail.startdate || "",
- 'content.where.enddate': detail.enddate || "",
- });
- } else {
- this.setData({
- 'content.where.begindate': "",
- 'content.where.enddate': "",
- });
- }
- this.getList(true)
- }
- })
|