reason.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <!-- 忽略输入弹窗 -->
  3. <uni-popup
  4. class="ignore-unipopup"
  5. ref="ignorePopupRef"
  6. type="bottom"
  7. :animation="false"
  8. :mask-click="false"
  9. borderRadius="10px 10px 10px 10px"
  10. >
  11. <view class="ignore-popup-box">
  12. <view>
  13. <uni-row class="flex-row align-center">
  14. <uni-col class="ignore-popup-title" :span="22">
  15. {{ $t("operation.ignoreReason") }}
  16. </uni-col>
  17. <uni-col :span="2">
  18. <uni-icons
  19. type="closeempty"
  20. size="20"
  21. color="#999"
  22. @click="closeIgnorePopup"
  23. ></uni-icons>
  24. </uni-col>
  25. </uni-row>
  26. </view>
  27. <view class="ignore-popup-content">
  28. <uni-easyinput
  29. type="textarea"
  30. class="ignore-popup-textarea"
  31. :placeholder="
  32. $t('operation.PleaseFillIn') + $t('operation.ignoreReason')
  33. "
  34. v-model="ignoreReason"
  35. ></uni-easyinput>
  36. </view>
  37. <view class="ignore-popup-btn">
  38. <button type="primary" @click="confirmIgnore">
  39. {{ $t("operation.submit") }}
  40. </button>
  41. </view>
  42. </view>
  43. </uni-popup>
  44. </template>
  45. <script setup>
  46. import dayjs from "dayjs";
  47. import { computed, ref, reactive, watch, onMounted } from "vue";
  48. import { useI18n } from "vue-i18n";
  49. const { t, locale } = useI18n({
  50. useScope: "global",
  51. });
  52. // 接收父组件传递的参数
  53. const props = defineProps({});
  54. // 忽略弹窗
  55. const ignorePopupRef = ref(null);
  56. // 忽略理由
  57. const ignoreReason = ref("");
  58. const openIgnore = () => {
  59. ignorePopupRef.value.open();
  60. };
  61. const closeIgnorePopup = () => {
  62. ignorePopupRef.value.close();
  63. ignoreReason.value = "";
  64. };
  65. // 忽略弹窗确认
  66. const confirmIgnore = (e) => {
  67. console.log("🚀 ~ confirmIgnore ~ e:", e);
  68. if (!ignoreReason.value) {
  69. uni.showToast({
  70. title: t("operation.PleaseFillIn") + t("operation.ignoreReason"),
  71. icon: "none",
  72. });
  73. return;
  74. }
  75. emit("ignore-submit", ignoreReason.value);
  76. };
  77. onMounted(() => {});
  78. const emit = defineEmits(["ignore-submit"]);
  79. // 提供外部方法
  80. const expose = {
  81. openIgnore,
  82. close: closeIgnorePopup,
  83. };
  84. defineExpose(expose);
  85. </script>
  86. <style lang="scss" scoped>
  87. .btn-ignore {
  88. margin-left: 10px;
  89. background-color: #e6a23c !important;
  90. border-color: #e6a23c !important;
  91. color: #fff;
  92. }
  93. .ignore-popup-box {
  94. padding: 20px;
  95. background: #fff;
  96. border-radius: 10px 10px 0 0;
  97. }
  98. .ignore-popup-title {
  99. text-align: center;
  100. }
  101. .ignore-popup-close {
  102. text-align: right;
  103. }
  104. .ignore-popup-content {
  105. margin: 15px;
  106. }
  107. </style>