WXL
2 天以前 c80bc467a41daa6cbae4e5515a300a8ca98cfeaa
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
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
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
<template>
  <view class="case-report-container">
    <view class="form-content">
      <view class="page-header">
        <text class="page-title">{{
          isEditMode ? "修改案例" : "上报案例"
        }}</text>
      </view>
 
      <!-- 案例基本信息卡片 -->
      <view class="form-section">
        <view class="section-header">
          <view class="section-icon">📋</view>
          <text class="section-title">案例基本信息</text>
        </view>
        <view class="form-grid">
          <view class="form-item">
            <text class="item-label">案例编号</text>
            <u-input
              v-model="form.caseNo"
              placeholder="系统自动生成"
              disabled
              :disabledColor="disabledColor"
            />
          </view>
          <view class="form-item">
            <text class="item-label">上报医院</text>
            <u-input
              v-model="form.toHospital"
              placeholder="请输入上报医院"
              maxlength="100"
            />
          </view>
          <view class="form-item">
            <text class="item-label">科室名称</text>
            <u-input
              v-model="form.deptName"
              placeholder="请输入上报科室"
              maxlength="50"
            />
          </view>
          <view class="form-item">
            <text class="item-label required">患者姓名</text>
            <u-input
              type="text"
              v-model="form.name"
              placeholder="请输入姓名"
              maxlength="20"
            />
          </view>
        </view>
      </view>
 
      <!-- 个人信息卡片(捐献人信息) -->
      <view class="form-section">
        <view class="section-header">
          <view class="section-icon">👤</view>
          <text class="section-title">个人信息</text>
        </view>
        <view class="form-grid">
          <view class="form-item">
            <text class="item-label">民族</text>
            <picker
              mode="selector"
              :range="nationList"
              :value="nationIndex"
              @change="onNationChange"
            >
              <view class="picker">
                <text>{{ currentNationText || "请选择民族" }}</text>
                <text class="icon-arrow">›</text>
              </view>
            </picker>
          </view>
          <view class="form-item">
            <text class="item-label">国籍</text>
            <u-input
              type="text"
              v-model="form.nationality"
              placeholder="请输入国籍"
            />
          </view>
          <view class="form-item">
            <text class="item-label">证件类型</text>
            <picker
              mode="selector"
              :range="idCardTypeList"
              :value="idCardTypeIndex"
              @change="onIdCardTypeChange"
            >
              <view class="picker">
                <text>{{ currentIdCardTypeText || "请选择证件类型" }}</text>
                <text class="icon-arrow">›</text>
              </view>
            </picker>
          </view>
          <view class="form-item">
            <text class="item-label">证件号码</text>
            <u-input
              type="idcard"
              v-model="form.idcardno"
              placeholder="请输入证件号码"
              maxlength="18"
              @blur="onIdCardChange"
            />
            <text class="error-text" v-if="idCardError">{{ idCardError }}</text>
          </view>
          <view class="form-item">
            <text class="item-label">性别</text>
            <view class="radio-options">
              <view
                v-for="gender in genderOptions"
                :key="gender.value"
                class="option-item"
                :class="{ active: form.sex == gender.value }"
                @click="form.sex = gender.value"
              >
                <text class="radio-dot"></text>
                <text class="option-label">{{ gender.label }}</text>
              </view>
            </view>
          </view>
          <view class="form-item">
            <text class="item-label">出生日期</text>
            <picker
              mode="date"
              :value="form.birthday"
              @change="onBirthdayChange"
            >
              <view class="picker">
                <text>{{ form.birthday || "选择出生日期" }}</text>
                <text class="icon-arrow">›</text>
              </view>
            </picker>
          </view>
          <!-- ===== 修改:年龄改为可手动输入 + 单位选择 ===== -->
          <view class="form-item">
            <text class="item-label">年龄</text>
            <view style="display: flex; gap: 10rpx; align-items: center">
              <u-input
                v-model="form.age"
                placeholder="输入或自动计算"
                type="number"
                style="flex: 1"
              />
              <picker
                mode="selector"
                :range="ageUnitList"
                :value="ageUnitIndex"
                @change="onAgeUnitChange"
                style="flex: 0 0 160rpx"
              >
                <view
                  class="picker"
                  style="
                    height: 86rpx;
                    background: #fafafa;
                    border-radius: 12rpx;
                    padding: 0 16rpx;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                    border: 2rpx solid #e5e5e7;
                  "
                >
                  <text>{{ currentAgeUnitText || "单位" }}</text>
                  <text class="icon-arrow">›</text>
                </view>
              </picker>
            </view>
          </view>
          <!-- ===== 修改结束 ===== -->
          <view class="form-item">
            <text class="item-label">联系电话</text>
            <u-input
              v-model="form.phone"
              placeholder="请输入联系电话"
              type="number"
            />
          </view>
          <view class="form-item">
            <text class="item-label">学历</text>
            <picker
              mode="selector"
              :range="educationList"
              :value="educationIndex"
              @change="onEducationChange"
            >
              <view class="picker">
                <text>{{ currentEducationText || "请选择学历" }}</text>
                <text class="icon-arrow">›</text>
              </view>
            </picker>
          </view>
          <view class="form-item">
            <text class="item-label">职业</text>
            <picker
              mode="selector"
              :range="occupationList"
              :value="occupationIndex"
              @change="onOccupationChange"
            >
              <view class="picker">
                <text>{{ currentOccupationText || "请选择职业" }}</text>
                <text class="icon-arrow">›</text>
              </view>
            </picker>
          </view>
          <view class="form-item">
            <text class="item-label">籍贯</text>
            <u-input v-model="form.nativeplace" placeholder="请输入籍贯" />
          </view>
        </view>
      </view>
 
      <!-- 地址信息卡片 -->
      <view class="form-section">
        <view class="section-header">
          <view class="section-icon">📍</view>
          <text class="section-title">地址信息</text>
        </view>
 
        <view class="address-block">
          <text class="address-label">现住地址</text>
          <area-select v-model="residenceAddress" @change="onResidenceChange" />
          <u-input
            class="address-detail-input"
            v-model="form.residenceaddress"
            placeholder="请输入详细地址"
            border="none"
          />
        </view>
 
        <view class="address-block">
          <text class="address-label">户籍地址</text>
          <area-select v-model="registerAddress" @change="onRegisterChange" />
          <u-input
            class="address-detail-input"
            v-model="form.registeraddress"
            placeholder="请输入详细地址"
            border="none"
          />
        </view>
      </view>
 
      <!-- 医疗信息卡片 -->
      <view class="form-section">
        <view class="section-header">
          <view class="section-icon">🏥</view>
          <text class="section-title">医疗信息</text>
        </view>
        <view class="form-grid">
          <view class="form-item">
            <text class="item-label">住院号</text>
            <u-input v-model="form.inpatientno" placeholder="请输入住院号" />
          </view>
          <view class="form-item">
            <text class="item-label">GCS评分</text>
            <u-input
              v-model="form.gcsScore"
              type="number"
              maxlength="1"
              placeholder="≤7"
              @blur="handleGcsBlur"
            />
          </view>
          <view class="form-item full-width">
            <text class="item-label required">疾病诊断</text>
            <u-textarea
              v-model="form.diagnosisname"
              placeholder="请输入疾病诊断名称"
              count
              maxlength="200"
            />
          </view>
          <view class="form-item">
            <text class="item-label">血型</text>
            <view class="radio-group horizontal">
              <view
                v-for="bloodType in bloodTypeOptions"
                :key="bloodType.value"
                class="radio-item"
                @click="form.bloodType = bloodType.value"
              >
                <view
                  class="radio-dot"
                  :class="{ active: form.bloodType == bloodType.value }"
                ></view>
                <text class="radio-label">{{ bloodType.label }}</text>
              </view>
            </view>
          </view>
          <view class="form-item">
            <text class="item-label">Rh(D)</text>
            <view class="radio-group horizontal">
              <view
                v-for="rh in rhOptions"
                :key="rh.value"
                class="radio-item"
                @click="form.rhYin = rh.value"
              >
                <view
                  class="radio-dot"
                  :class="{ active: form.rhYin == rh.value }"
                ></view>
                <text class="radio-label">{{ rh.label }}</text>
              </view>
            </view>
          </view>
          <view class="form-item full-width">
            <text class="item-label">传染病</text>
            <view class="checkbox-group single-line">
              <view
                v-for="disease in infectiousList"
                :key="disease.value"
                class="checkbox-item"
                :class="{ active: isInfectiousSelected(disease.value) }"
                @click="toggleInfectious(disease.value)"
              >
                <view
                  class="checkbox-box"
                  :class="{ active: isInfectiousSelected(disease.value) }"
                >
                  <text
                    v-if="isInfectiousSelected(disease.value)"
                    class="checkbox-check"
                    >✓</text
                  >
                </view>
                <text class="checkbox-label">{{ disease.label }}</text>
              </view>
            </view>
          </view>
          <view class="form-item full-width">
            <text class="item-label">其他</text>
            <u-input
              v-model="form.infectiousOther"
              placeholder="请输入其他传染病"
            />
          </view>
        </view>
      </view>
 
      <!-- 联系信息卡片 -->
      <view class="form-section">
        <view class="section-header">
          <view class="section-icon">📞</view>
          <text class="section-title">联系信息</text>
        </view>
        <view class="form-grid">
          <!-- <view class="form-item">
            <text class="item-label">ICU评估医生</text>
            <u-input v-model="form.icuDoctor" placeholder="请输入ICU评估医生" />
          </view>
          <view class="form-item">
            <text class="item-label">ICU医生电话</text>
            <u-input v-model="form.icuDoctorPhone" placeholder="请输入ICU医生电话" type="number" />
          </view> -->
          <view class="form-item">
            <text class="item-label">上报信息员</text>
            <u-input v-model="form.infoName" placeholder="请输入信息员" />
          </view>
          <!-- ===== 修改:报告时间改为可手动选择 ===== -->
          <view class="form-item">
            <text class="item-label">报告时间</text>
            <view
              class="picker"
              @click="showReportTimePicker = true"
              style="
                height: 86rpx;
                background: #fafafa;
                border-radius: 12rpx;
                padding: 0 24rpx;
                display: flex;
                align-items: center;
                justify-content: space-between;
                border: 2rpx solid #e5e5e7;
              "
            >
              <text>{{ form.reporttime || "选择报告时间" }}</text>
              <text class="icon-arrow">›</text>
            </view>
            <u-datetime-picker
              :show="showReportTimePicker"
              v-model="reportTimeValue"
              mode="datetime"
              @confirm="onReportTimeConfirm"
              @cancel="showReportTimePicker = false"
              title="选择报告时间"
            />
          </view>
          <!-- ===== 修改结束 ===== -->
        </view>
      </view>
 
      <!-- 附件上传组件(假设已实现) -->
      <attachment-upload
        ref="attachment"
        :files="attachments"
        :readonly="isReadonly"
        :maxCount="5"
        @update:files="handleFilesUpdate"
        @upload-base="handleBaseUpload"
        @preview="handlePreview"
      />
 
      <!-- 操作按钮 -->
      <view class="action-buttons">
        <u-button class="btn secondary" @click="handleCancel">取消</u-button>
        <u-button class="btn secondary" @click="resetForm">重置表单</u-button>
        <u-button
          class="btn primary"
          :disabled="!isFormValid || loading"
          @click="handleSubmit"
        >
          {{ loading ? "提交中..." : isEditMode ? "保存修改" : "提交上报" }}
        </u-button>
      </view>
    </view>
  </view>
