Blame view

antis-ncc-admin/src/views/extend/medicalStorePerformanceReport/summary-panel.vue 7.07 KB
7fc03b57   “wangming”   1
1
2
3
  <template>
    <div class="summary-panel">
      <div class="summary-panel__section">
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
4
5
6
7
8
        <div class="money-row">
          <div v-for="item in moneyKpis" :key="item.key" class="metric" :class="item.type">
            <i :class="item.icon" class="metric-icon" />
            <span class="metric-label">{{ item.label }}</span>
            <span class="metric-value" :title="item.fullText">{{ item.fullText }}</span>
7fc03b57   “wangming”   1
9
10
          </div>
        </div>
7fc03b57   “wangming”   1
11
  
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
        <div class="funnel-row">
          <div v-for="group in funnelGroups" :key="group.name" class="funnel-group">
            <span class="funnel-name">{{ group.name }}</span>
            <span v-for="item in group.items" :key="item.key" class="funnel-item">
              <span class="funnel-item__label">{{ item.label }}</span>
              <span class="funnel-item__value" :title="item.fullText">{{ item.fullText }}</span>
            </span>
          </div>
        </div>
  
        <div class="category-line">
          <span class="category-line__title"><i class="el-icon-goods" />品项</span>
          <div class="category-row">
            <div v-for="row in categoryRows" :key="row.categoryName" class="category-chip">
              <span class="category-chip__name">{{ row.categoryName || '无' }}</span>
              <span class="category-chip__amount">¥{{ formatMoney(row.amount) }}</span>
            </div>
          </div>
        </div>
