index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <view class="qaBox">
  3. <JHeader title="提问" width="50" height="50" style="padding: 24upx 0 0;"></JHeader>
  4. <view class="qaTopInfo">
  5. <view class="qaTopInfoBox">
  6. <image :src="common.seamingImgUrl(qudata.images[0])"></image>
  7. <view class="qaInfoText">
  8. <h3>{{ qudata.productName }}</h3>
  9. <span>共{{ questionNumber }}个问题</span>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="questionCent">
  14. <view class="uni-textarea">
  15. <textarea v-model="questionText" maxlength="200" placeholder="请说出你的问题..." auto-height />
  16. </view>
  17. <!-- <view class="anonymous"> -->
  18. <!-- <view class="flex-row-plus flex-items" @click="changeCheck"> -->
  19. <!-- <label>匿名提问</label> -->
  20. <!-- </view> -->
  21. <!-- </view> -->
  22. </view>
  23. <view class="putQuestionsBox" @click="addProblem">
  24. <span class="putQuestionsBtn">发布</span>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import { addProblemAnswerApi, getProductDetailsByIdApi } from '../../../api/anotherTFInterface'
  30. export default {
  31. name: 'PutQuestions',
  32. data() {
  33. return {
  34. anonymous: false,
  35. qudata: {
  36. images: []
  37. },
  38. questionText: '',
  39. ifAnonymous: 0,
  40. questionNumber: ''
  41. }
  42. },
  43. onLoad(options) {
  44. this.questionNumber = options.questionNumber
  45. uni.showLoading()
  46. getProductDetailsByIdApi({
  47. shopId: options.shopId,
  48. productId: options.productId,
  49. skuId: options.skuId,
  50. terminal: 1
  51. }).then((res) => {
  52. uni.hideLoading()
  53. this.qudata = res.data
  54. })
  55. .catch((res) => {
  56. uni.hideLoading()
  57. })
  58. },
  59. methods: {
  60. changeCheck() {
  61. this.anonymous = !this.anonymous
  62. },
  63. addProblem() {
  64. if (this.questionText === '') return this.$showToast('内容不能为空!')
  65. uni.showLoading({
  66. title: '提交中...',
  67. mask: true
  68. })
  69. if (this.anonymous == true) {
  70. this.ifAnonymous = 1
  71. } else {
  72. this.ifAnonymous = 0
  73. }
  74. addProblemAnswerApi({
  75. productId: this.qudata.productId,
  76. problem: this.questionText,
  77. ifAnonymous: this.ifAnonymous
  78. }).then((res) => {
  79. uni.hideLoading()
  80. uni.showToast({
  81. title: '提问成功',
  82. icon: 'success'
  83. })
  84. setTimeout(() => {
  85. this.$redirectTo('/another-tf/another-serve/questionList/index')
  86. }, 2000)
  87. })
  88. .catch((e) => {
  89. uni.hideLoading()
  90. })
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang="scss" scoped>
  96. .qaBox {
  97. padding: 0 30upx;
  98. .qaTopInfo {
  99. margin-top: 20upx;
  100. margin-bottom: 30upx;
  101. .qaTopInfoBox {
  102. display: flex;
  103. align-items: center;
  104. padding: 15upx 20upx;
  105. margin-bottom: 55upx;
  106. image {
  107. width: 120upx;
  108. height: 120upx;
  109. margin-right: 20upx;
  110. border: 2rpx solid #E4E5E6;
  111. }
  112. .qaInfoText {
  113. h3 {
  114. font-size: 30upx;
  115. font-weight: 500;
  116. color: #333333;
  117. }
  118. span {
  119. font-size: 24upx;
  120. color: #CCCCCC;
  121. margin-top: 20rpx;
  122. }
  123. }
  124. }
  125. }
  126. .questionCent {
  127. width: 100%;
  128. textarea {
  129. padding: 30upx;
  130. box-sizing: border-box;
  131. min-height: 300upx;
  132. background: #FFFFFF;
  133. border: 2upx solid #EEEEEE;
  134. width: 100%;
  135. color: #666666;
  136. }
  137. }
  138. .putQuestionsBox {
  139. position: fixed;
  140. bottom: 0;
  141. left: 0;
  142. width: 100%;
  143. background: #FFFFFF;
  144. .putQuestionsBtn {
  145. width: 90%;
  146. height: 100upx;
  147. line-height: 100upx;
  148. text-align: center;
  149. background: #333333;
  150. display: block;
  151. margin: 0 auto 70upx auto;
  152. color: #FFEBC4;
  153. font-size: 28rpx;
  154. }
  155. }
  156. }
  157. </style>