preview-sheet.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <template>
  2. <div class="preview">
  3. <div class="card" :class="{
  4. center:
  5. !isMoneyRewardCpd ||
  6. Number(baseFormData.amountValue) <=
  7. Number(currentCurrencyInfo.balance),
  8. }">
  9. <div class="card-title">
  10. <img class="img" v-if="
  11. isMoneyRewardCpd &&
  12. Number(baseFormData.amountValue) >
  13. Number(currentCurrencyInfo.balance)
  14. " :src="require('@/assets/subject/top-01.svg')" />
  15. <div class="font">
  16. Preview: <span>{{ installStatus ? "After" : "Before" }}</span> DeNet
  17. Installed
  18. </div>
  19. </div>
  20. <div class="flash">
  21. <preview-card
  22. :currentCurrencyInfo="currentCurrencyInfo"
  23. :postData="publishRes"
  24. :baseFormData="baseFormData"
  25. :amountFontSize="previewFontSize"
  26. :customPosterInfo="customPosterData">
  27. </preview-card>
  28. </div>
  29. </div>
  30. <!-- 需充值 -->
  31. <div class="card-content" v-if="
  32. isMoneyRewardCpd &&
  33. Number(baseFormData.amountValue) > Number(currentCurrencyInfo.balance)
  34. ">
  35. <template v-if="currentCurrencyInfo.currencyCode === 'USD'">
  36. <div class="card-title">
  37. <img class="img" :src="require('@/assets/subject/top-02.svg')" />
  38. <div class="font">Deposit to Send Giveaway</div>
  39. </div>
  40. <div class="card-list">
  41. <div class="item">
  42. <div class="l">Giveaway Amount</div>
  43. <div class="r order-amount">
  44. ${{ finalAmountData.orderAmountValue }}
  45. </div>
  46. </div>
  47. <div class="item">
  48. <div class="l">Balance</div>
  49. <div class="r txt">${{ finalAmountData.balance }}</div>
  50. </div>
  51. <div class="item">
  52. <div class="l">
  53. Paypal charges fee ({{ finalAmountData.feeDesc }})
  54. </div>
  55. <div class="r txt">${{ finalAmountData.feeAmountValue }}</div>
  56. </div>
  57. <div class="item">
  58. <div class="l">Deposit Amount</div>
  59. <div class="r deposit-amount">
  60. ${{ finalAmountData.rechargeAmountValue }}
  61. </div>
  62. </div>
  63. </div>
  64. </template>
  65. <template v-else>
  66. <div class="card-title">
  67. <img class="img" :src="require('@/assets/subject/top-02.svg')" />
  68. <div class="font">Deposit to Send Giveaway</div>
  69. </div>
  70. <top-up2 :currentCurrencyInfo="tempCurrentCurrencyInfo"
  71. @topUpDone="topUpDone">
  72. </top-up2>
  73. <div class="card-title">
  74. <img class="img" :src="require('@/assets/subject/top-03.svg')" />
  75. <div class="font">Wait for the amount to arrive</div>
  76. </div>
  77. <div class="card-amount">
  78. <img class="icon" src="@/assets/subject/icon-balance.png" />
  79. <div class="con">
  80. <div class="desc">Balance</div>
  81. <div class="price">
  82. {{ currentCurrencyInfo.balance }}
  83. {{ currentCurrencyInfo.tokenSymbol }}
  84. </div>
  85. </div>
  86. <img class="refresh"
  87. :class="{ 'icon-refresh-rotate': refreshRotate }"
  88. @click="updateCurrencyBanlce"
  89. :src="require('@/assets/svg/icon-form-refresh-blue.svg')" />
  90. </div>
  91. </template>
  92. </div>
  93. </div>
  94. </template>
  95. <script setup>
  96. import { ref, defineProps, defineEmits, provide, computed } from "vue";
  97. import previewCard from "@/view/iframe/publish/components/preview-card";
  98. import topUp2 from "@/view/iframe/publish/components/top-up2.vue";
  99. import { RewardType } from '@/types';
  100. let installStatus = ref(false);
  101. provide('installStatus', installStatus)
  102. // 刷新按钮旋转
  103. let refreshRotate = ref(false);
  104. const props = defineProps({
  105. baseFormData: {
  106. type: Object,
  107. default: () => {
  108. return {
  109. amountCurrencyCode: "",
  110. amountValue: "",
  111. totalCount: "",
  112. validityDuration: "",
  113. type: selectModeInfo.type,
  114. rewardType: RewardType.money,
  115. customizedReward: ""
  116. }
  117. },
  118. },
  119. currentCurrencyInfo: {
  120. type: Object,
  121. default: () => {
  122. return {}
  123. }
  124. },
  125. tempCurrentCurrencyInfo: {
  126. type: Object,
  127. default: () => {
  128. return {}
  129. }
  130. },
  131. publishRes: {
  132. type: Object,
  133. default: () => {
  134. return {}
  135. }
  136. },
  137. previewFontSize: {
  138. type: [Number, String],
  139. default: 56
  140. },
  141. customPosterData: {
  142. type: Object,
  143. default: () => {
  144. return {}
  145. }
  146. },
  147. finalAmountData: {
  148. type: Object,
  149. default: () => {
  150. return {
  151. currencyCode: '',
  152. feeAmountValue: 0,
  153. finalAmountValue: 0,
  154. requestAmountValue: 0,
  155. }
  156. }
  157. }
  158. });
  159. let isMoneyRewardCpd =computed(() => props.baseFormData.rewardType === RewardType.money);
  160. const emits = defineEmits(["onTopUpDone", "onUpdateCurrencyBanlce"]);
  161. const topUpDone = () => {
  162. emits("onTopUpDone", {});
  163. }
  164. const updateCurrencyBanlce = () => {
  165. if(!refreshRotate.value) {
  166. refreshRotate.value = true;
  167. setTimeout(() => {
  168. refreshRotate.value = false;
  169. }, 1000)
  170. }
  171. emits("onUpdateCurrencyBanlce", {});
  172. }
  173. </script>
  174. <style scoped lang="scss">
  175. .preview {
  176. padding: 30px 40px;
  177. height: calc(100% - 80px);
  178. overflow-y: auto;
  179. .card {
  180. float: left;
  181. width: 480px;
  182. position: relative;
  183. .flash {
  184. overflow: hidden;
  185. height: 600px;
  186. border-radius: 26px;
  187. border: solid 1px #ececec;
  188. }
  189. &.center {
  190. margin-left: 50%;
  191. transform: translateX(-50%);
  192. }
  193. }
  194. .card-title {
  195. height: 32px;
  196. .img {
  197. float: left;
  198. width: 20px;
  199. height: 20px;
  200. margin-right: 8px;
  201. }
  202. .font {
  203. float: left;
  204. font-size: 17px;
  205. font-weight: 500;
  206. span {
  207. color: #0091e9;
  208. }
  209. }
  210. }
  211. .card-content {
  212. float: right;
  213. width: 500px;
  214. }
  215. .card-amount {
  216. overflow: hidden;
  217. display: flex;
  218. height: 80px;
  219. align-items: center;
  220. padding: 20px;
  221. border-radius: 20px;
  222. border: 1px solid #e6e6e6;
  223. .icon {
  224. width: 40px;
  225. height: 40px;
  226. }
  227. .con {
  228. flex: 1;
  229. padding: 0 10px;
  230. .desc {
  231. color: rgba($color: #000000, $alpha: 0.5);
  232. font-size: 12px;
  233. margin-bottom: 4px;
  234. }
  235. .price {
  236. font-size: 16px;
  237. font-weight: bold;
  238. word-break: break-all;
  239. }
  240. }
  241. .refresh {
  242. cursor: pointer;
  243. width: 30px;
  244. height: 30px;
  245. margin-top: -5px;
  246. }
  247. }
  248. .card-list {
  249. padding: 10px 20px;
  250. border-radius: 20px;
  251. border: 1px solid #e6e6e6;
  252. .item {
  253. display: flex;
  254. justify-content: space-between;
  255. align-items: center;
  256. height: 47px;
  257. font-size: 14px;
  258. font-weight: 500;
  259. box-shadow: inset 0px -1px 0px #eaeaea;
  260. .order-amount {
  261. font-weight: 600;
  262. font-size: 20px;
  263. }
  264. .txt {
  265. font-weight: 500;
  266. font-size: 16px;
  267. color: #9a9a9a;
  268. }
  269. .deposit-amount {
  270. font-weight: 600;
  271. font-size: 20px;
  272. color: #1d9bf0;
  273. }
  274. }
  275. .item:last-child {
  276. box-shadow: none;
  277. }
  278. }
  279. .icon-refresh-rotate {
  280. transform: rotate(360deg);
  281. transition-duration: 1s;
  282. }
  283. }
  284. </style>