audit-records.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. <template>
  2. <view class="audit-records">
  3. <!-- 顶部导航栏 -->
  4. <view class="header">
  5. <view class="back-btn" @click="goBack"></view>
  6. <text class="header-title">撮合成功通知</text>
  7. <view class="placeholder"></view>
  8. </view>
  9. <scroll-view scroll-y class="content" @scrolltolower="loadMore">
  10. <!-- 加载中 -->
  11. <view v-if="loading && records.length === 0" class="loading-container">
  12. <text>加载中...</text>
  13. </view>
  14. <!-- 记录列表 -->
  15. <view v-else-if="records.length > 0" class="record-list">
  16. <view
  17. v-for="record in records"
  18. :key="record.id"
  19. class="record-item"
  20. :class="{ unread: !record.isRead && (record.auditStatus === 1 || record.auditStatus === 2) }"
  21. @click="openDetail(record)"
  22. >
  23. <!-- 状态标签 -->
  24. <view class="status-tag"
  25. :class="{
  26. 'status-pending': record.auditStatus === 0,
  27. 'status-success': record.auditStatus === 1,
  28. 'status-fail': record.auditStatus === 2,
  29. 'status-checking': record.auditStatus === 3
  30. }">
  31. {{ getStatusText(record.auditStatus) }}
  32. </view>
  33. <!-- 未读红点 -->
  34. <view v-if="!record.isRead && (record.auditStatus === 1 || record.auditStatus === 2)" class="unread-dot"></view>
  35. <!-- 记录内容 -->
  36. <view class="record-content">
  37. <view class="record-title">
  38. <text class="couple-names">{{ record.maleRealName }} & {{ record.femaleRealName }}</text>
  39. <text class="case-type">{{ record.caseType === 1 ? '订婚' : '结婚' }}</text>
  40. </view>
  41. <view class="record-summary">
  42. <text v-if="record.auditStatus === 0">您提交的撮合成功案例正在等待审核</text>
  43. <text v-else-if="record.auditStatus === 3">您的案例正在核实中,请耐心等待</text>
  44. <text v-else-if="record.auditStatus === 1">
  45. 恭喜!审核通过,获得{{ record.pointsReward || 0 }}积分
  46. <text v-if="record.cashReward > 0">+{{ record.cashReward }}元现金</text>
  47. 奖励
  48. </text>
  49. <text v-else-if="record.auditStatus === 2">审核未通过:{{ record.auditRemark || '未说明原因' }}</text>
  50. </view>
  51. <view class="record-time">{{ formatTime(record.createdAt) }}</view>
  52. </view>
  53. </view>
  54. <!-- 加载更多 -->
  55. <view v-if="loading" class="loading-more">
  56. <text>加载中...</text>
  57. </view>
  58. <view v-else-if="!hasMore" class="no-more">
  59. <text>没有更多了</text>
  60. </view>
  61. </view>
  62. <!-- 空状态 -->
  63. <view v-else class="empty-container">
  64. <view class="empty-icon">📋</view>
  65. <text class="empty-text">暂无审核记录</text>
  66. <text class="empty-hint">提交撮合成功案例后,审核进度将在这里显示</text>
  67. </view>
  68. </scroll-view>
  69. <!-- 详情弹窗 -->
  70. <uni-popup ref="detailPopup" type="center">
  71. <view class="detail-popup" v-if="currentRecord">
  72. <view class="popup-header">
  73. <text class="popup-title">审核详情</text>
  74. <view class="close-btn" @click="closeDetail">×</view>
  75. </view>
  76. <view class="popup-content">
  77. <!-- 状态 -->
  78. <view class="detail-status"
  79. :class="{
  80. 'status-pending': currentRecord.auditStatus === 0,
  81. 'status-success': currentRecord.auditStatus === 1,
  82. 'status-fail': currentRecord.auditStatus === 2,
  83. 'status-checking': currentRecord.auditStatus === 3
  84. }">
  85. <view class="status-icon" v-if="currentRecord.auditStatus !== 2">
  86. <text v-if="currentRecord.auditStatus === 0">⏳</text>
  87. <text v-else-if="currentRecord.auditStatus === 3">🔍</text>
  88. <text v-else-if="currentRecord.auditStatus === 1">✅</text>
  89. </view>
  90. <text class="status-text">{{ getStatusText(currentRecord.auditStatus) }}</text>
  91. </view>
  92. <!-- 案例信息 -->
  93. <view class="detail-section">
  94. <view class="section-title">案例信息</view>
  95. <view class="info-row">
  96. <text class="info-label">男方姓名</text>
  97. <text class="info-value">{{ currentRecord.maleRealName }}</text>
  98. </view>
  99. <view class="info-row">
  100. <text class="info-label">女方姓名</text>
  101. <text class="info-value">{{ currentRecord.femaleRealName }}</text>
  102. </view>
  103. <view class="info-row">
  104. <text class="info-label">案例类型</text>
  105. <text class="info-value">{{ currentRecord.caseType === 1 ? '订婚' : '结婚' }}</text>
  106. </view>
  107. <view class="info-row" v-if="currentRecord.caseDate">
  108. <text class="info-label">成功日期</text>
  109. <text class="info-value">{{ currentRecord.caseDate }}</text>
  110. </view>
  111. <view class="info-row">
  112. <text class="info-label">提交时间</text>
  113. <text class="info-value">{{ formatTime(currentRecord.createdAt) }}</text>
  114. </view>
  115. </view>
  116. <!-- 审核通过:显示奖励 -->
  117. <view v-if="currentRecord.auditStatus === 1" class="detail-section reward-section">
  118. <view class="section-title">🎉 奖励信息</view>
  119. <view class="reward-content">
  120. <view class="reward-item" v-if="currentRecord.pointsReward > 0">
  121. <text class="reward-icon">🏆</text>
  122. <text class="reward-text">积分奖励:+{{ currentRecord.pointsReward }}积分</text>
  123. </view>
  124. <view class="reward-item" v-if="currentRecord.cashReward > 0">
  125. <text class="reward-icon">💰</text>
  126. <text class="reward-text">现金奖励:+{{ currentRecord.cashReward }}元</text>
  127. </view>
  128. <view class="reward-status">
  129. <text v-if="currentRecord.rewardStatus === 1" class="issued">奖励已发放</text>
  130. <text v-else class="pending">奖励待发放</text>
  131. </view>
  132. </view>
  133. </view>
  134. <!-- 审核失败:显示原因 -->
  135. <view v-if="currentRecord.auditStatus === 2" class="detail-section fail-section">
  136. <view class="section-title">审核未通过</view>
  137. <view class="fail-reason">
  138. <text>{{ currentRecord.auditRemark || '未说明具体原因,如有疑问请联系客服' }}</text>
  139. </view>
  140. <view class="fail-hint" @click="goToResubmit">
  141. <text>您可以修改后重新提交审核</text>
  142. <text class="resubmit-link">去提交 ></text>
  143. </view>
  144. </view>
  145. <!-- 待审核/核实中 -->
  146. <view v-if="currentRecord.auditStatus === 0 || currentRecord.auditStatus === 3" class="detail-section pending-section">
  147. <view class="section-title">{{ currentRecord.auditStatus === 0 ? '⏳ 等待审核' : '🔍 核实中' }}</view>
  148. <view class="pending-hint">
  149. <text v-if="currentRecord.auditStatus === 0">您的案例已提交,工作人员将尽快审核,请耐心等待</text>
  150. <text v-else>工作人员正在核实您的案例信息,请保持电话畅通</text>
  151. </view>
  152. </view>
  153. <!-- 审核时间 -->
  154. <view v-if="currentRecord.updatedAt" class="detail-section">
  155. <view class="info-row">
  156. <text class="info-label">审核时间</text>
  157. <text class="info-value">{{ formatTime(currentRecord.updatedAt) }}</text>
  158. </view>
  159. </view>
  160. </view>
  161. <view class="popup-footer">
  162. <button class="confirm-btn" @click="closeDetail">我知道了</button>
  163. </view>
  164. </view>
  165. </uni-popup>
  166. </view>
  167. </template>
  168. <script>
  169. import api from '@/utils/api.js'
  170. export default {
  171. data() {
  172. return {
  173. loading: false,
  174. records: [],
  175. currentRecord: null,
  176. matchmakerId: null,
  177. pageNum: 1,
  178. pageSize: 20,
  179. hasMore: true
  180. }
  181. },
  182. onLoad() {
  183. this.loadMatchmakerInfo()
  184. },
  185. onShow() {
  186. // 页面显示时刷新列表
  187. if (this.matchmakerId) {
  188. this.refreshList()
  189. }
  190. },
  191. methods: {
  192. goBack() {
  193. uni.navigateBack()
  194. },
  195. async loadMatchmakerInfo() {
  196. try {
  197. const userInfo = uni.getStorageSync('userInfo')
  198. if (userInfo && userInfo.userId) {
  199. const matchmakerInfo = await api.matchmaker.getByUserId(userInfo.userId)
  200. if (matchmakerInfo) {
  201. this.matchmakerId = matchmakerInfo.matchmakerId || matchmakerInfo.matchmaker_id || null
  202. if (this.matchmakerId) {
  203. this.loadRecords()
  204. } else {
  205. uni.showToast({ title: '未找到红娘信息', icon: 'none' })
  206. }
  207. }
  208. }
  209. } catch (e) {
  210. console.error('获取红娘信息失败', e)
  211. uni.showToast({ title: '获取红娘信息失败', icon: 'none' })
  212. }
  213. },
  214. async loadRecords() {
  215. if (this.loading || !this.hasMore) return
  216. this.loading = true
  217. try {
  218. const res = await api.successCaseUpload.getAuditRecords(
  219. this.matchmakerId,
  220. null, // 不筛选状态,显示全部
  221. this.pageNum,
  222. this.pageSize
  223. )
  224. const pageData = res?.records || res?.data?.records || []
  225. const total = res?.total || res?.data?.total || 0
  226. if (this.pageNum === 1) {
  227. this.records = pageData
  228. } else {
  229. this.records = [...this.records, ...pageData]
  230. }
  231. this.hasMore = this.records.length < total
  232. this.pageNum++
  233. } catch (e) {
  234. console.error('加载审核记录失败', e)
  235. uni.showToast({ title: '加载失败', icon: 'none' })
  236. } finally {
  237. this.loading = false
  238. }
  239. },
  240. refreshList() {
  241. this.pageNum = 1
  242. this.hasMore = true
  243. this.records = []
  244. this.loadRecords()
  245. },
  246. loadMore() {
  247. if (this.hasMore && !this.loading) {
  248. this.loadRecords()
  249. }
  250. },
  251. async openDetail(record) {
  252. this.currentRecord = record
  253. this.$refs.detailPopup.open()
  254. // 如果是已审核完成且未读,标记为已读
  255. if ((record.auditStatus === 1 || record.auditStatus === 2) && !record.isRead) {
  256. try {
  257. await api.successCaseUpload.markAsRead(record.id)
  258. // 更新本地状态
  259. record.isRead = 1
  260. } catch (e) {
  261. console.error('标记已读失败', e)
  262. }
  263. }
  264. },
  265. closeDetail() {
  266. this.$refs.detailPopup.close()
  267. this.currentRecord = null
  268. },
  269. // 跳转到重新提交审核页面
  270. goToResubmit() {
  271. if (!this.currentRecord) return
  272. // 关闭弹窗
  273. this.$refs.detailPopup.close()
  274. // 跳转到提交页面,携带记录ID用于回显数据
  275. uni.navigateTo({
  276. url: `/pages/matchmaker-workbench/success-case-upload?resubmitId=${this.currentRecord.id}`
  277. })
  278. },
  279. getStatusText(status) {
  280. const statusMap = {
  281. 0: '待审核',
  282. 1: '审核通过',
  283. 2: '审核失败',
  284. 3: '核实中'
  285. }
  286. return statusMap[status] || '未知'
  287. },
  288. // getStatusClass 方法已移除,改用内联对象语法
  289. formatTime(timeStr) {
  290. if (!timeStr) return ''
  291. const date = new Date(timeStr)
  292. const now = new Date()
  293. const diff = now - date
  294. // 一分钟内
  295. if (diff < 60000) {
  296. return '刚刚'
  297. }
  298. // 一小时内
  299. if (diff < 3600000) {
  300. return Math.floor(diff / 60000) + '分钟前'
  301. }
  302. // 今天
  303. if (date.toDateString() === now.toDateString()) {
  304. return date.getHours() + ':' + String(date.getMinutes()).padStart(2, '0')
  305. }
  306. // 昨天
  307. const yesterday = new Date(now)
  308. yesterday.setDate(yesterday.getDate() - 1)
  309. if (date.toDateString() === yesterday.toDateString()) {
  310. return '昨天 ' + date.getHours() + ':' + String(date.getMinutes()).padStart(2, '0')
  311. }
  312. // 更早
  313. const month = date.getMonth() + 1
  314. const day = date.getDate()
  315. return `${month}-${day} ${date.getHours()}:${String(date.getMinutes()).padStart(2, '0')}`
  316. }
  317. }
  318. }
  319. </script>
  320. <style lang="scss" scoped>
  321. .audit-records {
  322. min-height: 100vh;
  323. background: linear-gradient(180deg, #fff1f7 0%, #f6ebff 45%, #fbf7ff 75%, #ffffff 100%);
  324. display: flex;
  325. flex-direction: column;
  326. }
  327. /* 顶部导航栏 */
  328. .header {
  329. display: flex;
  330. align-items: center;
  331. justify-content: space-between;
  332. padding: 25rpx 30rpx;
  333. padding-top: calc(25rpx + env(safe-area-inset-top));
  334. background: transparent;
  335. .back-btn {
  336. width: 70rpx;
  337. height: 70rpx;
  338. display: flex;
  339. align-items: center;
  340. justify-content: center;
  341. background: rgba(240, 240, 240, 0.5);
  342. border-radius: 50%;
  343. background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23333"><path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/></svg>');
  344. background-size: 40rpx 40rpx;
  345. background-repeat: no-repeat;
  346. background-position: center;
  347. }
  348. .header-title {
  349. font-size: 38rpx;
  350. font-weight: bold;
  351. color: #333;
  352. }
  353. .placeholder {
  354. width: 70rpx;
  355. }
  356. }
  357. .content {
  358. flex: 1;
  359. padding: 20rpx 24rpx;
  360. box-sizing: border-box;
  361. }
  362. /* 记录列表 */
  363. .record-list {
  364. padding-bottom: 40rpx;
  365. }
  366. .record-item {
  367. background: #ffffff;
  368. border-radius: 24rpx;
  369. padding: 28rpx;
  370. margin-bottom: 20rpx;
  371. box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.05);
  372. position: relative;
  373. &.unread {
  374. background: linear-gradient(135deg, #fff8fb 0%, #fef5ff 100%);
  375. border: 2rpx solid rgba(233, 30, 99, 0.15);
  376. }
  377. }
  378. /* 状态标签 */
  379. .status-tag {
  380. position: absolute;
  381. top: 0;
  382. left: 28rpx;
  383. padding: 6rpx 16rpx;
  384. border-radius: 0 0 12rpx 12rpx;
  385. font-size: 22rpx;
  386. font-weight: 500;
  387. &.status-pending {
  388. background: #fff3e0;
  389. color: #f57c00;
  390. }
  391. &.status-success {
  392. background: #e8f5e9;
  393. color: #43a047;
  394. }
  395. &.status-fail {
  396. background: #ffebee;
  397. color: #e53935;
  398. }
  399. &.status-checking {
  400. background: #e3f2fd;
  401. color: #1976d2;
  402. }
  403. }
  404. /* 未读红点 */
  405. .unread-dot {
  406. position: absolute;
  407. top: 20rpx;
  408. right: 20rpx;
  409. width: 16rpx;
  410. height: 16rpx;
  411. background: #e91e63;
  412. border-radius: 50%;
  413. }
  414. /* 记录内容 */
  415. .record-content {
  416. padding-top: 30rpx;
  417. }
  418. .record-title {
  419. display: flex;
  420. align-items: center;
  421. margin-bottom: 12rpx;
  422. .couple-names {
  423. font-size: 32rpx;
  424. font-weight: 600;
  425. color: #333;
  426. margin-right: 16rpx;
  427. }
  428. .case-type {
  429. font-size: 24rpx;
  430. color: #9c27b0;
  431. background: #f3e5f5;
  432. padding: 4rpx 12rpx;
  433. border-radius: 8rpx;
  434. }
  435. }
  436. .record-summary {
  437. font-size: 26rpx;
  438. color: #666;
  439. line-height: 1.5;
  440. margin-bottom: 12rpx;
  441. }
  442. .record-time {
  443. font-size: 24rpx;
  444. color: #999;
  445. }
  446. /* 加载状态 */
  447. .loading-container,
  448. .empty-container {
  449. display: flex;
  450. flex-direction: column;
  451. justify-content: center;
  452. align-items: center;
  453. padding: 100rpx 0;
  454. color: #999;
  455. font-size: 28rpx;
  456. }
  457. .empty-icon {
  458. font-size: 80rpx;
  459. margin-bottom: 20rpx;
  460. }
  461. .empty-text {
  462. font-size: 32rpx;
  463. color: #666;
  464. margin-bottom: 12rpx;
  465. }
  466. .empty-hint {
  467. font-size: 26rpx;
  468. color: #999;
  469. }
  470. .loading-more,
  471. .no-more {
  472. text-align: center;
  473. padding: 30rpx 0;
  474. color: #999;
  475. font-size: 26rpx;
  476. }
  477. /* 详情弹窗 */
  478. .detail-popup {
  479. width: 650rpx;
  480. background: #ffffff;
  481. border-radius: 24rpx;
  482. overflow: hidden;
  483. }
  484. .popup-header {
  485. display: flex;
  486. align-items: center;
  487. justify-content: space-between;
  488. padding: 30rpx;
  489. border-bottom: 1rpx solid #f0f0f0;
  490. .popup-title {
  491. font-size: 34rpx;
  492. font-weight: 600;
  493. color: #333;
  494. }
  495. .close-btn {
  496. width: 50rpx;
  497. height: 50rpx;
  498. display: flex;
  499. align-items: center;
  500. justify-content: center;
  501. font-size: 40rpx;
  502. color: #999;
  503. }
  504. }
  505. .popup-content {
  506. padding: 30rpx;
  507. max-height: 70vh;
  508. overflow-y: auto;
  509. }
  510. /* 详情状态 */
  511. .detail-status {
  512. display: flex;
  513. flex-direction: column;
  514. align-items: center;
  515. padding: 30rpx;
  516. border-radius: 16rpx;
  517. margin-bottom: 30rpx;
  518. &.status-pending {
  519. background: #fff3e0;
  520. }
  521. &.status-success {
  522. background: #e8f5e9;
  523. }
  524. &.status-fail {
  525. background: #ffebee;
  526. }
  527. &.status-checking {
  528. background: #e3f2fd;
  529. }
  530. .status-icon {
  531. font-size: 60rpx;
  532. margin-bottom: 12rpx;
  533. }
  534. .status-text {
  535. font-size: 32rpx;
  536. font-weight: 600;
  537. }
  538. }
  539. /* 详情区块 */
  540. .detail-section {
  541. margin-bottom: 30rpx;
  542. .section-title {
  543. font-size: 28rpx;
  544. font-weight: 600;
  545. color: #333;
  546. margin-bottom: 16rpx;
  547. padding-bottom: 12rpx;
  548. border-bottom: 1rpx solid #f0f0f0;
  549. }
  550. }
  551. .info-row {
  552. display: flex;
  553. justify-content: space-between;
  554. padding: 12rpx 0;
  555. .info-label {
  556. font-size: 26rpx;
  557. color: #999;
  558. }
  559. .info-value {
  560. font-size: 26rpx;
  561. color: #333;
  562. }
  563. }
  564. /* 奖励区块 */
  565. .reward-section {
  566. background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
  567. padding: 24rpx;
  568. border-radius: 16rpx;
  569. .section-title {
  570. border-bottom: none;
  571. padding-bottom: 0;
  572. }
  573. }
  574. .reward-content {
  575. .reward-item {
  576. display: flex;
  577. align-items: center;
  578. padding: 12rpx 0;
  579. .reward-icon {
  580. font-size: 36rpx;
  581. margin-right: 12rpx;
  582. }
  583. .reward-text {
  584. font-size: 28rpx;
  585. color: #333;
  586. font-weight: 500;
  587. }
  588. }
  589. .reward-status {
  590. margin-top: 16rpx;
  591. text-align: center;
  592. .issued {
  593. color: #43a047;
  594. font-size: 26rpx;
  595. }
  596. .pending {
  597. color: #f57c00;
  598. font-size: 26rpx;
  599. }
  600. }
  601. }
  602. /* 失败区块 */
  603. .fail-section {
  604. background: #fff5f5;
  605. padding: 24rpx;
  606. border-radius: 16rpx;
  607. .section-title {
  608. border-bottom: none;
  609. padding-bottom: 0;
  610. color: #e53935;
  611. }
  612. .fail-reason {
  613. font-size: 28rpx;
  614. color: #333;
  615. line-height: 1.6;
  616. padding: 12rpx 0;
  617. }
  618. .fail-hint {
  619. font-size: 24rpx;
  620. color: #999;
  621. margin-top: 12rpx;
  622. display: flex;
  623. justify-content: space-between;
  624. align-items: center;
  625. .resubmit-link {
  626. color: #9c27b0;
  627. font-weight: 500;
  628. }
  629. }
  630. }
  631. /* 待审核区块 */
  632. .pending-section {
  633. background: #f5f5f5;
  634. padding: 24rpx;
  635. border-radius: 16rpx;
  636. .section-title {
  637. border-bottom: none;
  638. padding-bottom: 0;
  639. }
  640. .pending-hint {
  641. font-size: 26rpx;
  642. color: #666;
  643. line-height: 1.6;
  644. }
  645. }
  646. /* 弹窗底部 */
  647. .popup-footer {
  648. padding: 20rpx 30rpx 30rpx;
  649. .confirm-btn {
  650. width: 100%;
  651. height: 88rpx;
  652. background: linear-gradient(135deg, #e91e63 0%, #9c27b0 100%);
  653. color: #ffffff;
  654. font-size: 32rpx;
  655. font-weight: 500;
  656. border-radius: 44rpx;
  657. display: flex;
  658. align-items: center;
  659. justify-content: center;
  660. border: none;
  661. }
  662. }
  663. </style>