</template>
 
<script setup>
import { ref, computed, onMounted, watch } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import attachmentUpload from "@/components/attachment"; // 根据实际路径调整
import AreaSelect from "@/components/AreaSelect"; // 引入省市区组件
import { useUserStore } from "@/stores/user";
import { useDictMapper } from "@/utils/useDictMapper";
 
// ==================== 字典数据 ====================
const requiredDictTypes = [
  "sys_IDType",
  "sys_user_sex",
  "sys_Nation",
  "sys_BloodType",
  "sys_Infectious",
  "sys_AgeUnit", // 年龄单位(已存在)
  "sys_education",
  "sys_occupation",
];
 
const { dictData, loading: dictLoading } = useDictMapper(requiredDictTypes);
const getDictList = (dictType) => dictData.value[dictType] || [];
 
const nationList = computed(() =>
  getDictList("sys_Nation").map((item) => item.label),
);
const idCardTypeList = computed(() =>
  getDictList("sys_IDType").map((item) => item.label),
);
const infectiousList = computed(() => getDictList("sys_Infectious"));
const educationList = computed(() =>
  getDictList("sys_education").map((item) => item.label),
);
const occupationList = computed(() =>
  getDictList("sys_occupation").map((item) => item.label),
);
// 年龄单位列表
const ageUnitList = computed(() =>
  getDictList("sys_AgeUnit").map((item) => item.label),
);
 
