index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view class="wid bor-line-F7F7F7">
  3. <JHeader title="全部问答" width="50" height="50" style="padding: 24upx 0 0;"></JHeader>
  4. <view class="qaBox">
  5. <view class="qaTopInfo">
  6. <view class="qaTopInfoBox">
  7. <image :src="common.seamingImgUrl(productInfo.images[0])"></image>
  8. <view class="qaInfoText">
  9. <h3>{{ productInfo.productName }}</h3>
  10. <span>共{{ problemsList.length }}个问题</span>
  11. </view>
  12. </view>
  13. </view>
  14. <QuestionsAndAnswersList :product-info="productInfo" :problems-list="problemsList" />
  15. <view class="putQuestionsBox">
  16. <view
  17. class="putQuestionsBtn"
  18. @click="go(`/another-tf/another-serve/putQuestions/index?shopId=${productInfo.shopId}&productId=${productInfo.productId}&skuId=${productInfo.skuId}&questionNumber=${problemsList.length}`)"
  19. >
  20. 去提问
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import { getProblemsSeckillApi, getProductDetailsByIdApi } from '../../../api/anotherTFInterface'
  28. import QuestionsAndAnswersList from '../goodsDetails/components/QuestionsAndAnswersList'
  29. export default {
  30. name: 'AnswerList',
  31. components: { QuestionsAndAnswersList },
  32. data() {
  33. return {
  34. productId: 0,
  35. isEmpty: false,
  36. problemsList: [], // 商品问答数据
  37. problemsTotal: 0,
  38. queryInfo: {
  39. page: 1,
  40. pageSize: 20
  41. },
  42. productInfo: {
  43. images: []
  44. }
  45. }
  46. },
  47. onLoad(options) {
  48. this.productId = options.productId
  49. uni.showLoading()
  50. getProductDetailsByIdApi({
  51. shopId: options.shopId,
  52. productId: this.productId,
  53. skuId: options.skuId,
  54. terminal: 1
  55. }).then((res) => {
  56. uni.hideLoading()
  57. this.productInfo = res.data
  58. })
  59. .catch((res) => {
  60. uni.hideLoading()
  61. })
  62. this.getProblemsList()
  63. },
  64. methods: {
  65. // 商品问答数据
  66. getProblemsList(isLoadmore) {
  67. uni.showLoading()
  68. getProblemsSeckillApi({ ...this.queryInfo, productId: this.productId }).then((res) => {
  69. this.problemsTotal = res.data.total
  70. if (isLoadmore) {
  71. this.problemsList.push(...res.data.list)
  72. } else {
  73. this.problemsList = res.data.list
  74. }
  75. this.isEmpty = this.problemsList.length === 0
  76. uni.hideLoading()
  77. })
  78. .catch((e) => {
  79. uni.hideLoading()
  80. })
  81. },
  82. onReachBottom() {
  83. if (this.problemsList.length < this.problemsTotal) {
  84. ++this.queryInfo.page
  85. this.getProblemsList(true)
  86. }
  87. }
  88. }
  89. }
  90. </script>
  91. <style lang="less" scoped>
  92. .qaBox {
  93. padding-bottom: 140upx;
  94. .qaTopInfo {
  95. margin-top: 20upx;
  96. margin-bottom: 30upx;
  97. padding: 0 40upx;
  98. .qaTopInfoBox {
  99. border-radius: 10upx;
  100. display: flex;
  101. align-items: center;
  102. padding: 15upx 20upx;
  103. margin-bottom: 55upx;
  104. background: #F6F6F6;
  105. image {
  106. width: 60upx;
  107. height: 60upx;
  108. border-radius: 5upx;
  109. margin-right: 20upx;
  110. }
  111. .qaInfoText {
  112. h3 {
  113. font-size: 30upx;
  114. font-weight: 500;
  115. color: #333333;
  116. }
  117. span {
  118. font-size: 24upx;
  119. color: #999999;
  120. }
  121. }
  122. }
  123. }
  124. .putQuestionsBox {
  125. position: fixed;
  126. bottom: 0;
  127. left: 0;
  128. width: 100%;
  129. background: #FFFFFF;
  130. }
  131. .putQuestionsBtn {
  132. width: 421upx;
  133. height: 67upx;
  134. line-height: 67upx;
  135. text-align: center;
  136. background: #333333;
  137. border-radius: 5upx;
  138. display: block;
  139. margin: 35rpx auto 35rpx auto;
  140. color: #FFEBC4;
  141. }
  142. }
  143. </style>