多租户商城-商户小程序端
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.

187 lines
4.9 KiB

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