detail.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <div>
  3. <a-page-header :ghost="false" :backIcon="false" class="newProductDetail-back">
  4. <!-- 自定义的二级文字标题 -->
  5. <template slot="subTitle">
  6. <a id="newProductDetail-back-btn" href="javascript:;" @click="goBack">
  7. <a-icon type="left" />
  8. 返回
  9. </a>
  10. </template>
  11. </a-page-header>
  12. <div class="newProductDetail-modal">
  13. <!-- 产品详情 -->
  14. <h4>{{ (detailsData && detailsData.name) || '--' }}</h4>
  15. <div class="productHead">
  16. <div class="productInfo">
  17. <!--
  18. ***省级经销商:市场价、特约价1显示 0不显示
  19. ***市级经销商:特约价1显示 0不显示
  20. -->
  21. <a-descriptions bordered :column="2" size="small">
  22. <a-descriptions-item label="产品品牌:">{{ (detailsData && detailsData.productBrandName) || '--' }}</a-descriptions-item>
  23. <a-descriptions-item label="产品编码:">{{ (detailsData && detailsData.code) || '--' }}</a-descriptions-item>
  24. <a-descriptions-item label="原厂编码:">{{ (detailsData && detailsData.origCode) || '--' }}</a-descriptions-item>
  25. <a-descriptions-item label="条形码:">{{ detailsData&&detailsData.qrCode || '--' }}</a-descriptions-item>
  26. <a-descriptions-item label="商品尺寸:">{{ (detailsData && detailsData.size) || '--' }}</a-descriptions-item>
  27. <a-descriptions-item label="重量:">{{ (detailsData && detailsData.weight) || '--' }}</a-descriptions-item>
  28. <a-descriptions-item label="计量单位:">{{ (detailsData && detailsData.unit) || '--' }}</a-descriptions-item>
  29. <!-- <a-descriptions-item label="市级价:" v-if="this.specialPriceObj.dealerLevel&&this.specialPriceObj.dealerLevel == 'PROVINCE'">{{ detailsData&&(detailsData.cityPrice||detailsData.cityPrice==0) ? toThousands(detailsData.cityPrice):'--' }}</a-descriptions-item>
  30. <a-descriptions-item label="特约价:" v-if="(this.specialPriceObj.isShowSpecialPrice&&this.specialPriceObj.isShowSpecialPrice != 0)">{{ detailsData && (detailsData.specialPrice||detailsData.specialPrice==0)?toThousands(detailsData.specialPrice) : '--' }}</a-descriptions-item>
  31. <a-descriptions-item label="终端价:">{{ detailsData && (detailsData.terminalPrice || detailsData.terminalPrice==0)?toThousands(detailsData.terminalPrice):'--' }}</a-descriptions-item>
  32. <a-descriptions-item label="车主价:">{{ detailsData && (detailsData.carOwnersPrice || detailsData.carOwnersPrice==0)?toThousands(detailsData.carOwnersPrice):'--' }}</a-descriptions-item> -->
  33. </a-descriptions>
  34. <div class="productDetail">
  35. <h4>产品介绍</h4>
  36. <div class="productDesc">
  37. <div v-if="detailsData && detailsData.description" v-html="detailsData.description"></div>
  38. <span v-else>暂无产品介绍</span>
  39. </div>
  40. </div>
  41. </a-descriptions></div>
  42. <div class="productImg" v-if="detailsData && detailsData.productPicList && detailsData.productPicList.length>0">
  43. <a-carousel arrows dots-class="slick-dots slick-thumb">
  44. <a slot="customPaging" slot-scope="props">
  45. <img :src="detailsData.productPicList[props.i].imageUrl" />
  46. </a>
  47. <div slot="prevArrow" slot-scope="props" class="custom-slick-arrow" style="left: 10px;zIndex: 1"><a-icon type="left-circle" style="color: #314659;" /></div>
  48. <div slot="nextArrow" slot-scope="props" class="custom-slick-arrow" style="right: 10px"><a-icon type="right-circle" style="color: #314659;" /></div>
  49. <div v-for="(item, index) in detailsData.productPicList" :key="index">
  50. <img-zoom :src="item.imageUrl" width="100%" height="100%" :bigsrc="item.imageUrl" :configs="configs"></img-zoom>
  51. </div>
  52. </a-carousel>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </template>
  58. <script>
  59. import { commonMixin } from '@/utils/mixin'
  60. import imgZoom from 'vue2.0-zoom'
  61. import { productDetail, getCurrentDealer } from '@/api/product.js'
  62. export default {
  63. name: 'ProductInfoDetail',
  64. components: { imgZoom },
  65. mixins: [commonMixin],
  66. computed: {
  67. productTypeName () {
  68. const productTypeName1 = this.detailsData && this.detailsData.productTypeName1 ? this.detailsData.productTypeName1 : ''
  69. const productTypeName2 = this.detailsData && this.detailsData.productTypeName2 ? ' > ' + this.detailsData.productTypeName2 : ''
  70. const productTypeName3 = this.detailsData && this.detailsData.productTypeName3 ? ' > ' + this.detailsData.productTypeName3 : ''
  71. return productTypeName1 + productTypeName2 + productTypeName3
  72. }
  73. },
  74. data () {
  75. return {
  76. itemId: null,
  77. detailsData: null, // 详情数据
  78. prevPageInfo: null,
  79. configs: {
  80. width: 600,
  81. height: 350,
  82. maskWidth: 80,
  83. maskHeight: 80,
  84. maskColor: 'red',
  85. maskOpacity: 0.2
  86. },
  87. specialPriceObj: {}
  88. }
  89. },
  90. methods: {
  91. // 获取详情
  92. getDetail () {
  93. this.detailsData = null
  94. productDetail({ sn: this.itemId }).then(res => {
  95. if (res.status == 200) {
  96. this.detailsData = res.data
  97. } else {
  98. this.detailsData = null
  99. }
  100. })
  101. },
  102. // 获取特约价
  103. getSpecialPriceInfo () {
  104. getCurrentDealer().then(res => {
  105. if (res.status == 200) {
  106. this.specialPriceObj = res.data
  107. }
  108. })
  109. },
  110. // 返回
  111. goBack () {
  112. this.$router.push({ path: this.prevPageInfo && this.prevPageInfo.path })
  113. }
  114. },
  115. mounted () {
  116. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  117. this.itemId = this.$route.params.sn
  118. this.getDetail()
  119. this.getSpecialPriceInfo()
  120. }
  121. },
  122. activated () {
  123. this.itemId = this.$route.params.sn
  124. this.getDetail()
  125. this.getSpecialPriceInfo()
  126. },
  127. beforeRouteEnter (to, from, next) {
  128. next(vm => {
  129. vm.prevPageInfo = from
  130. })
  131. }
  132. }
  133. </script>
  134. <style lang="less">
  135. #_magnifier_layer{
  136. left: 500px!important;
  137. }
  138. /* For demo */
  139. .ant-carousel .slick-slide {
  140. text-align: center;
  141. overflow: hidden;
  142. display: flex;
  143. justify-content: center;
  144. align-items: center;
  145. }
  146. .ant-carousel .custom-slick-arrow {
  147. width: 25px;
  148. height: 25px;
  149. font-size: 25px;
  150. color: #fff;
  151. opacity: 0.3;
  152. }
  153. .ant-carousel .custom-slick-arrow:before {
  154. display: none;
  155. }
  156. .ant-carousel .custom-slick-arrow:hover {
  157. opacity: 0.5;
  158. }
  159. .ant-carousel .slick-slide img {
  160. width: 100%;
  161. max-height: 100%;
  162. }
  163. .ant-carousel{
  164. border: 1px solid #e8e8e8;
  165. }
  166. .ant-carousel .slick-dots {
  167. height: auto;
  168. }
  169. .ant-carousel .slick-slide img {
  170. border: 5px solid #fff;
  171. display: block;
  172. margin: auto;
  173. max-width: 90%;
  174. }
  175. .ant-carousel .slick-thumb {
  176. bottom: -40px;
  177. }
  178. .ant-carousel .slick-thumb li {
  179. width: 40px;
  180. height: 35px;
  181. }
  182. .ant-carousel .slick-thumb li img {
  183. width: 100%;
  184. height: 100%;
  185. filter: grayscale(100%);
  186. }
  187. .ant-carousel .slick-thumb li.slick-active img {
  188. filter: grayscale(0%);
  189. }
  190. .newProductDetail-back {
  191. margin-bottom: 10px;
  192. }
  193. .newProductDetail-modal {
  194. background-color: #fff;
  195. padding: 15px 15px 55px;
  196. h4 {
  197. font-size: 18px;
  198. }
  199. .productHead {
  200. display: flex;
  201. .productImg {
  202. width: 240px;
  203. }
  204. .productInfo {
  205. flex-grow: 1;
  206. margin-right: 10px;
  207. }
  208. .sycxImg {
  209. margin-top: 10px;
  210. p {
  211. font-size: 14px;
  212. padding: 5px 10px;
  213. background-color: #dcf1ff;
  214. }
  215. img {
  216. width: 100px;
  217. }
  218. }
  219. }
  220. .productDetail {
  221. border: 1px solid #eee;
  222. margin-top: 10px;
  223. h4 {
  224. font-size: 14px;
  225. padding: 5px 10px;
  226. background-color: #dcf1ff;
  227. }
  228. .productDesc {
  229. padding: 15px;
  230. }
  231. }
  232. .ant-descriptions-item-label.ant-descriptions-item-colon {
  233. width: 120px;
  234. }
  235. .btn-cont {
  236. text-align: center;
  237. margin: 35px 0 10px;
  238. }
  239. }
  240. </style>