|
|
@@ -0,0 +1,100 @@
|
|
|
+const _Http = getApp().globalData.http,
|
|
|
+ currency = require("../../utils/currency"),
|
|
|
+ CNY = (value, symbol = "¥", precision = 2) => currency(value, {
|
|
|
+ symbol,
|
|
|
+ precision
|
|
|
+ }).format();
|
|
|
+import {
|
|
|
+ getHeight
|
|
|
+} from "../../utils/getHeight";
|
|
|
+Component({
|
|
|
+ properties: {
|
|
|
+
|
|
|
+ },
|
|
|
+ options: {
|
|
|
+ addGlobalClass: true
|
|
|
+ },
|
|
|
+ lifetimes: {
|
|
|
+ attached: function () {
|
|
|
+ getApp().globalData.Language.getLanguagePackage(this)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ list: [{
|
|
|
+ type: "订单",
|
|
|
+ datatype: 1
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "出货",
|
|
|
+ datatype: 2
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "开票",
|
|
|
+ datatype: 3
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "回款",
|
|
|
+ datatype: 4
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "content": {
|
|
|
+ "type": 1,
|
|
|
+ "dataid": 54,
|
|
|
+ "dateType": "本年",
|
|
|
+ "datatype": 1
|
|
|
+ },
|
|
|
+ initialize: false, // 是否初始化
|
|
|
+ height: 0,
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getList(init = false) {
|
|
|
+ let content = this.data.content,
|
|
|
+ item = this.data.list[content.datatype - 1];
|
|
|
+ if (!init && item.init) return;
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20231009125304,
|
|
|
+ content
|
|
|
+ }).then(res => {
|
|
|
+ console.log(item.type + "面板", res)
|
|
|
+ this.selectComponent('#ListBox' + content.datatype).RefreshToComplete();
|
|
|
+ if (res.code != '1') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ let data = res.data,
|
|
|
+ dividend = wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000;
|
|
|
+ data.target_l = CNY(data.target_l / dividend);
|
|
|
+ data.nowTarget_l = CNY(data.nowTarget_l / dividend);
|
|
|
+ data.unamount = CNY(data.unamount / dividend);
|
|
|
+ data.amount = CNY(data.amount / dividend);
|
|
|
+ data.unnowTarget_l = CNY(data.unnowTarget_l / dividend);
|
|
|
+ data.wcamount = (data.wcamount * 100).toFixed(2); // 达成率
|
|
|
+ data.tbxsje = (data.tbxsje * 100).toFixed(2); // 同比增长率
|
|
|
+ data.hbxsje = (data.hbxsje * 100).toFixed(2); // 环比增长率
|
|
|
+ data.wcnowTarget_l = (data.wcnowTarget_l * 100).toFixed(2); // 累计目标达成率
|
|
|
+ data.init = true;
|
|
|
+ this.setData({
|
|
|
+ [`list[${content.datatype - 1}]`]: Object.assign(item, data),
|
|
|
+ })
|
|
|
+ console.log("list", this.data.list)
|
|
|
+ this.setHeight()
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ setHeight() {
|
|
|
+ getHeight("#head", this).then(height => {
|
|
|
+ this.setData({
|
|
|
+ height: height - 20
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ swiperChange({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.setData({
|
|
|
+ "content.datatype": detail.currentItemId
|
|
|
+ })
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ }
|
|
|
+})
|