// ==================== 状态管理 ====================
const userStore = useUserStore();
const isEditMode = ref(false);
const currentId = ref(null);
const selectedInfectious = ref([]);
const loading = ref(false);
const currentTime = ref("");
const disabledColor = ref("#f5f5f7");
const isReadonly = ref(false);
const showDatePicker = ref(false);
const birthdayValue = ref(0);
const nationIndex = ref(-1);
const idCardTypeIndex = ref(-1);
const educationIndex = ref(-1);
const occupationIndex = ref(-1);
const idCardError = ref("");
const attachments = ref([]);
 
// 年龄单位索引
const ageUnitIndex = ref(-1);
 
// 报告时间选择器
const showReportTimePicker = ref(false);
const reportTimeValue = ref(Date.now());
 
// 地址数据
const residenceAddress = ref({ sheng: "", shi: "", qu: "" });
const registerAddress = ref({ sheng: "", shi: "", qu: "" });
 
// ==================== 表单数据 ====================
const form = ref({
  caseNo: "",
  treatmenthospitalname: "",
  toHospital: "",
  coordinatorName: "",
  coordinatorNo: "",
  treatmentdeptname: "",
  deptName: "",
  name: "",
  nation: "",
  nationality: "中国",
  idcardtype: "",
  idcardno: "",
  rhYin: "1",
  sex: "",
  birthday: "",
  age: "",
  ageunit: "",
  inpatientno: "",
  gcsScore: "",
  diagnosisname: "",
  bloodType: "",
  infoName: "",
  phone: "",
  icuDoctor: "",
  icuDoctorPhone: "",
  reportername: "",
  reporterno: "",
  reporterphone: "",
  reporttime: "",
  contactperson: "",
  education: "",
  illnessoverview: "",
  infectious: "",
  infectiousOther: "",
  isTransport: "",
  nativeplace: "",
  occupation: "",
  patientstate: "",
  registeraddress: "",
  registerprovince: "",
  registerprovincename: "",
  registercityname: "",
  registertownname: "",
  registercommunityname: "",
  residenceaddress: "",
  residenceprovince: "",
  residenceprovincename: "",
  residencecountycode: "",
  residencecountyname: "",
  residencetownname: "",
  residencecommunity: "",
  residencecommunityname: "",
  remark: "",
  reportStatus: "1",
  terminationCase: 0,
  annexfilesList: [],
});
 
