123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- <template>
- <div class="customized-reward-edit">
- <div class="wrap">
- <div class="header">
- <img
- :src="require('@/assets/svg/icon-close.svg')"
- class="icon-close"
- @click="cancel" />
- </div>
- <div class="title">Enter Reward Name</div>
- <input
- class="prize-name-input"
- v-model="customizedReward"
- maxlength="30"
- placeholder="Enter Reward Name"
- @input="onInput"/>
- <div class="btns">
- <div class="remove" :class="isUseFul && isCheckedCustom ? 'use-ful' : ''" @click="remove" >Remove</div>
- <div class="confirm" :class="isUseFul ? 'use-ful' : ''" @click="submit" >Confirm</div>
- </div>
- </div>
- </div>
- </template>
- <script setup>
- import { ref, defineProps, onMounted, computed, defineEmits } from "vue";
- import { RewardType } from "@/types";
- const props = defineProps({
- customizedReward: {
- type: String,
- default: ""
- },
- rewardType: {
- type: Number,
- default: RewardType.money
- }
- });
- let customizedReward = ref(props.customizedReward);
- const emits = defineEmits(['removeReward', 'submitReward', 'closeRewardPopup']);
- let isUseFul = computed(() => customizedReward.value.length > 0);
- let isCheckedCustom = computed(() => props.rewardType === RewardType.custom);
- const onInput = (e) => {
- customizedReward.value = e.target.value;
- }
- const cancel = () => {
- emits('closeRewardPopup');
- }
- const submit = () => {
- isUseFul.value && emits('submitReward', customizedReward.value);
- }
- const remove = () => {
- if(!isUseFul.value || !isCheckedCustom.value) {
- return
- }
- customizedReward.value = '';
- emits('removeReward');
- }
- </script>
- <style lang="scss" scoped>
- .customized-reward-edit {
- position: fixed;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- width: 100vw;
- height: 100vh;
- background-color: rgba(0,0,0,.6);
- z-index: 1000000;
- .wrap {
- width: 630px;
- height: 270px;
- position: fixed;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- background: #FFFFFF;
- border-radius: 20px;
- padding: 0 0 20px;
- display: flex;
- flex-direction: column;
- justify-content: flex-start;
- .header {
- height: 48px;
- padding: 12px 14px;
- position: relative;
- }
- .header::after{
- content: "";
- position: absolute;
- width: 200%;
- height: 1px;
- bottom: 0;
- left: 0;
- background-color: #D1D9DD;
- transform: scale(0.5);
- transform-origin: 0;
- }
- .title {
- font-weight: 500;
- font-size: 16px;
- line-height: 55px;
- height: 55px;
- margin:2px 20px 0;
- letter-spacing: 0.3px;
-
- }
- .prize-name-input {
- height: 49px;
- background: #FFFFFF;
- border: 1px solid #DDDDDD;
- border-radius: 100px;
- margin: 0 20px;
- padding: 0 20px;
- }
- .btns {
- display: flex;
- padding: 45px 20px 0;
- justify-content: space-between;
- div {
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- width: 170px;
- height: 51px;
- background: rgba(225, 225, 225, 0.01);
- border: 1px solid #CECECE;
- border-radius: 51px;
- color: #cecece;
- }
- .confirm {
- background-color: #E1E1E1;
- color: #fff;
- }
- .use-ful{
- &.remove {
- border: 1px solid #FF0A0A;
- color: #FF0A0A;
- }
- &.confirm {
- background: #1D9BF0;
- }
- }
- }
- }
- }
- </style>
|