confirm.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <template>
  2. <!-- 公共组件 -->
  3. <div class="confirm">
  4. <v-head :title="'Withdraw'" :show_more="true"></v-head>
  5. <!-- 内容 -->
  6. <div class="content">
  7. <div class="order">
  8. <div class="txt">Confirm order</div>
  9. <div class="money">{{ withdraw_info.data.amount }} {{ withdraw_info.data.currency_code }}</div>
  10. <!-- <div class="txt">≈$6.67</div> -->
  11. </div>
  12. <div class="info">
  13. <div class="item">
  14. <div class="key">Address</div>
  15. <div class="val">{{ withdraw_info.data.input_address }}</div>
  16. </div>
  17. <div class="item">
  18. <div class="key">Network</div>
  19. <!-- <div class="val">{{ withdraw_info.token_chain }}</div> -->
  20. <div class="val">BNB Smart Chain (BEP20)</div>
  21. </div>
  22. <div class="info-warn">
  23. Ensure the network is correct
  24. </div>
  25. <div class="item">
  26. <div class="key">Amount</div>
  27. <div class="val">{{ withdraw_info.data.amount }} {{ withdraw_info.token_symbol }}</div>
  28. </div>
  29. <div class="item">
  30. <div class="key">Network fee</div>
  31. <div class="val">{{ withdraw_info.data.fee_amount }} {{ withdraw_info.token_symbol }}</div>
  32. </div>
  33. </div>
  34. <div class="tips">
  35. <div class="tips-icon">
  36. <img :src="require('@/assets/svg/icon-top-up-tips-warning.svg')" alt="">
  37. </div>
  38. <div class="tips-content">
  39. <p>Ensure that the address is correct and on the same network. Otherwise, you'll lose your assets.
  40. </p>
  41. </div>
  42. </div>
  43. </div>
  44. <!-- 底部 -->
  45. <div class="footer">
  46. <div class="left">
  47. <img :src="require('@/assets/svg/icon-enter-ed.svg')" alt="" v-if="state.img_enter_state"
  48. @click="clickEnter">
  49. <img :src="require('@/assets/svg/icon-enter.svg')" alt="" v-else @click="clickEnter">
  50. <span @click="clickEnter">Read </span> &nbsp;
  51. <span class="agreement" @click="clickRisk">Risk Warning</span>
  52. </div>
  53. <div class="right">
  54. <div class="btn" @click="clickBtn" :class="{ enter: state.img_enter_state }">Confirm</div>
  55. </div>
  56. </div>
  57. </div>
  58. </template>
  59. <script setup>
  60. import { reactive, inject, onMounted } from 'vue'
  61. import VHead from '@/view/popup/components/head.vue'
  62. import { withdrawRequest } from "@/http/account";
  63. import router from "@/router/popup.js";
  64. import Report from "@/log-center/log";
  65. import { message } from "ant-design-vue";
  66. let withdraw_info = inject('withdraw_info')
  67. withdraw_info.source = 'confirm'
  68. withdraw_info.state_page = {}
  69. let state = reactive({
  70. img_enter_state: false
  71. })
  72. const clickBtn = () => {
  73. if (!state.img_enter_state) {
  74. return
  75. }
  76. withdrawRequest({
  77. params: {
  78. "amountValue": withdraw_info.data.input_amount,
  79. "currencyCode": withdraw_info.currency_code,
  80. "withdrawNetwork": withdraw_info.token_chain,
  81. "withdrawReceiveAccount": withdraw_info.data.input_address
  82. }
  83. }).then((res) => {
  84. switch (res.code.toString()) {
  85. case '0':
  86. withdraw_info.state_page.txt = ['Estimated completion with a few minutes', 'View history for the latest updates']
  87. router.push('/withdraw/success')
  88. break
  89. case '4002':
  90. message.error(res.msg);
  91. break
  92. default:
  93. message.error(res.code);
  94. }
  95. })
  96. }
  97. onMounted(()=>{
  98. Report.reportLog({
  99. pageSource: Report.pageSource.denetWithdrawConfirm,
  100. businessType: Report.businessType.pageView,
  101. });
  102. state.img_enter_state = withdraw_info.enter_state
  103. })
  104. const clickRisk = () => {
  105. withdraw_info.enter_state = state.img_enter_state
  106. router.push('/withdraw/risk')
  107. }
  108. const clickEnter = () => {
  109. state.img_enter_state = !state.img_enter_state
  110. }
  111. </script>
  112. <style lang='scss' scoped>
  113. .confirm {
  114. position: relative;
  115. height: 100%;
  116. .head {
  117. height: 48px;
  118. display: flex;
  119. flex-wrap: nowrap;
  120. justify-content: space-between;
  121. align-items: center;
  122. padding: 0 12px;
  123. border-bottom: 1px solid #DBDBDB;
  124. .back,
  125. .more {
  126. width: 24px;
  127. height: 24px;
  128. cursor: pointer;
  129. }
  130. .title {
  131. padding-left: 16px;
  132. flex: 1;
  133. color: #000000;
  134. font-size: 16px;
  135. font-weight: 500;
  136. }
  137. }
  138. .content {
  139. padding: 16px 16px 0 16px;
  140. .order {
  141. text-align: center;
  142. .txt {
  143. font-weight: 500;
  144. font-size: 15px;
  145. color: #000000;
  146. }
  147. .txt:first-child {
  148. margin-bottom: 9px;
  149. }
  150. .txt:last-child {
  151. margin-top: 5px;
  152. }
  153. .money {
  154. font-weight: 600;
  155. font-size: 24px;
  156. color: #000000;
  157. }
  158. }
  159. .info {
  160. text-align: right;
  161. background: #F7F7F7;
  162. border-radius: 18px;
  163. padding: 0 16px 20px 16px;
  164. margin-top: 20px;
  165. .item {
  166. display: flex;
  167. padding-top: 20px;
  168. .key {
  169. text-align: left;
  170. width: 100px;
  171. color: #8B8B8B;
  172. font-weight: 500;
  173. font-size: 14px;
  174. }
  175. .val {
  176. word-break: break-all;
  177. flex: 1;
  178. font-weight: 500;
  179. font-size: 14px;
  180. text-align: right;
  181. letter-spacing: 0.5px;
  182. }
  183. }
  184. .info-warn {
  185. margin-top: 7px;
  186. background: #F4EEE1;
  187. border-radius: 5px;
  188. height: 30px;
  189. line-height: 30px;
  190. text-align: center;
  191. display: inline-block;
  192. padding: 0 8px;
  193. color: #AD8226;
  194. }
  195. }
  196. .tips {
  197. margin-top: 12px;
  198. font-size: 13px;
  199. height: 118;
  200. overflow: auto;
  201. background: #FCF5E5;
  202. display: flex;
  203. padding: 10px;
  204. border-radius: 10px;
  205. .tips-icon {
  206. width: 30px;
  207. img {
  208. width: 20px;
  209. height: 20px;
  210. }
  211. }
  212. .tips-content {
  213. flex: 1;
  214. }
  215. p {
  216. margin: 0;
  217. padding: 0;
  218. color: #AD8226;
  219. }
  220. }
  221. }
  222. .footer {
  223. background: #FFFFFF;
  224. z-index: 11;
  225. border-top: 1px solid #DBDBDB;
  226. bottom: 0;
  227. height: 80px;
  228. display: flex;
  229. position: absolute;
  230. justify-content: space-between;
  231. width: 100%;
  232. bottom: 0;
  233. align-items: center;
  234. .left {
  235. cursor: pointer;
  236. margin-left: 16px;
  237. display: flex;
  238. align-items: center;
  239. img {
  240. width: 24px;
  241. height: 24px;
  242. margin-right: 10px;
  243. }
  244. span {
  245. font-size: 14px;
  246. }
  247. .agreement {
  248. text-decoration: underline;
  249. color: #1D9BF0;
  250. }
  251. }
  252. .right {
  253. margin-right: 16px;
  254. .btn {
  255. cursor: pointer;
  256. width: 140px;
  257. height: 46px;
  258. line-height: 46px;
  259. text-align: center;
  260. font-weight: 600;
  261. font-size: 18px;
  262. color: #FFFFFF;
  263. background: #D2D2D2;
  264. border-radius: 100px;
  265. }
  266. .enter {
  267. background: #1D9BF0;
  268. }
  269. }
  270. }
  271. }
  272. </style>