// ==================== 选项数据 ====================
const genderOptions = computed(() => {
  const sexDict = getDictList("sys_user_sex");
  if (sexDict.length)
    return sexDict.map((item) => ({ label: item.label, value: item.value }));
  return [
    { label: "男", value: "1" },
    { label: "女", value: "2" },
  ];
});
 
const bloodTypeOptions = [
  { label: "A型", value: "A型" },
  { label: "B型", value: "B型" },
  { label: "O型", value: "O型" },
  { label: "AB型", value: "AB型" },
];
 
const rhOptions = [
  { label: "阳性", value: "1" },
  { label: "阴性", value: "0" },
];
 
// ==================== 计算属性 ====================
const isFormValid = computed(
  () => form.value.name && form.value.diagnosisname && form.value.toHospital,
);
 
// 年龄显示(用于回显单位文本)
const currentAgeUnitText = computed(() => {
  if (ageUnitIndex.value >= 0 && ageUnitList.value[ageUnitIndex.value]) {
    return ageUnitList.value[ageUnitIndex.value];
  }
  if (form.value.ageunit) {
    const found = getDictList("sys_AgeUnit").find(
      (item) => item.value === form.value.ageunit,
    );
    return found ? found.label : form.value.ageunit;
  }
  return "";
});
 
const currentNationText = computed(() => {
  if (nationIndex.value >= 0 && nationList.value[nationIndex.value])
    return nationList.value[nationIndex.value];
  return form.value.nation || "";
});
 
const currentIdCardTypeText = computed(() => {
  if (idCardTypeIndex.value >= 0 && idCardTypeList.value[idCardTypeIndex.value])
    return idCardTypeList.value[idCardTypeIndex.value];
  if (form.value.idcardtype) {
    const found = getDictList("sys_IDType").find(
      (item) => item.value == form.value.idcardtype,
    );
    return found ? found.label : form.value.idcardtype;
  }
  return "";
});
 
const currentEducationText = computed(() => {
  if (educationIndex.value >= 0 && educationList.value[educationIndex.value])
    return educationList.value[educationIndex.value];
  if (form.value.education) {
    const found = getDictList("sys_education").find(
      (item) => item.value == form.value.education,
    );
    return found ? found.label : form.value.education;
  }
  return "";
});
 
const currentOccupationText = computed(() => {
  if (occupationIndex.value >= 0 && occupationList.value[occupationIndex.value])
    return occupationList.value[occupationIndex.value];
  if (form.value.occupation) {
    const found = getDictList("sys_occupation").find(
      (item) => item.value == form.value.occupation,
    );
    return found ? found.label : form.value.occupation;
  }
  return "";
});
 
// ==================== 方法 ====================
const updateCurrentTime = () => {
  const now = new Date();
  const year = now.getFullYear();
  const month = String(now.getMonth() + 1).padStart(2, "0");
  const day = String(now.getDate()).padStart(2, "0");
  const hours = String(now.getHours()).padStart(2, "0");
  const minutes = String(now.getMinutes()).padStart(2, "0");
  const seconds = String(now.getSeconds()).padStart(2, "0");
  const timeStr = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  currentTime.value = timeStr;
  // 如果报告时间尚未手动设置(或为空),则自动填入当前时间
  if (!form.value.reporttime) {
    form.value.reporttime = timeStr;
  }
};
 
const generateCaseNo = () => {
  // 优先使用上报时间,如果没有则使用当前时间
  const timeStr = form.value.reporttime || currentTime.value;
 
  // 解析时间字符串
  let year, month, day, hours, minutes;
 
  if (timeStr) {
    // 格式:2026-07-15 14:30:00
    const parts = timeStr.split(" ");
    if (parts.length >= 2) {
      const dateParts = parts[0].split("-");
      const timeParts = parts[1].split(":");
      year = dateParts[0];
      month = dateParts[1];
      day = dateParts[2];
      hours = timeParts[0];
      minutes = timeParts[1];
    } else {
      // 只有日期没有时间
      const dateParts = timeStr.split("-");
      year = dateParts[0];
      month = dateParts[1];
      day = dateParts[2];
      hours = "00";
      minutes = "00";
    }
  } else {
    // 没有上报时间,使用当前时间
    const now = new Date();
    year = now.getFullYear().toString();
    month = String(now.getMonth() + 1).padStart(2, "0");
    day = String(now.getDate()).padStart(2, "0");
    hours = String(now.getHours()).padStart(2, "0");
    minutes = String(now.getMinutes()).padStart(2, "0");
  }
 
  // 格式:opo202607151430
  form.value.caseNo = `${year}${month}${day}${hours}${minutes}`;
};
 
// 民族选择
const onNationChange = (e) => {
  const index = parseInt(e.detail.value);
  nationIndex.value = index;
  form.value.nation = nationList.value[index];
};
 
// 证件类型选择
const onIdCardTypeChange = (e) => {
  const index = parseInt(e.detail.value);
  idCardTypeIndex.value = index;
  const selectedLabel = idCardTypeList.value[index];
  const dictItem = getDictList("sys_IDType").find(
    (item) => item.label == selectedLabel,
  );
  form.value.idcardtype = dictItem ? dictItem.value : selectedLabel;
};
 
