index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <div>
  3. <div class="row">
  4. <div class="col">设备名称:</div>
  5. <div class="col">{{ productInfo.productName }}</div>
  6. </div>
  7. <div class="row">
  8. <div class="col">设备SN码:</div>
  9. <div class="col">{{ productInfo.snCode }}</div>
  10. </div>
  11. <div class="row">
  12. <div class="col">设备图片:</div>
  13. <div class="col">
  14. <preview-image v-if="productInfo.productImage" class="preview-image" :src="productInfo.productImage" />
  15. </div>
  16. </div>
  17. <div class="row">
  18. <div class="col">授权牌:</div>
  19. <div class="col">
  20. <preview-image v-if="productInfo.certificateImage" class="preview-image" :src="productInfo.certificateImage" />
  21. </div>
  22. </div>
  23. <div class="row">
  24. <div class="col">购买渠道:</div>
  25. <div class="col">{{ productInfo.purchaseWay }}</div>
  26. </div>
  27. <div class="row">
  28. <div class="col">发票:</div>
  29. <div class="col">
  30. <preview-image v-if="productInfo.invoiceImage" class="preview-image" :src="productInfo.invoiceImage" />
  31. </div>
  32. </div>
  33. </div>
  34. </template>
  35. <script>
  36. import { getProductById } from '@/api/product'
  37. export default {
  38. name: 'DeviceDetail',
  39. props: {
  40. productId: {
  41. type: String,
  42. default: ''
  43. }
  44. },
  45. data() {
  46. return {
  47. productInfo: {
  48. productId: '',
  49. productName: '',
  50. snCode: '',
  51. productImage: '',
  52. certificateImage: '',
  53. paramList: [],
  54. invoiceImage: '',
  55. brandName: '',
  56. purchaseWay: ''
  57. }
  58. }
  59. },
  60. created() {
  61. this.getDetail()
  62. },
  63. methods: {
  64. // 获取商品详情
  65. getDetail() {
  66. this.isLoading = true
  67. getProductById({ productId: this.productId })
  68. .then((res) => {
  69. this.productInfo = { ...this.productInfo, ...res.data }
  70. })
  71. .finally(() => {
  72. this.isLoading = false
  73. })
  74. }
  75. }
  76. }
  77. </script>
  78. <style lang="scss" scoped>
  79. .row {
  80. display: flex;
  81. justify-content: flex-start;
  82. align-items: flex-start;
  83. margin-bottom: 25px;
  84. .col {
  85. font-size: 14px;
  86. color: #333;
  87. &:first-child {
  88. min-width: 100px;
  89. text-align: right;
  90. margin-right: 8px;
  91. font-weight: bold;
  92. color: #666;
  93. }
  94. .el-image {
  95. margin-left: 12px;
  96. &:first-child {
  97. margin-left: 0;
  98. }
  99. }
  100. }
  101. }
  102. .preview-image {
  103. display: inline-block;
  104. }
  105. </style>