|
@@ -1,156 +1,193 @@
|
|
|
<template>
|
|
|
- <div class="overlay" v-if="visible">
|
|
|
- <div class="content">
|
|
|
- <div class="head">
|
|
|
- <div class="close-btn" @click="close">
|
|
|
- ×
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="body">
|
|
|
- <div class="left"></div>
|
|
|
- <div class="right">
|
|
|
- <div class="form-wrapper">
|
|
|
- <div class="form-base">
|
|
|
- <div class="item">
|
|
|
- <div class="label">
|
|
|
- USD
|
|
|
- </div>
|
|
|
- <el-input v-model="baseFormData.amount"
|
|
|
- placeholder="$0.00"
|
|
|
- :input-style="{'box-shadow': 'none'}" />
|
|
|
- </div>
|
|
|
- <div class="item">
|
|
|
- <div class="label">
|
|
|
- Quantity
|
|
|
+ <div class="overlay" v-if="visible">
|
|
|
+ <div class="content"
|
|
|
+ :style="{height: showPreview ? previewDialogHeight + 'px' : dialogHeight +'px' }">
|
|
|
+ <div class="head">
|
|
|
+ <div class="close-btn" @click="close">
|
|
|
+ {{ showPreview ? "🔙" : "× " }}
|
|
|
</div>
|
|
|
- <el-input v-model="baseFormData.quantity"
|
|
|
- placeholder="Enter quantity"
|
|
|
- :input-style="{'box-shadow': 'none'}" />
|
|
|
- </div>
|
|
|
</div>
|
|
|
- <div class="form-require">
|
|
|
- <div class="bar">
|
|
|
- <div class="label">
|
|
|
- Require
|
|
|
- </div>
|
|
|
- <el-dropdown trigger="click">
|
|
|
- <div class="button">+</div>
|
|
|
- <template #dropdown>
|
|
|
- <el-dropdown-menu>
|
|
|
- <el-dropdown-item
|
|
|
- v-for="(item, index) in optionsList"
|
|
|
- :key="index"
|
|
|
- @click="addOption(item)">
|
|
|
- {{item.type}}
|
|
|
- </el-dropdown-item>
|
|
|
- </el-dropdown-menu>
|
|
|
- </template>
|
|
|
- </el-dropdown>
|
|
|
- </div>
|
|
|
- <div class="form-item"
|
|
|
- v-for="(item, index) in formList"
|
|
|
- :key="index">
|
|
|
- <div class="label">
|
|
|
- {{item.type}}
|
|
|
- </div>
|
|
|
- <div class="control">
|
|
|
- <el-input v-model="formData[item.type]"
|
|
|
- placeholder="Please input"
|
|
|
- :input-style="{'box-shadow': 'none'}"
|
|
|
- v-if="item.type == 'Follow'"/>
|
|
|
- <div class="inner"
|
|
|
- v-else
|
|
|
- @click="selectChange(item)">
|
|
|
- {{formData[item.type]?'✅':'❌'}}
|
|
|
- </div>
|
|
|
+ <div class="body">
|
|
|
+ <div class="left"></div>
|
|
|
+ <div class="right">
|
|
|
+ <template v-if="!showPreview">
|
|
|
+ <div class="form-wrapper">
|
|
|
+ <div class="form-base">
|
|
|
+ <div class="item">
|
|
|
+ <div class="label">USD</div>
|
|
|
+ <el-input
|
|
|
+ v-model="baseFormData.amount"
|
|
|
+ placeholder="$0.00"
|
|
|
+ :input-style="{ 'box-shadow': 'none' }"/>
|
|
|
+ </div>
|
|
|
+ <div class="item">
|
|
|
+ <div class="label">Quantity</div>
|
|
|
+ <el-input
|
|
|
+ v-model="baseFormData.quantity"
|
|
|
+ placeholder="Enter quantity"
|
|
|
+ :input-style="{ 'box-shadow': 'none' }"/>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-require">
|
|
|
+ <div class="bar">
|
|
|
+ <div class="label">Require</div>
|
|
|
+ <el-dropdown trigger="click">
|
|
|
+ <div class="button">+</div>
|
|
|
+ <template #dropdown>
|
|
|
+ <el-dropdown-menu>
|
|
|
+ <el-dropdown-item
|
|
|
+ v-for="(item, index) in optionsList"
|
|
|
+ :key="index"
|
|
|
+ @click="addOption(item)">
|
|
|
+ {{ item.type }}
|
|
|
+ </el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </template>
|
|
|
+ </el-dropdown>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="form-item"
|
|
|
+ v-for="(item, index) in formList"
|
|
|
+ :key="index">
|
|
|
+ <div class="label">
|
|
|
+ {{ item.type }}
|
|
|
+ </div>
|
|
|
+ <div class="control">
|
|
|
+ <el-input
|
|
|
+ v-model="formData[item.type]"
|
|
|
+ v-if="item.type == 'Follow'"
|
|
|
+ placeholder="Please input"
|
|
|
+ :input-style="{
|
|
|
+ 'box-shadow': 'none',
|
|
|
+ }"/>
|
|
|
+ <div
|
|
|
+ class="inner"
|
|
|
+ v-else
|
|
|
+ @click="selectChange(item)">
|
|
|
+ {{formData[item.type]? "✅": "❌"}}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="btn"
|
|
|
+ @click="removeOption(item, index)">
|
|
|
+ ×
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="submit-btn" @click="confirm">NEXT</div>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <preview-card></preview-card>
|
|
|
+ <paypal-button :amount="baseFormData.amount" @payPalFinsh="payPalFinsh"></paypal-button>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
- <div class="btn" @click="removeOption(item, index)">
|
|
|
- ×
|
|
|
- </div>
|
|
|
- </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="submit-btn" @click="confirm">
|
|
|
- NEXT
|
|
|
- </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
/* eslint-disable */
|
|
|
- import {ref, watch, reactive} from "vue";
|
|
|
- let visible = ref(true);
|
|
|
-
|
|
|
- let baseFormData = reactive({
|
|
|
- amount: '',
|
|
|
- quantity: '',
|
|
|
- });
|
|
|
-
|
|
|
- let formData = reactive({
|
|
|
- Follow: '',
|
|
|
- Like: false,
|
|
|
- Retweet: false
|
|
|
- });
|
|
|
-
|
|
|
- let optionsList = reactive([
|
|
|
- {type: 'Follow'},
|
|
|
- {type: 'Like'},
|
|
|
- {type: 'Retweet'},
|
|
|
- ]);
|
|
|
-
|
|
|
- let formList = reactive([
|
|
|
- {type: 'Follow'},
|
|
|
- {type: 'Like'},
|
|
|
- {type: 'Retweet'},
|
|
|
- ]);
|
|
|
-
|
|
|
- const props = defineProps({
|
|
|
- dialogVisible: {
|
|
|
- type: Boolean,
|
|
|
- default: false
|
|
|
- }
|
|
|
- })
|
|
|
+import { ref, watch, reactive, onMounted } from "vue";
|
|
|
+import previewCard from "./preview-card";
|
|
|
+import paypalButton from "./paypal-button";
|
|
|
+
|
|
|
+let visible = ref(true);
|
|
|
+let showPreview = ref(false);
|
|
|
+let dialogHeight = ref(620);
|
|
|
+let previewDialogHeight = ref(880)
|
|
|
+
|
|
|
+let baseFormData = reactive({
|
|
|
+ amount: "",
|
|
|
+ quantity: "",
|
|
|
+});
|
|
|
+
|
|
|
+let formData = reactive({
|
|
|
+ Follow: "",
|
|
|
+ Like: false,
|
|
|
+ Retweet: false,
|
|
|
+});
|
|
|
+
|
|
|
+let optionsList = reactive([
|
|
|
+ { type: "Follow" },
|
|
|
+ { type: "Like" },
|
|
|
+ { type: "Retweet" },
|
|
|
+]);
|
|
|
+
|
|
|
+let formList = reactive([
|
|
|
+ { type: "Follow" },
|
|
|
+ { type: "Like" },
|
|
|
+ { type: "Retweet" },
|
|
|
+]);
|
|
|
+
|
|
|
+const props = defineProps({
|
|
|
+ dialogVisible: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false,
|
|
|
+ },
|
|
|
+});
|
|
|
|
|
|
- watch(
|
|
|
+watch(
|
|
|
() => props.dialogVisible,
|
|
|
(newVal, oldVal) => {
|
|
|
- console.log('watch', newVal)
|
|
|
- visible.value = newVal
|
|
|
+ console.log("watch", newVal);
|
|
|
+ visible.value = newVal;
|
|
|
}
|
|
|
- );
|
|
|
+);
|
|
|
|
|
|
- const emits = defineEmits(['close', 'confirm'])
|
|
|
+const emits = defineEmits(["close", "confirm"]);
|
|
|
|
|
|
- const close = () => {
|
|
|
- emits('close', false)
|
|
|
- }
|
|
|
+const close = () => {
|
|
|
+ if (showPreview) {
|
|
|
+ showPreview.value = false;
|
|
|
+ } else {
|
|
|
+ emits("close", false);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const setPreviewDialogHeight = () => {
|
|
|
+ let clientHeight = document.documentElement.clientHeight;
|
|
|
+ let gapSafe = 80;
|
|
|
+
|
|
|
+ if(clientHeight - gapSafe >= previewDialogHeight.value) {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ previewDialogHeight.value = clientHeight - gapSafe;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const confirm = () => {
|
|
|
+ setPreviewDialogHeight();
|
|
|
+ showPreview.value = true;
|
|
|
+};
|
|
|
|
|
|
- const confirm = () => {
|
|
|
- emits('confirm', false)
|
|
|
- }
|
|
|
+const addOption = (params) => {
|
|
|
+ let hasItem = formList.find((item) => item.type == params.type);
|
|
|
+ if (!formList.length || !hasItem) {
|
|
|
+ formList.push(params);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const removeOption = (params, index) => {
|
|
|
+ formList.splice(index, 1);
|
|
|
+};
|
|
|
+
|
|
|
+const selectChange = (params, index) => {
|
|
|
+ formData[params.type] = !formData[params.type];
|
|
|
+};
|
|
|
|
|
|
- const addOption = (params) => {
|
|
|
- let hasItem = formList.find(item => item.type == params.type);
|
|
|
- if (!formList.length || !hasItem) {
|
|
|
- formList.push(params)
|
|
|
- }
|
|
|
- }
|
|
|
+const payPalFinsh = () => {
|
|
|
+ emits("close", false);
|
|
|
+}
|
|
|
|
|
|
- const removeOption = (params, index) => {
|
|
|
- formList.splice(index, 1);
|
|
|
- }
|
|
|
+onMounted(() => {
|
|
|
+});
|
|
|
|
|
|
- const selectChange = (params, index) => {
|
|
|
- formData[params.type] = !formData[params.type];
|
|
|
- }
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
- .overlay {
|
|
|
+.overlay {
|
|
|
position: fixed;
|
|
|
top: 0;
|
|
|
right: 0;
|
|
@@ -158,151 +195,163 @@
|
|
|
left: 0;
|
|
|
z-index: 2000;
|
|
|
height: 100%;
|
|
|
- background-color: rgba(0,0,0,.5);
|
|
|
+ background-color: rgba(0, 0, 0, 0.5);
|
|
|
overflow: auto;
|
|
|
|
|
|
.content {
|
|
|
- width: 43%;
|
|
|
- height: 500px;
|
|
|
- background: #FFFFFF;
|
|
|
- border-radius: 16px;
|
|
|
- position: absolute;
|
|
|
- left: 50%;
|
|
|
- top: 10%;
|
|
|
- transform: translate(-50%, 0);
|
|
|
- box-sizing: border-box;
|
|
|
-
|
|
|
- .head {
|
|
|
- border-bottom: 1px solid #ECECEC;
|
|
|
- height: 48px;
|
|
|
+ width: 650px;
|
|
|
+ height: 620px;
|
|
|
+ background: #ffffff;
|
|
|
+ border-radius: 16px;
|
|
|
+ position: absolute;
|
|
|
+ left: 50%;
|
|
|
+ top: 50%;
|
|
|
+ transform: translate(-50%, -50%);
|
|
|
box-sizing: border-box;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- .close-btn {
|
|
|
- width: max-content;
|
|
|
- font-size: 20px;
|
|
|
- margin-left: 20px;
|
|
|
- cursor: pointer;
|
|
|
- }
|
|
|
- }
|
|
|
- .body {
|
|
|
- box-sizing: border-box;
|
|
|
- height: calc(100% - 48px);
|
|
|
- display: flex;
|
|
|
- .left,.right {
|
|
|
- height: 100%;
|
|
|
- }
|
|
|
- .left {
|
|
|
- width: 50px;
|
|
|
+
|
|
|
+ .head {
|
|
|
+ border-bottom: 1px solid #ececec;
|
|
|
+ height: 48px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .close-btn {
|
|
|
+ width: max-content;
|
|
|
+ font-size: 20px;
|
|
|
+ margin-left: 20px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
}
|
|
|
- .right {
|
|
|
- width: calc(100% - 50px);
|
|
|
- padding: 26px 18px;
|
|
|
- box-sizing: border-box;
|
|
|
- position: relative;
|
|
|
- border-left: 1px solid #ECECEC;
|
|
|
-
|
|
|
- .form-wrapper {
|
|
|
- .form-base {
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- align-items: center;
|
|
|
- .item {
|
|
|
- width: 250px;
|
|
|
- height: 60px;
|
|
|
- border: 1px solid #E1E1E1;
|
|
|
- box-sizing: border-box;
|
|
|
- border-radius: 15px;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: space-between;
|
|
|
- padding: 18px 16px;
|
|
|
-
|
|
|
- .label {
|
|
|
- font-weight: 500;
|
|
|
- font-size: 15px;
|
|
|
-
|
|
|
- .img {
|
|
|
- width: 20px;
|
|
|
- height: 20px;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ .body {
|
|
|
+ box-sizing: border-box;
|
|
|
+ height: calc(100% - 48px);
|
|
|
+ display: flex;
|
|
|
+
|
|
|
+ .left,
|
|
|
+ .right {
|
|
|
+ height: 100%;
|
|
|
}
|
|
|
|
|
|
- .form-require {
|
|
|
- border: 1px solid #E1E1E1;
|
|
|
- box-sizing: border-box;
|
|
|
- border-radius: 15px;
|
|
|
- margin-top: 12px;
|
|
|
+ .left {
|
|
|
+ width: 50px;
|
|
|
+ }
|
|
|
|
|
|
- .bar {
|
|
|
- padding: 2px 10px 0 10px;
|
|
|
+ .right {
|
|
|
+ width: calc(100% - 50px);
|
|
|
box-sizing: border-box;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: space-between;
|
|
|
- line-height: 50px;
|
|
|
-
|
|
|
- .button {
|
|
|
- width: 22px;
|
|
|
- height: 22px;
|
|
|
- background: #4A99E9;
|
|
|
- border-radius: 5px;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- color: #fff;
|
|
|
- cursor: pointer;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .form-item {
|
|
|
- height: 50px;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: space-between;
|
|
|
- margin: 0 16px;
|
|
|
- border-bottom: 1px solid #ECECEC;
|
|
|
- .label {
|
|
|
- width: 100px;
|
|
|
- color: rgba(0,0,0,.6);
|
|
|
- }
|
|
|
- .control {
|
|
|
- width: 264px;
|
|
|
- height: 50px;
|
|
|
- line-height: 50px;
|
|
|
- cursor: pointer;
|
|
|
-
|
|
|
- .inner {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
+ position: relative;
|
|
|
+ border-left: 1px solid #ececec;
|
|
|
+
|
|
|
+ .form-wrapper {
|
|
|
+ padding: 26px 18px;
|
|
|
box-sizing: border-box;
|
|
|
- padding-left: 10px;
|
|
|
- }
|
|
|
+
|
|
|
+ .form-base {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .item {
|
|
|
+ width: 220px;
|
|
|
+ height: 60px;
|
|
|
+ border: 1px solid #e1e1e1;
|
|
|
+ box-sizing: border-box;
|
|
|
+ border-radius: 15px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 16px 14px;
|
|
|
+
|
|
|
+ .label {
|
|
|
+ font-weight: 500;
|
|
|
+ font-size: 15px;
|
|
|
+
|
|
|
+ .img {
|
|
|
+ width: 20px;
|
|
|
+ height: 20px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .form-require {
|
|
|
+ border: 1px solid #e1e1e1;
|
|
|
+ box-sizing: border-box;
|
|
|
+ border-radius: 15px;
|
|
|
+ margin-top: 12px;
|
|
|
+
|
|
|
+ .bar {
|
|
|
+ padding: 2px 10px 0 10px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ line-height: 50px;
|
|
|
+
|
|
|
+ .button {
|
|
|
+ width: 22px;
|
|
|
+ height: 22px;
|
|
|
+ background: #4a99e9;
|
|
|
+ border-radius: 5px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ color: #fff;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .form-item {
|
|
|
+ height: 50px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ margin: 0 16px;
|
|
|
+ border-bottom: 1px solid #ececec;
|
|
|
+
|
|
|
+ .label {
|
|
|
+ width: 100px;
|
|
|
+ color: rgba(0, 0, 0, 0.6);
|
|
|
+ }
|
|
|
+
|
|
|
+ .control {
|
|
|
+ width: 264px;
|
|
|
+ height: 50px;
|
|
|
+ line-height: 50px;
|
|
|
+ cursor: pointer;
|
|
|
+
|
|
|
+ .inner {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding-left: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .btn {
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- .btn {
|
|
|
- cursor: pointer;
|
|
|
+
|
|
|
+ .submit-btn {
|
|
|
+ width: calc(100% - 36px);
|
|
|
+ height: 60px;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 60px;
|
|
|
+ background: #4a99e9;
|
|
|
+ border-radius: 15px;
|
|
|
+ color: #fff;
|
|
|
+ position: absolute;
|
|
|
+ bottom: 32px;
|
|
|
+ left: 18px;
|
|
|
+ cursor: pointer;
|
|
|
}
|
|
|
- }
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- .submit-btn {
|
|
|
- width: calc(100% - 36px);
|
|
|
- height: 60px;
|
|
|
- text-align: center;
|
|
|
- line-height: 60px;
|
|
|
- background: #4A99E9;
|
|
|
- border-radius: 15px;
|
|
|
- color: #fff;
|
|
|
- position: absolute;
|
|
|
- bottom: 32px;
|
|
|
- left: 18px;
|
|
|
- cursor: pointer;
|
|
|
- }
|
|
|
}
|
|
|
- }
|
|
|
}
|
|
|
- }
|
|
|
+}
|
|
|
</style>
|