wlzboy
2026-02-05 57e98ac3f59e9ca12d3fdbc6f89c9c0b1f86be4d
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
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
<template>
  <view class="home-container">
    <!-- 顶部用户信息区域 -->
    <view class="user-info-section">
      <view class="user-info-content">
        <view class="user-details">
          <view class="user-info-row">
            <text class="user-name">{{ userName || "未登录" }}</text>
            <text class="separator" v-if="currentUser.branchCompanyName"
              >|</text
            >
            <view class="branch-company" v-if="currentUser.branchCompanyName">
              <uni-icons
                type="location"
                size="16"
                color="#666"
                style="margin-right: 4rpx"
              ></uni-icons>
              <text>{{ currentUser.branchCompanyName }}</text>
            </view>
            <text class="separator" v-if="boundVehicle">|</text>
            <view
              class="vehicle-info"
              @click.stop="goToBindVehicle"
              v-if="boundVehicle"
            >
              <text>{{ boundVehicle }}</text>
              <uni-icons
                type="loop"
                size="16"
                color="#007AFF"
                style="margin-left: 4rpx"
              ></uni-icons>
            </view>
          </view>
          <view
            class="bind-vehicle-btn"
            v-if="!boundVehicle"
            @click="goToBindVehicle"
          >
            <uni-icons
              type="plus-filled"
              size="16"
              color="#007AFF"
              style="margin-right: 4rpx"
            ></uni-icons>
            <text>绑定车牌</text>
          </view>
        </view>
      </view>
    </view>
 
    <!-- 消息入口 -->
    <view class="message-entry" @click="goToMessages">
      <view class="message-icon">
        <uni-icons type="chat" size="24" color="#007AFF"></uni-icons>
      </view>
      <view class="message-text">消息中心</view>
      <view class="unread-dot" v-if="unreadMessageCount > 0">{{
        unreadMessageCount
      }}</view>
      <view class="arrow">
        <uni-icons type="arrowright" size="16" color="#999"></uni-icons>
      </view>
    </view>
 
    <!-- 订阅通知提示卡片(未订阅时显示) -->
    <view
      class="subscribe-banner"
      v-if="!hasSubscribed"
      @click="clickConfirmsubscribeTaskNotify"
    >
      <view class="banner-icon">
        <uni-icons type="bell" size="28" color="#ff9500"></uni-icons>
      </view>
      <view class="banner-content">
        <view class="banner-title">开启任务通知</view>
        <view class="banner-desc">及时接收任务分配和状态更新提醒</view>
      </view>
      <view class="banner-action">
        <text>立即开启</text>
        <uni-icons type="arrowright" size="16" color="#007AFF"></uni-icons>
      </view>
    </view>
 
    <!-- 正在运行的任务标题 -->
    <view class="running-tasks-header">
      <text class="header-title">正在运行的任务</text>
    </view>
 
    <!-- 正在运行的任务列表 -->
    <scroll-view 
      class="running-tasks-section" 
      scroll-y="true"
      @scrolltolower="onScrollToLower"
    >
      <view class="task-list">
        <view class="task-item" v-for="task in runningTasks" :key="task.id">
          <view class="task-main" @click="viewTaskDetail(task)">
            <!-- 任务头部:标题和状态标签 -->
            <view class="task-header">
              <view class="task-title">
                {{ getTaskTypeText(task.type) }} - {{ task.vehicle }}
                <text v-if="task.emergencyInfo && task.emergencyInfo.serviceOrdVip === '1'" class="vip-tag">VIP</text>
                <text v-if="task.emergencyInfo && task.emergencyInfo.fromHq2Is === '1'" class="hq-tag">广总</text>
              </view>
              <view
                class="task-status"
                :class="
                  task.taskStatus === 'PENDING'
                    ? 'status-pending'
                    : task.taskStatus === 'DEPARTING'
                    ? 'status-departing'
                    : task.taskStatus === 'ARRIVED'
                    ? 'status-arrived'
                    : task.taskStatus === 'RETURNING'
                    ? 'status-returning'
                    : task.taskStatus === 'COMPLETED'
                    ? 'status-completed'
                    : task.taskStatus === 'CANCELLED'
                    ? 'status-cancelled'
                    : task.taskStatus === 'IN_PROGRESS'
                    ? 'status-in-progress'
                    : 'status-default'
                "
              >
                {{ getStatusText(task.status) }}
              </view>
            </view>
 
            <!-- 任务编号和开始时间在同一行显示,但分开一些 -->
            <view class="task-code-row">
              <text class="task-code">{{ task.showTaskCode }}</text>
              <text class="task-time">{{ task.startTime }}</text>
            </view>
 
            <!-- 任务详细信息 -->
            <view class="task-info">
              <view class="info-row">
                <view class="info-item">
                  <view class="label">出发地:</view>
                  <view class="value">{{ getStartLocationDisplay(task) }}</view>
                </view>
                
              </view>
              <view class="info-row">
                <view class="info-item">
                  <view class="label">目的地:</view>
                  <view class="value">{{ getEndLocationDisplay(task) }}</view>
                </view>
              </view>
              <view class="info-row">
               
                <view class="info-item">
                  <view class="label">执行人员:</view>
                  <view class="value">{{ getAssigneesDisplay(task) }}</view>
                </view>
              </view>
            </view>
          </view>
 
          <!-- 操作按钮 -->
          <view class="task-actions">
            <!-- 待处理状态: 显示出发、取消 -->
            <template v-if="task.taskStatus === 'PENDING'">
              <button
                class="action-btn primary"
                @click="handleTaskAction(task, 'depart')"
              >
                出发
              </button>
              <button
                class="action-btn cancel"
                @click="handleTaskAction(task, 'cancel')"
              >
                取消
              </button>
            </template>
 
            <!-- 出发中状态: 显示已到达、强制结束 -->
            <template v-else-if="task.taskStatus === 'DEPARTING'">
              <button
                class="action-btn primary"
                @click="handleTaskAction(task, 'arrive')"
              >
                已到达
              </button>
              <button
                class="action-btn cancel"
                @click="handleTaskAction(task, 'forceCancel')"
              >
                强制结束
              </button>
            </template>
 
            <!-- 已到达状态: 显示已返程 -->
            <template v-else-if="task.taskStatus === 'ARRIVED'">
              <button
                class="action-btn primary"
                @click="handleTaskAction(task, 'return')"
              >
                已返程
              </button>
            </template>
 
            <!-- 返程中状态: 显示已完成 -->
            <template v-else-if="task.taskStatus === 'RETURNING'">
              <button
                class="action-btn primary"
                @click="handleTaskAction(task, 'complete')"
              >
                已完成
              </button>
            </template>
 
            <!-- 已完成/已取消: 不显示按钮 -->
          </view>
        </view>
 
        <view class="no-data" v-if="runningTasks.length === 0">
          <uni-icons type="info" size="40" color="#ccc"></uni-icons>
          <text>暂无正在运行的任务</text>
        </view>
        
        <!-- 加载更多提示 -->
        <view class="load-more" v-if="runningTasks.length > 0 && hasMore && loading">
          <uni-icons type="spinner-cycle" size="20" color="#999"></uni-icons>
          <text>正在加载更多数据...</text>
        </view>
        <view class="load-more no-more" v-else-if="runningTasks.length > 0 && !hasMore">
          <text>没有更多数据了</text>
        </view>
      </view>
    </scroll-view>
    
    <!-- 取消原因选择对话框 -->
    <uni-popup ref="cancelPopup" type="center" :is-mask-click="false">
      <view class="cancel-dialog">
        <view class="dialog-title">请选择取消原因</view>
        <picker mode="selector" :range="cancelReasonList" range-key="label" @change="selectCancelReason">
          <view class="reason-picker">
            <view class="picker-label">取消原因</view>
            <view class="picker-value">
              {{ selectedCancelReasonLabel }}
            </view>
            <uni-icons type="arrowright" size="16"></uni-icons>
          </view>
        </picker>
        <view class="dialog-buttons">
          <button class="cancel-btn" @click="closeCancelDialog">取消</button>
          <button class="confirm-btn" @click="confirmCancelTask">确定</button>
        </view>
      </view>
    </uni-popup>
  </view>
