_id.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803
  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. .marginTop {
  239. margin-top: 173px;
  240. }
  241. .common-banner-container {
  242. position: relative;
  243. width: 1200px;
  244. height: 100%;
  245. margin: 0 auto;
  246. }
  247. .common-banner-img {
  248. position: absolute;
  249. top: 0;
  250. left: 50%;
  251. overflow: hidden;
  252. width: 1920px;
  253. height: 100%;
  254. margin-left: -960px;
  255. }
  256. /*banner end*/
  257. /*面包屑部分*/
  258. div#bread-nav {
  259. width: 100%;
  260. height: auto;
  261. }
  262. #bread-nav {
  263. position: relative;
  264. }
  265. #bread-nav .brand-nav-content {
  266. float: right;
  267. }
  268. .brand-nav-box {
  269. width: 1200px;
  270. margin: 0 auto;
  271. color: #858585;
  272. font-size: 14px;
  273. text-align: left;
  274. line-height: 70px;
  275. }
  276. .brand-nav-content {
  277. float: left;
  278. }
  279. .brand-nav-title {
  280. float: left;
  281. }
  282. .brand-nav-list {
  283. float: left;
  284. overflow: hidden;
  285. }
  286. .brand-nav-list ul {
  287. overflow: hidden;
  288. }
  289. .brand-nav-list ul li {
  290. float: left;
  291. padding: 0 5px;
  292. }
  293. .brand-nav-list ul li a {
  294. display: block;
  295. width: 100%;
  296. height: 100%;
  297. color: #858585;
  298. }
  299. .brand-nav-list ul li:last-child a {
  300. color: #22202b;
  301. }
  302. .brand-nav-list ul li a:hover {
  303. color: #22202b;
  304. }
  305. /*面包屑部分结束*/
  306. /*Products show start*/
  307. div#products-show {
  308. overflow: hidden;
  309. width: 100%;
  310. height: auto;
  311. }
  312. /*Products top show start*/
  313. .products-msg {
  314. overflow: hidden;
  315. width: 100%;
  316. height: auto;
  317. }
  318. .products-msg-box {
  319. width: 1200px;
  320. height: auto;
  321. padding: 75px 0 110px;
  322. margin: 0 auto;
  323. border-top: 2px solid #d5d5d8;
  324. }
  325. /*products pic wrap start*/
  326. .products-pic-wrap {
  327. float: left;
  328. width: 500px;
  329. height: auto;
  330. }
  331. /*products pic wrap end*/
  332. /*products wrod wrap start*/
  333. .products-wrod-wrap {
  334. float: right;
  335. width: 600px;
  336. height: auto;
  337. padding-left: 57px;
  338. box-sizing: border-box;
  339. }
  340. .products-view-title {
  341. overflow: hidden;
  342. width: 100%;
  343. height: auto;
  344. color: #22202b;
  345. font-size: 30px;
  346. font-weight: bold;
  347. line-height: 32px;
  348. text-align: left;
  349. }
  350. .products-price {
  351. overflow: hidden;
  352. width: 100%;
  353. height: auto;
  354. margin: 50px 0;
  355. }
  356. .products-price-word {
  357. float: left;
  358. width: 105px;
  359. height: auto;
  360. color: #858585;
  361. font-size: 14px;
  362. font-weight: bold;
  363. line-height: 26px;
  364. text-align: left;
  365. }
  366. .products-price-box {
  367. overflow: hidden;
  368. float: left;
  369. color: #22202b;
  370. font-size: 24px;
  371. font-weight: bold;
  372. line-height: 26px;
  373. text-align: left;
  374. }
  375. span.products-price-mark {
  376. font-size: 14px;
  377. }
  378. .products-parameter {
  379. overflow: hidden;
  380. width: 100%;
  381. height: auto;
  382. color: #858585;
  383. font-size: 14px;
  384. line-height: 30px;
  385. text-align: left;
  386. }
  387. .products-parameter-word {
  388. float: left;
  389. width: 105px;
  390. font-weight: bold;
  391. }
  392. .products-par-details-box {
  393. float: left;
  394. }
  395. .prod-buy-now {
  396. overflow: hidden;
  397. width: 296px;
  398. height: 56px;
  399. margin-top: 42px;
  400. background: #22202b;
  401. font-size: 24px;
  402. text-align: center;
  403. line-height: 56px;
  404. -webkit-transition: all 0.5s ease;
  405. -o-transition: all 0.5s ease;
  406. transition: all 0.5s ease;
  407. }
  408. .prod-buy-now:hover {
  409. -webkit-transform: translateY(-5px);
  410. -ms-transform: translateY(-5px);
  411. -o-transform: translateY(-5px);
  412. transform: translateY(-5px);
  413. }
  414. .prod-buy-now a {
  415. display: block;
  416. overflow: hidden;
  417. width: 100%;
  418. height: 100%;
  419. color: #ffe9c0;
  420. }
  421. /*products wrod wrap end*/
  422. /*Products top show end*/
  423. /*Products details box start*/
  424. .products-details {
  425. width: 100%;
  426. height: auto;
  427. }
  428. .products-details-box {
  429. width: 1200px;
  430. height: auto;
  431. margin: 0 auto;
  432. padding-bottom: 110px;
  433. }
  434. /*products-search start*/
  435. .prod-search-warp {
  436. float: left;
  437. overflow: hidden;
  438. width: 200px;
  439. }
  440. .prod-search-box {
  441. overflow: hidden;
  442. width: 100%;
  443. height: auto;
  444. padding-bottom: 63px;
  445. }
  446. .prod-search-title {
  447. width: 100%;
  448. height: 52px;
  449. padding-left: 10px;
  450. border-top: 2px solid #e5e5e5;
  451. border-bottom: 2px solid #e5e5e5;
  452. color: #22202b;
  453. font-size: 18px;
  454. font-weight: bold;
  455. line-height: 50px;
  456. text-align: left;
  457. box-sizing: border-box;
  458. }
  459. .prod-search {
  460. overflow: hidden;
  461. width: 100%;
  462. height: auto;
  463. padding-left: 10px;
  464. padding: 33px 0 11px 10px;
  465. box-sizing: border-box;
  466. }
  467. .prod-search input {
  468. overflow: hidden;
  469. width: 172px;
  470. height: 36px;
  471. padding-left: 8px;
  472. border: 2px solid #e5e5e5;
  473. box-sizing: border-box;
  474. color: #858585;
  475. font-size: 14px;
  476. line-height: 32px;
  477. text-align: left;
  478. outline: none;
  479. }
  480. .prod-search-btn {
  481. overflow: hidden;
  482. width: 82px;
  483. height: 36px;
  484. margin-left: 10px;
  485. background: #22202b;
  486. color: #ffe9c0;
  487. font-size: 14px;
  488. line-height: 36px;
  489. text-align: center;
  490. cursor: pointer;
  491. }
  492. /*products-search end*/
  493. /*prod-details start*/
  494. .prod-details-warp {
  495. float: right;
  496. width: 950px;
  497. height: auto;
  498. }
  499. .prod-details-title {
  500. overflow: hidden;
  501. width: 100%;
  502. height: 57px;
  503. border-bottom: 2px solid #d5d5d8;
  504. color: #22202b;
  505. font-size: 24px;
  506. line-height: 24px;
  507. text-align: left;
  508. }
  509. .prod-details {
  510. overflow: hidden;
  511. width: 100%;
  512. height: auto;
  513. padding-top: 80px;
  514. }
  515. /*prod-details end*/
  516. /*Products details box end*/
  517. /*Products show end*/
  518. /*Related Products start*/
  519. div#related_products_wrap {
  520. width: 100%;
  521. height: auto;
  522. }
  523. .related_products_box {
  524. overflow: hidden;
  525. width: 1200px;
  526. height: auto;
  527. margin: 0 auto;
  528. }
  529. .related_products_title {
  530. overflow: hidden;
  531. width: 100%;
  532. height: 132px;
  533. border-bottom: 2px solid #d5d5d8;
  534. box-sizing: border-box;
  535. color: #22202b;
  536. font-size: 24px;
  537. font-weight: bold;
  538. line-height: 130px;
  539. text-align: left;
  540. }
  541. .related_prod_list_box {
  542. overflow: hidden;
  543. width: 100%;
  544. height: auto;
  545. padding: 30px 0 18px;
  546. }
  547. .related_prod_list_box ul {
  548. overflow: hidden;
  549. }
  550. .related_prod_list {
  551. float: left;
  552. width: 300px;
  553. height: 333px;
  554. border: 3px solid transparent;
  555. box-sizing: border-box;
  556. -webkit-transition: all 0.5s ease;
  557. -o-transition: all 0.5s ease;
  558. transition: all 0.5s ease;
  559. cursor: pointer;
  560. }
  561. li.related_prod_list:hover {
  562. border: 3px solid #dcdcdc;
  563. }
  564. .related_prod_list_img {
  565. display: flex;
  566. overflow: hidden;
  567. width: 100%;
  568. height: 236px;
  569. justify-content: center;
  570. align-items: center;
  571. }
  572. .related_prod_list_img img {
  573. width: 100%;
  574. height: 100%;
  575. -webkit-transition: all 1s ease;
  576. -o-transition: all 1s ease;
  577. transition: all 1s ease;
  578. }
  579. .related_prod_list_img img:hover {
  580. -webkit-transform: scale(1.1);
  581. -ms-transform: scale(1.1);
  582. -o-transform: scale(1.1);
  583. transform: scale(1.1);
  584. }
  585. .related_prod_name {
  586. overflow: hidden;
  587. width: 100%;
  588. height: 38px;
  589. }
  590. .related_prod_name a {
  591. display: block;
  592. overflow: hidden;
  593. width: 100%;
  594. height: 100%;
  595. padding: 0 20px;
  596. color: #979797;
  597. font-size: 14px;
  598. line-height: 38px;
  599. text-align: center;
  600. text-overflow: ellipsis;
  601. white-space: nowrap;
  602. box-sizing: border-box;
  603. -webkit-transition: all 0.5s ease;
  604. -o-transition: all 0.5s ease;
  605. transition: all 0.5s ease;
  606. }
  607. .related_prod_name a:hover {
  608. color: #22202b;
  609. }
  610. .related_prod_price {
  611. overflow: hidden;
  612. width: 100%;
  613. height: 40px;
  614. color: #22202b;
  615. text-align: center;
  616. }
  617. span.price-num {
  618. font-size: 24px;
  619. font-weight: bold;
  620. line-height: 40px;
  621. }
  622. /*Related Products end*/
  623. /*You Like start*/
  624. div#products_like_wrap {
  625. width: 100%;
  626. height: auto;
  627. }
  628. .products_like_box {
  629. overflow: hidden;
  630. width: 1200px;
  631. height: auto;
  632. margin: 0 auto;
  633. }
  634. .prod_like_title {
  635. overflow: hidden;
  636. width: 100%;
  637. height: 132px;
  638. border-bottom: 2px solid #d5d5d8;
  639. box-sizing: border-box;
  640. color: #22202b;
  641. font-size: 24px;
  642. font-weight: bold;
  643. line-height: 130px;
  644. text-align: left;
  645. }
  646. .prod_like_list_box {
  647. overflow: hidden;
  648. width: 100%;
  649. height: auto;
  650. padding: 30px 0 88px;
  651. }
  652. .prod_like_list_box ul {
  653. overflow: hidden;
  654. }
  655. .prod_like_list {
  656. float: left;
  657. width: 300px;
  658. height: 333px;
  659. border: 3px solid transparent;
  660. box-sizing: border-box;
  661. -webkit-transition: all 0.5s ease;
  662. -o-transition: all 0.5s ease;
  663. transition: all 0.5s ease;
  664. cursor: pointer;
  665. }
  666. li.prod_like_list:hover {
  667. border: 3px solid #dcdcdc;
  668. }
  669. .prod_like_list_img {
  670. display: flex;
  671. overflow: hidden;
  672. width: 100%;
  673. height: 236px;
  674. justify-content: center;
  675. align-items: center;
  676. }
  677. .prod_like_list_img img {
  678. width: 100%;
  679. height: 100%;
  680. -webkit-transition: all 1s ease;
  681. -o-transition: all 1s ease;
  682. transition: all 1s ease;
  683. }
  684. .prod_like_list_img img:hover {
  685. -webkit-transform: scale(1.1);
  686. -ms-transform: scale(1.1);
  687. -o-transform: scale(1.1);
  688. transform: scale(1.1);
  689. }
  690. .prod_like_name {
  691. overflow: hidden;
  692. width: 100%;
  693. height: 38px;
  694. }
  695. .prod_like_name a {
  696. display: block;
  697. overflow: hidden;
  698. width: 100%;
  699. height: 100%;
  700. padding: 0 20px;
  701. color: #979797;
  702. font-size: 14px;
  703. line-height: 38px;
  704. text-align: center;
  705. text-overflow: ellipsis;
  706. white-space: nowrap;
  707. box-sizing: border-box;
  708. -webkit-transition: all 0.5s ease;
  709. -o-transition: all 0.5s ease;
  710. transition: all 0.5s ease;
  711. }
  712. .prod_like_name a:hover {
  713. color: #22202b;
  714. }
  715. .prod_like_price {
  716. overflow: hidden;
  717. width: 100%;
  718. height: 40px;
  719. color: #22202b;
  720. text-align: center;
  721. }
  722. span.price-num {
  723. font-size: 24px;
  724. font-weight: bold;
  725. line-height: 40px;
  726. }
  727. /*You Like end*/
  728. </style>