ProductDetail.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <script setup>
  2. import { reactive,ref } from 'vue';
  3. import { stringifyQuery } from 'vue-router';
  4. import img from '@/assets/test.png'
  5. // let getProduct = reactive({
  6. // id:Number,
  7. // isStock:Boolean,
  8. // name:String,
  9. // description:String,
  10. // rating:Number,
  11. // salePrice:Number,
  12. // offerPrice:Number,
  13. // colors:String,
  14. // qty:String,
  15. // })
  16. let getProduct = reactive({
  17. id:Number,
  18. isStock:true,
  19. name:'产品名称',
  20. description:"Landsat 8 是美国陆地卫星计划(Landsat)的第八颗卫星,于2013年2月11号在加利福尼亚范登堡空军基地由Atlas-V火箭搭载发射成功,最初称为“陆地卫星数据连续性任务”(Landsat Data Continuity Mission,LDCM)。",
  21. rating:4,
  22. salePrice:15,
  23. offerPrice:12,
  24. inventory:300,
  25. state:'良好',
  26. category:'标准产品',
  27. qty:String,
  28. })
  29. let tab = ref()
  30. let text = ref( )
  31. </script>
  32. <template>
  33. <div>
  34. <v-row>
  35. <v-col lg="5" sm="12">
  36. <v-card id="my_card" >
  37. <v-img class="mx-auto"
  38. height="100%"
  39. width="100%"
  40. cover
  41. :src="img"
  42. ></v-img>
  43. </v-card>
  44. </v-col>
  45. <v-col lg="7" sm="12">
  46. <v-row>
  47. <div class="d-flex align-top">
  48. <div>
  49. <v-chip color="success" v-if="getProduct.isStock"> In Stock </v-chip>
  50. <v-chip color="error" v-else> Out of Stock </v-chip>
  51. <h3 class="text-h3 my-2 mb-3 ms-3">{{ getProduct.name }} <v-chip color="info" variant="outlined" size="small"> New</v-chip></h3>
  52. </div>
  53. </div>
  54. </v-row>
  55. <v-row>
  56. </v-row>
  57. <v-divider class="my-3"></v-divider>
  58. <v-row>
  59. <v-col lg="12">
  60. <div class="d-flex align-center gap-2">
  61. <h2 class="text-h2 text-primary">${{ getProduct.salePrice }}</h2>
  62. <v-chip color="secondary" size="x-large">
  63. <p>折扣后</p><p class="text-decoration-line-through text-medium-emphasis">${{ getProduct.offerPrice }}</p>
  64. </v-chip>
  65. </div>
  66. </v-col>
  67. <v-col lg="4">
  68. <tr>
  69. <td><p class="text-left text-subtitle-2">库存:</p></td>
  70. <td><p>{{getProduct.inventory }}</p></td>
  71. </tr>
  72. </v-col>
  73. <v-col lg="4">
  74. <tr>
  75. <td><p class="text-left text-subtitle-2">产品状态:</p></td>
  76. <td><p>{{ getProduct.state }}</p></td>
  77. </tr>
  78. </v-col>
  79. <v-col lg="4">
  80. <tr>
  81. <td><p class="text-left text-subtitle-2">类别:</p></td>
  82. <td><p>{{ getProduct.category }}</p></td>
  83. </tr>
  84. </v-col>
  85. <v-col lg="12">
  86. <p class="text-left text-subtitle-2">产品来源:</p>
  87. <p class="text-left v-col-lg-12 px-0">{{ getProduct.description }}</p>
  88. </v-col>
  89. <v-col lg="12" class="pb-0 pt-0">
  90. <p class="text-left text-subtitle-2 mb-2 ">产品评分:</p>
  91. <div class="text-medium-emphasis align-center d-flex mb-0 gap-2 ">
  92. <v-rating color="primary" half-increment v-model="getProduct.rating" > </v-rating>
  93. <small>({{ getProduct.rating }}+)</small>
  94. </div>
  95. </v-col>
  96. <v-col lg="6">
  97. <v-btn block color="primary" @click="store.AddToCart(getProduct)">
  98. <p style="font-weight: bold;">加入购物车</p>
  99. </v-btn>
  100. </v-col>
  101. <v-col lg="6">
  102. <v-btn block color="secondary" to="/ecommerce/checkout" @click="store.AddToCart(getProduct)">
  103. <p style="font-weight: bold;">立即订购</p>
  104. </v-btn>
  105. </v-col>
  106. </v-row>
  107. </v-col>
  108. <v-col>
  109. <v-tabs
  110. v-model="tab"
  111. color="primary"
  112. align-tabs="center"
  113. >
  114. <v-tab :value="1">产品介绍</v-tab>
  115. <v-tab :value="2">参数选择</v-tab>
  116. </v-tabs>
  117. <v-divider
  118. color="red"
  119. :thickness="2"
  120. ></v-divider>
  121. <v-window >
  122. <v-window-item :value="1">
  123. <v-card-text>
  124. <!-- 加载markdown -->
  125. <!-- <v-md-preview :text="text"></v-md-preview> -->
  126. </v-card-text>
  127. </v-window-item>
  128. <v-window-item :value="2">
  129. </v-window-item>
  130. </v-window>
  131. </v-col>
  132. </v-row>
  133. </div>
  134. </template>
  135. <style scoped>
  136. .productCustomize tr td {
  137. padding: 15px 20px;
  138. vertical-align: center;
  139. }
  140. #my_card{
  141. position: relative;
  142. height: 100%;
  143. width: 90%;
  144. left: 5%;
  145. }
  146. .v-divider{
  147. border-color: rgb(var(--v-theme-secondary)) !important;
  148. }
  149. </style>