8eb72f90
李宇
最新
|
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
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
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
|
queryParams: {
currentPage: 1,
pageSize: 300, // 写死为300
year: getCurrentYear(),
month: getCurrentMonth(), // yyyyMM 格式
storeId: ''
}
}
},
created() {
this.getStoreList()
this.getList()
},
methods: {
// 获取门店列表
async getStoreList() {
try {
const response = await getStoreSelector()
this.storeList = response.data.list || []
} catch (error) {
console.error('获取门店列表失败:', error)
this.storeList = []
}
},
// 获取列表数据
async getList() {
this.loading = true
try {
// 处理年月:从month选择器中提取年份和月份
let year = ''
let month = ''
if (this.queryParams.month && this.queryParams.month.length === 6) {
// yyyyMM 格式,如 202512
year = this.queryParams.month.substring(0, 4)
month = this.queryParams.month.substring(4, 6)
} else if (this.queryParams.year && this.queryParams.month) {
// 分别选择年份和月份
year = this.queryParams.year
month = this.queryParams.month.length === 6
? this.queryParams.month.substring(4, 6)
: this.queryParams.month
} else {
// 使用默认值(当前年月)
const now = new Date()
year = now.getFullYear().toString()
month = String(now.getMonth() + 1).padStart(2, '0')
}
const params = {
currentPage: this.queryParams.currentPage,
pageSize: this.queryParams.pageSize,
Year: year,
Month: month,
StoreId: this.queryParams.storeId || ''
}
const response = await getAssistantSalaryList(params)
if (response.code === 200) {
this.list = response.data.list || []
this.total = (response.data.pagination && response.data.pagination.total) || 0
} else {
this.$message.error(response.msg || '获取数据失败')
}
} catch (error) {
console.error('获取店助工资列表失败:', error)
this.$message.error('获取数据失败'+error)
} finally {
this.loading = false
}
},
// 搜索
handleQuery() {
this.queryParams.currentPage = 1
this.getList()
},
// 重置搜索
resetQuery() {
const getCurrentYear = () => {
return new Date().getFullYear().toString()
}
const getCurrentMonth = () => {
const now = new Date()
const year = now.getFullYear()
const month = String(now.getMonth() + 1).padStart(2, '0')
return `${year}${month}`
}
this.queryParams = {
currentPage: 1,
pageSize: 300, // 写死为300
year: getCurrentYear(),
month: getCurrentMonth(),
storeId: ''
}
this.getList()
},
// 显示计算工资弹窗
showCalculateDialog() {
const getCurrentYear = () => {
return new Date().getFullYear().toString()
}
const getCurrentMonth = () => {
const now = new Date()
const year = now.getFullYear()
const month = String(now.getMonth() + 1).padStart(2, '0')
return `${year}${month}`
}
this.calculateYear = getCurrentYear()
this.calculateMonth = getCurrentMonth()
this.calculateDialogVisible = true
},
// 关闭计算工资弹窗
handleCalculateDialogClose() {
this.calculateDialogVisible = false
},
// 确认计算工资
async handleCalculateConfirm() {
if (!this.calculateYear || !this.calculateMonth) {
this.$message.warning('请选择年份和月份')
return
}
// 从calculateMonth中提取月份(yyyyMM格式,如202512)
const year = this.calculateYear
const month = this.calculateMonth.length === 6
? this.calculateMonth.substring(4, 6)
: this.calculateMonth
this.calculateLoading = true
try {
const response = await calculateAssistantSalary(year, month)
if (response.code === 200) {
this.$message.success('计算工资成功')
this.calculateDialogVisible = false
this.getList()
} else {
this.$message.error(response.msg || '计算工资失败')
}
} catch (error) {
console.error('计算工资失败:', error)
this.$message.error(error.message || '计算工资失败')
} finally {
this.calculateLoading = false
}
},
// 格式化金额
formatMoney(value) {
if (value === null || value === undefined || value === '') {
return '0.00'
}
return Number(value).toFixed(2)
},
// 格式化百分比
formatPercent(value) {
if (value === null || value === undefined || value === '') {
return '0.00%'
}
|
ecbae9ec
李宇
最新
|
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
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
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
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
722
723
|
},
// 查看详情
handleViewDetail(row) {
this.currentDetailData = row
this.detailDialogVisible = true
},
// 关闭详情弹窗
handleDetailDialogClose() {
this.detailDialogVisible = false
this.currentDetailData = null
},
// 导出功能
async handleExport() {
if (!this.list || this.list.length === 0) {
this.$message.warning('暂无数据可导出')
return
}
this.exportLoading = true
try {
// 动态导入 xlsx 库
const XLSX = await import('xlsx')
// 构建表头
const headers = [
'门店名称',
'员工姓名',
'岗位',
'门店总业绩',
'门店开单业绩',
'门店退卡业绩',
'门店生命线',
'业绩完成率',
'提成比例',
'提成金额',
'进店消耗人数',
'第一阶段目标人数',
'第二阶段目标人数',
'是否达到第一阶段',
'是否达到第二阶段',
'阶段奖励金额',
'第一阶段奖励',
'第二阶段奖励',
'底薪金额',
'手机管理费',
'在店天数',
'请假天数',
'应发工资',
'实发工资',
'扣款合计',
'补贴合计',
'发奖金',
'退手机押金',
'退住宿押金',
'补发上月',
'当月是否发放',
'支付金额',
'待支付金额',
'当月支付总额',
'是否新店',
'新店保护阶段'
]
// 构建数据行
const dataRows = this.list.map(item => [
item.StoreName || '无',
item.EmployeeName || '无',
item.Position || '无',
this.formatMoney(item.StoreTotalPerformance),
this.formatMoney(item.StoreBillingPerformance),
this.formatMoney(item.StoreRefundPerformance),
this.formatMoney(item.StoreLifeline),
this.formatPercent(item.PerformanceCompletionRate),
this.formatPercent(item.CommissionRate),
this.formatMoney(item.CommissionAmount),
item.HeadCount || '0',
item.Stage1TargetHeadCount || '0',
item.Stage2TargetHeadCount || '0',
item.ReachedStage1 || '否',
item.ReachedStage2 || '否',
this.formatMoney(item.StageRewardAmount),
this.formatMoney(item.Stage1Reward),
this.formatMoney(item.Stage2Reward),
this.formatMoney(item.BaseSalary),
this.formatMoney(item.PhoneManagementFee),
item.WorkingDays || '0',
item.LeaveDays || '0',
this.formatMoney(item.GrossSalary),
this.formatMoney(item.ActualSalary),
this.formatMoney(item.TotalDeduction),
this.formatMoney(item.TotalSubsidy),
this.formatMoney(item.Bonus),
this.formatMoney(item.ReturnPhoneDeposit),
this.formatMoney(item.ReturnAccommodationDeposit),
this.formatMoney(item.LastMonthSupplement),
item.MonthlyPaymentStatus || '无',
this.formatMoney(item.PaidAmount),
this.formatMoney(item.PendingAmount),
this.formatMoney(item.MonthlyTotalPayment),
item.IsNewStore || '无',
item.NewStoreProtectionStage || '0'
])
// 合并表头和数据
const excelData = [headers, ...dataRows]
// 创建工作表
const ws = XLSX.utils.aoa_to_sheet(excelData)
// 设置列宽
const colWidths = headers.map(() => ({ wch: 15 }))
ws['!cols'] = colWidths
// 创建工作簿
const wb = XLSX.utils.book_new()
XLSX.utils.book_append_sheet(wb, ws, '店助工资')
// 生成文件名
const now = new Date()
const timestamp = now.getFullYear() +
String(now.getMonth() + 1).padStart(2, '0') +
String(now.getDate()).padStart(2, '0') +
String(now.getHours()).padStart(2, '0') +
String(now.getMinutes()).padStart(2, '0') +
String(now.getSeconds()).padStart(2, '0')
const fileName = `店助工资_${timestamp}.xlsx`
// 导出文件
XLSX.writeFile(wb, fileName)
this.$message.success('导出成功')
} catch (error) {
console.error('导出失败:', error)
this.$message.error('导出失败,请重试')
} finally {
this.exportLoading = false
}
|
8eb72f90
李宇
最新
|
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
|
}
}
}
</script>
<style lang="scss" scoped>
.app-container {
padding: 20px;
background: #f5f5f5;
}
.page-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 20px;
padding: 20px;
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
.header-left {
h2 {
margin: 0 0 8px 0;
color: #303133;
font-size: 20px;
font-weight: 600;
}
.page-desc {
margin: 0;
color: #909399;
font-size: 14px;
}
}
.header-right {
display: flex;
gap: 12px;
}
}
.search-container {
margin-bottom: 20px;
padding: 20px;
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.table-container {
margin-bottom: 20px;
padding: 20px;
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.store-name,
.employee-name {
display: flex;
align-items: center;
gap: 6px;
.store-icon,
.employee-icon {
color: #409EFF;
font-size: 16px;
}
}
// 表格样式优化
::v-deep .el-table {
.el-table__header-wrapper {
th {
background-color: #f5f7fa;
color: #606266;
font-weight: 600;
}
}
.el-table__body-wrapper {
.el-table__row {
&:hover {
background-color: #f5f7fa;
}
}
}
}
</style>
|