</template>
 
<script>
import { mapState } from "vuex";
import { getMyTasks, changeTaskStatus, checkTaskConsentAttachment } from "@/api/task";
import { getUserProfile } from "@/api/system/user";
import { getUserBoundVehicle } from "@/api/vehicle";
import { getUnreadCount } from "@/api/message";
import { getDicts } from "@/api/dict";
import { formatDateTime } from "@/utils/common";
import subscribeManager from "@/utils/subscribe";
import { checkTaskCanDepart } from "@/utils/taskValidator";
 
export default {
  data() {
    return {
      // 用户绑定的车辆信息
      boundVehicle: "",
      boundVehicleId: null,
 
      // 消息数据
      messages: [],
      unreadMessageCount: 0,
 
      // 正在运行的任务列表
      allTaskList: [], // 存储所有任务数据
      displayedTaskList: [], // 存储当前显示的任务数据
      loading: false,
 
      // 订阅状态
      hasSubscribed: false,
      
      // 前端分页相关
      currentPage: 1,
      pageSize: 10,
      hasMore: true,
      
      // 取消原因相关
      cancelReasonList: [], // 取消原因列表
      showCancelDialog: false, // 显示取消原因对话框
      selectedCancelReason: '', // 选中的取消原因
      currentCancelTask: null // 当前要取消的任务
    };
  },
  computed: {
    ...mapState({
      userName: (state) => state.user.nickName,
      currentUser: (state) => state.user,
    }),
 
    // 正在运行的任务(待处理和各种处理中的任务)
    runningTasks() {
      return this.displayedTaskList.filter((task) => {
        // 包含待处理、出发中、已到达、返程中等所有未完成的状态
        return [
          "PENDING",
          "DEPARTING",
          "ARRIVED",
          "RETURNING",
          "IN_PROGRESS",
        ].includes(task.taskStatus);
      });
    },
    
    // 获取选中的取消原因标签(用于弹窗显示)
    selectedCancelReasonLabel() {
      if (!this.selectedCancelReason || !this.cancelReasonList.length) {
        return '请选择'
      }
      const reason = this.cancelReasonList.find(r => r.value === this.selectedCancelReason)
      return reason ? reason.label : '请选择'
    },
  },
  onLoad() {
    // 检查用户是否已登录
    const userId = this.currentUser.userId;
    if (!userId) {
      console.log("用户未登录,跳过加载数据");
      return;
    }
 
    // 检查订阅状态(先检查本地,后面会检查微信官方状态)
    this.hasSubscribed = true;//subscribeManager.checkLocalSubscribeStatus();
 
    // 自动订阅(如果未订阅则显示确认弹窗)
    // this.autoSubscribeOnLaunch();
 
    // 加载用户绑定车辆信息
    this.loadUserVehicle();
    // 加载正在运行的任务
    this.loadRunningTasks();
    // 加载未读消息数量
    this.loadUnreadMessageCount();
    // 加载取消原因字典
    this.loadCancelReasonDict();
  },
  onShow() {
    // 检查用户是否已登录
    const userId = this.currentUser.userId;
    if (!userId) {
      console.log("用户未登录,跳过加载数据");
      return;
    }
 
    // 每次显示页面时刷新任务列表、绑定车辆和消息数量
    this.loadUserVehicle();
    // 重新加载任务列表时重置分页
    this.currentPage = 1;
    this.hasMore = true;
    this.loadRunningTasks();
    this.loadUnreadMessageCount();
  },
  onPullDownRefresh() {
    // 下拉刷新时重置分页参数
    this.currentPage = 1;
    this.hasMore = true;
    // 下拉刷新
    this.loadRunningTasks();
    setTimeout(() => {
      uni.stopPullDownRefresh();
    }, 1000);
  },
  methods: {
    // 滚动到底部时加载更多
    onScrollToLower() {
      if (this.hasMore && !this.loading) {
        this.loadMoreTasks();
      }
    },
    
    // 自动订阅(小程序启动时调用)
    autoSubscribeOnLaunch() {
      subscribeManager.autoSubscribe()
        .then((result) => {
          if (result.skipped) {
            console.log('用户已订阅,无需重复订阅');
            this.hasSubscribed = true;
          } else if (result.success) {
            this.hasSubscribed = true;
            console.log('自动订阅成功');
          } else {
            // 订阅失败或被拒绝,更新状态
            this.hasSubscribed = false;
          }
          
          // 如果返回了状态信息,输出详细状态
          if (result.status) {
            console.log('详细订阅状态:', result.status);
          }
        })
        .catch((error) => {
          console.log('自动订阅取消或失败:', error);
          this.hasSubscribed = false;
        });
    },
 
    // 加载用户绑定的车辆信息
    loadUserVehicle() {
      const userId = this.currentUser.userId;
      if (!userId) {
        console.error("用户未登录,无法获取绑定车辆信息");
        this.boundVehicle = "";
        this.boundVehicleId = null;
        return;
      }
 
      getUserBoundVehicle(userId)
        .then((response) => {
          if (response.code === 200 && response.data) {
            const vehicle = response.data;
            this.boundVehicle = vehicle.vehicleNumber || "未知车牌";
            this.boundVehicleId = vehicle.vehicleId;
            console.log("用户绑定车辆:", this.boundVehicle);
          } else {
            this.boundVehicle = "";
            this.boundVehicleId = null;
          }
        })
        .catch((error) => {
          console.error("获取绑定车辆信息失败:", error);
          this.boundVehicle = "";
          this.boundVehicleId = null;
        });
    },
 
    // 加载未读消息数量
    loadUnreadMessageCount() {
      // 检查用户是否已登录
      const userId = this.currentUser.userId;
      if (!userId) {
        console.log("用户未登录,跳过获取未读消息数量");
        return;
      }
 
      getUnreadCount()
        .then((response) => {
          if (response.code === 200) {
            this.unreadMessageCount = response.data || 0;
            // 更新TabBar徽标
            this.updateTabBarBadge(this.unreadMessageCount);
          }
        })
        .catch((error) => {
          console.error("获取未读消息数量失败:", error);
        });
    },
 
    // 更新TabBar徽标
    updateTabBarBadge(count) {
      if (count > 0) {
        uni.setTabBarBadge({
          index: 3, // 消息页面在tabBar中的索引
          text: count > 99 ? "99+" : count.toString(),
        });
      } else {
        uni.removeTabBarBadge({
          index: 3,
        });
      }
    },
 
    // 加载用户信息(保留以兼容之前的代码)
    loadUserProfile() {
      const userId = this.currentUser.userId;
      if (!userId) {
        console.error("用户未登录,无法获取用户信息");
        return;
      }
 
      getUserProfile()
        .then((response) => {
          const userInfo = response.data || response;
          // 获取用户绑定的车辆信息
          if (userInfo.boundVehicle) {
            this.boundVehicle = userInfo.boundVehicle.vehicleNumber;
            this.boundVehicleId = userInfo.boundVehicle.vehicleId;
          }
        })
        .catch((error) => {
          console.error("获取用户信息失败:", error);
        });
    },
 
    // 加载正在运行的任务
    loadRunningTasks() {
      const userId = this.currentUser.userId;
      if (!userId) {
        console.error("用户未登录,无法加载任务列表");
        return;
      }
 
      this.loading = true;
      // 使用 /task/my 接口获取当前用户相关的所有任务(用户创建、分配给用户、执行人是用户)
      getMyTasks()
        .then((response) => {
          this.loading = false;
          // 根据后端返回的数据结构进行解析
          const data = response.data || response.rows || response || [];
          
          // 如果是第一页,直接替换数据;否则追加数据
          if (this.currentPage === 1) {
            this.allTaskList = data;
          } else {
            this.allTaskList = [...this.allTaskList, ...data];
          }
          
          // 格式化任务数据
          this.allTaskList = this.allTaskList
            .filter((task) => {
              // 只显示未完成和未取消的任务
              return (
                task.taskStatus !== "COMPLETED" &&
                task.taskStatus !== "CANCELLED"
              );
            })
            .map((task) => {
              // 从assignedVehicles数组中获取车辆信息
              let vehicleInfo = "未分配车辆";
              if (task.assignedVehicles && task.assignedVehicles.length > 0) {
                const firstVehicle = task.assignedVehicles[0];
                vehicleInfo = firstVehicle.vehicleNo || "未知车牌";
                if (task.assignedVehicles.length > 1) {
                  vehicleInfo += ` 等${task.assignedVehicles.length}辆`;
                }
              }
 
              return {
                ...task,
                // 格式化显示字段
                id: task.taskId,
                type: task.taskType,
                vehicle: vehicleInfo,
                vehicleList: task.assignedVehicles || [],
                startLocation: task.departureAddress || task.startLocation || "未设置",
                endLocation: task.destinationAddress || task.endLocation || "未设置",
                startTime: task.plannedStartTime
                  ? (task.plannedStartTime.startsWith('1900') || task.plannedStartTime.startsWith('1970') 
                    ? '未分配时间' 
                    : formatDateTime(task.plannedStartTime, "YYYY-MM-DD HH:mm"))
                  : "未设置",
                assignee: task.assigneeName || "未分配",
                taskNo: task.taskCode || "未知编号",
                status: this.convertStatus(task.taskStatus), // 转换状态格式以兼容旧UI
              };
            });
 
          // 更新显示的任务列表
          this.updateDisplayedTaskList();
        })
        .catch((error) => {
          this.loading = false;
          console.error("加载任务列表失败:", error);
        });
    },
    
    // 更新显示的任务列表(前端分页)
    updateDisplayedTaskList() {
      const start = 0;
      const end = this.currentPage * this.pageSize;
      this.displayedTaskList = this.allTaskList.slice(start, end);
      this.hasMore = end < this.allTaskList.length;
    },
    
    // 加载更多任务(前端分页)
    loadMoreTasks() {
      if (!this.hasMore || this.loading) return;
      
      this.currentPage++;
      this.updateDisplayedTaskList();
    },
 
    // 格式化地址 - 只显示-前面的部分
    formatAddress(address) {
      if (!address) return "未设置";
      const dashIndex = address.indexOf("-");
      if (dashIndex > 0) {
        return address.substring(0, dashIndex);
      }
      return address;
    },
 
    // 获取出发地显示内容(转运任务显示转出医院名称)
    getStartLocationDisplay(task) {
      // 如果是转运任务且有emergencyInfo信息
      if (task.taskType === 'EMERGENCY_TRANSFER' && task.emergencyInfo && task.emergencyInfo.hospitalOutName) {
        return task.emergencyInfo.hospitalOutName;
      }
      // 其他情况使用原来的startLocation
      return this.formatAddress(task.startLocation || "未设置");
    },
 
    // 获取目的地显示内容(转运任务显示转入医院名称或详细地址)
    getEndLocationDisplay(task) {
      // 如果是转运任务且有emergencyInfo信息
      // console.log("get end location display",task.taskType,task.emergencyInfo.hospitalInAddress,task.showTaskCode);
      if (task.taskType === 'EMERGENCY_TRANSFER' && task.emergencyInfo) {
        // console.log('转运任务 - 紧急信息:', task.emergencyInfo)
        // 优先显示转入医院名称
        // console.log("get end local",task.emergencyInfo.hospitalInAddress);
        return task.emergencyInfo.hospitalInAddress;
        // if (task.emergencyInfo.hospitalInName) {
        //   if(task.emergencyInfo.hospitalInName.includes("家中")){
        //     return task.emergencyInfo.destinationAddress;
        //   }
        //   return task.emergencyInfo.hospitalInName;
        // }
        // // 如果没有转入医院名称,但有转入医院地址,则显示地址
        // if (task.emergencyInfo.hospitalInAddress) {
        //   return task.emergencyInfo.hospitalInAddress;
        // }
      }
      // 其他情况使用原来的endLocation
      return this.formatAddress(task.endLocation || "未设置");
    },
    
    // 获取执行人员显示(从 assignees 数组中提取 userName)
    getAssigneesDisplay(task) {
      // 如果有 assignees 数组且不为空
      if (task.assignees && task.assignees.length > 0) {
        // 提取所有 userName,过滤掉空值
        const userNames = task.assignees
          .map(assignee => assignee.userName)
          .filter(name => name); // 过滤掉 null/undefined/空字符串
        
        // 如果有有效的用户名,用逗号连接
        if (userNames.length > 0) {
          return userNames.join('、');
        }
      }
      
      // 如果没有 assignees 数组,使用旧的 assigneeName 或 assignee 字段
      return task.assigneeName || task.assignee || '未分配';
    },
 
    // 转换状态格式(将数据库状态转换为UI使用的状态)
    convertStatus(dbStatus) {
      const statusMap = {
        PENDING: "pending",
        DEPARTING: "processing",
        ARRIVED: "processing",
        RETURNING: "processing",
        IN_PROGRESS: "processing",
        COMPLETED: "completed",
        CANCELLED: "cancelled",
      };
      return statusMap[dbStatus] || "pending";
    },
    // 跳转到绑定车辆页面
    goToBindVehicle() {
      // 跳转到绑定车辆的页面
      this.$tab.navigateTo("/pages/bind-vehicle");
    },
 
    // 跳转到消息页面
    goToMessages() {
      this.$tab.switchTab("/pages/message/index");
    },
 
    // 查看任务详情
    viewTaskDetail(task) {
      // 跳转到任务详情页面 - 使用taskId
      this.$tab.navigateTo(`/pagesTask/detail?id=${task.taskId || task.id}`);
    },
 
    // 处理任务操作
    async handleTaskAction(task, action) {
      switch (action) {
        case "depart":
          // 出发 -> 状态变为出发中
          // 显示加载提示
          uni.showLoading({
            title: "检查任务状态...",
          });
 
          try {
            // 调用工具类检查任务是否可以出发(包含基本校验和冲突检查)
            const checkResult = await checkTaskCanDepart(task);
 
            uni.hideLoading();
 
            console.log("出发检查结果:", checkResult);
            console.log("valid:", checkResult.valid);
            console.log("conflicts:", checkResult.conflicts);
 
            if (!checkResult.valid) {
              // 校验失败,显示提示信息并提供跳转选项
              const conflicts = checkResult.conflicts || [];
              const conflictInfo = conflicts.length > 0 ? conflicts[0] : null;
 
              console.log("冲突信息:", conflictInfo);
 
              // 如果有冲突任务信息,提供跳转按钮
              if (conflictInfo && conflictInfo.taskId) {
                console.log(
                  "显示带跳转按钮的弹窗,任务ID:",
                  conflictInfo.taskId
                );
 
                const conflictTaskId = conflictInfo.taskId;
                const message =
                  checkResult.message || conflictInfo.message || "存在冲突任务";
 
                uni.showModal({
                  title: "提示",
                  content: message,
                  confirmText: "去处理",
                  cancelText: "知道了",
                  success: function (res) {
                    console.log("弹窗点击结果:", res);
                    if (res.confirm) {
                      // 用户点击"现在去处理",跳转到冲突任务详情页
                      console.log("准备跳转到任务详情页:", conflictTaskId);
                      uni.navigateTo({
                        url: `/pagesTask/detail?id=${conflictTaskId}`,
                      });
                    }
                  },
                  fail: function (err) {
                    console.error("显示弹窗失败:", err);
                  },
                });
              } else {
                // 没有冲突任务ID,只显示提示
                console.log("显示普通提示弹窗");
                uni.showModal({
                  title: "提示",
                  content: checkResult.message || "任务校验失败",
                  showCancel: false,
                  confirmText: "知道了",
                  fail: function (err) {
                    console.error("显示弹窗失败:", err);
                  },
                });
              }
              return;
            }
 
            // 所有检查通过,可以出发
            this.$modal
              .confirm("确定要出发吗?")
              .then(() => {
                this.updateTaskStatus(task.taskId, "DEPARTING", "任务已出发");
              })
              .catch(() => {});
          } catch (error) {
            uni.hideLoading();
            console.error("检查任务状态失败:", error);
            // 检查失败时,仍然允许出发
            this.$modal
              .confirm("检查任务状态失败,是否继续出发?")
              .then(() => {
                this.updateTaskStatus(task.taskId, "DEPARTING", "任务已出发");
              })
              .catch(() => {});
          }
          break;
 
        case "cancel":
          // 取消 -> 显示取消原因选择对话框
          this.currentCancelTask = task;
          this.showCancelReasonDialog();
          break;
 
        case "arrive":
          // 已到达 -> 状态变为已到达
          this.$modal
            .confirm("确认已到达目的地?")
            .then(() => {
              this.updateTaskStatus(task.taskId, "ARRIVED", "已到达目的地");
            })
            .catch(() => {});
          break;
 
        case "forceCancel":
          // 强制结束 -> 状态变为已取消
          this.$modal
            .confirm("确定要强制结束此任务吗?")
            .then(() => {
              this.updateTaskStatus(task.taskId, "CANCELLED", "任务已强制结束");
            })
            .catch(() => {});
          break;
 
        case "return":
          // 已返程 -> 状态变为返程中
          this.$modal
            .confirm("确认开始返程?")
            .then(() => {
              this.updateTaskStatus(task.taskId, "RETURNING", "已开始返程");
            })
            .catch(() => {});
          break;
 
        case "complete":
          // 已完成 -> 状态变为已完成
          // 需要检查是否上传了知情同意书
          this.checkConsentAttachmentAndThen(task.taskId, "COMPLETED", "任务已完成");
          break;
      }
    },
 
    // 更新任务状态
    updateTaskStatus(taskId, status, remark) {
      // 获取GPS位置信息
      this.getLocationAndUpdateStatus(taskId, status, remark);
    },
    
    // 加载取消原因字典
    loadCancelReasonDict() {
      getDicts('task_cancel_reason').then(response => {
        if (response.code === 200 && response.data) {
          this.cancelReasonList = response.data.map(item => ({
            value: item.dictValue,
            label: item.dictLabel
          }))
        }
      }).catch(error => {
        console.error('加载取消原因字典失败:', error)
      })
    },
    
    // 显示取消原因对话框
    showCancelReasonDialog() {
      this.selectedCancelReason = ''
      this.$refs.cancelPopup.open()
    },
    
    // 确认取消任务
    confirmCancelTask() {
      if (!this.selectedCancelReason) {
        this.$modal.showToast('请选择取消原因')
        return
      }
      
      this.$refs.cancelPopup.close()
      
      // 调用更新状态方法,传递取消原因
      this.updateTaskStatusWithCancelReason(this.currentCancelTask.taskId, 'CANCELLED', '任务已取消', this.selectedCancelReason)
    },
    
    // 取消对话框关闭
    closeCancelDialog() {
      this.$refs.cancelPopup.close()
      this.selectedCancelReason = ''
      this.currentCancelTask = null
    },
    
    // 选择取消原因
    selectCancelReason(e) {
      this.selectedCancelReason = this.cancelReasonList[e.detail.value].value
    },
    
    // 带取消原因的状态更新
    updateTaskStatusWithCancelReason(taskId, status, remark, cancelReason) {
      this.getLocationAndUpdateStatus(taskId, status, remark, cancelReason)
    },
    
    // 检查知情同意书附件并更新状态
    async checkConsentAttachmentAndThen(taskId, status, remark) {
      try {
        uni.showLoading({
          title: '检查附件...'
        });
        
        // 注意:这里会被请求拦截器处理,code !== 200 时会 reject
        const response = await checkTaskConsentAttachment(taskId).catch(err => {
          // 拦截器 reject 的情况,返回一个默认对象
          console.log('请求被拦截器 reject,err:', err);
          return { code: -1, msg: '未上传知情同意书' };
        });
        
        uni.hideLoading();
        console.log('检查附件结果:', response);
        
        if (response && response.code === 200) {
          // 已上传知情同意书,继续更新状态
          console.log('已上传知情同意书,继续完成任务');
          this.$modal
            .confirm("确认任务已完成?")
            .then(() => {
              this.updateTaskStatus(taskId, status, remark);
            })
            .catch(() => {});
        } else {
          // 未上传知情同意书或其他错误,阻止完成
          const message = (response && response.msg) || '任务未上传知情同意书,无法完成任务';
          console.log('未上传知情同意书,阻止完成');
          
          this.$modal.confirm(message + '。是否现在去上传?').then(() => {
            // 跳转到任务详情页上传附件
            this.$tab.navigateTo(`/pagesTask/detail?id=${taskId}`);
          }).catch(() => {});
        }
      } catch (error) {
        uni.hideLoading();
        console.error('检查附件异常:', error);
        
        // 如果检查失败(网络异常等),不允许完成任务
        this.$modal.showToast('检查附件状态失败,无法完成任务');
      }
    },
 
    // 获取位置信息并更新状态
    getLocationAndUpdateStatus(taskId, status, remark, cancelReason) {
      const that = this;
 
      // 使用uni.getLocation获取GPS位置
      uni.getLocation({
        type: "gcj02",
        geocode: true,
        altitude: true,
        success: function (res) {
          console.log("GPS定位成功:", res);
 
          const statusData = {
            taskStatus: status,
            remark: remark,
            latitude: res.latitude,
            longitude: res.longitude,
            locationAddress: res.address
              ? res.address.street || res.address.poiName || ""
              : "",
            locationProvince: res.address ? res.address.province || "" : "",
            locationCity: res.address ? res.address.city || "" : "",
            locationDistrict: res.address ? res.address.district || "" : "",
            gpsAccuracy: res.accuracy,
            altitude: res.altitude,
            speed: res.speed,
            heading: res.direction || res.heading,
          };
          
          // 如果有取消原因,添加到请求数据中
          if (cancelReason) {
            statusData.cancelReason = cancelReason
          }
 
          changeTaskStatus(taskId, statusData)
            .then((response) => {
              that.$modal.showToast("状态更新成功");
              that.loadRunningTasks();
            })
            .catch((error) => {
              console.error("更新任务状态失败:", error);
              that.$modal.showToast("状态更新失败,请重试");
            });
        },
        fail: function (err) {
          console.error("GPS定位失败:", err);
 
          that.$modal
            .confirm("GPS定位失败,是否继续更新状态?")
            .then(() => {
              const statusData = {
                taskStatus: status,
                remark: remark,
              };
              
              // 如果有取消原因,添加到请求数据中
              if (cancelReason) {
                statusData.cancelReason = cancelReason
              }
 
              changeTaskStatus(taskId, statusData)
                .then((response) => {
                  that.$modal.showToast("状态更新成功");
                  that.loadRunningTasks();
                })
                .catch((error) => {
                  console.error("更新任务状态失败:", error);
                  that.$modal.showToast("状态更新失败,请重试");
                });
            })
            .catch(() => {});
        },
      });
    },
 
    // 获取状态样式类
    getStatusClass(status) {
      const statusClassMap = {
        PENDING: "status-pending",
        DEPARTING: "status-departing",
        ARRIVED: "status-arrived",
        RETURNING: "status-returning",
        COMPLETED: "status-completed",
        CANCELLED: "status-cancelled",
        IN_PROGRESS: "status-in-progress",
      };
      return statusClassMap[status] || "status-default";
    },
 
    getStatusText(status) {
      // 支持新旧两种状态格式
      const statusMap = {
        // 新格式(数据库状态)
        PENDING: "待处理",
        DEPARTING: "出发中",
        ARRIVED: "已到达",
        RETURNING: "返程中",
        COMPLETED: "已完成",
        CANCELLED: "已取消",
        IN_PROGRESS: "处理中",
        // 旧格式(UI状态)
        pending: "待处理",
        processing: "处理中",
        completed: "已完成",
      };
      return statusMap[status] || "未知";
    },
 
    getTaskTypeText(type) {
      const typeMap = {
        // 新格式(数据库类型)
        MAINTENANCE: "维修保养",
        FUEL: "加油",
        OTHER: "其他",
        EMERGENCY_TRANSFER: "转运任务",
        WELFARE: "福祉车",
        // 旧格式(UI类型)
        maintenance: "维修保养",
        refuel: "加油",
        inspection: "巡检",
        emergency: "转运任务",
        welfare: "福祉车",
      };
      return typeMap[type] || "未知类型";
    },
 
    clickConfirmsubscribeTaskNotify() {
      subscribeManager.subscribeWithConfirm()
        .then((result) => {
          if (result.success) {
            this.hasSubscribed = true;
          }
        })
        .catch((error) => {
          console.log('订阅取消或失败:', error);
        });
    },
 
    // 订阅任务通知(直接调用,不显示确认弹窗)
    subscribeTaskNotify() {
      subscribeManager.subscribeDirect()
        .then((result) => {
          if (result.success) {
            this.hasSubscribed = true;
          }
        })
        .catch((error) => {
          console.log('订阅失败:', error);
        });
    },
  },
};
</script>
 
