transfer.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. <template>
  2. <div>
  3. <!-- <Header :logoImg="indexinfo.system_logo" style="margin-top: 20px"></Header> -->
  4. <div class="head">
  5. <img @click="back" src="@/assets/images/back.png" class="arrow_img" />
  6. <span>{{ $t('lang216') }}</span>
  7. </div>
  8. <div class="home_page" @scroll="handleScroll">
  9. <div class="pd1">
  10. <van-field v-model="key" :placeholder="$t('lang4')" class="input" right-icon="search" @click-right-icon="search" />
  11. <div class="banner">
  12. <van-swipe :autoplay="3000" class="my-swipe" ref="swipeRef">
  13. <van-swipe-item class="swipe-item" v-for="(item, index) in indexinfo.banner_list" :key="index">
  14. <van-image style="width: 100%; height: 100%" radius="12" :src="item.img_url" />
  15. </van-swipe-item>
  16. </van-swipe>
  17. </div>
  18. <van-dropdown-menu active-color="#3d3d3d">
  19. <van-dropdown-item v-model="sort" :options="option1" @change="search" />
  20. <van-dropdown-item v-model="type_id" :options="indexinfo.type_list" @change="search" />
  21. </van-dropdown-menu>
  22. </div>
  23. <div class="pd goods_box">
  24. <div class="goods_list jsb" v-for="(item, index) in list" :key="index">
  25. <van-image class="goods_list_img" radius="10" :src="item.img_url" />
  26. <div class="right" style="flex: 1">
  27. <span class="ellipsis">{{ item.name }}</span>
  28. <div class="green">{{ item.title }}</div>
  29. <span class="time_text t2">{{ $t('lang15') }}{{ item.nickname }}</span>
  30. <span class="time_text t2">{{ item.address }}</span>
  31. <div class="flex jsb">
  32. <div class="cen">
  33. <span class="mon_t">{{ $t('lang16') }}: </span>
  34. <span class="money"
  35. >{{ Math.floor(item.price * 100) / 100 }}<span class="ssm">{{ $t('lang174') }}</span></span
  36. >
  37. </div>
  38. <div class="buy" @click="navigatorToPage('TransferDetail', item.id)">
  39. <van-button class="buy_btn" type="primary">{{ $t('lang17') }}</van-button>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. </template>
  48. <script>
  49. import Header from '@/components/Header.vue';
  50. import { mapState } from 'vuex';
  51. import { homeApi } from '@/api/index';
  52. import BottomNavigation from '@/components/BottomNavigation.vue';
  53. import { Notify } from 'vant';
  54. import { dateFormat } from '@/utils/formatTool.js';
  55. export default {
  56. data() {
  57. return {
  58. show: false, //弹窗状态
  59. address: '', //上级地址
  60. noticeText: '', //公告
  61. indexinfo: {
  62. system_name: '',
  63. system_logo: '',
  64. banner_list: [],
  65. notice_list: [],
  66. },
  67. inviteCode: undefined,
  68. userinfo: {
  69. power: undefined,
  70. token: undefined,
  71. usdt: undefined,
  72. team_poser: undefined,
  73. },
  74. bindShow: false,
  75. time: 30 * 60 * 60 * 1000,
  76. showLoading: true,
  77. key: '',
  78. sort: 0,
  79. type_id: 0,
  80. option1: [
  81. { text: this.$t('lang31'), value: 0 },
  82. { text: this.$t('lang32'), value: 1 },
  83. { text: this.$t('lang33'), value: 2 },
  84. ],
  85. option2: [
  86. { text: this.$t('lang34'), value: 0 },
  87. { text: this.$t('lang28'), value: 1 },
  88. { text: this.$t('lang29'), value: 2 },
  89. { text: this.$t('lang30'), value: 3 },
  90. ],
  91. list: [],
  92. page: 1,
  93. };
  94. },
  95. created() {
  96. this.inviteCode = this.$route.query.inviteCode;
  97. if (this.inviteCode) {
  98. localStorage.setItem('inviteCode', this.inviteCode);
  99. }
  100. // this.getUserInfo();
  101. },
  102. mounted() {
  103. this.init();
  104. },
  105. methods: {
  106. //返回上一页
  107. back() {
  108. this.$router.back();
  109. },
  110. init() {
  111. this.getIndexInfo();
  112. this.getTransferList();
  113. },
  114. dateFormatFn(date) {
  115. return dateFormat(new Date(date * 1000), 'yyyy-MM-dd');
  116. },
  117. handleScroll(event) {
  118. const container = event.target;
  119. const scrollTop = container.scrollTop; // 滚动距离
  120. const scrollHeight = container.scrollHeight; // 内容总高度
  121. const clientHeight = container.clientHeight; // 可视区域高度
  122. // 判断是否滑动到底部
  123. if (scrollTop + clientHeight >= scrollHeight - 10) {
  124. console.log('Bottom');
  125. if (this.page != -1) {
  126. this.page++; // 页数加 1
  127. this.getTransferList(); // 触发加载更多
  128. }
  129. }
  130. },
  131. search() {
  132. this.page = 1;
  133. this.list = []; // 重置列表数据
  134. this.getTransferList(); // 触发重新获取列表数据
  135. },
  136. getTransferList() {
  137. homeApi.getTransferList({ sort: this.sort, type_id: this.type_id, key_val: this.key, page: this.page }).then(res => {
  138. if (res.code == 200) {
  139. if (this.list.length >= res.data.total) {
  140. this.page = -1; // 重置为 -1,表示没有更多数据
  141. } else {
  142. this.list = [...this.list, ...res.data.data];
  143. if (this.list.length >= res.data.total) {
  144. this.page = -1; // 重置为 -1,表示没有更多数据
  145. }
  146. }
  147. } else {
  148. }
  149. });
  150. },
  151. navigatorToPage(name, id) {
  152. this.$router.push({ name, query: { id: id } });
  153. },
  154. getIndexInfo() {
  155. homeApi.getIndexBaseInfo().then(res => {
  156. if (res.code == 200) {
  157. this.showLoading = false;
  158. this.indexinfo = res.data;
  159. this.indexinfo.type_list = res.data.type_list.map(item => {
  160. return { text: item.title, value: item.id };
  161. });
  162. this.indexinfo.type_list.unshift({ text: this.$t('lang34'), value: 0 });
  163. } else {
  164. this.showLoading = false;
  165. }
  166. });
  167. },
  168. handleExpand() {
  169. this.isExpand = !this.isExpand;
  170. },
  171. },
  172. computed: {
  173. ...mapState(['account']),
  174. },
  175. watch: {
  176. account(e) {
  177. // this.init();
  178. // this.bind();
  179. },
  180. },
  181. components: {
  182. Header,
  183. BottomNavigation,
  184. },
  185. };
  186. </script>
  187. <style lang="less" scoped>
  188. .head {
  189. position: fixed;
  190. top: 0;
  191. left: 0;
  192. width: 100%;
  193. display: flex;
  194. align-items: center;
  195. justify-content: center;
  196. color: rgba(#000, 0.8);
  197. letter-spacing: 1.5px;
  198. font-weight: 550;
  199. background: #fff;
  200. padding: 14px 0;
  201. z-index: 99;
  202. .arrow_img {
  203. position: absolute;
  204. left: 20px;
  205. width: 10px;
  206. height: 16px;
  207. // transform: translate(0, -50%);
  208. }
  209. }
  210. .home_page {
  211. padding: 50px 0 100px;
  212. height: 100vh;
  213. overflow: auto;
  214. .pd {
  215. padding: 14px;
  216. // background-color: #fff;
  217. }
  218. .pd1 {
  219. padding: 14px 14px 0;
  220. background-color: #fff;
  221. .input {
  222. width: 100%;
  223. // height: 35px;
  224. // line-height: 35px;
  225. border: 1px solid #29b286;
  226. border-radius: 20px;
  227. margin: 10px 0 20px;
  228. ::v-deep .van-field__control {
  229. padding: 6px 12px;
  230. }
  231. ::v-deep .van-icon-search {
  232. font-size: 22px;
  233. color: #29b286;
  234. font-weight: bold;
  235. margin-right: 10px;
  236. }
  237. }
  238. ::v-deep .van-popup {
  239. padding: 10px 20px 30px;
  240. }
  241. ::v-deep .van-dropdown-item__option {
  242. border-bottom: 1px solid rgba(#adadad, 0.2);
  243. padding: 10px 0 !important;
  244. }
  245. ::v-deep .van-dropdown-menu__bar {
  246. box-shadow: none;
  247. }
  248. ::v-deep .van-dropdown-item__option {
  249. color: #aaaaaa;
  250. }
  251. ::v-deep .van-ellipsis {
  252. color: #3d3d3d;
  253. font-size: 14px;
  254. }
  255. }
  256. .top {
  257. display: flex;
  258. justify-content: space-between;
  259. align-items: center;
  260. .cha {
  261. width: 100px;
  262. }
  263. .input {
  264. width: calc(100% - 110px);
  265. border: 1px solid #29b286;
  266. border-radius: 20px;
  267. }
  268. ::v-deep .van-field__control {
  269. padding: 6px 12px;
  270. }
  271. ::v-deep .van-icon-search {
  272. font-size: 20px;
  273. color: #29b286;
  274. font-weight: bold;
  275. margin-right: 10px;
  276. }
  277. }
  278. .notice {
  279. font-size: 13px;
  280. margin: 8px 0;
  281. .notice-ico {
  282. padding: 0 8px;
  283. border-radius: 20px;
  284. margin-right: 10px;
  285. background-color: #e8e8e8;
  286. }
  287. }
  288. ::v-deep .van-notice-bar {
  289. padding: 0 !important;
  290. }
  291. .banner {
  292. height: 160px;
  293. color: #fff;
  294. font-size: 22px;
  295. border-radius: 12px;
  296. .my-swipe {
  297. width: 100%;
  298. height: 100%;
  299. border-radius: 12px;
  300. }
  301. }
  302. .jsb {
  303. justify-content: space-between;
  304. }
  305. .goods_box {
  306. // margin: 14px;
  307. border-radius: 14px;
  308. .good_icon {
  309. width: 16px;
  310. height: 16px;
  311. margin-right: 5px;
  312. }
  313. }
  314. .goods_list {
  315. display: flex;
  316. // align-items: center;
  317. // justify-content: space-between;
  318. color: #000;
  319. padding: 14px;
  320. border-radius: 10px;
  321. // box-shadow: 0 4px 16px 0 rgba(53, 73, 93, 0.15);
  322. margin-bottom: 16px;
  323. // box-shadow: 4px 4px 15px 0px rgba(180, 212, 212, 0.29);
  324. background-color: #fff;
  325. // background-image: linear-gradient(90deg, rgba(217, 239, 239, 0.3) 0, rgba(217, 239, 239, 0.3) 0, rgba(225, 240, 242, 0.3) 100%, rgba(225, 240, 242, 0.3) 100%);
  326. &_img {
  327. width: 90px;
  328. height: 90px;
  329. border-radius: 10px;
  330. margin-right: 10px;
  331. }
  332. .right {
  333. width: calc(100% - 100px);
  334. display: flex;
  335. flex-direction: column;
  336. justify-content: space-between;
  337. font-size: 13px;
  338. box-sizing: border-box;
  339. // padding: 6px 0;
  340. .time_text {
  341. color: #7f7f7f;
  342. font-weight: normal;
  343. font-size: 10px;
  344. text-decoration: line-through;
  345. }
  346. .cen {
  347. color: red;
  348. font-size: 12px;
  349. }
  350. .money {
  351. font-size: 15px;
  352. }
  353. .ssm {
  354. font-size: 10px;
  355. font-weight: normal;
  356. }
  357. .mon_t {
  358. color: #3d3d3d;
  359. font-weight: normal;
  360. }
  361. .yel {
  362. background-color: #f9f6e5;
  363. font-weight: normal;
  364. margin-left: 8px;
  365. padding: 0px 8px;
  366. border-radius: 16px;
  367. .count {
  368. color: #f7c35d;
  369. font-size: 9px;
  370. }
  371. }
  372. .green {
  373. width: fit-content;
  374. color: #29b286;
  375. background-color: #ddf2e7;
  376. font-size: 10px;
  377. font-weight: normal;
  378. padding: 2px 6px;
  379. border-radius: 6px;
  380. margin: 3px 0;
  381. }
  382. .t2 {
  383. text-decoration: none;
  384. white-space: nowrap;
  385. padding: 2px 0;
  386. }
  387. }
  388. .buy {
  389. display: flex;
  390. align-items: flex-end;
  391. &_btn {
  392. height: 26px;
  393. line-height: 26px;
  394. font-size: 10px;
  395. background-color: #29b286;
  396. border: none;
  397. padding: 0 10px;
  398. white-space: nowrap;
  399. border-radius: 30px;
  400. }
  401. }
  402. }
  403. }
  404. .goods_list1 {
  405. flex-wrap: wrap;
  406. &_img {
  407. width: 100%;
  408. height: 70px;
  409. border-radius: 10px;
  410. margin-right: 10px;
  411. }
  412. .item {
  413. width: 45%;
  414. margin-bottom: 10px;
  415. .cen {
  416. padding-top: 4px;
  417. .mon_t {
  418. font-size: 11px;
  419. color: #7f7f7f;
  420. }
  421. .money::after {
  422. content: 'CHA/年';
  423. }
  424. }
  425. }
  426. }
  427. .bind_box {
  428. color: #000;
  429. padding: 20px 20px 30px;
  430. .address_field {
  431. border-bottom: 1px solid #cccccc9d;
  432. padding: 10px 0;
  433. margin: 20px 10px 20px;
  434. }
  435. .bind_button {
  436. color: #fff;
  437. text-align: center;
  438. background: #7938cf;
  439. border-radius: 20px;
  440. padding: 10px 0;
  441. }
  442. }
  443. .flex {
  444. display: flex;
  445. align-items: center;
  446. }
  447. .flex_end {
  448. align-items: flex-end;
  449. }
  450. ::v-deep .van-cascader__option {
  451. color: #000;
  452. }
  453. .ellipsis {
  454. overflow: hidden; /* 确保超出容器的文本被裁剪 */
  455. white-space: nowrap; /* 确保文本在一行内显示 */
  456. text-overflow: ellipsis; /* 使用省略号表示文本超出 */
  457. }
  458. </style>