farmCalendarPopup.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <popup
  3. v-model:show="showValue"
  4. round
  5. teleport="body"
  6. class="farm-calendar-popup"
  7. :close-on-click-overlay="false"
  8. >
  9. <div class="farm-calendar-popup__title">{{ t("agriFile.completeFarmInfo") }}</div>
  10. <div class="farm-calendar-popup__subtitle">
  11. {{ t("agriFile.getImmediately") }}
  12. <span>{{ t("workExecute.exclusiveFarmCalendar") }}</span>
  13. </div>
  14. <div class="farm-calendar-popup__days">
  15. <div
  16. v-for="(day, index) in weekDays"
  17. :key="day"
  18. class="farm-calendar-popup__day"
  19. :class="{ 'is-active': activeDay === index }"
  20. @click="activeDay = index"
  21. >
  22. {{ t(day) }}
  23. </div>
  24. </div>
  25. <div class="farm-calendar-popup__image">
  26. <img src="@/assets/img/common/empty-bg-2.png" alt="">
  27. </div>
  28. <div class="farm-calendar-popup__btn" @click="handleOpen">{{ t("agriFile.goEnable") }}</div>
  29. </popup>
  30. </template>
  31. <script setup>
  32. import { computed, ref } from "vue";
  33. import { Popup } from "vant";
  34. import { useI18n } from "@/i18n";
  35. const { t } = useI18n();
  36. const props = defineProps({
  37. show: {
  38. type: Boolean,
  39. default: false,
  40. },
  41. images: {
  42. type: Array,
  43. default: () => [],
  44. },
  45. });
  46. const emit = defineEmits(["update:show", "confirm"]);
  47. const showValue = computed({
  48. get: () => props.show,
  49. set: (val) => emit("update:show", val),
  50. });
  51. const weekDays = ["week.1", "week.2", "week.3", "week.4", "week.5"];
  52. const activeDay = ref(1);
  53. const currentImage = computed(() => props.images[activeDay.value] || "");
  54. const handleOpen = () => {
  55. emit("confirm");
  56. showValue.value = false;
  57. };
  58. </script>
  59. <style scoped lang="scss">
  60. .farm-calendar-popup {
  61. width: 82%;
  62. padding: 20px 10px;
  63. text-align: center;
  64. background: linear-gradient(360deg, #FFFFFF 1.28%, #D7EEFF 55.76%, #FFFFFF 98.67%);
  65. &__title,
  66. &__subtitle {
  67. font-size: 24px;
  68. font-family: "pangmenzhengdao";
  69. line-height: 28px;
  70. }
  71. &__subtitle {
  72. span {
  73. color: #2199f8;
  74. }
  75. }
  76. &__days {
  77. display: flex;
  78. justify-content: space-between;
  79. gap: 12px;
  80. margin-top: 14px;
  81. }
  82. &__day {
  83. position: relative;
  84. flex: 1;
  85. border-radius: 4px 4px 0 0;
  86. background: #fff;
  87. padding: 4px 0;
  88. &.is-active {
  89. background: linear-gradient(149.44deg, #9FD5FF 2.43%, #2199F8 91.84%);
  90. color: #fff;
  91. border-radius: 4px;
  92. &::after {
  93. content: "";
  94. position: absolute;
  95. left: 50%;
  96. bottom: -5px;
  97. transform: translateX(-50%);
  98. border-left: 6px solid transparent;
  99. border-right: 6px solid transparent;
  100. border-top: 6px solid #2199f8;
  101. }
  102. }
  103. }
  104. &__image {
  105. width: 100%;
  106. height: 142px;
  107. margin: 12px 0 14px;
  108. border-radius: 5px;
  109. background: #f2f4f7;
  110. img {
  111. display: block;
  112. width: 100%;
  113. height: 100%;
  114. }
  115. }
  116. &__btn {
  117. width: 162px;
  118. margin: auto;
  119. padding: 8px 0;
  120. border-radius: 25px;
  121. background: #2199f8;
  122. color: #fff;
  123. font-size: 16px;
  124. }
  125. }
  126. </style>