remindCustomer.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <div class="service-records-page">
  3. <custom-header name="提醒客户"></custom-header>
  4. <div class="record-list">
  5. <div v-for="(item, index) in recordList" :key="index" class="record-card">
  6. <img class="thumb" :src="item.postInfo.media && item.postInfo.media[0]" alt="农场缩略图" />
  7. <div class="card-body" @click="handleItemClick(item)">
  8. <div class="card-body-left">
  9. <div class="title van-multi-ellipsis--l2">{{ item.postInfo.title }}</div>
  10. <div class="date">{{ formatDate(item.postInfo.createTime) }}</div>
  11. </div>
  12. <div class="forward-btn" @click.stop="showShareSheet = true">转发</div>
  13. </div>
  14. </div>
  15. </div>
  16. </div>
  17. <fn-share-sheet v-model:show="showShareSheet" :options="shareOptions" @select="handleShareSelect" />
  18. </template>
  19. <script setup>
  20. import { ref, onMounted } from "vue";
  21. import customHeader from "@/components/customHeader.vue";
  22. import { useRouter } from "vue-router";
  23. import FnShareSheet from "@/components/pageComponents/FnShareSheet.vue";
  24. const router = useRouter();
  25. // 服务记录列表数据
  26. const recordList = ref([]);
  27. const showShareSheet = ref(false);
  28. const shareOptions = ref([
  29. { name: "微信", icon: "wechat", type: "wechat" },
  30. ]);
  31. const handleShareSelect = (option) => {
  32. console.log("option", option);
  33. };
  34. onMounted(() => {
  35. getListWithAnswer();
  36. });
  37. const getListWithAnswer = async () => {
  38. const { data } = await VE_API.user.listWithAnswer({farmId:'93684'});
  39. if (data.length) {
  40. recordList.value = data
  41. }
  42. };
  43. const formatDate = (dateStr) => {
  44. if (!dateStr) return "--";
  45. const date = new Date(dateStr);
  46. if (Number.isNaN(date.getTime())) return dateStr;
  47. const y = date.getFullYear();
  48. const m = `${date.getMonth() + 1}`.padStart(2, "0");
  49. const d = `${date.getDate()}`.padStart(2, "0");
  50. return `${y}-${m}-${d}`;
  51. };
  52. // 处理列表项点击
  53. const handleItemClick = (data) => {
  54. const questInfo = {
  55. quest: data.quest,
  56. answer: data.answerOptions,
  57. }
  58. router.push(`/warning_detail?id=${data.postInfo.postId}&questInfo=${JSON.stringify(questInfo)}`);
  59. };
  60. </script>
  61. <style lang="scss" scoped>
  62. .service-records-page {
  63. width: 100%;
  64. min-height: 100vh;
  65. background: #f5f5f5;
  66. .record-list {
  67. padding: 10px 12px;
  68. display: flex;
  69. flex-direction: column;
  70. gap: 10px;
  71. }
  72. .record-card {
  73. display: flex;
  74. gap: 12px;
  75. padding: 12px 10px;
  76. background: #ffffff;
  77. border-radius: 12px;
  78. align-items: center;
  79. height: 98px;
  80. box-sizing: border-box;
  81. .thumb {
  82. width: 80px;
  83. height: 74px;
  84. border-radius: 8px;
  85. object-fit: cover;
  86. }
  87. .card-body {
  88. width: calc(100% - 80px - 12px);
  89. height: 100%;
  90. display: flex;
  91. align-items: center;
  92. justify-content: space-between;
  93. .card-body-left{
  94. width: calc(100% - 62px - 12px);
  95. height: 95%;
  96. display: flex;
  97. flex-direction: column;
  98. justify-content: space-between;
  99. .date {
  100. font-size: 13px;
  101. color: #86909C;
  102. margin-top: 4px;
  103. }
  104. }
  105. }
  106. .forward-btn {
  107. padding: 6px 19px;
  108. background: rgba(33, 153, 248, 0.1);
  109. color: #2199F8;
  110. border-radius: 25px;
  111. font-size: 12px;
  112. }
  113. }
  114. }
  115. </style>