TransferDetail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  1. <template>
  2. <div class="product-detail-page">
  3. <!-- 顶部返回按钮 -->
  4. <!-- <van-nav-bar title="NFTCHA-全球首个NFT茶交易平台" left-arrow @click-left="goBack" /> -->
  5. <div class="back" @click="goBack">
  6. <van-icon name="arrow-left" size="22" />
  7. </div>
  8. <!-- 商品图片轮播 -->
  9. <van-swipe class="product-swiper" autoplay="3000" indicator-color="#fff">
  10. <van-swipe-item class="swipe-item" v-for="(image, index) in product.img_url" :key="index">
  11. <!-- <img :src="image" alt="商品图片" /> -->
  12. <van-image class="product-image" style="width: 100%; height: 100%" radius="0" :src="image" />
  13. </van-swipe-item>
  14. </van-swipe>
  15. <!-- 商品信息 -->
  16. <div class="product-info">
  17. <div class="product-price-stock">
  18. <div class="left">
  19. <div class="price">
  20. <span>{{ product.price }}</span>
  21. <span class="small">{{ $t('lang174') }}</span>
  22. <!-- <span class="small">{{ product.cost_price }}USDT</span> -->
  23. </div>
  24. <div class="tags">
  25. <van-tag class="tag" type="info">{{ $t('lang53') }}</van-tag>
  26. <!-- <span>{{ product.num }}{{ $t('lang52') }}</span> -->
  27. </div>
  28. </div>
  29. <!-- <div class="countdown">
  30. <div class="flex">
  31. <img src="@/assets/images/trade/clock.png" alt="" class="clock" />
  32. <span>{{ $t('lang54') }}</span>
  33. </div>
  34. <van-count-down class="count" :time="product.end_time - product.start_time">
  35. <template #default="timeData">
  36. <span class="block">{{ timeData.hours }}</span>
  37. <span class="colon">{{ $t('lang9') }}</span>
  38. <span class="block">{{ timeData.minutes }}</span>
  39. <span class="colon">{{ $t('lang10') }}</span>
  40. <span class="block">{{ timeData.seconds }}</span>
  41. <span class="colon">{{ $t('lang12') }}</span>
  42. </template>
  43. </van-count-down>
  44. </div> -->
  45. </div>
  46. <div class="goods_info">
  47. <div class="flex jsb">
  48. <span class="title">{{ product.name }}</span>
  49. <!-- <span class="red">{{ $t('lang55') }}{{ product.stock }}{{ $t('lang7') }}</span> -->
  50. </div>
  51. <div class="tag">{{ $t('lang56') }}</div>
  52. </div>
  53. </div>
  54. <!-- <div class="issue">
  55. <div v-for="(item, index) in product.times" :key="index" :class="[item.status == 2 ? 'item current' : 'item']">
  56. <div class="flex jsb">
  57. <span>{{ item.title }}</span>
  58. <span> {{ item.start_time_text.split(' ')[0] }}-{{ item.end_time_text.split(' ')[0] }} </span>
  59. <span class="red">{{ item.price }}</span>
  60. <span class="tag">{{ statusFn(item.status) }}</span>
  61. </div>
  62. <van-icon name="ellipsis" size="15" color="#aaaaaa" class="ellipsis-icon" />
  63. </div>
  64. </div> -->
  65. <div class="zp flex jsb">
  66. <span> {{ product.address }} </span>
  67. </div>
  68. <div class="zp flex jsb">
  69. <div class="flex">
  70. <img src="@/assets/images/trade/safe.png" alt="" class="safe" />
  71. <span class="t"> {{ $t('lang57') }} </span>
  72. </div>
  73. <div>
  74. <span> {{ $t('lang58') }} </span>
  75. <van-icon name="arrow" />
  76. </div>
  77. </div>
  78. <!-- 购买记录 -->
  79. <!-- <div class="purchase-record">
  80. <div class="section-title">{{ $t('lang59') }}</div>
  81. <div class="list">
  82. <div class="item flex jsb" v-for="(item, index) in product.order" :key="index">
  83. <div class="flex">
  84. <div class="avatar"></div>
  85. <span>{{ item.address.slice(0, 6) + '****' + item.address.slice(item.address.length - 6, item.address.length) }}</span>
  86. </div>
  87. <div>
  88. <span>{{ formatTimeDifference(item.create_time * 1000) }}</span>
  89. </div>
  90. </div>
  91. <div class="more" v-if="product.order.length == 0">{{ $t('lang60') }}</div>
  92. <div class="more" v-else>{{ $t('lang61') }}</div>
  93. </div>
  94. </div> -->
  95. <!-- 商品详情 -->
  96. <div class="product-details">
  97. <div class="section-title">{{ $t('lang62') }}</div>
  98. <!-- <div class="box flex jsb">
  99. <div class="item">
  100. <span class="key">{{ $t('lang63') }}</span>
  101. <span class="val ellipsis">{{ product.name }}</span>
  102. </div>
  103. <div class="item">
  104. <span class="key">净含量:</span>
  105. <span class="val">100g</span>
  106. </div>
  107. <div class="item">
  108. <span class="key">所属系列:</span>
  109. <span class="val">春夏秋冬系列</span>
  110. </div>
  111. <div class="item">
  112. <span class="key">茶叶产地:</span>
  113. <span class="val">云南贵州</span>
  114. </div>
  115. </div> -->
  116. </div>
  117. <!-- 宣传图片 -->
  118. <!-- <img v-for="(item, index) in product.img_url" :key="index" :src="item" class="promo-image" alt="" /> -->
  119. <div v-html="product.details" class="promo-image"></div>
  120. <!-- 底部导航栏 -->
  121. <div class="bottom">
  122. <div class="flex">
  123. <div class="flex flex-c">
  124. <img src="@/assets/images/trade/custom.png" alt="" class="icon" />
  125. <span>{{ $t('lang67') }}</span>
  126. </div>
  127. <div class="flex flex-c" @click="toPage('invite')">
  128. <img src="@/assets/images/trade/share.png" alt="" class="icon" />
  129. <span>{{ $t('lang68') }}</span>
  130. </div>
  131. </div>
  132. <div class="buy" @click="submit">
  133. <van-button class="buy_btn" type="primary">{{ $t('lang27') }}</van-button>
  134. </div>
  135. </div>
  136. <!-- <van-popup v-model="cascaderShow" round position="bottom">
  137. <div class="area">
  138. <div class="title">{{ $t('lang69') }}</div>
  139. <van-field v-model="search" :placeholder="$t('lang70')" class="input" right-icon="search" @click-right-icon="handleSearch" />
  140. <van-radio-group v-model="areaId" @change="handleChoose" v-if="arealist.length > 0">
  141. <van-cell-group class="vanlist" @scroll="handleScroll">
  142. <van-cell class="item" v-for="item in arealist" :key="item.id" :title="item.address" clickable>
  143. <template #right-icon>
  144. <van-radio :name="item.id" icon-size="16px" checked-color="#29b286" />
  145. </template>
  146. </van-cell>
  147. </van-cell-group>
  148. </van-radio-group>
  149. <div class="nomore" v-else>
  150. <span>{{$t('lang60')}}</span>
  151. </div>
  152. <div class="submit" @click="cascaderShow = true">
  153. <van-button class="submit_btn" type="primary" @click="submit">{{ $t('lang71') }}</van-button>
  154. </div>
  155. </div>
  156. </van-popup> -->
  157. <van-popup v-model="loading" round class="loading-popup">
  158. <div class="loading">
  159. <van-loading type="spinner" />
  160. </div>
  161. </van-popup>
  162. </div>
  163. </template>
  164. <script>
  165. import { homeApi } from '@/api/index';
  166. import { Dialog, Notify, Toast } from 'vant';
  167. export default {
  168. data() {
  169. return {
  170. product: {
  171. info: {},
  172. order: [],
  173. times: [],
  174. },
  175. time: 30 * 60 * 60 * 1000,
  176. cascaderShow: false,
  177. cascaderValue: '',
  178. currentIssue: 0,
  179. // 选项列表,children 代表子选项,支持多级嵌套
  180. options: [],
  181. arealist: [],
  182. search: '',
  183. areaId: '',
  184. loading: false,
  185. page: 1,
  186. };
  187. },
  188. mounted() {
  189. this.getTransferInfo(this.$route.query.id);
  190. },
  191. methods: {
  192. statusFn(status) {
  193. let result = '';
  194. switch (status) {
  195. case 0:
  196. result = this.$t('lang72');
  197. break;
  198. case 1:
  199. result = this.$t('lang73');
  200. break;
  201. case 2:
  202. result = this.$t('lang74');
  203. break;
  204. default:
  205. break;
  206. }
  207. return result;
  208. },
  209. goBack() {
  210. this.$router.back();
  211. },
  212. getTransferInfo(id) {
  213. homeApi.getTransferInfo({ ids: id }).then(res => {
  214. if (res.code == 200) {
  215. this.product = res.data;
  216. this.product.img_url = res.data.img_url.split(',');
  217. // this.getProductAddres();
  218. } else {
  219. }
  220. });
  221. },
  222. maskAddress(address) {
  223. return address.replace(/(\w{4})\w*(\w{4})/, '$1****$2');
  224. },
  225. onFinish({ selectedOptions }) {
  226. this.cascaderShow = false;
  227. },
  228. onClose(e) {},
  229. onChange(e) {},
  230. handleChoose(e) {
  231. console.log(e);
  232. this.areaId = e;
  233. },
  234. toPage(name) {
  235. this.$router.push({ name });
  236. },
  237. submit() {
  238. let _this = this;
  239. Dialog.confirm({
  240. title: this.$t('lang136'),
  241. message: this.$t('lang137'),
  242. confirmButtonText: _this.$t('lang111'),
  243. cancelButtonText: _this.$t('lang135'),
  244. })
  245. .then(() => {
  246. this.loading = true;
  247. homeApi.transferOrder({ order_id: this.product.id }).then(res => {
  248. if (res.code == 200) {
  249. this.loading = false;
  250. this.areaId = '';
  251. Toast({ message: res.msg });
  252. this.$router.push('assets');
  253. } else if (res.code == 15001) {
  254. this.loading = false;
  255. setTimeout(() => {
  256. this.$router.push('recharge');
  257. }, 300);
  258. } else {
  259. this.loading = false;
  260. }
  261. });
  262. })
  263. .catch(() => {
  264. // on cancel
  265. });
  266. // if (!this.areaId) {
  267. // Notify({ type: 'warning', message: this.$t('lang69') });
  268. // }
  269. },
  270. },
  271. };
  272. </script>
  273. <style lang="less" scoped>
  274. .product-detail-page {
  275. // background-color: #fff;
  276. padding-bottom: 100px;
  277. }
  278. .product-swiper {
  279. height: 250px;
  280. width: 100vw;
  281. }
  282. .product-image {
  283. width: 100%;
  284. height: 100%;
  285. }
  286. .product-info {
  287. .product-price-stock {
  288. display: flex;
  289. justify-content: space-between;
  290. align-items: center;
  291. padding: 6px 14px;
  292. background: linear-gradient(to right, #1ab986, #25d7bb);
  293. .left {
  294. flex: 1;
  295. padding-right: 10px;
  296. .price {
  297. font-size: 22px;
  298. color: #fff;
  299. .small {
  300. color: #e7e7e7;
  301. font-size: 12px;
  302. padding-right: 6px;
  303. }
  304. .small:last-child {
  305. text-decoration: line-through;
  306. }
  307. }
  308. .tags {
  309. display: flex;
  310. align-items: center;
  311. justify-content: space-between;
  312. font-size: 11px;
  313. color: #f8f8f8;
  314. text-align: right;
  315. margin-top: 6px;
  316. .tag {
  317. white-space: nowrap;
  318. color: #1ab986;
  319. font-size: 11px;
  320. border-radius: 4px;
  321. background-color: #fff;
  322. }
  323. }
  324. }
  325. .countdown {
  326. font-size: 13px;
  327. border-left: 1px solid #f1f1f1;
  328. padding-left: 10px;
  329. .clock {
  330. width: 20px;
  331. height: 20px;
  332. margin-right: 4px;
  333. }
  334. .count {
  335. margin-top: 6px;
  336. }
  337. .colon {
  338. display: inline-block;
  339. margin: 0 4px;
  340. color: #fff;
  341. font-size: 11px;
  342. }
  343. .block {
  344. display: inline-block;
  345. width: 21px;
  346. color: #1ab986;
  347. font-size: 12px;
  348. text-align: center;
  349. border-radius: 4px;
  350. background-color: #fff;
  351. }
  352. }
  353. }
  354. .goods_info {
  355. padding: 8px 14px;
  356. background-color: #fff;
  357. .title {
  358. font-size: 16px;
  359. font-weight: 550;
  360. color: #3d3d3d;
  361. }
  362. .red {
  363. color: rgb(255, 48, 48);
  364. font-size: 11px;
  365. }
  366. .tag {
  367. color: #0db39a;
  368. font-size: 11px;
  369. padding-top: 8px;
  370. }
  371. }
  372. }
  373. .issue {
  374. color: #aaaaaa;
  375. font-size: 13px;
  376. padding: 16px 14px;
  377. margin: 8px 0;
  378. background-color: #ffffff;
  379. .item {
  380. .ellipsis-icon {
  381. transform: rotate(90deg);
  382. margin-left: 0.8em;
  383. }
  384. }
  385. .red::after {
  386. content: 'USDT';
  387. font-size: 8px;
  388. }
  389. .item:last-child {
  390. .ellipsis-icon {
  391. display: none;
  392. }
  393. }
  394. .tag {
  395. font-size: 12px;
  396. padding: 2px 6px;
  397. border-radius: 4px;
  398. background-color: #fff;
  399. }
  400. .current {
  401. color: #000;
  402. .red {
  403. color: rgb(255, 48, 48);
  404. }
  405. .tag {
  406. color: #29b286;
  407. background-color: #d4f0e7;
  408. }
  409. }
  410. }
  411. .zp {
  412. color: #3d3d3d;
  413. font-size: 12px;
  414. padding: 16px 14px;
  415. margin: 8px 0;
  416. background-color: #ffffff;
  417. white-space: nowrap;
  418. .safe {
  419. width: 22px;
  420. height: 22px;
  421. margin-right: 4px;
  422. }
  423. .t {
  424. font-size: 13px;
  425. white-space: wrap;
  426. }
  427. }
  428. .jsb {
  429. justify-content: space-between;
  430. }
  431. .flex {
  432. display: flex;
  433. align-items: center;
  434. }
  435. .section-title {
  436. font-size: 15px;
  437. font-weight: bold;
  438. margin-bottom: 8px;
  439. }
  440. .purchase-record {
  441. color: #3d3d3d;
  442. padding: 14px;
  443. background-color: #fff;
  444. .list {
  445. .item {
  446. font-size: 12px;
  447. padding-top: 14px;
  448. .avatar {
  449. width: 28px;
  450. height: 28px;
  451. border-radius: 50%;
  452. margin-right: 4px;
  453. background: linear-gradient(to bottom right, #29b286, #30d5a0);
  454. }
  455. }
  456. }
  457. .more {
  458. text-align: center;
  459. font-size: 12px;
  460. color: #aaaaaa;
  461. padding-top: 20px;
  462. }
  463. }
  464. .product-details {
  465. color: #3d3d3d;
  466. font-size: 12px;
  467. padding: 16px 14px;
  468. margin: 8px 0 0;
  469. background-color: #ffffff;
  470. .box {
  471. color: #aaaaaa;
  472. flex-wrap: wrap;
  473. padding: 7px 14px;
  474. border-radius: 10px;
  475. background-color: #ededed;
  476. .item {
  477. display: flex;
  478. align-items: center;
  479. width: 50%;
  480. padding: 7px 0px;
  481. .val {
  482. color: #000;
  483. width: 50%;
  484. // display: block;
  485. }
  486. }
  487. }
  488. }
  489. .ellipsis {
  490. overflow: hidden; /* 确保超出容器的文本被裁剪 */
  491. white-space: nowrap; /* 确保文本在一行内显示 */
  492. text-overflow: ellipsis; /* 使用省略号表示文本超出 */
  493. }
  494. .promo-image {
  495. width: 100%;
  496. // margin-top: 14px;
  497. }
  498. .van-tabbar-item {
  499. font-size: 14px;
  500. }
  501. .bottom {
  502. position: fixed;
  503. bottom: 0;
  504. left: 0;
  505. width: 100%;
  506. height: 50px;
  507. background-color: #fff;
  508. display: flex;
  509. justify-content: space-between;
  510. align-items: center;
  511. padding: 0 14px;
  512. box-sizing: border-box;
  513. .flex-c {
  514. color: #3d3d3d;
  515. font-size: 10px;
  516. flex-direction: column;
  517. margin-right: 16px;
  518. .icon {
  519. width: 22px;
  520. height: 22px;
  521. margin-bottom: 3px;
  522. }
  523. }
  524. .buy {
  525. &_btn {
  526. height: 30px;
  527. line-height: 30px;
  528. font-size: 13px;
  529. background-color: #29b286;
  530. border: none;
  531. padding: 0 16px;
  532. white-space: nowrap;
  533. border-radius: 30px;
  534. }
  535. }
  536. }
  537. .back {
  538. position: fixed;
  539. z-index: 99;
  540. top: 14px;
  541. left: 14px;
  542. box-sizing: border-box;
  543. width: 40px;
  544. height: 40px;
  545. margin: auto auto;
  546. display: flex;
  547. align-items: center;
  548. justify-content: center;
  549. border-radius: 50%;
  550. background-color: #7a777b;
  551. }
  552. .area {
  553. padding: 20px 30px;
  554. width: 100%;
  555. box-sizing: border-box;
  556. position: relative;
  557. .title {
  558. color: #000;
  559. font-size: 15px;
  560. text-align: center;
  561. font-weight: bold;
  562. padding: 0 0 14px;
  563. }
  564. .vanlist {
  565. max-height: 350px;
  566. min-height: 350px;
  567. overflow: auto;
  568. box-sizing: border-box;
  569. margin: 20px 0;
  570. border: none !important;
  571. .item {
  572. padding: 12px 0 !important;
  573. border-bottom: 0.5px solid rgba(190, 190, 190, 0.15);
  574. }
  575. }
  576. .nomore {
  577. color: #aaa;
  578. text-align: center;
  579. font-size: 12px;
  580. height: 350px;
  581. padding: 40px 0;
  582. }
  583. .submit {
  584. width: 100%;
  585. // position: fixed;
  586. bottom: 30px;
  587. box-sizing: border-box;
  588. &_btn {
  589. width: 100%;
  590. height: 40px;
  591. line-height: 40px;
  592. font-size: 14px;
  593. background-color: #29b286;
  594. border: none;
  595. white-space: nowrap;
  596. border-radius: 30px;
  597. }
  598. }
  599. .input {
  600. width: 100%;
  601. border: 1px solid #29b286;
  602. border-radius: 20px;
  603. }
  604. ::v-deep .van-field__control {
  605. padding: 6px 12px;
  606. }
  607. ::v-deep .van-icon-search {
  608. font-size: 20px;
  609. color: #29b286;
  610. font-weight: bold;
  611. margin-right: 10px;
  612. }
  613. ::v-deep .van-hairline--top-bottom::after,
  614. ::v-deep.van-hairline-unset--top-bottom::after {
  615. border: none;
  616. }
  617. }
  618. ::v-deep .van-hairline--left::after {
  619. border-left-width: 0.005px !important;
  620. }
  621. ::v-deep .van-cascader__option,
  622. ::v-deep .van-cascader__title {
  623. color: #000;
  624. }
  625. ::v-deep .van-dialog__footer {
  626. ::v-deep .van-hairline--top::after {
  627. border-top-width: 0.005px !important;
  628. }
  629. ::v-deep .van-hairline--top {
  630. position: static !important;
  631. }
  632. }
  633. ::v-deep.van-dialog__confirm,
  634. ::v-deep.van-dialog__cancel {
  635. height: fit-content !important;
  636. }
  637. ::v-deep .van-hairline--left::after {
  638. border-left-width: 0.005px !important;
  639. }
  640. .loading {
  641. padding: 50px 60px;
  642. border: none;
  643. background-color: rgba(#353535, 1);
  644. }
  645. .loading-popup {
  646. background-color: rgba(#353535, 0);
  647. }
  648. </style>