Sfoglia il codice sorgente

首页新增抖音今日消耗+广点通今日消耗

Yannay 2 settimane fa
parent
commit
22802fd9cb
3 ha cambiato i file con 22 aggiunte e 3 eliminazioni
  1. 2 0
      mock/mockData.js
  2. 19 3
      pages/person/cards/index.vue
  3. 1 0
      pages/person/cards/styles/index.scss

+ 2 - 0
mock/mockData.js

@@ -12,6 +12,8 @@ const mockDataList = {
12 12
       msg: 'success',
13 13
       data: {
14 14
         todayConsume: 1234.56,//今日消耗
15
+        todayConsumeDy: 234.56,//抖音今日消耗
16
+        todayConsumeGdt: 1000.00,//广点通今日消耗
15 17
         todayPerformance: 56789.01,//今日业绩
16 18
         countTypeA: 25,//条数统计A类
17 19
         countTypeB: 12,//条数统计B类

+ 19 - 3
pages/person/cards/index.vue

@@ -5,10 +5,18 @@
5 5
             <view class="card_item today">
6 6
                 <view class="card_item_content">
7 7
                     <view class="card_header">
8
-                        <text class="card_title">今天消耗(元)</text>
8
+                        <text class="card_title">抖音<br />今天消耗(元)</text>
9 9
                     </view>
10 10
                     <view class="card_content">
11
-                        <text class="card_value">{{ cardData.todayConsume }}</text>
11
+                        <text class="card_value">{{ formatMoney(cardData.todayConsumeDy) }}</text>
12
+                    </view>
13
+                </view>
14
+                <view class="card_item_content">
15
+                    <view class="card_header">
16
+                        <text class="card_title">广点通<br />今天消耗(元)</text>
17
+                    </view>
18
+                    <view class="card_content">
19
+                        <text class="card_value">{{ formatMoney(cardData.todayConsumeGdt) }}</text>
12 20
                     </view>
13 21
                 </view>
14 22
                 <view class="card_item_content">
@@ -140,6 +148,8 @@ export default {
140 148
             // 卡片数据
141 149
             cardData: {
142 150
                 todayConsume: '-',
151
+                todayConsumeDy: '-',
152
+                todayConsumeGdt: '-',
143 153
                 todayPerformance: '-',
144 154
                 countTypeA: '-',
145 155
                 countTypeB: '-',
@@ -168,7 +178,7 @@ export default {
168 178
                 yAxis: {
169 179
                     gridType: "dash",
170 180
                     dashLength: 2,
171
-                    axisLabel:{
181
+                    axisLabel: {
172 182
                         show: false
173 183
                     }
174 184
                 },
@@ -188,6 +198,12 @@ export default {
188 198
     },
189 199
 
190 200
     methods: {
201
+        formatMoney(val) {
202
+            if (val === null || val === undefined || val === '' || val === '-') return '-';
203
+            const num = Number(val);
204
+            if (Number.isNaN(num)) return '-';
205
+            return num.toFixed(2);
206
+        },
191 207
         getCardData() {
192 208
             uni.$u.api.getPersonCards({ userId: this.$store.state.user.userInfo.userId }).then(res => {
193 209
                 if (res.code === 200) {

+ 1 - 0
pages/person/cards/styles/index.scss

@@ -55,6 +55,7 @@
55 55
       font-size: 28rpx;
56 56
       font-weight: 600;
57 57
       color: #333333;
58
+      text-align: center;
58 59
     }
59 60
     .count_icon{
60 61
       width: 30rpx;