customized-reward-edit.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <div class="customized-reward-edit">
  3. <div class="wrap">
  4. <div class="header">
  5. <img
  6. :src="require('@/assets/svg/icon-close.svg')"
  7. class="icon-close"
  8. @click="cancel" />
  9. </div>
  10. <div class="title">Enter Reward Name</div>
  11. <input
  12. class="prize-name-input"
  13. v-model="customizedReward"
  14. maxlength="30"
  15. placeholder="Enter Reward Name"
  16. @input="onInput"/>
  17. <div class="btns">
  18. <div class="remove" :class="isUseFul && isCheckedCustom ? 'use-ful' : ''" @click="remove" >Remove</div>
  19. <div class="confirm" :class="isUseFul ? 'use-ful' : ''" @click="submit" >Confirm</div>
  20. </div>
  21. </div>
  22. </div>
  23. </template>
  24. <script setup>
  25. import { ref, defineProps, onMounted, computed, defineEmits } from "vue";
  26. import { RewardType } from "@/types";
  27. const props = defineProps({
  28. customizedReward: {
  29. type: String,
  30. default: ""
  31. },
  32. rewardType: {
  33. type: Number,
  34. default: RewardType.money
  35. }
  36. });
  37. let customizedReward = ref(props.customizedReward);
  38. const emits = defineEmits(['removeReward', 'submitReward', 'closeRewardPopup']);
  39. let isUseFul = computed(() => customizedReward.value.length > 0);
  40. let isCheckedCustom = computed(() => props.rewardType === RewardType.custom);
  41. const onInput = (e) => {
  42. customizedReward.value = e.target.value;
  43. }
  44. const cancel = () => {
  45. emits('closeRewardPopup');
  46. }
  47. const submit = () => {
  48. isUseFul.value && emits('submitReward', customizedReward.value);
  49. }
  50. const remove = () => {
  51. if(!isUseFul.value || !isCheckedCustom.value) {
  52. return
  53. }
  54. customizedReward.value = '';
  55. emits('removeReward');
  56. }
  57. </script>
  58. <style lang="scss" scoped>
  59. .customized-reward-edit {
  60. position: fixed;
  61. left: 50%;
  62. top: 50%;
  63. transform: translate(-50%, -50%);
  64. width: 100vw;
  65. height: 100vh;
  66. background-color: rgba(0,0,0,.6);
  67. z-index: 1000000;
  68. .wrap {
  69. width: 630px;
  70. height: 270px;
  71. position: fixed;
  72. left: 50%;
  73. top: 50%;
  74. transform: translate(-50%, -50%);
  75. background: #FFFFFF;
  76. border-radius: 20px;
  77. padding: 0 0 20px;
  78. display: flex;
  79. flex-direction: column;
  80. justify-content: flex-start;
  81. .header {
  82. height: 48px;
  83. padding: 12px 14px;
  84. position: relative;
  85. }
  86. .header::after{
  87. content: "";
  88. position: absolute;
  89. width: 200%;
  90. height: 1px;
  91. bottom: 0;
  92. left: 0;
  93. background-color: #D1D9DD;
  94. transform: scale(0.5);
  95. transform-origin: 0;
  96. }
  97. .title {
  98. font-weight: 500;
  99. font-size: 16px;
  100. line-height: 55px;
  101. height: 55px;
  102. margin:2px 20px 0;
  103. letter-spacing: 0.3px;
  104. }
  105. .prize-name-input {
  106. height: 49px;
  107. background: #FFFFFF;
  108. border: 1px solid #DDDDDD;
  109. border-radius: 100px;
  110. margin: 0 20px;
  111. padding: 0 20px;
  112. }
  113. .btns {
  114. display: flex;
  115. padding: 45px 20px 0;
  116. justify-content: space-between;
  117. div {
  118. display: flex;
  119. flex-direction: row;
  120. justify-content: center;
  121. align-items: center;
  122. width: 170px;
  123. height: 51px;
  124. background: rgba(225, 225, 225, 0.01);
  125. border: 1px solid #CECECE;
  126. border-radius: 51px;
  127. color: #cecece;
  128. }
  129. .confirm {
  130. background-color: #E1E1E1;
  131. color: #fff;
  132. }
  133. .use-ful{
  134. &.remove {
  135. border: 1px solid #FF0A0A;
  136. color: #FF0A0A;
  137. }
  138. &.confirm {
  139. background: #1D9BF0;
  140. }
  141. }
  142. }
  143. }
  144. }
  145. </style>