agriExecutePopup.vue 5.1 KB

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