liyongli 3 anni fa
parent
commit
e77380b77f
1 ha cambiato i file con 32 aggiunte e 38 eliminazioni
  1. 32 38
      src/views/HardAdvertisement/HardAdvertisement.vue

+ 32 - 38
src/views/HardAdvertisement/HardAdvertisement.vue

@@ -207,8 +207,8 @@
           <el-col :span="12" v-if="customerData.now && customerData.now.length">
             <div class="customer_list">
               <div class="customer_list_head">
-                {{ customerData.now[0].dt }}至{{
-                  customerData.now[customerData.now.length - 1].dt
+                {{ customerData.now[0].dts }}至{{
+                  customerData.now[0].dte
                 }}
                 单位({{ customer_list[customer_act].company }})
               </div>
@@ -270,8 +270,8 @@
           >
             <div class="customer_list">
               <div class="customer_list_head">
-                {{ customerData.before[0].dt }}至{{
-                  customerData.before[customerData.before.length - 1].dt
+                {{ customerData.before[0].dts }}至{{
+                  customerData.before[0].dte
                 }}
                 单位({{ customer_list[customer_act].company }})
               </div>
@@ -498,21 +498,25 @@ export default {
           text: "费用",
           proportionType: "fee",
           type: 3,
+          unit: "元",
         },
         {
           text: "时长",
           proportionType: "timeSize",
           type: 2,
+          unit: "分",
         },
         {
           text: "频次",
           proportionType: "pinci",
           type: 1,
+          unit: "次",
         },
         {
           text: "客户量",
           proportionType: "customer",
           type: 4,
+          unit: "个",
         },
       ],
       customer_list: [
@@ -565,7 +569,6 @@ export default {
       adChannelList().then(r => {
         this.channleList = r || [];
         let sel = this.timeSelect[this.active];
-        console.log(sel);
         launchList({
           channelId: this.channleList[this.channel_act].channelId,
           start: sel.startDate,
@@ -739,13 +742,19 @@ export default {
         if (keyName === "trend") keys.push(realItem.hour);
         o.dt && realKey[0].push(o.dt);
         n.dt && realKey[1].push(n.dt);
-        o[key] >= 0 && value[0].push(o[key]);
-        n[key] >= 0 && value[1].push(n[key]);
+        o[key] >= 0 &&
+          value[0].push(key === "timeSize" ? o[key] / 60000 : o[key]);
+        n[key] >= 0 &&
+          value[1].push(key === "timeSize" ? n[key] / 60000 : n[key]);
+      }
+      if (old && old.length) {
+        if (old[0].dt === old[old.length - 1].dt) lendata.push(`${old[0].dt}`);
+        else lendata.push(`${old[0].dt}到${old[old.length - 1].dt}`);
+      }
+      if (now && now.length) {
+        if (now[0].dt === now[now.length - 1].dt) lendata.push(`${now[0].dt}`);
+        else lendata.push(`${now[0].dt}到${now[now.length - 1].dt}`);
       }
-      if (old && old.length)
-        lendata.push(`${old[0].dt}到${old[old.length - 1].dt}`);
-      if (now && now.length)
-        lendata.push(`${now[0].dt}到${now[now.length - 1].dt}`);
       return {
         keys,
         realKey,
@@ -772,7 +781,7 @@ export default {
       if (isNaN(num)) return 0;
       if (num >= 100000000) return (num / 100000000).toFixed(0) - 0 + "亿";
       if (num >= 10000) return (num / 10000).toFixed(0) - 0 + "万";
-      return num;
+      return Number(num).toFixed(2);
     },
     launchChart(list) {
       if (!this.$refs.launch) return;
@@ -814,16 +823,8 @@ export default {
           formatter: item => {
             let bf = list.before || [],
               no = list.now || [];
-            let vb = this.numFor(
-                bf[item[0].dataIndex][
-                  this.launch_list[this.launch_act].proportionType
-                ] || 0
-              ),
-              vn = this.numFor(
-                no[item[0].dataIndex][
-                  this.launch_list[this.launch_act].proportionType
-                ] || 0
-              );
+            let vb = this.numFor(item[0].value || 0),
+              vn = this.numFor(item[1].value || 0);
             return `${this.launch_list[this.launch_act].text} <br /> ${
               bf[item[0].dataIndex].dt
             } ${vb} <br />${no[item[0].dataIndex].dt} ${vn}`;
@@ -864,22 +865,15 @@ export default {
         tooltip: {
           trigger: "axis",
           formatter: item => {
-            let bf = list.before || [],
-              no = list.now || [];
-            console.log(item);
-            let vb = this.numFor(
-                bf[item[0].dataIndex][
-                  this.launch_list[this.trend_act].proportionType
-                ] || 0
-              ),
-              vn = this.numFor(
-                no[item[0].dataIndex][
-                  this.launch_list[this.trend_act].proportionType
-                ] || 0
-              );
-            return `${this.launch_list[this.trend_act].text} <br /> ${
-              item[0].name
-            }时 ${vb} <br />${item[0].name}时 ${vn}`;
+              let s = item[0] || {}, e  = item[1] || {};
+            let vb = this.numFor(s.value || 0),
+              vn = this.numFor(e.value || 0),
+              sele = this.launch_list[this.trend_act];
+            return `${sele.text} <br />${s.seriesName} ${
+              s.name
+            }时 ${vb + (sele.unit || "")} <br />${e.seriesName || ""} ${
+              s.name
+            }时 ${vn + (sele.unit || "")}`;
           },
         },
         yAxis: {