<style lang="scss">
.home-container {
  padding: 20rpx;
  background-color: #f5f5f5;
  height: 100vh;
  display: flex;
  flex-direction: column;
  // 隐藏滚动条但保持滚动功能
  ::-webkit-scrollbar {
    display: none;
    width: 0 !important;
    height: 0 !important;
    background: transparent;
  }
  
  // Firefox滚动条隐藏
  * {
    scrollbar-width: none; /* Firefox */
  }
  
  // IE/Edge滚动条隐藏
  * {
    -ms-overflow-style: none; /* IE 10+ */
  }
}
 
// 用户信息区域
.user-info-section {
  background-color: white;
  border-radius: 15rpx;
  padding: 30rpx;
  margin-bottom: 20rpx;
  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  flex-shrink: 0; // 防止收缩
 
  .user-info-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
 
    .user-details {
      flex: 1;
 
      .user-info-row {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        margin-bottom: 12rpx;
 
        .user-name {
          font-size: 32rpx;
          font-weight: bold;
          color: #333;
        }
 
        .separator {
          margin: 0 12rpx;
          color: #ddd;
          font-size: 28rpx;
        }
 
        .branch-company {
          font-size: 26rpx;
          color: #666;
          display: flex;
          align-items: center;
        }
 
        .vehicle-info {
          font-size: 26rpx;
          color: #007aff;
          display: flex;
          align-items: center;
        }
      }
 
      .bind-vehicle-btn {
        font-size: 26rpx;
        color: #007aff;
        display: flex;
        align-items: center;
 
        &:active {
          opacity: 0.7;
        }
      }
    }
  }
}
 
