agriExecutePopup.vue 4.4 KB

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