agriExecutePopup.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <popup v-model:show="showValue" round class="agri-execute-popup" :z-index="zIndex" teleport="body">
  3. <div class="popup-content">
  4. <!-- 头部区域 -->
  5. <div class="popup-header">
  6. <img class="expert-logo" src="@/assets/img/home/bird.png" alt="" />
  7. <!-- <img class="expert-logo" :src="popupData?.expertAvatar" alt="" /> -->
  8. <div class="expert-info">
  9. <!-- <span>{{ popupData?.expertName || "韦帮稳" }}专家</span> -->
  10. <span>飞鸟</span>
  11. <span class="invite-text">邀请您进行农情互动</span>
  12. </div>
  13. </div>
  14. <div class="popup-tips">为了更好校准您的农事执行时间</div>
  15. <!-- 标题 -->
  16. <div class="popup-title">{{ popupData.subjectName }}</div>
  17. <!-- 异常信息区域 -->
  18. <div class="abnormal-info" v-if="popupData.subjectRemark">
  19. {{ popupData.subjectRemark }}
  20. </div>
  21. <!-- 图片区域 -->
  22. <img :src="popupData.exampleImg" alt="农事执行图片" class="execute-image" />
  23. <!-- 按钮区域 -->
  24. <div class="popup-buttons">
  25. <div class="btn-later" @click="handleLater" v-if="popupData.laterBtn">
  26. {{ popupData.laterButtonText || "稍后执行" }}
  27. </div>
  28. <div class="btn-executed" @click="handleExecuted">
  29. 开始采集
  30. </div>
  31. </div>
  32. </div>
  33. </popup>
  34. </template>
  35. <script setup>
  36. import { Popup } from "vant";
  37. import { ref } from "vue";
  38. import { useRouter } from "vue-router";
  39. const router = useRouter();
  40. const props = defineProps({
  41. // 遮罩层z-index
  42. zIndex: {
  43. type: Number,
  44. default: 9999,
  45. },
  46. });
  47. const emit = defineEmits(["later"]);
  48. const showValue = ref(false);
  49. // 稍后执行
  50. const handleLater = () => {
  51. emit("later");
  52. emit("update:show", false);
  53. };
  54. // 我已执行
  55. const handleExecuted = () => {
  56. showValue.value = false;
  57. router.push(`/interaction_list?farmId=${farmIdData.value}&regionId=${popupData.value.regionId}&interactionTypeId=${popupData.value.interactionTypeId}`);
  58. };
  59. const popupData = ref({});
  60. const farmIdData = ref(null);
  61. const showPopup = async (farmId) => {
  62. farmIdData.value = farmId;
  63. const { data } = await VE_API.home.hasUnrepliedTriggeredInteraction({ subjectId: localStorage.getItem("selectedFarmId") });
  64. if (data && data.id != null) {
  65. popupData.value = data;
  66. showValue.value = true;
  67. popupData.value.exampleImg = JSON.parse(data.exampleImagesJson)[0];
  68. }
  69. };
  70. // const handleClosePopup = () => {
  71. // VE_API.monitor.closeTodayPopup({
  72. // interactionId: popupData.value.id,
  73. // });
  74. // }
  75. defineExpose({
  76. showPopup,
  77. });
  78. </script>
  79. <style scoped lang="scss">
  80. .agri-execute-popup {
  81. width: 100%;
  82. padding: 16px;
  83. border-radius: 12px;
  84. .popup-content {
  85. display: flex;
  86. flex-direction: column;
  87. }
  88. .popup-tips {
  89. color: #000;
  90. font-size: 16px;
  91. margin-bottom: 5px;
  92. }
  93. .popup-header {
  94. margin-bottom: 5px;
  95. display: flex;
  96. align-items: center;
  97. gap: 6px;
  98. .expert-logo {
  99. width: 22px;
  100. height: 22px;
  101. border-radius: 50%;
  102. object-fit: cover;
  103. }
  104. .expert-info {
  105. font-size: 12px;
  106. color: #000;
  107. .invite-text {
  108. margin-left: 6px;
  109. color: rgba(0, 0, 0, 0.4);
  110. }
  111. }
  112. }
  113. .popup-title {
  114. font-size: 26px;
  115. // margin-bottom: 14px;
  116. font-family: "PangMenZhengDao";
  117. color: #0785E8;
  118. }
  119. .abnormal-info {
  120. padding: 12px;
  121. color: #2199f8;
  122. background: rgba(33, 153, 248, 0.1);
  123. padding: 3px 9px 9px;
  124. border-radius: 8px;
  125. position: relative;
  126. margin-top: 15px;
  127. // 三角形小尖尖
  128. &::before {
  129. content: "";
  130. position: absolute;
  131. top: -8px;
  132. left: 20px;
  133. width: 0;
  134. height: 0;
  135. border-left: 15px solid transparent;
  136. border-right: 2px solid transparent;
  137. border-bottom: 8px solid rgba(33, 153, 248, 0.1);
  138. }
  139. }
  140. .execute-image {
  141. width: 100%;
  142. height: 200px;
  143. border-radius: 5px;
  144. object-fit: cover;
  145. margin: 11px 0 13px 0;
  146. }
  147. .popup-buttons {
  148. display: flex;
  149. gap: 13px;
  150. .btn-later,
  151. .btn-executed {
  152. flex: 1;
  153. padding: 8px;
  154. border-radius: 4px;
  155. font-size: 16px;
  156. text-align: center;
  157. }
  158. .btn-later {
  159. border: 1px solid #d7d7d7;
  160. color: #9d9d9d;
  161. }
  162. .btn-executed {
  163. background: #2199f8;
  164. color: #ffffff;
  165. border: 1px solid #2199f8;
  166. }
  167. }
  168. }
  169. </style>