_id.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799
  1. <template>
  2. <section class="cotainer">
  3. <!-- 轮播图部分开始 -->
  4. <div id="common-banner">
  5. <div class="common-banner-container">
  6. <div class="common-banner-img">
  7. <img src="~/assets/images/prod-view/banner.png">
  8. </div>
  9. </div>
  10. </div>
  11. <!-- 轮播图部分结束 -->
  12. <!-- 面包屑部分 -->
  13. <div id="bread-nav">
  14. <div class="brand-nav-box clearfix">
  15. <div class="brand-nav-content">
  16. <div class="brand-nav-title">
  17. <span>当前位置:</span>
  18. </div>
  19. <div class="brand-nav-list">
  20. <ul>
  21. <li>
  22. <nuxt-link target="_blank" to="/">首页</nuxt-link>
  23. </li>
  24. <li>></li>
  25. <li class="brand-nav-products">
  26. <nuxt-link target="_blank" to="/prod">产品列表</nuxt-link>
  27. </li>
  28. <li>></li>
  29. <template v-for="item in $store.state.headProdNav">
  30. <li
  31. class="brand-nav-prod-list"
  32. :key="item.proCategoryId"
  33. v-if=" item.proCategoryId == $route.query.typeId && $route.query.typeId == 97"
  34. >
  35. <nuxt-link target="_blank" to="/prod/newPro">{{item.proCategoryName}}</nuxt-link>
  36. </li>
  37. </template>
  38. <template v-for="item in $store.state.headProdNav">
  39. <li
  40. class="brand-nav-prod-list"
  41. :key="item.proCategoryId"
  42. v-if=" item.proCategoryId == $route.query.typeId && $route.query.typeId != 96 && $route.query.typeId != 97"
  43. >
  44. <nuxt-link
  45. target="_blank"
  46. :to="{name: 'prod-typeId',params: {typeId: item.proCategoryId}}"
  47. >{{item.proCategoryName}}</nuxt-link>
  48. </li>
  49. </template>
  50. <li>></li>
  51. <li
  52. class="brand-nav-prod-style"
  53. v-if="$route.query.typeId != 96 && $route.query.typeId != 97"
  54. >
  55. <template v-for="(item,index) in $store.state.headProdNav[($route.query.typeId - 1)].children">
  56. <div
  57. :key="index"
  58. v-if=" $route.query.classId == item.proCategoryId"
  59. >
  60. <nuxt-link
  61. :to="{name: 'prod-typeId',params: {typeId: $route.query.typeId},query: {classId: item.proCategoryId}}"
  62. >{{item.proCategoryName}}</nuxt-link>
  63. </div>
  64. </template>
  65. </li>
  66. </ul>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. <!-- 面包屑部分结束 -->
  72. <!-- Products show start -->
  73. <div id="products-show">
  74. <!-- Products top show start -->
  75. <div class="products-msg">
  76. <div class="products-msg-box clearfix">
  77. <div class="products-pic-wrap">
  78. <prodViewImages
  79. :bigImage="bigImage"
  80. :middleImage="middleImage"
  81. :smallImage="smallImage"
  82. ></prodViewImages>
  83. </div>
  84. <div class="products-wrod-wrap">
  85. <div class="products-view-title">
  86. <h1>{{prodViewData.proName}}</h1>
  87. </div>
  88. <div class="products-price">
  89. <div class="products-price-word">价格</div>
  90. <div class="products-price-box">
  91. <span class="products-price-mark">¥</span>
  92. <span class="products-price-num">{{prodViewData.proPrice}}</span>
  93. </div>
  94. </div>
  95. <div class="products-parameter">
  96. <div class="products-parameter-word">产品参数</div>
  97. <div class="products-par-details-box">
  98. <p v-for="(value,key,index) in prodViewData.param" :key="index">{{key}}:{{value}}</p>
  99. </div>
  100. </div>
  101. <div class="prod-buy-now">
  102. <!-- <a href="javascript:void(0)" target="_blank" rel="nofollow">立即购买</a> -->
  103. <a :href="`${prodViewData.proSrc}`" target="_blank" rel="nofollow">立即购买</a>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. <!-- Products top show end -->
  109. <!-- Products details box start -->
  110. <div class="products-details">
  111. <div class="products-details-box clearfix">
  112. <!-- products-search start -->
  113. <div class="prod-search-warp">
  114. <div class="prod-search-box">
  115. <div class="prod-search-title">
  116. <p>产品搜索</p>
  117. </div>
  118. <div class="prod-search">
  119. <input type="text" name="" placeholder="请输入关键字">
  120. </div>
  121. <div class="prod-search-btn">搜索</div>
  122. </div>
  123. <prodViewLink></prodViewLink>
  124. </div>
  125. <!-- products-search end -->
  126. <!-- prod-details start -->
  127. <div class="prod-details-warp">
  128. <div class="prod-details-title">
  129. <p>商品详情</p>
  130. </div>
  131. <div class="prod-details" v-html="prodViewData.proMsg"></div>
  132. </div>
  133. <!-- prod-details end -->
  134. </div>
  135. </div>
  136. <!-- Products details box end -->
  137. </div>
  138. <!-- Products show end -->
  139. <!-- Related Products start -->
  140. <div id="related_products_wrap">
  141. <div class="related_products_box">
  142. <div class="related_products_title">
  143. <p>相关产品</p>
  144. </div>
  145. <div class="related_prod_list_box">
  146. <prodListShow :prodList="relatedProdData"></prodListShow>
  147. </div>
  148. </div>
  149. </div>
  150. <!-- Related Products end -->
  151. <!-- You Like start -->
  152. <div id="products_like_wrap">
  153. <div class="products_like_box">
  154. <div class="prod_like_title">
  155. <p>猜你喜欢</p>
  156. </div>
  157. <div class="prod_like_list_box">
  158. <prodListShow :prodList="likeProdData"></prodListShow>
  159. </div>
  160. </div>
  161. </div>
  162. <!-- You Like end -->
  163. </section>
  164. </template>
  165. <script>
  166. import axios from "axios";
  167. import prodListShow from "~/components/common/prodListShow";
  168. import prodViewImages from "~/components/products/prodViewImages";
  169. import prodViewLink from "~/components/products/prodViewLink";
  170. export default {
  171. head() {
  172. return {
  173. title: this.prodViewData.proMetaTitle,
  174. meta: [
  175. {
  176. name: "keywords",
  177. hid: "keywords",
  178. content: `${this.prodViewData.proMetaKeyWord}`,
  179. },
  180. {
  181. name: "description",
  182. hid: "description",
  183. content: `${this.prodViewData.proMetaDescription}`,
  184. },
  185. ],
  186. };
  187. },
  188. validata({ params }) {
  189. return /^\d+$/.test(params.id);
  190. },
  191. async asyncData({ params, query, store }) {
  192. let typeId = query.typeId;
  193. let classId = query.classId;
  194. let id = params.id;
  195. //详情信息
  196. let prodViewData = await axios(
  197. `${store.state.wordpressAPI}/product/detail/${id}`
  198. );
  199. //相关产品
  200. let relatedProdData = await axios(
  201. `${store.state.wordpressAPI}/product/getProByTpyeId/${classId}/4`
  202. );
  203. //猜你喜欢
  204. let likeProdData = await axios(
  205. `${store.state.wordpressAPI}/product/getProRandom/4`
  206. );
  207. return {
  208. prodViewData: prodViewData.data,
  209. relatedProdData: relatedProdData.data,
  210. likeProdData: likeProdData.data,
  211. bigImage: prodViewData.data.proImgs,
  212. middleImage: prodViewData.data.proImgs,
  213. smallImage: prodViewData.data.proImgs,
  214. };
  215. },
  216. components: {
  217. prodListShow,
  218. prodViewImages,
  219. prodViewLink,
  220. },
  221. created() {
  222. console.log(this.$route.query);
  223. console.log(this.$route.params);
  224. }
  225. };
  226. </script>
  227. <style scoped>
  228. /*banner start*/
  229. div#common-banner {
  230. height: 394px;
  231. }
  232. #common-banner {
  233. position: relative;
  234. overflow: hidden;
  235. width: 100%;
  236. height: 600px;
  237. }
  238. .common-banner-container {
  239. position: relative;
  240. width: 1200px;
  241. height: 100%;
  242. margin: 0 auto;
  243. }
  244. .common-banner-img {
  245. position: absolute;
  246. top: 0;
  247. left: 50%;
  248. overflow: hidden;
  249. width: 1920px;
  250. height: 100%;
  251. margin-left: -960px;
  252. }
  253. /*banner end*/
  254. /*面包屑部分*/
  255. div#bread-nav {
  256. width: 100%;
  257. height: auto;
  258. }
  259. #bread-nav {
  260. position: relative;
  261. }
  262. #bread-nav .brand-nav-content {
  263. float: right;
  264. }
  265. .brand-nav-box {
  266. width: 1200px;
  267. margin: 0 auto;
  268. color: #858585;
  269. font-size: 14px;
  270. text-align: left;
  271. line-height: 70px;
  272. }
  273. .brand-nav-content {
  274. float: left;
  275. }
  276. .brand-nav-title {
  277. float: left;
  278. }
  279. .brand-nav-list {
  280. float: left;
  281. overflow: hidden;
  282. }
  283. .brand-nav-list ul {
  284. overflow: hidden;
  285. }
  286. .brand-nav-list ul li {
  287. float: left;
  288. padding: 0 5px;
  289. }
  290. .brand-nav-list ul li a {
  291. display: block;
  292. width: 100%;
  293. height: 100%;
  294. color: #858585;
  295. }
  296. .brand-nav-list ul li:last-child a {
  297. color: #22202b;
  298. }
  299. .brand-nav-list ul li a:hover {
  300. color: #22202b;
  301. }
  302. /*面包屑部分结束*/
  303. /*Products show start*/
  304. div#products-show {
  305. overflow: hidden;
  306. width: 100%;
  307. height: auto;
  308. }
  309. /*Products top show start*/
  310. .products-msg {
  311. overflow: hidden;
  312. width: 100%;
  313. height: auto;
  314. }
  315. .products-msg-box {
  316. width: 1200px;
  317. height: auto;
  318. padding: 75px 0 110px;
  319. margin: 0 auto;
  320. border-top: 2px solid #d5d5d8;
  321. }
  322. /*products pic wrap start*/
  323. .products-pic-wrap {
  324. float: left;
  325. width: 500px;
  326. height: auto;
  327. }
  328. /*products pic wrap end*/
  329. /*products wrod wrap start*/
  330. .products-wrod-wrap {
  331. float: right;
  332. width: 600px;
  333. height: auto;
  334. padding-left: 57px;
  335. box-sizing: border-box;
  336. }
  337. .products-view-title {
  338. overflow: hidden;
  339. width: 100%;
  340. height: auto;
  341. color: #22202b;
  342. font-size: 30px;
  343. font-weight: bold;
  344. line-height: 32px;
  345. text-align: left;
  346. }
  347. .products-price {
  348. overflow: hidden;
  349. width: 100%;
  350. height: auto;
  351. margin: 50px 0;
  352. }
  353. .products-price-word {
  354. float: left;
  355. width: 105px;
  356. height: auto;
  357. color: #858585;
  358. font-size: 14px;
  359. font-weight: bold;
  360. line-height: 26px;
  361. text-align: left;
  362. }
  363. .products-price-box {
  364. overflow: hidden;
  365. float: left;
  366. color: #22202b;
  367. font-size: 24px;
  368. font-weight: bold;
  369. line-height: 26px;
  370. text-align: left;
  371. }
  372. span.products-price-mark {
  373. font-size: 14px;
  374. }
  375. .products-parameter {
  376. overflow: hidden;
  377. width: 100%;
  378. height: auto;
  379. color: #858585;
  380. font-size: 14px;
  381. line-height: 30px;
  382. text-align: left;
  383. }
  384. .products-parameter-word {
  385. float: left;
  386. width: 105px;
  387. font-weight: bold;
  388. }
  389. .products-par-details-box {
  390. float: left;
  391. }
  392. .prod-buy-now {
  393. overflow: hidden;
  394. width: 296px;
  395. height: 56px;
  396. margin-top: 42px;
  397. background: #22202b;
  398. font-size: 24px;
  399. text-align: center;
  400. line-height: 56px;
  401. -webkit-transition: all 0.5s ease;
  402. -o-transition: all 0.5s ease;
  403. transition: all 0.5s ease;
  404. }
  405. .prod-buy-now:hover {
  406. -webkit-transform: translateY(-5px);
  407. -ms-transform: translateY(-5px);
  408. -o-transform: translateY(-5px);
  409. transform: translateY(-5px);
  410. }
  411. .prod-buy-now a {
  412. display: block;
  413. overflow: hidden;
  414. width: 100%;
  415. height: 100%;
  416. color: #ffe9c0;
  417. }
  418. /*products wrod wrap end*/
  419. /*Products top show end*/
  420. /*Products details box start*/
  421. .products-details {
  422. width: 100%;
  423. height: auto;
  424. }
  425. .products-details-box {
  426. width: 1200px;
  427. height: auto;
  428. margin: 0 auto;
  429. padding-bottom: 110px;
  430. }
  431. /*products-search start*/
  432. .prod-search-warp {
  433. float: left;
  434. overflow: hidden;
  435. width: 200px;
  436. }
  437. .prod-search-box {
  438. overflow: hidden;
  439. width: 100%;
  440. height: auto;
  441. padding-bottom: 63px;
  442. }
  443. .prod-search-title {
  444. width: 100%;
  445. height: 52px;
  446. padding-left: 10px;
  447. border-top: 2px solid #e5e5e5;
  448. border-bottom: 2px solid #e5e5e5;
  449. color: #22202b;
  450. font-size: 18px;
  451. font-weight: bold;
  452. line-height: 50px;
  453. text-align: left;
  454. box-sizing: border-box;
  455. }
  456. .prod-search {
  457. overflow: hidden;
  458. width: 100%;
  459. height: auto;
  460. padding-left: 10px;
  461. padding: 33px 0 11px 10px;
  462. box-sizing: border-box;
  463. }
  464. .prod-search input {
  465. overflow: hidden;
  466. width: 172px;
  467. height: 36px;
  468. padding-left: 8px;
  469. border: 2px solid #e5e5e5;
  470. box-sizing: border-box;
  471. color: #858585;
  472. font-size: 14px;
  473. line-height: 32px;
  474. text-align: left;
  475. outline: none;
  476. }
  477. .prod-search-btn {
  478. overflow: hidden;
  479. width: 82px;
  480. height: 36px;
  481. margin-left: 10px;
  482. background: #22202b;
  483. color: #ffe9c0;
  484. font-size: 14px;
  485. line-height: 36px;
  486. text-align: center;
  487. cursor: pointer;
  488. }
  489. /*products-search end*/
  490. /*prod-details start*/
  491. .prod-details-warp {
  492. float: right;
  493. width: 950px;
  494. height: auto;
  495. }
  496. .prod-details-title {
  497. overflow: hidden;
  498. width: 100%;
  499. height: 57px;
  500. border-bottom: 2px solid #d5d5d8;
  501. color: #22202b;
  502. font-size: 24px;
  503. line-height: 24px;
  504. text-align: left;
  505. }
  506. .prod-details {
  507. overflow: hidden;
  508. width: 100%;
  509. height: auto;
  510. padding-top: 80px;
  511. }
  512. /*prod-details end*/
  513. /*Products details box end*/
  514. /*Products show end*/
  515. /*Related Products start*/
  516. div#related_products_wrap {
  517. width: 100%;
  518. height: auto;
  519. }
  520. .related_products_box {
  521. overflow: hidden;
  522. width: 1200px;
  523. height: auto;
  524. margin: 0 auto;
  525. }
  526. .related_products_title {
  527. overflow: hidden;
  528. width: 100%;
  529. height: 132px;
  530. border-bottom: 2px solid #d5d5d8;
  531. box-sizing: border-box;
  532. color: #22202b;
  533. font-size: 24px;
  534. font-weight: bold;
  535. line-height: 130px;
  536. text-align: left;
  537. }
  538. .related_prod_list_box {
  539. overflow: hidden;
  540. width: 100%;
  541. height: auto;
  542. padding: 30px 0 18px;
  543. }
  544. .related_prod_list_box ul {
  545. overflow: hidden;
  546. }
  547. .related_prod_list {
  548. float: left;
  549. width: 300px;
  550. height: 333px;
  551. border: 3px solid transparent;
  552. box-sizing: border-box;
  553. -webkit-transition: all 0.5s ease;
  554. -o-transition: all 0.5s ease;
  555. transition: all 0.5s ease;
  556. cursor: pointer;
  557. }
  558. li.related_prod_list:hover {
  559. border: 3px solid #dcdcdc;
  560. }
  561. .related_prod_list_img {
  562. display: flex;
  563. overflow: hidden;
  564. width: 100%;
  565. height: 236px;
  566. justify-content: center;
  567. align-items: center;
  568. }
  569. .related_prod_list_img img {
  570. width: 100%;
  571. height: 100%;
  572. -webkit-transition: all 1s ease;
  573. -o-transition: all 1s ease;
  574. transition: all 1s ease;
  575. }
  576. .related_prod_list_img img:hover {
  577. -webkit-transform: scale(1.1);
  578. -ms-transform: scale(1.1);
  579. -o-transform: scale(1.1);
  580. transform: scale(1.1);
  581. }
  582. .related_prod_name {
  583. overflow: hidden;
  584. width: 100%;
  585. height: 38px;
  586. }
  587. .related_prod_name a {
  588. display: block;
  589. overflow: hidden;
  590. width: 100%;
  591. height: 100%;
  592. padding: 0 20px;
  593. color: #979797;
  594. font-size: 14px;
  595. line-height: 38px;
  596. text-align: center;
  597. text-overflow: ellipsis;
  598. white-space: nowrap;
  599. box-sizing: border-box;
  600. -webkit-transition: all 0.5s ease;
  601. -o-transition: all 0.5s ease;
  602. transition: all 0.5s ease;
  603. }
  604. .related_prod_name a:hover {
  605. color: #22202b;
  606. }
  607. .related_prod_price {
  608. overflow: hidden;
  609. width: 100%;
  610. height: 40px;
  611. color: #22202b;
  612. text-align: center;
  613. }
  614. span.price-num {
  615. font-size: 24px;
  616. font-weight: bold;
  617. line-height: 40px;
  618. }
  619. /*Related Products end*/
  620. /*You Like start*/
  621. div#products_like_wrap {
  622. width: 100%;
  623. height: auto;
  624. }
  625. .products_like_box {
  626. overflow: hidden;
  627. width: 1200px;
  628. height: auto;
  629. margin: 0 auto;
  630. }
  631. .prod_like_title {
  632. overflow: hidden;
  633. width: 100%;
  634. height: 132px;
  635. border-bottom: 2px solid #d5d5d8;
  636. box-sizing: border-box;
  637. color: #22202b;
  638. font-size: 24px;
  639. font-weight: bold;
  640. line-height: 130px;
  641. text-align: left;
  642. }
  643. .prod_like_list_box {
  644. overflow: hidden;
  645. width: 100%;
  646. height: auto;
  647. padding: 30px 0 88px;
  648. }
  649. .prod_like_list_box ul {
  650. overflow: hidden;
  651. }
  652. .prod_like_list {
  653. float: left;
  654. width: 300px;
  655. height: 333px;
  656. border: 3px solid transparent;
  657. box-sizing: border-box;
  658. -webkit-transition: all 0.5s ease;
  659. -o-transition: all 0.5s ease;
  660. transition: all 0.5s ease;
  661. cursor: pointer;
  662. }
  663. li.prod_like_list:hover {
  664. border: 3px solid #dcdcdc;
  665. }
  666. .prod_like_list_img {
  667. display: flex;
  668. overflow: hidden;
  669. width: 100%;
  670. height: 236px;
  671. justify-content: center;
  672. align-items: center;
  673. }
  674. .prod_like_list_img img {
  675. width: 100%;
  676. height: 100%;
  677. -webkit-transition: all 1s ease;
  678. -o-transition: all 1s ease;
  679. transition: all 1s ease;
  680. }
  681. .prod_like_list_img img:hover {
  682. -webkit-transform: scale(1.1);
  683. -ms-transform: scale(1.1);
  684. -o-transform: scale(1.1);
  685. transform: scale(1.1);
  686. }
  687. .prod_like_name {
  688. overflow: hidden;
  689. width: 100%;
  690. height: 38px;
  691. }
  692. .prod_like_name a {
  693. display: block;
  694. overflow: hidden;
  695. width: 100%;
  696. height: 100%;
  697. padding: 0 20px;
  698. color: #979797;
  699. font-size: 14px;
  700. line-height: 38px;
  701. text-align: center;
  702. text-overflow: ellipsis;
  703. white-space: nowrap;
  704. box-sizing: border-box;
  705. -webkit-transition: all 0.5s ease;
  706. -o-transition: all 0.5s ease;
  707. transition: all 0.5s ease;
  708. }
  709. .prod_like_name a:hover {
  710. color: #22202b;
  711. }
  712. .prod_like_price {
  713. overflow: hidden;
  714. width: 100%;
  715. height: 40px;
  716. color: #22202b;
  717. text-align: center;
  718. }
  719. span.price-num {
  720. font-size: 24px;
  721. font-weight: bold;
  722. line-height: 40px;
  723. }
  724. /*You Like end*/
  725. </style>