Blame view

antis-ncc-admin/src/views/statisticsList/form13.vue 22.8 KB
50f29afc   李宇   build(antis-ncc-a...
1
2
3
4
5
6
7
8
9
  <template>
    <div class="NCC-common-layout">
      <div class="NCC-common-layout-center">
        <!-- 筛选条件 -->
        <el-row class="NCC-common-search-box" :gutter="16">
          <el-form @submit.native.prevent>
            <el-col :span="6">
              <el-form-item label="开始时间">
                <el-date-picker 
1658622a   李宇   ```
10
                  v-model="query.StartBillingTime" 
86ade5ce   李宇   报表
11
12
13
                  type="date" 
                  value-format="yyyy-MM-dd" 
                  format="yyyy-MM-dd" 
50f29afc   李宇   build(antis-ncc-a...
14
15
16
17
18
19
20
                  placeholder="开始时间"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="结束时间">
                <el-date-picker 
1658622a   李宇   ```
21
                  v-model="query.EndBillingTime" 
86ade5ce   李宇   报表
22
23
24
                  type="date" 
                  value-format="yyyy-MM-dd" 
                  format="yyyy-MM-dd" 
50f29afc   李宇   build(antis-ncc-a...
25
26
27
28
29
30
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
68
69
70
71
72
73
74
75
76
77
78
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
104
105
106
107
108
109
110
111
112
113
                  placeholder="结束时间"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="开单活动">
                <el-select
                  v-model="query.activityId"
                  placeholder="请选择开单活动"
                  filterable
                  clearable
                  :style='{"width":"100%"}'>
                  <el-option
                    v-for="item in activityOptions"
                    :key="item.id"
                    :label="item.activityName"
                    :value="item.id">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="品项">
                <el-select
                  v-model="query.itemId"
                  placeholder="请选择品项"
                  filterable
                  clearable
                  :style='{"width":"100%"}'>
                  <el-option
                    v-for="item in itemOptions"
                    :key="item.id"
                    :label="item.xmmc"
                    :value="item.id">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="会员">
                <el-select
                  v-model="query.memberId"
                  placeholder="请选择会员"
                  filterable
                  remote
                  :remote-method="remoteMemberMethod"
                  :loading="memberLoading"
                  clearable
                  :style='{"width":"100%"}'>
                  <el-option
                    v-for="item in memberOptions"
                    :key="item.id"
                    :label="`${item.khmc}(${item.sjh || ''} ${item.gsmdName || ''})`"
                    :value="item.id">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="品项类型">
                <el-select
                  v-model="query.itemType"
                  placeholder="请选择品项类型"
                  filterable
                  clearable
                  :style='{"width":"100%"}'>
                  <el-option
                    v-for="item in itemTypeOptions"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="购买类型">
                <el-select
                  v-model="query.SourceType"
                  placeholder="请选择购买类型"
                  clearable
                  :style='{"width":"100%"}'>
                  <el-option label="购买" value="购买" />
                  <el-option label="赠送" value="赠送" />
                  <el-option label="体验" value="体验" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
ffd6aaca   李宇   最新
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
              <el-form-item label="组织类型">
                <el-select
                  v-model="query.organizationType"
                  placeholder="请选择组织类型"
                  filterable
                  clearable
                  @change="handleOrganizationTypeChange"
                  :style='{"width":"100%"}'>
                  <el-option label="事业部" value="事业部"></el-option>
                  <el-option label="科技部" value="科技部"></el-option>
                  <el-option label="教育部" value="教育部"></el-option>
                  <el-option label="大项目部" value="大项目部"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="部门">
                <el-select
                  v-model="query.departmentId"
                  placeholder="请选择部门"
                  filterable
                  clearable
                  @change="handleDepartmentChange"
                  :style='{"width":"100%"}'>
                  <el-option
                    v-for="dept in departmentOptions"
                    :key="dept.Id || dept.id"
                    :label="dept.FullName || dept.fullName"
                    :value="dept.Id || dept.id">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
262c3578   李宇   ```
148
149
              <el-form-item label="门店">
                <el-select
ffd6aaca   李宇   最新
150
                  v-model="query.storeIds"
262c3578   李宇   ```
151
                  placeholder="请选择门店"
ffd6aaca   李宇   最新
152
                  multiple
262c3578   李宇   ```
153
154
155
156
157
158
159
160
161
162
163
164
165
                  filterable
                  clearable
                  :style='{"width":"100%"}'>
                  <el-option
                    v-for="store in storeOptions"
                    :key="store.id"
                    :label="store.dm"
                    :value="store.id">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
50f29afc   李宇   build(antis-ncc-a...
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
              <el-form-item>
                <el-button type="primary" icon="el-icon-search" @click="search()">查询</el-button>
                <el-button icon="el-icon-refresh-right" @click="reset()">重置</el-button>
              </el-form-item>
            </el-col>
          </el-form>
        </el-row>
  
        <!-- 数据表格 -->
        <div class="NCC-common-layout-main NCC-flex-main">
          <NCC-table v-loading="listLoading" :data="list" has-c>
            <el-table-column prop="billingTime" label="开单时间" min-width="160">
              <template slot-scope="scope">
                <i class="el-icon-time" style="margin-right: 4px; color: #409EFF;"></i>
                <span>{{ formatDateTime(scope.row.billingTime) || '无' }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="memberName" label="会员名称" min-width="120">
              <template slot-scope="scope">
                <i class="el-icon-user" style="margin-right: 4px; color: #409EFF;"></i>
                <span>{{ scope.row.memberName || '无' }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="memberPhone" label="会员手机号" min-width="120">
              <template slot-scope="scope">
                <i class="el-icon-phone" style="margin-right: 4px; color: #67C23A;"></i>
                <span>{{ scope.row.memberPhone || '无' }}</span>
              </template>
            </el-table-column>
262c3578   李宇   ```
195
196
197
198
199
200
            <el-table-column prop="storeName" label="门店名称" min-width="120">
              <template slot-scope="scope">
                <i class="el-icon-shop" style="margin-right: 4px; color: #409EFF;"></i>
                <span>{{ scope.row.storeName || '无' }}</span>
              </template>
            </el-table-column>
50f29afc   李宇   build(antis-ncc-a...
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
            <el-table-column prop="itemName" label="品项名称" min-width="150">
              <template slot-scope="scope">
                <i class="el-icon-goods" style="margin-right: 4px; color: #409EFF;"></i>
                <span>{{ scope.row.itemName || '无' }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="itemType" label="品项类型" min-width="100">
              <template slot-scope="scope">
                <el-tag 
                  :type="getItemTypeTagType(scope.row.itemType)" 
                  size="small">
                  {{ scope.row.itemType || '无' }}
                </el-tag>
              </template>
            </el-table-column>
            <el-table-column prop="activityName" label="营销活动名称" min-width="150">
              <template slot-scope="scope">
                <i class="el-icon-tickets" style="margin-right: 4px; color: #67C23A;"></i>
                <span>{{ scope.row.activityName || '无' }}</span>
              </template>
            </el-table-column>
1658622a   李宇   ```
222
            <el-table-column prop="actualPrice" label="品项金额" min-width="120" align="right">
50f29afc   李宇   build(antis-ncc-a...
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
              <template slot-scope="scope">
                <i class="el-icon-money" style="margin-right: 4px; color: #67C23A;"></i>
                <span class="amount-paid">¥{{ formatMoney(scope.row.actualPrice) }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="projectNumber" label="项目数" min-width="100" align="right">
              <template slot-scope="scope">
                <i class="el-icon-menu" style="margin-right: 4px; color: #67C23A;"></i>
                <span>{{ scope.row.projectNumber || 0 }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="sourceType" label="来源类型" min-width="100">
              <template slot-scope="scope">
                <i class="el-icon-link" style="margin-right: 4px; color: #909399;"></i>
                <span>{{ scope.row.sourceType || '无' }}</span>
              </template>
            </el-table-column>
2036dd49   李宇   最新
240
241
242
243
244
245
246
            <el-table-column prop="sourceType" label="付款方式" min-width="100">
              <template slot-scope="scope">
                <span>{{ scope.row.paymentMethod || '无' }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="sourceType" label="合作机构" min-width="100">
              <template slot-scope="scope">
64ac7d69   李宇   最新
247
                <span>{{ scope.row.paymentMethod == '合作' ? (scope.row.hgjgName || '无') : '无' }}</span>
2036dd49   李宇   最新
248
249
              </template>
            </el-table-column>
6ec1ef37   李宇   最新
250
            <el-table-column prop="sourceType" label="结算机构" min-width="100">
2036dd49   李宇   最新
251
              <template slot-scope="scope">
64ac7d69   李宇   最新
252
                <span>{{ scope.row.paymentMethod != '合作' ? (scope.row.fkyyName || '无') : '无' }}</span>
2036dd49   李宇   最新
253
254
              </template>
            </el-table-column>
50f29afc   李宇   build(antis-ncc-a...
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
            <el-table-column prop="remark" label="备注" min-width="150" show-overflow-tooltip>
              <template slot-scope="scope">
                <i class="el-icon-edit-outline" style="margin-right: 4px; color: #909399;"></i>
                <span>{{ scope.row.remark || '无' }}</span>
              </template>
            </el-table-column>
          </NCC-table>
          <pagination 
            v-show="total > 0" 
            :total="total" 
            :page.sync="listQuery.currentPage"
            :limit.sync="listQuery.pageSize" 
            @pagination="search" 
          />
        </div>
      </div>
    </div>
  </template>
  
  <script>
  import request from '@/utils/request'
  import Pagination from '@/components/Pagination'
  
  export default {
    name: 'BillingItemDetailList',
    components: {
      Pagination
    },
    data() {
      return {
        query: {
1658622a   李宇   ```
286
287
          StartBillingTime: undefined,
          EndBillingTime: undefined,
50f29afc   李宇   build(antis-ncc-a...
288
289
290
291
          activityId: undefined,
          itemId: undefined,
          memberId: undefined,
          itemType: undefined,
262c3578   李宇   ```
292
          SourceType: undefined,
ffd6aaca   李宇   最新
293
294
295
          organizationType: undefined,
          departmentId: undefined,
          storeIds: []
50f29afc   李宇   build(antis-ncc-a...
296
297
298
299
300
301
        },
        activityOptions: [],
        itemOptions: [],
        itemTypeOptions: [],
        memberOptions: [],
        memberLoading: false,
262c3578   李宇   ```
302
        storeOptions: [],
ffd6aaca   李宇   最新
303
        departmentOptions: [],
50f29afc   李宇   build(antis-ncc-a...
304
305
306
307
308
        list: [],
        listLoading: false,
        total: 0,
        listQuery: {
          currentPage: 1,
262c3578   李宇   ```
309
          pageSize: 10
50f29afc   李宇   build(antis-ncc-a...
310
311
312
313
314
315
316
317
318
        }
      }
    },
    created() {
      this.setDefaultTimeRange()
      this.initActivityOptions()
      this.initItemOptions()
      this.initItemTypeOptions()
      this.initMemberOptions()
ffd6aaca   李宇   最新
319
      this.loadAllStores()
50f29afc   李宇   build(antis-ncc-a...
320
321
      this.search()
    },
ffd6aaca   李宇   最新
322
323
324
325
326
327
328
329
    watch: {
      // 监听开始时间变化,重新加载门店列表
      'query.StartBillingTime'() {
        this.$nextTick(() => {
          this.initStoreOptions()
        })
      }
    },
50f29afc   李宇   build(antis-ncc-a...
330
331
332
333
334
335
    methods: {
      // 设置默认时间范围(本月1号到现在)
      setDefaultTimeRange() {
        const now = new Date()
        const firstDayOfMonth = new Date(now.getFullYear(), now.getMonth(), 1)
        
86ade5ce   李宇   报表
336
337
        this.query.StartBillingTime = this.formatDate(firstDayOfMonth)
        this.query.EndBillingTime = this.formatDate(now)
ffd6aaca   李宇   最新
338
339
340
341
342
343
344
        
        // 时间设置后,如果有组织类型和部门,重新加载门店列表
        if (this.query.organizationType && this.query.departmentId) {
          this.$nextTick(() => {
            this.initStoreOptions()
          })
        }
50f29afc   李宇   build(antis-ncc-a...
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
      },
  
      // 初始化开单活动选项
      initActivityOptions() {
        request({
          url: '/api/Extend/lqpackageinfo/GetPackageInfoListAsync',
          method: 'GET',
          data: {
            currentPage: 1,
            pageSize: 1000
          }
        }).then(res => {
          if (res.data && res.data.list) {
            this.activityOptions = res.data.list
          }
        }).catch(() => {
          this.activityOptions = []
        })
      },
  
      // 初始化品项选项
      initItemOptions() {
        request({
          url: '/api/Extend/LqXmzl',
          method: 'GET',
          data: {
            currentPage: 1,
            pageSize: 1000
          }
        }).then(res => {
          if (res.data && res.data.list) {
            this.itemOptions = res.data.list
          }
        }).catch(() => {
          this.itemOptions = []
        })
      },
  
      // 初始化品项类型选项(使用qt2字段数据)
      initItemTypeOptions() {
        request({
          url: '/api/Extend/lqxmzl/GetDistinctFieldData?fieldName=qt2',
          method: 'GET'
        }).then(res => {
          if (res.code == 200 && res.data && res.data.values) {
            this.itemTypeOptions = res.data.values.map(item => ({
              label: item,
              value: item
            }))
          } else {
            this.itemTypeOptions = []
          }
        }).catch(() => {
          this.itemTypeOptions = []
        })
      },
  
      // 初始化会员选项
      initMemberOptions() {
        request({
          url: '/api/Extend/LqKhxx',
          method: 'GET',
          data: {
            currentPage: 1,
            pageSize: 10
          }
        }).then(res => {
          if (res.code == 200 && res.data.list && res.data.list.length > 0) {
            this.memberOptions = res.data.list
          }
        }).catch(() => {
          this.memberOptions = []
        })
      },
  
ffd6aaca   李宇   最新
420
421
      // 加载全部门店(当没有选择部门时)
      loadAllStores() {
262c3578   李宇   ```
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
        request({
          url: '/api/Extend/LqMdxx',
          method: 'GET',
          data: {
            currentPage: 1,
            pageSize: 1000
          }
        }).then(res => {
          if (res.data && res.data.list) {
            this.storeOptions = res.data.list
          }
        }).catch(() => {
          this.storeOptions = []
        })
      },
  
ffd6aaca   李宇   最新
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
      // 获取部门选项(根据组织类型)
      loadDepartmentOptions() {
        if (!this.query.organizationType) {
          this.departmentOptions = []
          return
        }
        
        request({
          url: '/api/Extend/Organize/GetByName',
          method: 'GET',
          data: {
            organizeName: this.query.organizationType
          }
        }).then(res => {
          this.departmentOptions = res.data || []
          // 如果部门ID不在新列表中,清空部门ID
          if (this.query.departmentId) {
            const exists = this.departmentOptions.some(
              dept => (dept.Id || dept.id) === this.query.departmentId
            )
            if (!exists) {
              this.query.departmentId = undefined
              this.query.storeIds = []
              this.storeOptions = []
            }
          }
        }).catch(() => {
          this.departmentOptions = []
        })
      },
  
      // 初始化门店选项(根据组织类型、部门、年月)
      initStoreOptions() {
        // 如果没有选择部门,加载全部门店
        if (!this.query.departmentId) {
          this.loadAllStores()
          return
        }
  
        // 如果缺少必要参数,不加载门店列表
        if (!this.query.organizationType || !this.query.StartBillingTime) {
          this.storeOptions = []
          return
        }
  
        // 从开始时间提取年月(格式:YYYYMM)
        // StartBillingTime 格式为 yyyy-MM-dd
        const dateStr = this.query.StartBillingTime
        if (!dateStr) {
          this.storeOptions = []
          return
        }
        
        // 提取年月,格式:YYYYMM
        const monthStr = dateStr.substring(0, 4) + dateStr.substring(5, 7)
  
        request({
          url: '/api/Extend/lqmdtarget/GetManagedStores',
          method: 'POST',
          data: {
            month: monthStr,
            organizationType: this.query.organizationType,
            departmentId: this.query.departmentId
          }
        }).then(res => {
          if (res.data && Array.isArray(res.data)) {
            // 将返回的数据格式转换为 storeOptions 需要的格式
            // 返回格式: [{ StoreId: "...", StoreName: "..." }]
            // 需要格式: [{ id: "...", dm: "..." }]
            this.storeOptions = res.data.map(store => ({
              id: store.StoreId,
              dm: store.StoreName
            }))
            // 默认选中所有获取到的门店
            this.query.storeIds = this.storeOptions.map(store => store.id)
          } else {
            this.storeOptions = []
            this.query.storeIds = []
          }
        }).catch(err => {
          console.error('获取门店列表失败:', err)
          this.$message({
            type: 'error',
            message: '获取门店列表失败',
            duration: 1500
          })
          this.storeOptions = []
          this.query.storeIds = []
        })
      },
  
      // 处理组织类型变化
      handleOrganizationTypeChange() {
        // 清空部门和门店
        this.query.departmentId = undefined
        this.query.storeIds = []
        // 重新加载部门选项
        this.loadDepartmentOptions()
        // 加载全部门店(因为部门已清空)
        this.loadAllStores()
      },
  
      // 处理部门变化
      handleDepartmentChange() {
        // 清空门店选择
        this.query.storeIds = []
        // 重新加载门店列表(如果有部门则加载部门管理的门店,否则加载全部门店)
        this.initStoreOptions()
      },
  
50f29afc   李宇   build(antis-ncc-a...
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
      // 会员远程搜索
      remoteMemberMethod(query) {
        if (query !== '') {
          this.memberLoading = true
          request({
            url: '/api/Extend/LqKhxx',
            method: 'GET',
            data: {
              currentPage: 1,
              pageSize: 20,
              keyword: query
            }
          }).then(res => {
            this.memberLoading = false
            if (res.code == 200 && res.data.list && res.data.list.length > 0) {
              this.memberOptions = res.data.list
            } else {
              this.memberOptions = []
            }
          }).catch(() => {
            this.memberLoading = false
            this.memberOptions = []
          })
        } else {
          this.memberOptions = []
        }
      },
  
      // 查询数据
      search() {
        this.listLoading = true
  
        const params = {
          currentPage: this.listQuery.currentPage,
          pageSize: this.listQuery.pageSize
        }
  
1658622a   李宇   ```
585
586
        if (this.query.StartBillingTime) {
          params.StartBillingTime = this.query.StartBillingTime
50f29afc   李宇   build(antis-ncc-a...
587
588
        }
  
1658622a   李宇   ```
589
590
        if (this.query.EndBillingTime) {
          params.EndBillingTime = this.query.EndBillingTime
50f29afc   李宇   build(antis-ncc-a...
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
        }
  
        if (this.query.activityId) {
          params.activityId = this.query.activityId
        }
  
        if (this.query.itemId) {
          params.itemId = this.query.itemId
        }
  
        if (this.query.memberId) {
          params.memberId = this.query.memberId
        }
  
        if (this.query.itemType) {
          params.itemType = this.query.itemType
        }
        if (this.query.SourceType) {
          params.SourceType = this.query.SourceType
        }
ffd6aaca   李宇   最新
611
        if (this.query.storeIds && this.query.storeIds.length > 0) {
0a60e4b5   李宇   最新
612
          params.StoreIds = this.query.storeIds.join(',')
262c3578   李宇   ```
613
        }
50f29afc   李宇   build(antis-ncc-a...
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
  
        request({
          url: '/api/Extend/lqkdkdjlb/billing-item-detail-list',
          method: 'GET',
          data: params
        }).then(res => {
          if (res.data && res.data.list) {
            this.list = res.data.list
            this.total = (res.data.pagination && res.data.pagination.total) || res.data.list.length || 0
          } else {
            this.list = []
            this.total = 0
          }
          this.listLoading = false
        }).catch(err => {
          console.error('查询失败:', err)
          this.$message({
            type: 'error',
            message: '查询失败,请重试',
            duration: 1500
          })
          this.listLoading = false
          this.list = []
          this.total = 0
        })
      },
  
      // 重置查询条件
      reset() {
        this.query = {
1658622a   李宇   ```
644
645
          StartBillingTime: undefined,
          EndBillingTime: undefined,
50f29afc   李宇   build(antis-ncc-a...
646
647
648
649
          activityId: undefined,
          itemId: undefined,
          memberId: undefined,
          itemType: undefined,
262c3578   李宇   ```
650
          SourceType: undefined,
ffd6aaca   李宇   最新
651
652
653
          organizationType: undefined,
          departmentId: undefined,
          storeIds: []
50f29afc   李宇   build(antis-ncc-a...
654
655
        }
        this.setDefaultTimeRange()
ffd6aaca   李宇   最新
656
657
658
        this.departmentOptions = []
        // 重置后加载全部门店
        this.loadAllStores()
50f29afc   李宇   build(antis-ncc-a...
659
660
661
662
        this.listQuery.currentPage = 1
        this.listQuery.pageSize = 20
        this.list = []
        this.total = 0
1138c09e   李宇   feat(LqLaundryFlo...
663
        this.search()
50f29afc   李宇   build(antis-ncc-a...
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
      },
  
      // 获取品项类型的标签类型
      getItemTypeTagType(itemType) {
        const typeMap = {
          '购买': 'success',
          '赠送': 'info',
          '体验': 'warning'
        }
        return typeMap[itemType] || ''
      },
  
      // 格式化金额
      formatMoney(amount) {
        if (!amount && amount !== 0) return '0.00'
        return Number(amount).toFixed(2)
      },
  
86ade5ce   李宇   报表
682
683
684
685
686
687
688
689
690
691
692
693
694
695
      // 格式化日期(只到天)
      formatDate(date) {
        if (!date) return ''
        try {
          const d = new Date(date)
          const year = d.getFullYear()
          const month = String(d.getMonth() + 1).padStart(2, '0')
          const day = String(d.getDate()).padStart(2, '0')
          return `${year}-${month}-${day}`
        } catch (e) {
          return ''
        }
      },
  
50f29afc   李宇   build(antis-ncc-a...
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
      // 格式化日期时间
      formatDateTime(dateTime) {
        if (!dateTime) return '无'
        try {
          const date = new Date(dateTime)
          const year = date.getFullYear()
          const month = String(date.getMonth() + 1).padStart(2, '0')
          const day = String(date.getDate()).padStart(2, '0')
          const hours = String(date.getHours()).padStart(2, '0')
          const minutes = String(date.getMinutes()).padStart(2, '0')
          const seconds = String(date.getSeconds()).padStart(2, '0')
          return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
        } catch (e) {
          return dateTime
        }
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .amount-paid {
    color: #67C23A;
    font-weight: 500;
  }
  </style>