// 消息入口
.message-entry {
  display: flex;
  align-items: center;
  background-color: white;
  border-radius: 15rpx;
  padding: 30rpx;
  margin-bottom: 20rpx;
  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  position: relative;
 
  .message-icon {
    margin-right: 20rpx;
  }
 
  .message-text {
    flex: 1;
    font-size: 32rpx;
    color: #333;
  }
 
  .unread-dot {
    position: absolute;
    top: 15rpx;
    right: 60rpx;
    background-color: #ff4d4f;
    color: white;
    border-radius: 50%;
    width: 32rpx;
    height: 32rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20rpx;
  }
 
  .arrow {
    margin-left: 20rpx;
  }
}
 
// 订阅通知横幅
.subscribe-banner {
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, #fff9e6 0%, #fff3e0 100%);
  border-radius: 15rpx;
  padding: 30rpx;
  margin-bottom: 20rpx;
  box-shadow: 0 2rpx 10rpx rgba(255, 149, 0, 0.1);
  border: 1rpx solid #ffe0b2;
 
  .banner-icon {
    margin-right: 20rpx;
    flex-shrink: 0;
  }
 
  .banner-content {
    flex: 1;
 
    .banner-title {
      font-size: 30rpx;
      font-weight: bold;
      color: #333;
      margin-bottom: 8rpx;
    }
 
    .banner-desc {
      font-size: 24rpx;
      color: #666;
      line-height: 1.4;
    }
  }
 
  .banner-action {
    display: flex;
    align-items: center;
    padding: 12rpx 24rpx;
    background-color: white;
    border-radius: 30rpx;
    flex-shrink: 0;
 
    text {
      font-size: 26rpx;
      color: #007aff;
      margin-right: 4rpx;
    }
  }
 
  &:active {
    opacity: 0.9;
  }
}
 
