agriExecutePopup.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <popup
  3. v-model:show="showValue"
  4. round
  5. class="agri-execute-popup"
  6. :overlay-style="overlayStyle"
  7. :close-on-click-overlay="closeOnClickOverlay"
  8. :z-index="zIndex"
  9. teleport="body"
  10. >
  11. <div class="popup-content">
  12. <!-- 头部区域 -->
  13. <div class="popup-header">
  14. <img class="expert-logo" src="@/assets/img/mine/expert-icon.png" alt="" />
  15. <div class="expert-info">
  16. <span>{{ popupData.expertName || "韦帮稳" }}专家</span>
  17. <span class="invite-text">邀请您</span>
  18. </div>
  19. </div>
  20. <!-- 标题 -->
  21. <div class="popup-title">{{ popupData.title }}</div>
  22. <!-- 异常信息区域 -->
  23. <div class="abnormal-info">
  24. {{ popupData.abnormalText }}
  25. </div>
  26. <!-- 图片区域 -->
  27. <img src="@/assets/img/home/example-4.png" alt="农事执行图片" class="execute-image" />
  28. <!-- 按钮区域 -->
  29. <div class="popup-buttons">
  30. <div class="btn-later" @click="handleLater" v-if="popupData.laterBtn">
  31. {{ popupData.laterButtonText || "稍后执行" }}
  32. </div>
  33. <div class="btn-executed" @click="handleExecuted">
  34. {{ popupData.executedButtonText || "我已执行" }}
  35. </div>
  36. </div>
  37. </div>
  38. </popup>
  39. </template>
  40. <script setup>
  41. import { Popup } from "vant";
  42. import { computed } from "vue";
  43. const props = defineProps({
  44. // 控制弹窗显示/隐藏
  45. show: {
  46. type: Boolean,
  47. default: false,
  48. },
  49. // 标题
  50. popupData: {
  51. type: Object,
  52. default: () => ({
  53. expertName: "韦帮稳",
  54. title: "梢期杀虫 农事执行",
  55. abnormalText: "由于***异常的出现,由于***异常的出现,由于***异常的出现,由于***异常的出现,",
  56. imageUrl: "",
  57. }),
  58. },
  59. // 遮罩层样式
  60. overlayStyle: {
  61. type: Object,
  62. default: () => ({
  63. "backdrop-filter": "blur(4px)",
  64. }),
  65. },
  66. // 是否在点击遮罩层后关闭弹窗
  67. closeOnClickOverlay: {
  68. type: Boolean,
  69. default: false,
  70. },
  71. // 遮罩层z-index
  72. zIndex: {
  73. type: Number,
  74. default: 9999,
  75. },
  76. });
  77. const emit = defineEmits(["update:show", "later", "executed"]);
  78. // 处理v-model双向绑定
  79. const showValue = computed({
  80. get: () => props.show,
  81. set: (value) => emit("update:show", value),
  82. });
  83. // 稍后执行
  84. const handleLater = () => {
  85. emit("later");
  86. emit("update:show", false);
  87. };
  88. // 我已执行
  89. const handleExecuted = () => {
  90. emit("executed");
  91. emit("update:show", false);
  92. };
  93. </script>
  94. <style scoped lang="scss">
  95. .agri-execute-popup {
  96. width: 100%;
  97. padding: 16px;
  98. border-radius: 12px;
  99. .popup-content {
  100. display: flex;
  101. flex-direction: column;
  102. }
  103. .popup-header {
  104. margin-bottom: 5px;
  105. display: flex;
  106. align-items: center;
  107. gap: 6px;
  108. .expert-logo {
  109. width: 26px;
  110. height: 26px;
  111. }
  112. .expert-info {
  113. font-size: 16px;
  114. .invite-text {
  115. color: #999999;
  116. margin-left: 6px;
  117. }
  118. }
  119. }
  120. .popup-title {
  121. font-size: 26px;
  122. margin-bottom: 14px;
  123. font-family: "PangMenZhengDao";
  124. }
  125. .abnormal-info {
  126. padding: 12px;
  127. color: #2199f8;
  128. background: rgba(33, 153, 248, 0.1);
  129. padding: 3px 9px 9px;
  130. border-radius: 8px;
  131. position: relative;
  132. margin-top: 5px;
  133. // 三角形小尖尖
  134. &::before {
  135. content: "";
  136. position: absolute;
  137. top: -8px;
  138. left: 20px;
  139. width: 0;
  140. height: 0;
  141. border-left: 15px solid transparent;
  142. border-right: 2px solid transparent;
  143. border-bottom: 8px solid rgba(33, 153, 248, 0.1);
  144. }
  145. }
  146. .execute-image {
  147. width: 100%;
  148. height: 184px;
  149. border-radius: 5px;
  150. object-fit: cover;
  151. margin: 11px 0 13px 0;
  152. }
  153. .popup-buttons {
  154. display: flex;
  155. gap: 13px;
  156. .btn-later,
  157. .btn-executed {
  158. flex: 1;
  159. padding: 8px;
  160. border-radius: 4px;
  161. font-size: 16px;
  162. text-align: center;
  163. }
  164. .btn-later {
  165. border: 1px solid #d7d7d7;
  166. color: #9d9d9d;
  167. }
  168. .btn-executed {
  169. background: #2199f8;
  170. color: #ffffff;
  171. border: 1px solid #2199f8;
  172. }
  173. }
  174. }
  175. </style>