gaoluyang
2025-08-11 df1992a1c3ca982b1432aaf41668bb8437d02a2d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
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
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
583
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
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
<template>
  <view class="content">
        <view class="header-section">
            <view class="currentFactory">
                <up-text type="primary" :text="userStore.currentFactoryName" @click="show = true" size="18"
                                 class="factoryName" suffixIcon="arrow-right" :iconStyle="iconStyle"></up-text>
            </view>
            <up-picker :show="show" :columns="factoryList" @confirm="changeFactory"></up-picker>
        </view>
        
        <view class="hero-section">
            <view class="bg-img">
                <view class="hero-content">
                    <text class="hero-title">产品库存管理系统</text>
                </view>
            </view>
        </view>
        
        <view class="notice-section">
            <view class="notice">
                <view class="notice-content">
                    <view class="notice-left">
                        <text class="notice-status">📊 实时监控</text>
                    </view>
                    <view class="notice-separator"></view>
                    <view class="notice-right">
                        <text class="notice-label">{{currentStatus}}</text>
                        <text class="notice-text">当日销售设备数:<text class="notice-number">{{number}}<text class="notice-unit">个</text></text></text>
                    </view>
                </view>
            </view>
        </view>
        
        <!-- 营销管理模块 -->
        <view class="common-module marketing-module">
            <view class="module-header">
                <view class="module-title-container">
                    <text class="module-title">营销管理</text>
                </view>
            </view>
            <view class="module-content">
                <up-grid
                    :border="false"
                    col="4"
                >
                    <up-grid-item
                        v-for="(item, index) in marketingItems"
                        :key="index"
                        @click="handleCommonItemClick(item)"
                    >
                        <view class="icon-container" :style="{ background: item.bgColor }">
                            <up-icon
                                :name="item.icon"
                                :size="26"
                                color="#ffffff"
                            ></up-icon>
                        </view>
                        <text class="item-label">{{item.label}}</text>
                    </up-grid-item>
                </up-grid>
            </view>
        </view>
        
        <!-- 采购管理模块 -->
        <view class="common-module purchase-module">
            <view class="module-header">
                <view class="module-title-container">
                    <text class="module-title">采购管理</text>
                </view>
            </view>
            <view class="module-content">
                <up-grid
                    :border="false"
                    col="4"
                >
                    <up-grid-item
                        v-for="(item, index) in purchaseItems"
                        :key="index"
                        @click="handleCommonItemClick(item)"
                    >
                        <view class="icon-container" :style="{ background: item.bgColor }">
                            <up-icon
                                :name="item.icon"
                                :size="26"
                                color="#ffffff"
                            ></up-icon>
                        </view>
                        <text class="item-label">{{item.label}}</text>
                    </up-grid-item>
                </up-grid>
            </view>
        </view>
        
        <!-- 协同办公模块 -->
        <view class="common-module collaboration-module">
            <view class="module-header">
                <view class="module-title-container">
                    <text class="module-title">协同办公</text>
                </view>
            </view>
            <view class="module-content">
                <up-grid
                    :border="false"
                    col="4"
                >
                    <up-grid-item
                        v-for="(item, index) in collaborationItems"
                        :key="index"
                        @click="handleCommonItemClick(item)"
                    >
                        <view class="icon-container" :style="{ background: item.bgColor }">
                            <up-icon
                                :name="item.icon"
                                :size="26"
                                color="#ffffff"
                            ></up-icon>
                        </view>
                        <text class="item-label">{{item.label}}</text>
                    </up-grid-item>
                </up-grid>
            </view>
        </view>
        
        <!-- 设备管理模块 -->
        <view class="common-module equipment-module">
            <view class="module-header">
                <view class="module-title-container">
                    <text class="module-title">设备管理</text>
                </view>
            </view>
            <view class="module-content">
                <up-grid
                    :border="false"
                    col="4"
                >
                    <up-grid-item
                        v-for="(item, index) in equipmentItems"
                        :key="index"
                        @click="handleCommonItemClick(item)"
                    >
                        <view class="icon-container" :style="{ background: item.bgColor }">
                            <up-icon
                                :name="item.icon"
                                :size="26"
                                color="#ffffff"
                            ></up-icon>
                        </view>
                        <text class="item-label">{{item.label}}</text>
                    </up-grid-item>
                </up-grid>
            </view>
        </view>
  </view>
