多租户商城-客户PC端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

192 lines
5.1 KiB

2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="interactionDiagramPage">
  3. <div class="left">
  4. <!-- 互动图 -->
  5. <InteractionDiagramImage ref="interactionDiagramImage" @clickProductDetail="clickProductDetail"
  6. v-loading="pageloading">
  7. </InteractionDiagramImage>
  8. </div>
  9. <div class="right">
  10. <!-- 商品信息列表 -->
  11. <div class="productList">
  12. <div class="product-detail" @click="clickProductDetail(point)" v-for="(point, index) in showPointList"
  13. :key="index">
  14. <div class="image-container">
  15. <img class="product-image" v-if="point.product.image" :src="point.product.image" />
  16. </div>
  17. <div class="product-info">
  18. <div class="product-name">{{ (point.product && point.product.productName) ? point.product.productName : '' }}
  19. </div>
  20. <div class="product-price">{{ (point.product && point.product.price) ? point.product.price : '' }}</div>
  21. </div>
  22. </div>
  23. </div>
  24. </div>
  25. </div>
  26. </template>
  27. <script>
  28. import { getInteractionDiagramDetail, getProducts } from '@/api/interactionDiagram.js'
  29. import InteractionDiagramImage from '@/views/interactionDiagram/components/interactionDiagramImage.vue'
  30. export default {
  31. name: 'interactionDiagramDetail',
  32. components: {
  33. InteractionDiagramImage
  34. },
  35. data() {
  36. return {
  37. pageloading: false,
  38. interactionDiagramDetailData: {},
  39. pointList: [],
  40. showPointList: []
  41. }
  42. },
  43. created() {
  44. this.interactionDiagramId = JSON.parse(this.$route.query.interactionDiagramId)
  45. this.getInteractionDiagramDetail()
  46. },
  47. methods: {
  48. // 获取互动图详情
  49. async getInteractionDiagramDetail() {
  50. this.pageloading = true
  51. const response = await getInteractionDiagramDetail({
  52. interactionDiagramId: this.interactionDiagramId
  53. })
  54. const res = response.data
  55. if (res.code === '200') {
  56. this.interactionDiagramDetailData = res.data
  57. if (this.interactionDiagramDetailData.pointData) {
  58. this.pointList = JSON.parse(this.interactionDiagramDetailData.pointData);
  59. }
  60. this.showPointList = this.pointList.filter(item => item.product)
  61. let productIdList = this.showPointList.map(item => item.product.productId)
  62. const getProductsResponse = await getProducts({
  63. ids: productIdList,
  64. page: 1,
  65. pageSize: productIdList.length
  66. })
  67. if (getProductsResponse.data.code === '200') {
  68. let productList = getProductsResponse.data.data.list
  69. if (productList) {
  70. this.pointList.forEach(item => {
  71. if (item.product) {
  72. let newProduct = productList.find(newItem => newItem.productId == item.product.productId)
  73. if (newProduct) {
  74. item.product = newProduct
  75. }
  76. }
  77. })
  78. }
  79. }
  80. this.$refs.interactionDiagramImage.setParams(this.interactionDiagramDetailData, this.pointList)
  81. this.pageloading = false
  82. } else {
  83. this.$message.error(res.message || '请求失败!')
  84. }
  85. },
  86. clickProductDetail(product) {
  87. let data = {
  88. productId: product.productId,
  89. skuId: product.skuId,
  90. shopId: product.shopId
  91. }
  92. this.$router.push({
  93. path: "/productDetail",
  94. query: {
  95. proData: JSON.stringify(data)
  96. }
  97. })
  98. }
  99. }
  100. }
  101. </script>
  102. <style lang="scss" scoped>
  103. .interactionDiagramPage {
  104. background-color: #F5F5F5;
  105. padding: 50px 0 50px 0;
  106. display: flex;
  107. flex-direction: row;
  108. flex-wrap: nowrap;
  109. align-content: flex-start;
  110. justify-content: center;
  111. align-items: flex-start;
  112. .left {
  113. flex: 1;
  114. margin-right: 5px;
  115. }
  116. .right {
  117. flex: 1;
  118. margin-left: 5px;
  119. .productList {
  120. .product-detail {
  121. display: flex;
  122. flex-direction: row;
  123. flex-wrap: nowrap;
  124. align-content: flex-start;
  125. justify-content: flex-start;
  126. align-items: flex-start;
  127. margin-bottom: 15px;
  128. .image-container {
  129. width: 80px;
  130. height: 80px;
  131. .product-image {
  132. width: 100%;
  133. height: 100%;
  134. object-fit: contain;
  135. }
  136. }
  137. .product-info {
  138. margin-left: 8px;
  139. display: flex;
  140. flex-direction: column;
  141. flex-wrap: nowrap;
  142. align-content: flex-start;
  143. justify-content: flex-start;
  144. align-items: flex-start;
  145. }
  146. .product-name {
  147. width: 100%;
  148. height: auto;
  149. font-size: 16px;
  150. font-family: Source Han Sans CN;
  151. font-weight: bold;
  152. color: #252744;
  153. display: block;
  154. overflow: hidden;
  155. text-overflow: ellipsis;
  156. white-space: nowrap;
  157. line-height: 20px;
  158. text-align: left;
  159. }
  160. .product-price {
  161. width: auto;
  162. height: 20px;
  163. line-height: 20px;
  164. font-size: 14px;
  165. font-family: Source Han Sans CN;
  166. font-weight: bold;
  167. color: #252744;
  168. margin-top: 6px;
  169. }
  170. }
  171. }
  172. }
  173. }
  174. </style>