// 正在运行的任务标题
.running-tasks-header {
  margin-bottom: 20rpx;
  flex-shrink: 0; // 防止收缩
 
  .header-title {
    font-size: 36rpx;
    font-weight: bold;
    color: #333;
  }
}
 
// 正在运行的任务列表
.running-tasks-section {
  flex: 1;
  background-color: white;
  border-radius: 15rpx;
  padding: 30rpx;
  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  // 隐藏滚动条但保持滚动功能
  ::-webkit-scrollbar {
    display: none;
    width: 0 !important;
    height: 0 !important;
    background: transparent;
  }
 
  // Firefox滚动条隐藏
  * {
    scrollbar-width: none; /* Firefox */
  }
 
  // IE/Edge滚动条隐藏
  * {
    -ms-overflow-style: none; /* IE 10+ */
  }
 
  .task-list {
    .task-item {
      background-color: #fafafa;
      border-radius: 15rpx;
      margin-bottom: 30rpx;
      overflow: hidden;
 
      .task-main {
        padding: 30rpx;
        border-bottom: 1rpx solid #f0f0f0;
 
        // 任务头部:标题和状态
        .task-header {
          display: flex;
          justify-content: space-between;
          align-items: flex-start;
          margin-bottom: 15rpx;
 
          .task-title {
            flex: 1;
            font-size: 32rpx;
            font-weight: bold;
            padding-right: 20rpx;
            line-height: 1.4;
          }
 
          .task-status {
            padding: 8rpx 20rpx;
            border-radius: 30rpx;
            font-size: 24rpx;
            white-space: nowrap;
            flex-shrink: 0;
 
            // 待处理 - 橙色
            &.status-pending {
              background-color: #fff3e0;
              color: #ff9500;
            }
 
            // 出发中 - 蓝色
            &.status-departing {
              background-color: #e3f2fd;
              color: #007aff;
            }
 
            // 已到达 - 紫色
            &.status-arrived {
              background-color: #f3e5f5;
              color: #9c27b0;
            }
 
            // 返程中 - 青色
            &.status-returning {
              background-color: #e0f2f1;
              color: #009688;
            }
 
            // 已完成 - 绿色
            &.status-completed {
              background-color: #e8f5e9;
              color: #34c759;
            }
 
            // 已取消 - 灰色
            &.status-cancelled {
              background-color: #f5f5f5;
              color: #999;
            }
 
            // 处理中 (兼容旧数据) - 蓝色
            &.status-in-progress {
              background-color: #e3f2fd;
              color: #007aff;
            }
 
            // 默认样式
            &.status-default {
              background-color: #f5f5f5;
              color: #666;
            }
          }
        }
 
        // 任务编号和时间在同一行显示
        .task-code-row {
          margin-bottom: 15rpx;
          padding: 10rpx 0;
          border-bottom: 1rpx dashed #e0e0e0;
          display: flex;
          justify-content: space-between;
 
          .task-code {
            font-size: 28rpx;
            color: #333;
            font-weight: 500;
            font-family: monospace;
          }
          
          .task-time {
            font-size: 28rpx;
            color: #333;
            font-weight: 500;
            font-family: monospace;
          }
        }
 
        .task-info {
          .info-row {
            display: flex;
            margin-bottom: 15rpx;
 
            &:last-child {
              margin-bottom: 0;
            }
 
            .info-item {
              flex: 1;
              display: flex;
 
              .label {
                font-size: 26rpx;
                color: #666;
                margin-right: 10rpx;
                white-space: nowrap;
              }
 
              .value {
                font-size: 26rpx;
                flex: 1;
                word-break: break-all;
                overflow-wrap: break-word;
                line-height: 1.5;
                max-height: none;
                overflow: visible;
              }
            }
          }
        }
      }
 
      .task-actions {
        display: flex;
        padding: 20rpx;
 
        .action-btn {
          flex: 1;
          height: 70rpx;
          border-radius: 10rpx;
          font-size: 26rpx;
          margin: 0 5rpx;
          background-color: #f0f0f0;
          color: #333;
 
          &.primary {
            background-color: #007aff;
            color: white;
          }
 
          &.cancel {
            background-color: #ff3b30;
            color: white;
          }
 
          &.disabled {
            opacity: 0.5;
          }
 
          &:first-child {
            margin-left: 0;
          }
 
          &:last-child {
            margin-right: 0;
          }
        }
      }
    }
 
    .no-data {
      text-align: center;
      padding: 100rpx 0;
      color: #999;
 
      text {
        display: block;
        margin-top: 20rpx;
      }
    }
    
    .load-more {
      display: flex;
      justify-content: center;
      align-items: center;
      padding: 20rpx 0;
      color: #999;
      font-size: 28rpx;
      
      &.no-more {
        color: #666;
      }
    }
    
    .vip-tag {
      display: inline-block;
      padding: 2rpx 8rpx;
      font-size: 20rpx;
      color: #fff;
      background-color: #ff0000;
      border-radius: 4rpx;
      margin-left: 10rpx;
      vertical-align: middle;
    }
    
    .hq-tag {
      display: inline-block;
      padding: 2rpx 8rpx;
      font-size: 20rpx;
      color: #fff;
      background-color: #5856d6;
      border-radius: 4rpx;
      margin-left: 10rpx;
      vertical-align: middle;
    }
  }
}
 
// 取消原因对话框样式
.cancel-dialog {
  width: 600rpx;
  background-color: white;
  border-radius: 20rpx;
  padding: 40rpx;
  
  .dialog-title {
    font-size: 32rpx;
    font-weight: bold;
    text-align: center;
    margin-bottom: 30rpx;
    color: #333;
  }
  
  .reason-picker {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20rpx 30rpx;
    background-color: #f5f5f5;
    border-radius: 10rpx;
    margin-bottom: 30rpx;
    
    .picker-label {
      font-size: 28rpx;
      color: #666;
    }
    
    .picker-value {
      flex: 1;
      text-align: right;
      margin: 0 20rpx;
      font-size: 28rpx;
      color: #333;
    }
  }
  
  .dialog-buttons {
    display: flex;
    gap: 20rpx;
    
    button {
      flex: 1;
      height: 80rpx;
      line-height: 80rpx;
      border-radius: 10rpx;
      font-size: 28rpx;
      border: none;
    }
    
    .cancel-btn {
      background-color: #f5f5f5;
      color: #666;
    }
    
    .confirm-btn {
      background-color: #007AFF;
      color: white;
    }
  }
}
</style>