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

335 lines
7.3 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <view
  3. class="qaBox"
  4. v-if="ifShow"
  5. >
  6. <view class="qaTopInfo">
  7. <view
  8. class="qaTopInfoBox"
  9. @click="goGoodsDetails"
  10. >
  11. <image :src="detailList.image"></image>
  12. <view class="qaInfoText">
  13. <h3>{{ detailList.productName }}</h3>
  14. <span>{{ detailList.count }}个问题</span>
  15. </view>
  16. </view>
  17. <view class="qaTitBox">
  18. <view class="qaTit"><i></i>
  19. <h3>{{ detailList.problem }}</h3></view>
  20. <view class="qaTitTime"><img :src="detailList.headImage" />
  21. <span class="qaName">{{ detailList.name }}</span>
  22. <span class="qaTimeInfo">{{ detailList.createTime }}</span></view>
  23. </view>
  24. </view>
  25. <view class="answerListBox">
  26. <view class="answerNum">{{ answerslength }}条回答</view>
  27. <view
  28. class="answerList"
  29. v-for="item in detailList.answers"
  30. :key="item.answerId"
  31. >
  32. <view class="answerItem">
  33. <view class="itemTit">
  34. <view class="itemAvatarBox">
  35. <img
  36. :src="item.headImage"
  37. alt=""
  38. >
  39. <span class="answerName">{{ item.name }}</span>
  40. </view>
  41. <view class="answerTime">{{ item.createTime }}</view>
  42. </view>
  43. <view class="answerInfo">{{ item.answer }}</view>
  44. </view>
  45. </view>
  46. </view>
  47. <view
  48. v-if="detailList.ifExhibition==1"
  49. class="pad-bot-100"
  50. ></view>
  51. <view
  52. class="answerBtn"
  53. v-if="detailList.ifExhibition==1"
  54. :style="{'padding-bottom':(isIphone==true? 50:0)+'rpx'}"
  55. >
  56. <view class="uni-form-item uni-column answerBtnBox">
  57. <input
  58. class="uni-input"
  59. v-model="answerText"
  60. maxlength="200"
  61. focus
  62. placeholder="被邀请的用户才能回答"
  63. />
  64. <view
  65. class="answerButton"
  66. @click="answer"
  67. >回答
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. const NET = require('../../utils/request')
  75. const API = require('../../config/api')
  76. import QuestionsAndAnswersList from "./components/QuestionsAndAnswersList";
  77. export default {
  78. name: "qADetail",
  79. components:{QuestionsAndAnswersList},
  80. data() {
  81. return {
  82. detailList: {},//商品问答详情
  83. productId: '',
  84. images: '',
  85. productName: '',
  86. problemsData: {},
  87. answerText: "",
  88. answerslength: 0,
  89. num: 0,
  90. isIphone: false,
  91. ifShow: false
  92. }
  93. },
  94. onLoad(options) {
  95. this.isIphone = getApp().globalData.isIphone;
  96. this.problemsData = this.$getJumpParam(options)
  97. this.getProblems()
  98. },
  99. methods: {
  100. goGoodsDetails() {
  101. let shopId = this.detailList.shopId
  102. let productId = this.detailList.productId
  103. let skuId = this.detailList.skuId
  104. uni.navigateTo({
  105. url: 'goodsDetails?shopId=' + shopId + '&productId=' + productId + '&skuId=' + skuId
  106. })
  107. },
  108. //商品问答数据
  109. getProblems() {
  110. NET.request(API.getProblemDetail, {
  111. problemId: this.problemsData.problemId,
  112. productId: this.problemsData.productId,
  113. }, 'GET').then(res => {
  114. this.detailList = res.data
  115. this.ifShow = true
  116. this.answerslength = this.detailList.answers.length
  117. uni.removeStorageSync('seeAllFnData')
  118. }).catch(res => {
  119. uni.showToast({
  120. title: '失败',
  121. icon: "none"
  122. })
  123. })
  124. },
  125. //回答
  126. answer() {
  127. NET.request(API.addAnswer, {
  128. productId: this.problemsData.productId,
  129. answer: this.answerText,
  130. problemId: this.problemsData.problemId
  131. }, 'POST').then(res => {
  132. this.getProblems()
  133. this.answerText = ""
  134. uni.showToast({
  135. title: '回答成功',
  136. icon: "success"
  137. })
  138. }).catch(res => {
  139. uni.showToast({
  140. title: '失败',
  141. icon: "none"
  142. })
  143. })
  144. }
  145. }
  146. }
  147. </script>
  148. <style
  149. lang="scss"
  150. scoped
  151. >
  152. .qaBox {
  153. padding: 0 30upx;
  154. .qaTopInfo {
  155. margin-top: 20upx;
  156. .qaTopInfoBox {
  157. border-radius: 10upx;
  158. display: flex;
  159. align-items: center;
  160. padding: 15upx 20upx;
  161. margin-bottom: 55upx;
  162. image {
  163. border: 2px solid #E4E5E6;
  164. width: 120upx;
  165. height: 120upx;
  166. margin-right: 20upx;
  167. }
  168. .qaInfoText {
  169. h3 {
  170. font-size: 30upx;
  171. font-weight: 500;
  172. color: #333333;
  173. margin-bottom: 20rpx;
  174. }
  175. span {
  176. font-size: 24upx;
  177. color: #999999;
  178. }
  179. }
  180. }
  181. .qaTitBox {
  182. padding-bottom: 30upx;
  183. border-bottom: 1upx solid #EEEEEE;
  184. .qaTit {
  185. display: flex;
  186. align-items: center;
  187. margin-bottom: 35rpx;
  188. i {
  189. width: 54rpx;
  190. height: 54rpx;
  191. line-height: 54rpx;
  192. background: #FBC864;
  193. font-style: normal;
  194. text-align: center;
  195. font-size: 28rpx;
  196. font-weight: bold;
  197. color: #FFFFFF;
  198. margin-right: 30rpx;
  199. border-radius: 50%;
  200. }
  201. h3 {
  202. font-size: 28upx;
  203. font-weight: 500;
  204. color: #333333;
  205. }
  206. }
  207. .qaTitTime {
  208. display: flex;
  209. align-items: center;
  210. img {
  211. width: 44upx;
  212. height: 44upx;
  213. margin-right: 20upx;
  214. }
  215. .qaName {
  216. font-size: 28upx;
  217. color: #666666;
  218. margin-right: 35upx;
  219. }
  220. .qaTimeInfo {
  221. color: #CCCCCC;
  222. font-size: 22upx;
  223. }
  224. }
  225. }
  226. }
  227. .answerListBox {
  228. .answerNum {
  229. font-size: 24upx;
  230. color: #CCCCCC;
  231. margin-bottom: 40upx;
  232. margin-top: 30upx;
  233. }
  234. .answerList {
  235. padding-bottom: 50upx;
  236. .answerItem {
  237. margin-bottom: 10upx;
  238. .itemTit {
  239. display: flex;
  240. align-items: center;
  241. justify-content: space-between;
  242. .itemAvatarBox {
  243. display: flex;
  244. img {
  245. width: 46upx;
  246. height: 46upx;
  247. margin-right: 20upx;
  248. }
  249. .answerName {
  250. font-size: 26upx;
  251. color: #333333;
  252. font-weight: bold;
  253. }
  254. }
  255. .answerTime {
  256. color: #CCCCCC;
  257. font-size: 20upx;
  258. }
  259. }
  260. .answerInfo {
  261. color: #333333;
  262. font-size: 28upx;
  263. margin-top: 20upx;
  264. font-weight: 400;
  265. }
  266. }
  267. }
  268. }
  269. .answerBtn {
  270. position: fixed;
  271. width: 100%;
  272. bottom: 0;
  273. left: 0;
  274. .answerBtnBox {
  275. display: flex;
  276. align-items: center;
  277. justify-content: space-between;
  278. width: 100%;
  279. padding: 30upx;
  280. background: #FFFFFF;
  281. input {
  282. margin-right: 30upx;
  283. width: 530upx;
  284. background: #F1F1F1;
  285. min-height: 84upx;
  286. padding-left: 30upx;
  287. font-size: 28upx;
  288. color: #999999;
  289. }
  290. .input-placeholder {
  291. font-size: 24upx;
  292. color: #999999;
  293. }
  294. .answerButton {
  295. width: 152upx;
  296. height: 84upx;
  297. background: #333333;
  298. text-align: center;
  299. line-height: 84upx;
  300. font-size: 30upx;
  301. color: #FFEBC4;
  302. }
  303. }
  304. }
  305. }
  306. </style>