typeDetail.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. <template>
  2. <div class="page">
  3. <!-- 顶部返回按钮 -->
  4. <div class="head">
  5. <div class="back" @click="back">
  6. <van-icon name="arrow-left" size="18" />
  7. </div>
  8. <div @click="changeStar">
  9. <svg t="1746761208974" class="icon" viewBox="0 0 1058 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1116" width="22" height="22" v-if="product.collect == null">
  10. <path
  11. d="M274.72727305 953.81818174c-5.4545458 0-10.90909073 0-16.36363653-2.72727247-13.63636406-5.4545458-24.54545479-13.63636406-32.72727305-27.27272724-5.4545458-10.90909073-8.18181826-21.81818145-5.45454492-35.45454551L263.81818144 634.72727305 81.09090898 454.72727305c-21.81818145-21.81818145-21.81818145-54.54545449 0-76.36363682 8.18181826-8.18181826 19.09090898-13.63636406 29.99999971-16.36363652l253.63636436-38.18181797 114.5454539-229.09090869c5.4545458-13.63636406 16.36363653-21.81818145 32.72727305-27.27272725 13.63636406-5.4545458 27.27272724-2.72727247 40.90909131 2.72727246 10.90909073 5.4545458 19.09090898 13.63636406 24.5454539 24.54545479l114.54545479 229.09090869 253.63636347 38.18181797c29.99999971 5.4545458 49.09090869 32.72727305 46.36363624 62.72727275-2.72727247 10.90909073-8.18181826 21.81818145-16.36363565 30.00000059L792.90909072 634.72727305l43.63636377 253.63636348c2.72727247 13.63636406 0 29.99999971-8.18181826 40.90909042s-21.81818145 19.09090898-35.4545455 21.81818233c-10.90909073 2.72727247-24.54545479 0-35.45454552-5.45454581L525.63636406 828.36363623l-226.36363711 119.99999971c-8.18181826 5.4545458-16.36363653 5.4545458-24.5454539 5.4545458zM525.63636406 124.72727276l-125.4545455 256.36363593L116.5454545 419.27272754l204.54545477 199.09090899-49.09090956 280.90909071 253.63636435-133.63636377 253.63636348 133.63636377-49.09090957-280.90909072 204.54545479-199.09090898-280.90909073-40.90909131L525.63636406 124.72727276z"
  12. fill="#ffffff"
  13. p-id="1117"
  14. ></path>
  15. </svg>
  16. <svg t="1746757109445" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1562" width="22" height="22" v-if="product.collect != null">
  17. <path
  18. d="M547.978 84.41l114.854 232.476c5.536 11.07 16.606 19.373 30.444 22.141l256 37.362c31.827 4.152 45.665 44.281 22.14 67.806l-186.81 179.891c-9.687 9.687-13.838 22.141-11.07 34.595l42.896 256c5.536 31.827-29.059 56.735-58.118 41.514l-229.709-120.39c-11.07-5.535-24.908-5.535-37.362 0l-229.708 120.39c-29.06 15.221-63.654-9.687-58.119-41.514l44.281-254.616c2.768-12.454-1.383-26.292-11.07-34.595L53.967 444.195c-23.524-23.525-11.07-62.27 22.141-67.806l256-37.362c12.454-1.384 23.524-9.686 30.443-22.14L477.405 84.41c13.838-29.06 55.352-29.06 70.573 0z m0 0"
  19. fill="#FFBE11"
  20. p-id="1563"
  21. ></path>
  22. </svg>
  23. </div>
  24. </div>
  25. <div class="box" @scroll="handleScroll">
  26. <div class="bg" :style="{ backgroundImage: `url(${product.thum})` }"></div>
  27. <div class="content">
  28. <!-- <div class="mb">
  29. <span>{{ $t('lang300') }}</span>
  30. </div> -->
  31. <img :src="product.thum" alt="" class="pic" />
  32. <span class="name">{{ product.name }}</span>
  33. <div class="num">
  34. <div class="num_box">
  35. <div class="left">{{ $t('lang301') }}</div>
  36. <div class="right">{{ product.issue }}{{ $t('lang7') }}</div>
  37. </div>
  38. <div class="num_box">
  39. <div class="left">{{ $t('lang302') }}</div>
  40. <div class="right">{{ product.circulation }}{{ $t('lang7') }}</div>
  41. </div>
  42. </div>
  43. </div>
  44. <div class="bottom">
  45. <van-tabs v-model="navActive" color="#29B286" title-active-color="#000" class="van-tabs">
  46. <van-tab :title="$t('lang343')"></van-tab>
  47. <van-tab :title="$t('lang344')"></van-tab>
  48. </van-tabs>
  49. <div class="flex sb" v-if="navActive == 0">
  50. <div class="small_nav flex">
  51. <span :class="[index == smallNavIndex ? 'small_nav_item nav_active' : 'small_nav_item']" v-for="(item, index) in smallNav" :key="index" @click="changeType(item, index)">{{
  52. item.key
  53. }}</span>
  54. </div>
  55. <div class="flex sort" v-if="smallNavIndex == 0">
  56. <div class="flex" @click="handlePriceSort">
  57. <span>{{ $t('lang247') }}</span>
  58. <img src="@/assets/images/index/j0.png" alt="" style="width: 14px" v-if="sort == 0" />
  59. <img src="@/assets/images/index/j2.png" alt="" style="width: 14px" v-else-if="sort == 1" />
  60. <img src="@/assets/images/index/j1.png" alt="" style="width: 14px" v-else-if="sort == 2" />
  61. </div>
  62. <!-- <div class="flex" @click="handleVolumeSort">
  63. <span>{{ $t('lang346') }}</span>
  64. <img src="@/assets/images/index/j0.png" alt="" style="width: 14px" v-if="volume == 0" />
  65. <img src="@/assets/images/index/j2.png" alt="" style="width: 14px" v-else-if="volume == 1" />
  66. <img src="@/assets/images/index/j1.png" alt="" style="width: 14px" v-else-if="volume == 2" />
  67. </div> -->
  68. </div>
  69. </div>
  70. <template v-if="navActive == 0 && smallNavIndex == 0">
  71. <div class="list" v-if="product.producttransfer.length > 0">
  72. <van-checkbox-group v-model="checkOrder">
  73. <div class="list_item flex sb" v-for="(item, index) in product.producttransfer" :key="index">
  74. <div class="flex">
  75. <van-checkbox :name="item" @click.stop shape="square" checked-color="#29b286" icon-size="16px"></van-checkbox>
  76. <div @click="navigatorTo('TransferDetail', { id: ids, transfer_id: item.id })">
  77. <div class="flex">
  78. <span class="list_item_name">{{ product.name }}</span>
  79. <div class="lock flex" v-if="new Date().getTime() - item.lock_time * 1000 <= 180000 && new Date().getTime() - item.lock_time * 1000 > 0">
  80. <svg t="1746769983067" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="15442" width="11" height="11">
  81. <path
  82. d="M787.16806 952.268282 236.83194 952.268282c-30.395264 0-55.033407-24.638143-55.033407-55.033407L181.798533 429.449889c0-30.395264 24.638143-55.033407 55.033407-55.033407l82.550111 0 0-110.066815c0-106.379842 86.238107-192.617949 192.617949-192.617949s192.617949 86.238107 192.617949 192.617949l0 110.066815 82.550111 0c30.395264 0 55.033407 24.638143 55.033407 55.033407l0 467.784986C842.201467 927.630139 817.562301 952.268282 787.16806 952.268282zM484.483296 672.046113l0 115.121947 55.033407 0 0-115.121947c31.990598-11.373025 55.033407-41.605583 55.033407-77.496002 0-45.592384-36.957727-82.550111-82.550111-82.550111s-82.550111 36.957727-82.550111 82.550111C429.449889 630.440529 452.491675 660.673088 484.483296 672.046113zM622.066815 264.348644c0-60.787458-49.279357-110.066815-110.066815-110.066815s-110.066815 49.279357-110.066815 110.066815l0 110.066815 220.134653 0L622.067838 264.348644z"
  83. fill="#ffffff"
  84. p-id="15443"
  85. ></path>
  86. </svg>
  87. <span>{{ $t('lang347') }}</span>
  88. </div>
  89. </div>
  90. <div class="sn">{{ item.order_no }}</div>
  91. </div>
  92. </div>
  93. <div class="flex" @click="navigatorTo('TransferDetail', { id: ids, transfer_id: item.id })">
  94. <div class="flex">
  95. <svg width="28" height="28" viewBox="0 -3 80 96" xmlns="http://www.w3.org/2000/svg">
  96. <path d="M70,35 C56,28 38,40 40,54 C40,64 50,74 70,66" fill="none" stroke="black" stroke-width="6" stroke-linecap="round" />
  97. <line x1="52" y1="29" x2="52" y2="73" stroke="black" stroke-width="5.2" stroke-linecap="round" />
  98. <line x1="63" y1="29" x2="63" y2="73" stroke="black" stroke-width="5.2" stroke-linecap="round" />
  99. </svg>
  100. <span class="price"> {{ item.price }} </span>
  101. </div>
  102. <van-icon name="arrow" size="18" color="#c5c5c5" />
  103. </div>
  104. </div>
  105. </van-checkbox-group>
  106. </div>
  107. <div class="bare" v-else>
  108. <span>{{ $t('lang60') }}</span>
  109. </div>
  110. <div class="btn_box" @click="navigatorTo('TransferOrder')">
  111. <div class="btn">{{ $t('lang352') }}</div>
  112. </div>
  113. </template>
  114. <template v-else-if="navActive == 0 && smallNavIndex == 1">
  115. <div class="list buy" v-if="buyingList.length > 0">
  116. <div class="list_item flex sb" v-for="(item, index) in buyingList" @click="navigatorTo('soldConsignment', { product_id: product.id, buying: item.id })" :key="index">
  117. <div>
  118. <div class="flex">
  119. <svg width="28" height="28" viewBox="28 2 100 96" xmlns="http://www.w3.org/2000/svg">
  120. <path
  121. d="M70,35
  122. C56,28 38,40 40,54
  123. C40,64 50,74 70,66"
  124. fill="none"
  125. stroke="black"
  126. stroke-width="6"
  127. stroke-linecap="round"
  128. />
  129. <line x1="52" y1="29" x2="52" y2="73" stroke="black" stroke-width="5.2" stroke-linecap="round" />
  130. <line x1="63" y1="29" x2="63" y2="73" stroke="black" stroke-width="5.2" stroke-linecap="round" />
  131. </svg>
  132. <span class="price"> {{ item.min_price }} </span>
  133. </div>
  134. <div class="wallet">{{ $t('lang350') }}</div>
  135. </div>
  136. <div class="flex">
  137. <van-icon name="arrow" size="18" color="#c5c5c5" />
  138. </div>
  139. </div>
  140. </div>
  141. <div class="bare" v-else>
  142. <span>{{ $t('lang60') }}</span>
  143. </div>
  144. <div class="btn_box" @click="navigatorTo('initiatePurchase', { product: JSON.stringify(product) })">
  145. <div class="btn">{{ $t('lang349') }}</div>
  146. </div>
  147. </template>
  148. <template v-if="navActive == 1">
  149. <div class="announcement" v-if="announcement.length > 0">
  150. <div class="announcement_item" v-for="(item1, index1) in announcement" :key="index1" @click="navigatorTo('bulletinDetail', {id: item1.id})">
  151. {{ item1.title }}
  152. </div>
  153. </div>
  154. <div class="bare" v-else>
  155. <span>{{ $t('lang60') }}</span>
  156. </div>
  157. </template>
  158. </div>
  159. </div>
  160. </div>
  161. </template>
  162. <script>
  163. import { homeApi } from '@/api/index';
  164. import { Dialog, Notify, Toast } from 'vant';
  165. export default {
  166. data() {
  167. return {
  168. loading: false,
  169. submitPopop: false,
  170. number: 1,
  171. product: {
  172. // products: {
  173. // thum: '',
  174. // },
  175. producttransfer: [],
  176. },
  177. navActive: 0,
  178. smallNav: [
  179. {
  180. key: this.$t('lang49'),
  181. value: 0,
  182. },
  183. {
  184. key: this.$t('lang345'),
  185. value: 1,
  186. },
  187. ],
  188. smallNavIndex: 0,
  189. sort: 0,
  190. volume: 0,
  191. announcement: [],
  192. page: 1,
  193. checkOrder: [],
  194. buyingList: [],
  195. ids: '',
  196. };
  197. },
  198. mounted() {
  199. this.ids = this.$route.query.id;
  200. this.getTransferDetail();
  201. },
  202. methods: {
  203. back() {
  204. this.$router.back();
  205. },
  206. getTransferDetail() {
  207. homeApi.getTransferDetail({ ids: this.ids, sort: this.sort }).then(res => {
  208. if (res.code == 200) {
  209. this.product = res.data;
  210. this.marketAnnouncement();
  211. this.getBuyingList();
  212. } else {
  213. }
  214. });
  215. },
  216. handleScroll(event) {
  217. const container = event.target;
  218. const scrollTop = container.scrollTop; // 滚动距离
  219. const scrollHeight = container.scrollHeight; // 内容总高度
  220. const clientHeight = container.clientHeight; // 可视区域高度
  221. // 判断是否滑动到底部
  222. if (scrollTop + clientHeight >= scrollHeight - 10) {
  223. console.log('Bottom');
  224. if (this.page != -1) {
  225. this.page++; // 页数加 1
  226. if (this.navActive == 1) {
  227. this.marketAnnouncement();
  228. }
  229. }
  230. }
  231. },
  232. marketAnnouncement() {
  233. homeApi.marketAnnouncement({ product_id: this.product.id, page: this.page }).then(res => {
  234. if (res.code == 200) {
  235. if (this.announcement.length >= res.data.total) {
  236. this.page = -1; // 重置为 -1,表示没有更多数据
  237. } else {
  238. this.announcement = [...this.announcement, ...res.data.data];
  239. if (this.announcement.length >= res.data.total) {
  240. this.page = -1; // 重置为 -1,表示没有更多数据
  241. }
  242. }
  243. } else {
  244. }
  245. });
  246. },
  247. getBuyingList() {
  248. homeApi.getBuyingList({ product_id: this.product.id }).then(res => {
  249. if (res.code == 200) {
  250. this.buyingList = res.data;
  251. } else {
  252. }
  253. });
  254. },
  255. submit() {
  256. let _this = this;
  257. let params = {
  258. id: this.$route.query.id,
  259. num: this.number,
  260. product_list: {},
  261. };
  262. this.loading = true;
  263. homeApi.synthesisCreate(params).then(res => {
  264. if (res.code == 200) {
  265. _this.loading = false;
  266. Toast({ message: _this.$t('lang318') });
  267. _this.$router.push('mine');
  268. } else if (res.code == 15001) {
  269. _this.loading = false;
  270. setTimeout(() => {
  271. _this.$router.push('recharge');
  272. }, 300);
  273. } else {
  274. _this.loading = false;
  275. }
  276. });
  277. },
  278. navigatorTo(name, query) {
  279. console.log(this.checkOrder);
  280. if (name == 'TransferOrder') {
  281. if (this.checkOrder.length <= 0) {
  282. return this.$toast(this.$t('lang373'));
  283. }
  284. query = {
  285. product: JSON.stringify(this.product),
  286. checkOrder: JSON.stringify(this.checkOrder),
  287. };
  288. }
  289. this.$router.push({ name, query });
  290. },
  291. handlePriceSort() {
  292. if (this.sort == 0) {
  293. this.sort = 1;
  294. } else if (this.sort == 1) {
  295. this.sort = 2;
  296. } else if (this.sort == 2) {
  297. this.sort = 1;
  298. }
  299. this.getTransferDetail();
  300. },
  301. changeType(item, index) {
  302. this.smallNavIndex = index;
  303. },
  304. // changeTab(item){
  305. // console.log(item);
  306. // },
  307. changeStar() {
  308. if (this.product.collect == null) {
  309. this.product.collect = 1;
  310. } else {
  311. this.product.collect = null;
  312. }
  313. homeApi.collect({ market_id: this.product.id }).then(res => {
  314. if (res.code == 200) {
  315. } else {
  316. this.$toast(res.msg);
  317. this.product.collect = null;
  318. }
  319. });
  320. },
  321. },
  322. };
  323. </script>
  324. <style lang="less" scoped>
  325. // .page{
  326. // height: 100vh;
  327. // overflow: auto;
  328. // // background-color: #fff;
  329. // }
  330. .head {
  331. position: fixed;
  332. top: 14px;
  333. left: 0;
  334. width: 100%;
  335. display: flex;
  336. align-items: center;
  337. justify-content: space-between;
  338. font-size: 14px;
  339. color: rgba(#000, 0.8);
  340. letter-spacing: 1.5px;
  341. padding: 14px 20px;
  342. z-index: 99;
  343. .arrow_img {
  344. // position: absolute;
  345. width: 10px;
  346. height: 16px;
  347. // transform: translate(0, -50%);
  348. }
  349. .back {
  350. color: #acacac;
  351. box-sizing: border-box;
  352. width: 32px;
  353. height: 32px;
  354. display: flex;
  355. align-items: center;
  356. justify-content: center;
  357. border-radius: 50%;
  358. background-color: rgba(#000, 0.3);
  359. }
  360. }
  361. .box {
  362. position: relative;
  363. width: 100%;
  364. height: 100vh;
  365. overflow: auto;
  366. color: #000;
  367. font-size: 13px;
  368. padding: 50px 0 120px;
  369. box-sizing: border-box;
  370. background-color: #fff;
  371. .bg {
  372. width: 100%;
  373. position: absolute;
  374. inset: 0;
  375. background-size: 100% 270px;
  376. background-repeat: no-repeat;
  377. // background-position: center;
  378. filter: blur(30px);
  379. // transform: scale(1.1); /* 防止边缘模糊 */
  380. z-index: 1;
  381. pointer-events: none; /* 不阻挡点击事件 */
  382. }
  383. .content {
  384. position: relative;
  385. z-index: 2;
  386. display: flex;
  387. justify-content: center;
  388. flex-direction: column;
  389. align-items: center;
  390. padding: 50px 0 16px;
  391. .pic {
  392. width: 140px;
  393. height: 140px;
  394. border-radius: 12px;
  395. border: 3px solid #c0c0c0;
  396. }
  397. .name {
  398. font-size: 15px;
  399. letter-spacing: 2px;
  400. font-weight: 600;
  401. padding: 16px 0;
  402. }
  403. .num {
  404. display: flex;
  405. align-items: center;
  406. &_box {
  407. display: flex;
  408. align-items: center;
  409. font-size: 8px;
  410. letter-spacing: 1px;
  411. margin: 0 5px;
  412. .left {
  413. color: #000;
  414. padding: 0px 3px;
  415. // border: 0.5px solid #ffe493;
  416. background: linear-gradient(to right, #ddb54e, #f9eca9);
  417. }
  418. .right {
  419. color: #000;
  420. padding: 0 3px;
  421. background-color: rgba(#fbf8de, 1);
  422. }
  423. }
  424. }
  425. }
  426. .flex {
  427. display: flex;
  428. align-items: center;
  429. }
  430. .sb {
  431. justify-content: space-between;
  432. }
  433. .bottom {
  434. padding: 0 14px;
  435. .small_nav {
  436. width: fit-content;
  437. font-size: 11px;
  438. padding: 2px;
  439. border-radius: 20px;
  440. margin-top: 6px;
  441. background-color: #f5f5f5;
  442. &_item {
  443. color: #8b8b8b;
  444. display: block;
  445. text-align: center;
  446. min-width: 26px;
  447. padding: 2px 6px;
  448. margin: 1px;
  449. border-radius: 20px;
  450. overflow: hidden; //超出的文本隐藏
  451. text-overflow: ellipsis; //溢出用省略号显示
  452. white-space: nowrap; //溢出不换行
  453. }
  454. }
  455. .nav_active {
  456. color: #29b286;
  457. background-color: #fff !important;
  458. }
  459. .sort {
  460. color: #8b8b8b;
  461. font-size: 11px;
  462. .flex {
  463. padding-left: 14px;
  464. }
  465. }
  466. .list {
  467. &_item {
  468. padding: 14px 0;
  469. border-bottom: 1px solid rgba(#c7c7c7, 0.3);
  470. &_name {
  471. font-weight: 600;
  472. font-size: 15px;
  473. width: 160px;
  474. overflow: hidden; /* 确保超出容器的文本被裁剪 */
  475. white-space: nowrap; /* 确保文本在一行内显示 */
  476. text-overflow: ellipsis; /* 使用省略号表示文本超出 */
  477. }
  478. .lock {
  479. color: #fff;
  480. font-size: 9px;
  481. // letter-spacing: 1px;
  482. white-space: nowrap;
  483. padding: 1px 2px;
  484. border-radius: 2px;
  485. margin-left: 8px;
  486. background-color: #29b286;
  487. }
  488. .sn {
  489. font-weight: 600;
  490. font-size: 13px;
  491. padding-top: 8px;
  492. }
  493. .price {
  494. font-weight: 600;
  495. font-size: 17px;
  496. }
  497. .van-icon {
  498. margin-left: 12px;
  499. }
  500. /deep/ .van-checkbox__icon .van-icon {
  501. margin-right: 8px;
  502. border-radius: 2px;
  503. border-color: #29b286 !important;
  504. }
  505. }
  506. }
  507. .buy {
  508. .price {
  509. margin-left: -12px;
  510. }
  511. .wallet {
  512. font-size: 11px;
  513. color: #8b8b8b;
  514. padding-top: 4px;
  515. }
  516. }
  517. .announcement {
  518. padding-top: 10px;
  519. &_item {
  520. padding: 10px 0;
  521. border-bottom: 1px solid rgba(#c7c7c7, 0.3);
  522. margin-bottom: 8px;
  523. }
  524. }
  525. /deep/.van-tab {
  526. flex: none;
  527. font-weight: 600;
  528. color: #c5c5c5;
  529. font-size: 13px;
  530. letter-spacing: 0.5px;
  531. margin-right: 10px;
  532. }
  533. /deep/.van-tabs__nav--line {
  534. padding-bottom: 10px;
  535. }
  536. }
  537. .btn_box {
  538. position: fixed;
  539. bottom: 0;
  540. left: 0;
  541. width: 100%;
  542. height: 80px;
  543. padding: 16px 20px;
  544. border-top: 1px solid rgba(#c7c7c7, 0.3);
  545. background-color: #fff;
  546. .btn {
  547. display: flex;
  548. align-items: center;
  549. flex-direction: column;
  550. justify-content: center;
  551. height: 100%;
  552. box-sizing: border-box;
  553. color: #fff;
  554. font-size: 15px;
  555. text-align: center;
  556. font-weight: 600;
  557. letter-spacing: 1px;
  558. padding: 12px 10px;
  559. border-radius: 22px;
  560. background-color: #29b286;
  561. }
  562. .submit {
  563. width: 58%;
  564. background-color: #17ab79;
  565. }
  566. }
  567. .bare {
  568. text-align: center;
  569. font-size: 14px;
  570. padding: 60px 14px;
  571. color: #888;
  572. }
  573. }
  574. </style>