</template>
 
<script setup>
import {ref, onMounted, nextTick, reactive} from 'vue';
import {userLoginFacotryList} from "@/api/login";
import modal from "@/plugins/modal";
import useUserStore from "@/store/modules/user";
 
const userStore = useUserStore()
const factoryId = ref('');
const show = ref(false);
const factoryList = ref([]);
const factoryListTem = ref([]);
const iconStyle = {
    fontSize: '18px',
    color: '#2979ff'
}
 
// 通知状态切换
const statusList = ['销售', '采购']
let statusIndex = 0
const currentStatus = ref(statusList[0])
const number = ref(7643)
 
// 定时器切换通知状态
const startStatusTimer = () => {
    setInterval(() => {
        statusIndex = (statusIndex + 1) % statusList.length
        currentStatus.value = statusList[statusIndex]
    }, 3000)
}
 
// 营销管理功能数据
const marketingItems = reactive([
    {
        icon: 'account',
        label: '销售台账',
        bgColor: '#2979ff'
    },
    {
        icon: 'home',
        label: '开票登记',
        bgColor: '#1976d2'
    },
    {
        icon: 'file-text',
        label: '开票台账',
        bgColor: '#42a5f5'
    },
    {
        icon: 'shopping-cart',
        label: '回款登记',
        bgColor: '#64b5f6'
    },
    {
        icon: 'chat',
        label: '回款流水',
        bgColor: '#90caf9'
    },
    {
        icon: 'chat',
        label: '客户往来',
        bgColor: '#90caf9'
    }
]);
 
// 采购管理功能数据
const purchaseItems = reactive([
    {
        icon: 'order',
        label: '采购台账',
        bgColor: '#bbdefb'
    },
    {
        icon: 'truck',
        label: '来票登记',
        bgColor: '#e3f2fd'
    },
    {
        icon: 'box',
        label: '来票台账',
        bgColor: '#f3e5f5'
    },
    {
        icon: 'chart-line',
        label: '付款登记',
        bgColor: '#e8eaf6'
    },
    {
        icon: 'settings',
        label: '付款流水',
        bgColor: '#f1f8e9'
    },
    {
        icon: 'settings',
        label: '供应商往来',
        bgColor: '#f1f8e9'
    },
]);
 
// 协同办公功能数据
const collaborationItems = reactive([
    {
        icon: 'checkmark-circle',
        label: '协同审批',
        bgColor: '#4caf50'
    },
    {
        icon: 'map-pin',
        label: '客户拜访',
        bgColor: '#ff9800'
    }
]);
 
// 设备管理功能数据
const equipmentItems = reactive([
    {
        icon: 'list',
        label: '设备台账',
        bgColor: '#9c27b0'
    },
    {
        icon: 'wrench',
        label: '设备报修',
        bgColor: '#f44336'
    },
    {
        icon: 'shield-check',
        label: '设备保养',
        bgColor: '#00bcd4'
    }
]);
 
// 处理常用功能点击
const handleCommonItemClick = (item) => {
    // 根据不同的功能项进行跳转
    switch (item.label) {
        case '销售台账':
            uni.navigateTo({
                url: '/pages/sales/salesAccount/index'
            });
            break;
        default:
            uni.showToast({
                title: `点击了${item.label}`,
                icon: 'none'
            });
    }
};
 
// 创建对子组件的引用
const uToastRef = ref(null);
 
