12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- let _Http = getApp().globalData.http,
- content = {
- pageNumber: 1,
- pageTotal: 1,
- pageSize: 10,
- "where": {
- "condition": "",
- "status": ""
- }
- },
- currency = require("../../../../../utils/currency"),
- CNY = value => currency(value, {
- symbol: "",
- precision: 2
- }).format(),
- obj = {};
- import {
- formatTime
- } from "../../../../../utils/getTime"
- Component({
- lifetimes: {
- attached: function () {
- this.getList(true)
- let date = formatTime().split(" ")[0].split("/");
- obj = {
- year: date[0],
- month: date[1],
- day: date[2],
- quarter: Math.ceil(date[1] / 3)
- };
- console.log(obj)
- },
- },
- data: {
- list: []
- },
- methods: {
- getList(init = false) {
- if (init) {
- content.pageNumber = 1;
- content.pageTotal = 1;
- }
- if (content.pageNumber > content.pageTotal) return;
- _Http.basic({
- "id": 20231103100503,
- "version": 1,
- content
- }).then(res => {
- console.log("获取经销商排名", res)
- if (res.msg != '成功') return;
- let list = res.data.map(v => {
- //l基本 h挑战 a实际 pl基础目标实际完成率 ph挑战目标实际完成率
- let ar = [{
- fulfill: CNY(v.m1a + v.m2a + v.m3a),
- target: CNY(v.m3l + v.m3l + v.m3l),
- }, {
- fulfill: CNY(v.m4a + v.m5a + v.m6a),
- target: CNY(v.m4l + v.m5l + v.m6l),
- }, {
- fulfill: CNY(v.m7a + v.m8a + v.m9a),
- target: CNY(v.m7l + v.m8l + v.m9l),
- }, {
- fulfill: CNY(v.m10a + v.m11a + v.m12a),
- target: CNY(v.m10l + v.m11l + v.m12l),
- }];
- v.quarter = ar[obj.quarter - 1];
- console.log(obj.month)
- console.log(CNY(v[`m${obj.month}a`]))
- v.thisMonth = {
- fulfill: CNY(v[`m${obj.month}a`]),
- target: CNY(v[`m${obj.month}l`])
- }
- v.sumamount_currentmonth = CNY(v.sumamount_currentmonth)
- v.sumamount_year = CNY(v.sumamount_year)
- return v
- })
- this.setData({
- list: res.pageNumber == 1 ? list : this.data.list.concat(list)
- });
- content.pageNumber = res.pageNumber + 1;
- content.pageTotal = res.pageTotal;
- })
- }
- }
- })
|