// 学历选择
const onEducationChange = (e) => {
  const index = parseInt(e.detail.value);
  educationIndex.value = index;
  const selectedLabel = educationList.value[index];
  const dictItem = getDictList("sys_education").find(
    (item) => item.label == selectedLabel,
  );
  form.value.education = dictItem ? dictItem.value : selectedLabel;
};
 
// 职业选择
const onOccupationChange = (e) => {
  const index = parseInt(e.detail.value);
  occupationIndex.value = index;
  const selectedLabel = occupationList.value[index];
  const dictItem = getDictList("sys_occupation").find(
    (item) => item.label == selectedLabel,
  );
  form.value.occupation = dictItem ? dictItem.value : selectedLabel;
};
 
// 年龄单位选择
const onAgeUnitChange = (e) => {
  const index = parseInt(e.detail.value);
  ageUnitIndex.value = index;
  const selectedLabel = ageUnitList.value[index];
  const dictItem = getDictList("sys_AgeUnit").find(
    (item) => item.label === selectedLabel,
  );
  form.value.ageunit = dictItem ? dictItem.value : selectedLabel;
};
 
// 出生日期
const onBirthdayChange = (e) => {
  form.value.birthday = e.detail.value;
  calculateAge();
};
 
const onDateConfirm = (e) => {
  const date = new Date(e.value);
  form.value.birthday = `${date.getFullYear()}-${String(
    date.getMonth() + 1,
  ).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
  calculateAge();
  showDatePicker.value = false;
};
 
const calculateAge = () => {
  if (!form.value.birthday) {
    form.value.age = "";
    form.value.ageunit = "";
    ageUnitIndex.value = -1;
    return;
  }
  const birthDate = new Date(form.value.birthday);
  const today = new Date();
  if (isNaN(birthDate.getTime())) return;
  if (birthDate > today) {
    uni.showToast({ title: "出生日期不能是未来日期", icon: "none" });
    form.value.age = "";
    form.value.ageunit = "";
    ageUnitIndex.value = -1;
    return;
  }
  const daysDiff = Math.floor((today - birthDate) / (1000 * 60 * 60 * 24));
  if (daysDiff < 0) return;
  let years = today.getFullYear() - birthDate.getFullYear();
  let months = today.getMonth() - birthDate.getMonth();
  let days = today.getDate() - birthDate.getDate();
  let ageValue, ageUnit;
  if (years >= 1) {
    if (months < 0 || (months === 0 && days < 0)) years--;
    ageValue = years.toString();
    ageUnit = "岁";
  } else if (daysDiff >= 30) {
    let totalMonths = years * 12 + months;
    if (days < 0) totalMonths--;
    ageValue = Math.max(1, totalMonths).toString();
    ageUnit = "个月";
  } else {
    ageValue = Math.max(1, daysDiff).toString();
    ageUnit = "天";
  }
  form.value.age = ageValue;
  form.value.ageunit = ageUnit;
  // 同步单位索引
  const unitList = ageUnitList.value;
  const idx = unitList.findIndex((item) => item === ageUnit);
  ageUnitIndex.value = idx >= 0 ? idx : -1;
};
 
// 身份证处理
const validateIdCard = () => {
  const idCard = form.value.idcardno;
  if (!idCard) {
    idCardError.value = "";
    return true;
  }
  if (idCard.length !== 18) {
    idCardError.value = "身份证号码必须是18位";
    return false;
  }
  const reg = /^\d{17}(\d|X|x)$/;
  if (!reg.test(idCard)) {
    idCardError.value = "身份证号码格式不正确";
    return false;
  }
  const coefficientArray = [
    7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2,
  ];
  const checkCodeMap = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];
  let sum = 0;
  for (let i = 0; i < 17; i++)
    sum += parseInt(idCard.charAt(i), 10) * coefficientArray[i];
  const checkCode = checkCodeMap[sum % 11];
  if (checkCode != idCard.charAt(17).toUpperCase()) {
    idCardError.value = "身份证号码校验失败";
    return false;
  }
  idCardError.value = "";
  return true;
};
 
const onIdCardChange = () => {
  if (validateIdCard()) extractBirthdayFromIdCard();
};
 
const extractBirthdayFromIdCard = () => {
  const idCard = form.value.idcardno;
  if (!idCard || idCard.length !== 18) return;
  const year = idCard.substring(6, 10);
  const month = idCard.substring(10, 12);
  const day = idCard.substring(12, 14);
  const birthDate = new Date(`${year}-${month}-${day}`);
  if (isNaN(birthDate.getTime())) return;
  form.value.birthday = `${year}-${month}-${day}`;
  calculateAge();
  const genderCode = parseInt(idCard.charAt(16), 10);
  if (!isNaN(genderCode)) form.value.sex = genderCode % 2 === 1 ? "1" : "2";
  uni.showToast({
    title: "已自动提取出生日期和性别",
    icon: "success",
    duration: 1500,
  });
};
 
const handleGcsBlur = () => {
  const val = Number(form.value.gcsScore);
  if (!val && val !== 0) return;
  if (val > 7) {
    uni.showToast({ title: "GCS评分不能大于7", icon: "none" });
    form.value.gcsScore = "";
  }
  if (val < 3) {
    uni.showToast({ title: "GCS评分不能小于3", icon: "none" });
    form.value.gcsScore = "";
  }
};
 
// 传染病
const toggleInfectious = (value) => {
  const index = selectedInfectious.value.indexOf(value);
  if (index === -1) selectedInfectious.value.push(value);
  else selectedInfectious.value.splice(index, 1);
  form.value.infectious = selectedInfectious.value.join(",");
};
const isInfectiousSelected = (value) =>
  selectedInfectious.value.includes(value);
 
// 报告时间手动选择
const onReportTimeConfirm = (e) => {
  const date = new Date(e.value);
  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");
  form.value.reporttime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  showReportTimePicker.value = false;
 
  // 如果是新增模式,重新生成案例编号
  if (!isEditMode.value) {
    generateCaseNo();
  }
};
 
// 附件处理(示例,需根据实际附件组件调整)
const handleBaseUpload = (file) => attachments.value.push(file);
const handleFilesUpdate = (files) => {
  attachments.value = files.map((file) => ({ ...file }));
};
const handlePreview = (file) => {
  const fullUrl = file.url.startsWith("http")
    ? file.url
    : (file.url.startsWith("/") ? "" : "/") + file.url;
  if (file.type.includes("image")) {
    uni.previewImage({
      urls: attachments.value
        .filter((f) => f.type.includes("image"))
        .map((f) =>
          f.url.startsWith("http")
            ? f.url
            : (f.url.startsWith("/") ? "" : "/") + f.url,
        ),
      current: fullUrl,
    });
  } else if (file.type.includes("pdf")) {
    uni.downloadFile({
      url: fullUrl,
      success: (res) =>
        uni.openDocument({
          filePath: res.tempFilePath,
          fileType: "pdf",
          showMenu: true,
        }),
    });
  } else {
    uni.showToast({ title: "暂不支持此文件类型预览", icon: "none" });
  }
};
 
// 地址变更处理
const onResidenceChange = (val) => {
  form.value.residenceprovincename = val.sheng;
  form.value.residenceprovince = val.provinceCode || "";
  form.value.residencecountyname = val.shi;
  form.value.residencetownname = val.qu;
  // 可根据需要补充区县code
};
const onRegisterChange = (val) => {
  form.value.registerprovincename = val.sheng;
  form.value.registerprovince = val.provinceCode || "";
  form.value.registercityname = val.shi;
  form.value.registertownname = val.qu;
};
 
// 表单操作
const handleCancel = () => uni.navigateBack();
 
const resetForm = () => {
  uni.showModal({
    title: "确认重置",
    content: "确定要清空所有已填写的内容吗?",
    success: (res) => {
      if (res.confirm) {
        Object.keys(form.value).forEach((key) => {
          if (!["id", "caseNo"].includes(key)) form.value[key] = "";
        });
        form.value.nationality = "中国";
        form.value.reportStatus = "1";
        form.value.terminationCase = 0;
        nationIndex.value = -1;
        idCardTypeIndex.value = -1;
        educationIndex.value = -1;
        occupationIndex.value = -1;
        ageUnitIndex.value = -1;
        selectedInfectious.value = [];
        attachments.value = [];
        residenceAddress.value = { sheng: "", shi: "", qu: "" };
        registerAddress.value = { sheng: "", shi: "", qu: "" };
        if (!isEditMode.value) {
          // 重置报告时间为当前时间
          updateCurrentTime();
          // 根据新的上报时间生成案例编号
          generateCaseNo();
        }
        uni.showToast({ title: "表单已重置", icon: "success" });
      }
    },
  });
};
 
const handleSubmit = async () => {
  if (!isFormValid.value) {
    uni.showToast({ title: "请填写姓名、疾病诊断和上报医院", icon: "none" });
    return;
  }
  try {
    loading.value = true;
    uni.showLoading({ title: isEditMode.value ? "修改中..." : "提交中..." });
    const submitData = {
      ...form.value,
      treatmenthospitalname: form.value.toHospital,
      age: parseInt(form.value.age) || 0,
      annexfilesList: attachments.value.map((file) => ({
        path: file.url,
        fileName: file.name,
        type: file.type,
      })),
      isTransport: form.value.isTransport,
      terminationCase: form.value.terminationCase || 0,
      reportStatus: form.value.reportStatus || "1",
    };
    let res;
    if (isEditMode.value) {
      res = await uni.$uapi.post(
        "/project/donatebaseinforeport/edit",
        submitData,
      );
    } else {
      res = await uni.$uapi.post(
        "/project/donatebaseinforeport/add",
        submitData,
      );
    }
    uni.hideLoading();
    if (res.code == 200) {
      uni.showToast({
        title: isEditMode.value ? "修改成功" : "上报成功",
        icon: "success",
      });
      setTimeout(() => uni.navigateBack(), 1500);
    } else {
      throw new Error(res.msg || "操作失败");
    }
  } catch (error) {
    uni.showToast({
      title: error.message || (isEditMode.value ? "修改失败" : "上报失败"),
      icon: "none",
    });
  } finally {
    loading.value = false;
  }
};
 
// 加载案例数据
const loadCaseData = async (id) => {
  try {
    loading.value = true;
    const res = await uni.$uapi.get(
      `/project/donatebaseinforeport/getInfo/${id}`,
    );
    if (res.code) {
      form.value = res.data;
      if (res.data.infectious)
        selectedInfectious.value = res.data.infectious
          .split(",")
          .filter((item) => item.trim() !== "");
      if (form.value.nation) {
        const idx = nationList.value.findIndex(
          (item) => item == form.value.nation,
        );
        nationIndex.value = idx >= 0 ? idx : -1;
      }
      if (form.value.idcardtype) {
        const dictList = getDictList("sys_IDType");
        const idx = dictList.findIndex(
          (item) => item.value == form.value.idcardtype,
        );
        idCardTypeIndex.value = idx >= 0 ? idx : -1;
      }
      if (form.value.education) {
        const dictList = getDictList("sys_education");
        const idx = dictList.findIndex(
          (item) => item.value == form.value.education,
        );
        educationIndex.value = idx >= 0 ? idx : -1;
      }
      if (form.value.occupation) {
        const dictList = getDictList("sys_occupation");
        const idx = dictList.findIndex(
          (item) => item.value == form.value.occupation,
        );
        occupationIndex.value = idx >= 0 ? idx : -1;
      }
      // 年龄单位回显
      if (form.value.ageunit) {
        const unitList = ageUnitList.value;
        const idx = unitList.findIndex((item) => item === form.value.ageunit);
        ageUnitIndex.value = idx >= 0 ? idx : -1;
      }
      // 地址回显
      if (res.data.residenceprovincename) {
        residenceAddress.value = {
          sheng: res.data.residenceprovincename,
          shi: res.data.residencecountyname,
          qu: res.data.residencetownname,
        };
      }
      if (res.data.registerprovincename) {
        registerAddress.value = {
          sheng: res.data.registerprovincename,
          shi: res.data.registercityname,
          qu: res.data.registertownname,
        };
      }
      if (res.data.annexfilesList) {
        attachments.value = res.data.annexfilesList.map((item) => ({
          url: item.path,
          name: item.fileName,
          type: item.type || "",
        }));
      }
    } else {
      throw new Error(res.msg || "数据加载失败");
    }
  } catch (error) {
    uni.showToast({ title: "数据加载失败,请重试", icon: "none" });
  } finally {
    loading.value = false;
  }
};
 
// ==================== 生命周期 ====================
onMounted(() => {
  updateCurrentTime();
  setInterval(updateCurrentTime, 1000);
});
 
onLoad(async (options) => {
  if (options.id) {
    currentId.value = options.id;
    isEditMode.value = true;
    await new Promise((resolve) => {
      if (!dictLoading.value) resolve();
      else {
        const stopWatch = watch(dictLoading, (val) => {
          if (!val) {
            stopWatch();
            resolve();
          }
        });
      }
    });
    await loadCaseData(options.id);
  } else {
    isEditMode.value = false;
    generateCaseNo();
    // 新增时默认填入报告时间
    updateCurrentTime();
  }
 
  if (!userStore.userInfo) await userStore.refreshUserInfo();
  const user = userStore.userInfo;
  if (user) {
    if (!form.value.treatmenthospitalname)
      form.value.treatmenthospitalname = user.orgName;
    if (!form.value.toHospital) form.value.toHospital = user.orgName;
    if (!form.value.coordinatorName)
      form.value.coordinatorName = user.coordinatorName;
    if (!form.value.coordinatorNo)
      form.value.coordinatorNo = user.coordinatorNo;
    if (!form.value.infoName) form.value.infoName = user.nickName;
    if (!form.value.phone) form.value.phone = user.phonenumber;
    if (!form.value.reportername) form.value.reportername = user.name;
    if (!form.value.reporterno) form.value.reporterno = user.userId;
  }
  updateCurrentTime();
});
</script>
 
<style lang="scss" scoped>
// 样式与原来保持一致,新增地址块样式
.case-report-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #f8fdff 0%, #e8f7f6 100%);
}
 
.form-content {
  padding: 30rpx;
  padding-bottom: 220rpx;
}
 
.page-header {
  padding: 30rpx 0;
  text-align: center;
  margin-bottom: 20rpx;
}
 
.page-title {
  font-size: 38rpx;
  font-weight: 700;
  color: #1d1d1f;
  letter-spacing: 2rpx;
}
 
.form-section {
  background: #fff;
  border-radius: 20rpx;
  padding: 30rpx;
  margin-bottom: 26rpx;
  box-shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.05);
}
 
.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 28rpx;
  padding-bottom: 20rpx;
  border-bottom: 2rpx solid #f0f0f0;
}
 
.section-icon {
  font-size: 34rpx;
  margin-right: 14rpx;
}
 
.section-title {
  font-size: 32rpx;
  font-weight: 650;
  color: #1d1d1f;
}
 
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 28rpx;
}
 
.form-item {
  display: flex;
  flex-direction: column;
 
  &.full-width {
    grid-column: 1 / -1;
  }
}
 
.item-label {
  font-size: 28rpx;
  color: #1d1d1f;
  font-weight: 520;
  margin-bottom: 12rpx;
 
  &.required::after {
    content: "*";
    color: #ff4757;
    margin-left: 4rpx;
  }
}
 
:deep(.u-input),
:deep(.u-textarea) {
  border: 2rpx solid #e5e5e7 !important;
  border-radius: 12rpx !important;
  padding: 20rpx 24rpx !important;
  background: #fff !important;
 
  &:focus-within {
    border-color: #0f95b0 !important;
  }
}
 
.picker {
  height: 86rpx;
  background: #fafafa;
  border-radius: 12rpx;
  padding: 0 24rpx;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 2rpx solid #e5e5e7;
 
  &:active {
    border-color: #0f95b0;
  }
 
  .icon-arrow {
    font-size: 34rpx;
    color: #86868b;
    transform: rotate(90deg);
  }
}
 
.radio-options {
  display: flex;
  gap: 44rpx;
 
  .option-item {
    display: flex;
    align-items: center;
    gap: 14rpx;
 
    .radio-dot {
      width: 34rpx;
      height: 34rpx;
      border: 3rpx solid #d1d1d6;
      border-radius: 50%;
      position: relative;
    }
 
    .option-label {
      font-size: 28rpx;
      color: #1d1d1f;
    }
 
    &.active .radio-dot {
      border-color: #0f95b0;
 
      &::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 18rpx;
        height: 18rpx;
        background: #0f95b0;
        border-radius: 50%;
      }
    }
 
    &.active .option-label {
      color: #0f95b0;
      font-weight: 550;
    }
  }
}
 
.radio-group {
  display: flex;
  gap: 40rpx;
 
  &.horizontal {
    flex-wrap: wrap;
    gap: 20rpx;
  }
}
 
// 替换原有的 .radio-group.horizontal 相关样式
.radio-group.horizontal {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 18rpx;
 
  .radio-item {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8rpx;
    padding: 10rpx 20rpx;
    border-radius: 20rpx;
    background: #f5f5f7;
    transition: all 0.2s;
 
    .radio-dot {
      width: 36rpx;
      height: 36rpx;
      border: 2rpx solid #d1d1d6;
      border-radius: 50%;
      background-color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s;
 
      &.active {
        border-color: #0f95b0;
        background-color: #0f95b0;
 
        // 可选:如果希望有白色对勾,取消注释下面
        // &::after {
        //   content: "✓";
        //   font-size: 20rpx;
        //   color: white;
        //   line-height: 1;
        // }
      }
    }
 
    .radio-label {
      font-size: 26rpx;
      color: #1d1d1f;
      white-space: nowrap;
    }
 
    // 选中时整体背景微微变色(可选)
    &.active {
      background: rgba(15, 149, 176, 0.1);
    }
  }
}
 
.checkbox-group.single-line {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 16rpx;
 
  .checkbox-item {
    display: flex;
    align-items: center;
    gap: 8rpx;
    flex-shrink: 0;
    padding: 10rpx 20rpx;
    border-radius: 22rpx;
    background: #f5f5f7;
 
    &.active {
      border-color: #0f95b0;
      background: rgba(15, 149, 176, 0.09);
    }
 
    .checkbox-box {
      width: 30rpx;
      height: 30rpx;
      border: 2rpx solid #d1d1d6;
      border-radius: 6rpx;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #fff;
 
      &.active {
        border-color: #0f95b0;
        background: #0f95b0;
      }
 
      .checkbox-check {
        font-size: 20rpx;
        color: white;
        font-weight: bold;
      }
    }
 
    .checkbox-label {
      font-size: 25rpx;
      color: #1d1d1f;
      white-space: nowrap;
    }
  }
}
 
.error-text {
  font-size: 23rpx;
  color: #ff4757;
  margin-top: 8rpx;
}
 
.address-block {
  margin-bottom: 32rpx;
 
  .address-label {
    font-size: 27rpx;
    color: #1d1d1f;
    font-weight: 520;
    margin-bottom: 12rpx;
    display: block;
  }
 
  .address-detail-input {
    margin-top: 16rpx;
  }
}
 
.action-buttons {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  padding: 20rpx 30rpx calc(20rpx + env(safe-area-inset-bottom));
  box-shadow: 0 -4rpx 24rpx rgba(0, 0, 0, 0.07);
  z-index: 9;
  display: flex;
  gap: 20rpx;
 
  .btn {
    flex: 1;
    height: 84rpx;
    border-radius: 16rpx;
    font-size: 31rpx;
    font-weight: 530;
    display: flex;
    align-items: center;
    justify-content: center;
 
    &.secondary {
      background: #f5f5f7 !important;
      color: #1d1d1f !important;
    }
 
    &.primary {
      background: linear-gradient(135deg, #0f95b0, #66b8b5) !important;
      color: #fff !important;
 
      &:disabled {
        background: #c8c8cc !important;
        opacity: 0.55;
      }
    }
  }
}
</style>