function getUserLoginFacotryList() {
    userLoginFacotryList({userName: userStore.nickName}).then(res => {
        // 检查res.data是否为数组
        factoryList.value[0] = []
        if (res.data && Array.isArray(res.data)) {
            factoryListTem.value = res.data
            res.data.forEach(item => {
                factoryList.value[0].push(item.deptName)
            })
            factoryId.value = userStore.currentDeptId
        } else {
            // 如果res.data不是数组,设置为空数组
            factoryList.value = []
        }
    }).catch(error => {
        modal.msgError('获取公司列表失败:', error)
        factoryList.value = []
    })
}
const changeFactory = async (arr) => {
    show.value = false;
    const factoryId = factoryListTem.value[arr.indexs[0]].deptId
    const loginForm = {
        username: userStore.name,
        password: uni.getStorageSync('remembered_password'),
        factoryId: factoryId,
    }
    modal.loading("刷新中,请耐心等待...")
    userStore.loginCheckFactory(loginForm).then(() => {
        modal.closeLoading()
        nextTick(() => {
            loginSuccess()
        });
    }).catch(() => {
        modal.closeLoading()
    })
}
function loginSuccess(result) {
    uni.reLaunch({
        url: '/pages/index'
    });
}
 
// 定义方法
const click = (name) => {
    if (uToastRef.value) {
        uToastRef.value.success(`点击了第${name + 1}个`); // 注意:这里加1是因为通常我们是从第1个开始计数的
    }
};
 
onMounted(() => {
    // 设置用户信息
    userStore.getInfo()
    getUserLoginFacotryList()
    // 启动通知状态定时器
    startStatusTimer()
});
</script>
 
<style scoped lang="scss">
.content {
    background: linear-gradient(135deg, #f8f9fa 0%, #e3f2fd 100%);
    min-height: 100vh;
    padding: 20px;
    padding-top: env(safe-area-inset-top);
    position: relative;
    
    &::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="dots" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="rgba(41, 121, 255, 0.03)"/></pattern></defs><rect width="100" height="100" fill="url(%23dots)"/></svg>');
        pointer-events: none;
        z-index: -1;
    }
    
    &::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: radial-gradient(circle at 20% 80%, rgba(41, 121, 255, 0.02) 0%, transparent 50%),
                    radial-gradient(circle at 80% 20%, rgba(156, 39, 176, 0.02) 0%, transparent 50%);
        pointer-events: none;
        z-index: -1;
    }
}
 
/* 本页不再定义 .safe-area-top,已移至全局样式 */
 
.header-section {
    margin-bottom: 16px;
    animation: fadeInDown 0.6s ease-out;
}
 
.currentFactory {
    margin-top: 8px;
    margin-left: 4px;
    font-weight: 500;
    display: flex;
}
 
.factoryName {
    width: auto;
}
 
:deep(.u-text) {
    align-items: center;
}
 
.hero-section {
    margin-bottom: 16px;
    animation: fadeInUp 0.6s ease-out 0.1s both;
}
 
.bg-img {
    width: 100%;
    height: 120px;
    background: linear-gradient(135deg, #2979ff 0%, #1565c0 100%);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(41, 121, 255, 0.15);
    
    &::before {
        content: '';
        position: absolute;
        top: -50%;
        left: -50%;
        width: 200%;
        height: 200%;
        background: conic-gradient(from 0deg, transparent, rgba(255,255,255,0.1), transparent, rgba(255,255,255,0.05), transparent);
        animation: rotate 20s linear infinite;
    }
    
    &::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        width: 120px;
        height: 120px;
        background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
        border-radius: 50%;
        transform: translate(40px, -40px);
    }
}
 
.hero-content {
    position: relative;
    z-index: 1;
    padding: 20px;
    height: 100%;
    display: flex;
    align-items: center;
}
 
.hero-title {
    color: #ffffff;
    font-size: 24px;
    font-weight: 600;
}
 
 
 
.notice-section {
    margin-bottom: 16px;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}
 
