carInfoModal.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <a-modal
  3. centered
  4. class="carInfoDetail-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. v-model="isShow"
  8. @cancle="isShow=false"
  9. :width="800">
  10. <div>
  11. <div class="head-info-con">
  12. <p class="head-info-title">车型信息</p>
  13. <a-divider style="margin: 12px 0;" />
  14. </div>
  15. <a-descriptions bordered :column="2" size="small" class="head-info-main">
  16. <a-descriptions-item label="车型信息:">{{ infoData&&infoData.text || '--' }}</a-descriptions-item>
  17. <a-descriptions-item label="品牌:">{{ infoData&&infoData.brand_name || '--' }}</a-descriptions-item>
  18. <a-descriptions-item label="车型:">{{ infoData&&infoData.model_name || '--' }}</a-descriptions-item>
  19. <a-descriptions-item label="品牌LOGO:">
  20. <img :src="infoData&&infoData.icon?infoData.icon:defImg" width="30" height="30" style="border-radius: 50%;" />
  21. </a-descriptions-item>
  22. <a-descriptions-item label="排量:">{{ infoData&&infoData.sub_name || '--' }}</a-descriptions-item>
  23. <a-descriptions-item label="年款:">{{ infoData&&infoData.year || '--' }}</a-descriptions-item>
  24. <a-descriptions-item label="车型图:">
  25. <div v-if="infoData&&infoData.images.length>0">
  26. <img :src="infoData.images[0] || defImg" width="30" height="30" class="imageUrl" @click="inited(infoData.images)" />
  27. </div>
  28. <span v-else>--</span>
  29. </a-descriptions-item>
  30. <a-descriptions-item label="车系:">{{ infoData&&infoData.series_name || '--' }}</a-descriptions-item>
  31. </a-descriptions>
  32. <div class="head-info-con" v-if="infoData&&infoData.params">
  33. <p class="head-info-title">配置信息</p>
  34. <a-divider style="margin: 12px 0;" />
  35. </div>
  36. <a-descriptions bordered :column="2" size="small" v-if="infoData&&infoData.params" class="head-info-main">
  37. <a-descriptions-item v-for="item in infoData.params" :label="item.type_name+':'">{{ item.value || '--' }}</a-descriptions-item>
  38. </a-descriptions>
  39. <div class="btn-cont"><a-button id="carInfoDetail-modal-back" @click="isShow = false">返回</a-button></div>
  40. </div>
  41. </a-modal>
  42. </template>
  43. <script>
  44. import defImg from '@/assets/def_img@2x.png'
  45. export default {
  46. name: 'CarInfoDetailModal',
  47. props: {
  48. openModal: { // 弹框显示状态
  49. type: Boolean,
  50. default: false
  51. },
  52. infoData: {
  53. type: Object,
  54. default: () => {
  55. return {}
  56. }
  57. }
  58. },
  59. data () {
  60. return {
  61. isShow: this.openModal, // 是否打开弹框
  62. defImg
  63. }
  64. },
  65. methods: {
  66. inited (viewer) {
  67. if (viewer) {
  68. const imageUrl = []
  69. viewer.map(item => {
  70. imageUrl.push(item)
  71. })
  72. this.$viewerApi({
  73. images: imageUrl
  74. })
  75. }
  76. }
  77. },
  78. watch: {
  79. // 父页面传过来的弹框状态
  80. openModal (newValue, oldValue) {
  81. this.isShow = newValue
  82. },
  83. // 重定义的弹框状态
  84. isShow (newValue, oldValue) {
  85. if (!newValue) {
  86. this.$emit('close')
  87. }
  88. }
  89. }
  90. }
  91. </script>
  92. <style lang="less">
  93. .carInfoDetail-modal{
  94. .ant-modal-body {
  95. padding: 40px 40px 24px;
  96. }
  97. .ant-descriptions-item-label.ant-descriptions-item-colon{
  98. width: 117px;
  99. }
  100. .btn-cont {
  101. text-align: center;
  102. margin: 35px 0 10px;
  103. }
  104. .head-info-con{
  105. .head-info-title{
  106. font-size: 16px;
  107. margin: 0;
  108. }
  109. }
  110. .head-info-main{
  111. margin-bottom: 20px;
  112. }
  113. .imageUrl{
  114. cursor: pointer;
  115. }
  116. }
  117. </style>