7fc03b57   “wangming”   1
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
      </div>
    </div>
  </template>
  
  <script>
  import { formatMoney, formatNumber, formatPercent, normalizeSummary, pickField } from './format-utils'
  
  const DEFAULT_CATEGORIES = ['面部', '私密', '大健康', '臻咪', '精雕', '脂间', '功能医学', '窈窕针']
  
  export default {
    name: 'MedicalStorePerformanceSummaryPanel',
    props: {
      summary: {
        type: Object,
        default: () => ({})
      },
      categoryAmounts: {
        type: Array,
        default: () => []
      }
    },
    computed: {
      summaryData() {
        return normalizeSummary(this.summary)
      },
      categoryRows() {
        const map = {}
        ;(this.categoryAmounts || []).forEach((item) => {
          const name = pickField(item, 'CategoryName', 'categoryName')
          if (!name) return
          map[name] = Number(pickField(item, 'Amount', 'amount') || 0)
        })
        return DEFAULT_CATEGORIES.map((name) => ({
          categoryName: name,
          amount: map[name] || 0
        }))
      },
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
68
69
70
71
72
73
74
75
76
      moneyKpis() {
        const s = this.summaryData
        return [
          { key: 'monthTarget', label: '目标合计', fullText: '¥' + formatMoney(s.monthTarget), icon: 'el-icon-aim', type: 'primary' },
          { key: 'completedPerformance', label: '完成业绩', fullText: '¥' + formatMoney(s.completedPerformance), icon: 'el-icon-s-finance', type: 'success' },
          { key: 'refundAmount', label: '退款金额', fullText: '¥' + formatMoney(s.refundAmount), icon: 'el-icon-refresh-left', type: 'danger' }
        ]
      },
      funnelGroups() {
7fc03b57   “wangming”   1
77
78
        const s = this.summaryData
        return [
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
          {
            name: '整体',
            items: [
              { key: 'arrivalCount', label: '到院', fullText: formatNumber(s.arrivalCount) },
              { key: 'consultationCount', label: '见诊', fullText: formatNumber(s.consultationCount) },
              { key: 'dealCount', label: '成交', fullText: formatNumber(s.dealCount) },
              { key: 'dealRate', label: '成交率', fullText: formatPercent(s.dealRate) + '%' }
            ]
          },
          {
            name: '售前',
            items: [
              { key: 'preSalesConsultationCount', label: '见诊', fullText: formatNumber(s.preSalesConsultationCount) },
              { key: 'preSalesDealCount', label: '成交', fullText: formatNumber(s.preSalesDealCount) },
              { key: 'preSalesDealRate', label: '成交率', fullText: formatPercent(s.preSalesDealRate) + '%' }
            ]
          },
          {
            name: '售后',
            items: [
              { key: 'afterSalesConsultationCount', label: '见诊', fullText: formatNumber(s.afterSalesConsultationCount) },
              { key: 'afterSalesDealCount', label: '成交', fullText: formatNumber(s.afterSalesDealCount) },
              { key: 'afterSalesDealRate', label: '成交率', fullText: formatPercent(s.afterSalesDealRate) + '%' }
            ]
          }
7fc03b57   “wangming”   1
104
105
106
107
108
109
110
111
112
113
114
115
116
        ]
      }
    },
    methods: {
      formatMoney
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .summary-panel {
    --ink: #1f2333;
    --sub: #6b7280;
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
117
    --line: #e6e8ef;
7fc03b57   “wangming”   1
118
119
    --card: #ffffff;
    --blue: #3b82f6;
7fc03b57   “wangming”   1
120
    --green: #2f9e6e;
7fc03b57   “wangming”   1
121
    --amber: #d99a2b;
7fc03b57   “wangming”   1
122
    --red: #e05a4e;
7fc03b57   “wangming”   1
123
  
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
124
    width: 100%;
7fc03b57   “wangming”   1
125
126
127
  }
  
  .summary-panel__section {
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
128
129
130
    background: transparent;
    border: 0;
    padding: 0;
7fc03b57   “wangming”   1
131
132
  }
  
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
133
134
135
136
137
138
139
140
  .money-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  
  .metric {
    display: flex;
7fc03b57   “wangming”   1
141
    align-items: center;
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
    gap: 6px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fafbff;
    min-width: 0;
    box-sizing: border-box;
  
    &.primary .metric-icon { color: var(--blue); }
    &.success .metric-icon { color: var(--green); }
    &.warning .metric-icon { color: var(--amber); }
    &.danger .metric-icon { color: var(--red); }
  }
  
  .metric-icon {
    font-size: 14px;
    flex-shrink: 0;
  }
  
  .metric-label {
    font-size: 12px;
    color: var(--sub);
    flex-shrink: 0;
    line-height: 1;
  }
  
  .metric-value {
    margin-left: auto;
    font-size: 15px;
7fc03b57   “wangming”   1
172
173
    font-weight: 700;
    color: var(--ink);
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
174
175
176
    line-height: 1;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
7fc03b57   “wangming”   1
177
178
  }
  
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
179
  .funnel-row {
7fc03b57   “wangming”   1
180
    display: grid;
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
181
    grid-template-columns: 1.35fr 1fr 1fr;
7fc03b57   “wangming”   1
182
    gap: 8px;
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
183
    margin-top: 8px;
7fc03b57   “wangming”   1
184
185
  }
  
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
186
  .funnel-group {
7fc03b57   “wangming”   1
187
    display: flex;
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
188
189
190
191
192
193
194
    align-items: center;
    gap: 12px;
    min-height: 36px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
7fc03b57   “wangming”   1
195
    box-sizing: border-box;
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
196
197
    min-width: 0;
  }
7fc03b57   “wangming”   1
198
  
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
199
200
201
202
203
204
  .funnel-name {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
7fc03b57   “wangming”   1
205
206
  }
  
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
207
208
209
210
211
212
213
214
215
  .funnel-item {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    white-space: nowrap;
    min-width: 0;
  }
  
  .funnel-item__label {
7fc03b57   “wangming”   1
216
    font-size: 12px;
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
217
218
    color: var(--sub);
    line-height: 1;
7fc03b57   “wangming”   1
219
220
  }
  
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
221
  .funnel-item__value {
7fc03b57   “wangming”   1
222
223
224
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
    line-height: 1;
    font-variant-numeric: tabular-nums;
  }
  
  .category-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
  }
  
  .category-line__title {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
7fc03b57   “wangming”   1
244
  
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
245
246
247
248
    i {
      color: var(--blue);
      margin-right: 4px;
      font-size: 14px;
7fc03b57   “wangming”   1
249
250
251
    }
  }
  
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
  .category-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
  }
  
  .category-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 8px;
    border-radius: 6px;
    background: #fafbff;
    border: 1px solid var(--line);
    box-sizing: border-box;
  }
  
  .category-chip__name {
    font-size: 12px;
7fc03b57   “wangming”   1
273
    color: var(--sub);
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
274
275
276
277
278
279
280
281
282
    line-height: 1;
  }
  
  .category-chip__amount {
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
    white-space: nowrap;
7fc03b57   “wangming”   1
283
284
  }
  
00832d76   “wangming”   fix: 上午半天假过点仍可打上班...
285
286
287
288
289
290
291
  @media (max-width: 1280px) {
    .money-row {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  
    .funnel-row {
      grid-template-columns: 1fr;
7fc03b57   “wangming”   1
292
293
294
    }
  }
  </style>