.notice {
    width: 100%;
    background: linear-gradient(135deg, #EAF2FF 0%, #BBDEFB 100%);
    border: 1px solid #e3f2fd;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(41, 121, 255, 0.08);
    position: relative;
    overflow: hidden;
    
    &::before {
        content: '';
        position: absolute;
        top: -50%;
        left: -50%;
        width: 200%;
        height: 200%;
        background: linear-gradient(45deg, transparent, rgba(255,255,255,0.6), transparent);
        animation: shine 4s infinite;
    }
    
    &::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        width: 80px;
        height: 80px;
        background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
        border-radius: 50%;
        transform: translate(30px, -30px);
    }
}
 
 
 
@keyframes shine {
    0% { 
        transform: translateX(-100%) translateY(-100%) rotate(45deg); 
    }
    100% { 
        transform: translateX(100%) translateY(100%) rotate(45deg); 
    }
}
 
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
 
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
 
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
 
.notice-content {
    display: flex;
    align-items: center;
    height: 100%;
    position: relative;
    z-index: 1;
}
 
.notice-left {
    margin-right: 16px;
}
 
.notice-status {
    font-weight: 600;
    font-size: 16px;
    color: #1976d2;
}
 
.notice-separator {
    width: 1px;
    height: 24px;
    background: #e0e0e0;
    margin-right: 16px;
}
 
.notice-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
}
 
.notice-label {
    color: #1976d2;
    font-size: 14px;
    font-weight: 500;
    margin-right: 12px;
}
 
.notice-text {
    font-weight: 400;
    font-size: 14px;
    color: #666666;
}
 
.notice-number {
    font-weight: 600;
    font-size: 16px;
    color: #1976d2;
    margin-left: 4px;
}
 
.notice-unit {
    color: #666666;
    font-size: 14px;
    margin-left: 2px;
}
 
/* 功能模块样式 */
.common-module {
    margin-bottom: 24px;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    border: none;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    
    &::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        width: 60px;
        height: 60px;
        background: radial-gradient(circle, rgba(0,0,0,0.02) 0%, transparent 70%);
        border-radius: 50%;
        transform: translate(30px, -30px);
    }
    
    &:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
        
        &::after {
            background: radial-gradient(circle, rgba(0,0,0,0.04) 0%, transparent 70%);
        }
    }
}
 
.marketing-module {
    --module-color: #2979ff;
}
 
.purchase-module {
    --module-color: #1976d2;
}
 
.collaboration-module {
    --module-color: #4caf50;
}
 
.equipment-module {
    --module-color: #9c27b0;
}
 
.module-header {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
 
.module-title-container {
    display: flex;
    align-items: center;
}
 
.module-title {
    color: #333333;
    font-size: 18px;
    font-weight: 600;
    position: relative;
    
    &::after {
        content: '';
        position: absolute;
        bottom: -4px;
        left: 0;
        width: 100%;
        height: 2px;
        background: linear-gradient(90deg, var(--module-color), rgba(255,255,255,0.9));
        border-radius: 1px;
        transition: all 0.3s ease;
        box-shadow: 0 0 8px rgba(0,0,0,0.1);
    }
    
    &:hover::after {
        width: 30px;
        box-shadow: 0 0 12px rgba(0,0,0,0.15);
    }
}
 
.module-subtitle {
    color: #666666;
    font-size: 12px;
    font-weight: 400;
    margin-left: 8px;
}
 
.module-content {
    width: 100%;
    display: grid;
    gap: 16px;
}
 
.icon-container {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    
    &::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%, rgba(255,255,255,0.05) 100%);
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    &::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 12px;
        background: linear-gradient(45deg, transparent, rgba(255,255,255,0.2), transparent);
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    &:hover {
        transform: translateY(-3px) scale(1.02);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.18);
        
        &::before,
        &::after {
            opacity: 1;
        }
    }
}
 
.item-label {
    font-size: 13px;
    color: #555555;
    text-align: center;
    display: block;
    line-height: 1.4;
    font-weight: 500;
    margin-top: 4px;
    margin-bottom: 10px;
}
 
.grid-text {
    font-size: 14px;
    color: #909399;
    padding: 10rpx 0 20rpx 0rpx;
    /* #ifndef APP-PLUS */
    box-sizing: border-box;
    /* #endif */
}
 
 
</style>