detail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. <template>
  2. <div class="page" @scroll="handleScroll">
  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">
  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>
  45. <div class="bottom">
  46. <van-tabs v-model="navActive" color="#29B286" title-active-color="#000" class="van-tabs">
  47. <van-tab :title="$t('lang351')"></van-tab>
  48. <van-tab :title="$t('lang344')"></van-tab>
  49. </van-tabs>
  50. <div v-if="navActive == 0" v-html="product.details"></div>
  51. <div v-if="navActive == 1">
  52. <div class="announcement" v-if="announcement.length > 0">
  53. <div class="announcement_item" v-for="(item1, index1) in announcement" :key="index1">
  54. {{ item1.title }}
  55. </div>
  56. </div>
  57. <div class="bare" v-else>
  58. <span>{{ $t('lang60') }}</span>
  59. </div>
  60. </div>
  61. <div class="btn_box flex sb">
  62. <div class="left">
  63. <div class="flex">
  64. <svg width="28" height="28" viewBox="28 2 100 96" xmlns="http://www.w3.org/2000/svg">
  65. <path
  66. d="M70,35
  67. C56,28 38,40 40,54
  68. C40,64 50,74 70,66"
  69. fill="none"
  70. stroke="black"
  71. stroke-width="6"
  72. stroke-linecap="round"
  73. />
  74. <line x1="52" y1="29" x2="52" y2="73" stroke="black" stroke-width="5.2" stroke-linecap="round" />
  75. <line x1="63" y1="29" x2="63" y2="73" stroke="black" stroke-width="5.2" stroke-linecap="round" />
  76. </svg>
  77. <span class="price"> {{ this.product.producttransfer[0]?.price }} </span>
  78. </div>
  79. <div @click="navigatorTo('transfer')">{{ $t('lang353') }}<van-icon name="arrow" size="14" color="#c5c5c5" /></div>
  80. </div>
  81. <div class="btn" @click="navigatorTo('TransferOrder')">{{ $t('lang352') }}</div>
  82. </div>
  83. </div>
  84. </div>
  85. </template>
  86. <script>
  87. import { homeApi } from '@/api/index';
  88. import { Dialog, Notify, Toast } from 'vant';
  89. export default {
  90. data() {
  91. return {
  92. loading: false,
  93. number: 1,
  94. product: {
  95. producttransfer: [],
  96. },
  97. navActive: 0,
  98. smallNav: [
  99. {
  100. key: this.$t('lang49'),
  101. value: 0,
  102. },
  103. {
  104. key: this.$t('lang345'),
  105. value: 1,
  106. },
  107. ],
  108. smallNavIndex: 0,
  109. sort: 0,
  110. volume: 0,
  111. announcement: [],
  112. page: 1,
  113. price: 0,
  114. };
  115. },
  116. mounted() {
  117. this.getTransferDetail();
  118. },
  119. methods: {
  120. back() {
  121. this.$router.back();
  122. },
  123. changeStar() {
  124. if (this.product.collect == null) {
  125. this.product.collect = 1;
  126. } else {
  127. this.product.collect = null;
  128. }
  129. homeApi.collect({ market_id: this.product.id }).then(res => {
  130. if (res.code == 200) {
  131. } else {
  132. this.$toast(res.msg);
  133. this.product.collect = null;
  134. }
  135. });
  136. },
  137. handleScroll(event) {
  138. const container = event.target;
  139. const scrollTop = container.scrollTop; // 滚动距离
  140. const scrollHeight = container.scrollHeight; // 内容总高度
  141. const clientHeight = container.clientHeight; // 可视区域高度
  142. // 判断是否滑动到底部
  143. if (scrollTop + clientHeight >= scrollHeight - 10) {
  144. console.log('Bottom');
  145. if (this.page != -1) {
  146. this.page++; // 页数加 1
  147. if (this.navActive == 1) {
  148. this.marketAnnouncement();
  149. }
  150. }
  151. }
  152. },
  153. getTransferDetail() {
  154. homeApi.getTransferDetail({ ids: this.$route.query.id, transfer_id: this.$route.query.transfer_id }).then(res => {
  155. if (res.code == 200) {
  156. this.product = res.data;
  157. // this.price = this.product.producttransfer.filter(i => {
  158. // return i.id == this.$route.query.transfer_id;
  159. // })[0].price;
  160. this.marketAnnouncement();
  161. } else {
  162. }
  163. });
  164. },
  165. marketAnnouncement() {
  166. homeApi.marketAnnouncement({ product_id: this.product.id, page: this.page }).then(res => {
  167. if (res.code == 200) {
  168. if (this.announcement.length >= res.data.total) {
  169. this.page = -1; // 重置为 -1,表示没有更多数据
  170. } else {
  171. this.announcement = [...this.announcement, ...res.data.data];
  172. if (this.announcement.length >= res.data.total) {
  173. this.page = -1; // 重置为 -1,表示没有更多数据
  174. }
  175. }
  176. } else {
  177. }
  178. });
  179. },
  180. submit() {
  181. let _this = this;
  182. let params = {
  183. id: this.$route.query.id,
  184. num: this.number,
  185. product_list: {},
  186. };
  187. this.loading = true;
  188. homeApi.synthesisCreate(params).then(res => {
  189. if (res.code == 200) {
  190. _this.loading = false;
  191. Toast({ message: _this.$t('lang318') });
  192. _this.$router.push('mine');
  193. } else if (res.code == 15001) {
  194. _this.loading = false;
  195. setTimeout(() => {
  196. _this.$router.push('recharge');
  197. }, 300);
  198. } else {
  199. _this.loading = false;
  200. }
  201. });
  202. },
  203. navigatorTo(name, query) {
  204. if (name == 'TransferOrder') {
  205. query = {
  206. product: JSON.stringify(this.product),
  207. checkOrder: JSON.stringify(this.product.producttransfer),
  208. };
  209. }
  210. this.$router.push({ name, query });
  211. },
  212. handlePriceSort() {
  213. console.log(this.sort);
  214. if (this.sort == 0) {
  215. this.sort = 1;
  216. } else if (this.sort == 1) {
  217. this.sort = 2;
  218. } else if (this.sort == 2) {
  219. this.sort = 1;
  220. }
  221. this.search();
  222. },
  223. handleVolumeSort() {
  224. console.log(this.volume);
  225. if (this.volume == 0) {
  226. this.volume = 1;
  227. } else if (this.volume == 1) {
  228. this.volume = 2;
  229. } else if (this.volume == 2) {
  230. this.volume = 1;
  231. }
  232. this.search();
  233. },
  234. },
  235. };
  236. </script>
  237. <style lang="less" scoped>
  238. .head {
  239. position: fixed;
  240. top: 14px;
  241. left: 0;
  242. width: 100%;
  243. display: flex;
  244. align-items: center;
  245. justify-content: space-between;
  246. font-size: 14px;
  247. color: rgba(#000, 0.8);
  248. letter-spacing: 1.5px;
  249. padding: 14px 20px;
  250. z-index: 99;
  251. .arrow_img {
  252. // position: absolute;
  253. width: 10px;
  254. height: 16px;
  255. // transform: translate(0, -50%);
  256. }
  257. .back {
  258. color: #acacac;
  259. box-sizing: border-box;
  260. width: 32px;
  261. height: 32px;
  262. display: flex;
  263. align-items: center;
  264. justify-content: center;
  265. border-radius: 50%;
  266. background-color: rgba(#000, 0.3);
  267. }
  268. }
  269. .page {
  270. height: 100vh;
  271. overflow: auto;
  272. }
  273. .box {
  274. position: relative;
  275. width: 100%;
  276. height: 620px;
  277. color: #000;
  278. font-size: 13px;
  279. padding-top: 50px;
  280. box-sizing: border-box;
  281. // background-color: #fff;
  282. .bg {
  283. width: 100%;
  284. position: absolute;
  285. inset: 0;
  286. background-size: 200% 790px;
  287. background-repeat: no-repeat;
  288. background-position: center -50px;
  289. filter: blur(16px);
  290. // transform: scale(1.1); /* 防止边缘模糊 */
  291. z-index: 1;
  292. pointer-events: none; /* 不阻挡点击事件 */
  293. }
  294. .content {
  295. position: relative;
  296. z-index: 2;
  297. display: flex;
  298. justify-content: center;
  299. flex-direction: column;
  300. align-items: center;
  301. padding: 80px 0 16px;
  302. .pic {
  303. width: 300px;
  304. height: 300px;
  305. border-radius: 12px;
  306. border: 8px solid #c0c0c0;
  307. }
  308. .name {
  309. color: #fff;
  310. font-size: 19px;
  311. letter-spacing: 2px;
  312. font-weight: 600;
  313. padding: 16px 0;
  314. }
  315. .num {
  316. display: flex;
  317. align-items: center;
  318. &_box {
  319. display: flex;
  320. align-items: center;
  321. font-size: 8px;
  322. letter-spacing: 1px;
  323. margin: 0 5px;
  324. .left {
  325. color: #000;
  326. padding: 0px 3px;
  327. // border: 0.5px solid #ffe493;
  328. background: linear-gradient(to right, #ddb54e, #f9eca9);
  329. }
  330. .right {
  331. color: #000;
  332. padding: 0 3px;
  333. background-color: rgba(#fbf8de, 0.5);
  334. }
  335. }
  336. }
  337. }
  338. }
  339. .flex {
  340. display: flex;
  341. align-items: center;
  342. }
  343. .sb {
  344. justify-content: space-between;
  345. }
  346. .bottom {
  347. padding: 14px 14px 120px;
  348. background-color: #fff;
  349. .small_nav {
  350. width: fit-content;
  351. font-size: 11px;
  352. padding: 2px;
  353. border-radius: 20px;
  354. background-color: #f5f5f5;
  355. &_item {
  356. color: #8b8b8b;
  357. display: block;
  358. text-align: center;
  359. min-width: 26px;
  360. padding: 2px 6px;
  361. margin: 1px;
  362. border-radius: 20px;
  363. overflow: hidden; //超出的文本隐藏
  364. text-overflow: ellipsis; //溢出用省略号显示
  365. white-space: nowrap; //溢出不换行
  366. }
  367. }
  368. .nav_active {
  369. color: #29b286;
  370. background-color: #fff !important;
  371. }
  372. .sort {
  373. color: #8b8b8b;
  374. font-size: 11px;
  375. .flex {
  376. padding-left: 14px;
  377. }
  378. }
  379. .announcement {
  380. padding-top: 10px;
  381. &_item {
  382. color: #000;
  383. font-size: 13px;
  384. padding: 10px 0;
  385. border-bottom: 1px solid rgba(#c7c7c7, 0.3);
  386. margin-bottom: 8px;
  387. }
  388. }
  389. /deep/.van-tab {
  390. flex: none;
  391. font-weight: 600;
  392. color: #c5c5c5;
  393. font-size: 13px;
  394. letter-spacing: 0.5px;
  395. margin-right: 10px;
  396. }
  397. /deep/.van-tabs__nav--line {
  398. padding-bottom: 10px;
  399. }
  400. }
  401. .btn_box {
  402. position: fixed;
  403. bottom: 0;
  404. left: 0;
  405. width: 100%;
  406. height: 75px;
  407. z-index: 99;
  408. padding: 16px 20px;
  409. border-top: 1px solid rgba(#c7c7c7, 0.3);
  410. background-color: #fff;
  411. .btn {
  412. display: flex;
  413. align-items: center;
  414. flex-direction: column;
  415. justify-content: center;
  416. width: 68%;
  417. height: 100%;
  418. box-sizing: border-box;
  419. color: #fff;
  420. font-size: 15px;
  421. text-align: center;
  422. font-weight: 600;
  423. letter-spacing: 1px;
  424. padding: 12px 10px;
  425. border-radius: 22px;
  426. background-color: #29b286;
  427. }
  428. .submit {
  429. width: 58%;
  430. background-color: #17ab79;
  431. }
  432. .left {
  433. color: #000;
  434. font-size: 14px;
  435. .price {
  436. font-size: 18px;
  437. font-weight: 600;
  438. margin-left: -10px;
  439. }
  440. }
  441. }
  442. </style>