index.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <view class="container">
  3. <JHeader title="评价详情" width="50" height="50" style="padding: 24upx 0 0;"></JHeader>
  4. <!-- 评论详情 -->
  5. <view class="evaluate-contentbox">
  6. <view class="evaluate-content flex-items flex-row flex-sp-between">
  7. <view class="flex-items">
  8. <image
  9. v-if="detailsCommentVOData.headImage" class="user-headSmallImg"
  10. :src="common.seamingImgUrl(detailsCommentVOData.headImage)"
  11. ></image>
  12. <image v-else class="user-headSmallImg" src="../../../static/images/new-user/default-user-avatar.png"></image>
  13. <label v-if="detailsCommentVOData.name" class="fs28 mar-left-20">{{ detailsCommentVOData.name }}</label>
  14. <label v-else class="fs28 mar-left-20">匿名</label>
  15. </view>
  16. <label class="font-color-999 fs22">{{ detailsCommentVOData.createTime }}</label>
  17. </view>
  18. <view class="fs22 font-color-999 mar-top-10">
  19. {{ detailsCommentVOData.value }}
  20. </view>
  21. <view class="fs26 pad-topbot-20">{{ detailsCommentVOData.comment }}</view>
  22. <view v-if="detailsCommentVOData.image" class="evaluateImg-box">
  23. <view v-for="(cItem, index) in imageList" :key="index" @click="previewImg(1, index)">
  24. <image class="evaluate-Img" :src="common.seamingImgUrl(cItem)"></image>
  25. </view>
  26. </view>
  27. <view v-if="detailsCommentVOData.addComment" class="addComments-box flex-column-plus">
  28. <label class="font-color-C5AA7B mar-top-30">用户追评</label>
  29. <label class="mar-top-20">{{ detailsCommentVOData.addComment }}</label>
  30. <view v-if="detailsCommentVOData.addImage" class="evaluateImg-box mar-top-20">
  31. <view v-for="(dItem, index) in imgDataResult" :key="index" @click="previewImg(2, index)">
  32. <image class="evaluate-Img" :src="common.seamingImgUrl(dItem)"></image>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="goodsDes-box flex-column-plus mar-top-30">
  37. <view class="flex-row-plus" @click="goGoodsDetails">
  38. <image class="goodsDes-img" :src="common.seamingImgUrl(detailsCommentVOData.productImage)"></image>
  39. <view class="goodsDesText-box">
  40. <label class="fs26 goodsDes-text">{{ detailsCommentVOData.productName }}</label>
  41. <view class="mar-top-70">
  42. <label>¥ {{ detailsCommentVOData.productPrice }}</label>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="linkBox">
  49. <view v-if="detailsCommentVOData.addComment != ''" class="butBox flex-row-plus">
  50. <view class="addPraise-box1 flex-items-plus" @click="zanTap">
  51. <tui-icon
  52. v-if="detailsCommentVOData.ifLike" :size="30" color="#c5aa7b" name="agree"
  53. ></tui-icon>
  54. <tui-icon
  55. v-else :size="30" color="#cccccc" name="agree"
  56. ></tui-icon>
  57. <label class="mar-left-10" :class="[ detailsCommentVOData.ifLike ? 'font-color-FFEBC4' : 'font-color-DDD' ]">点赞</label>
  58. </view>
  59. </view>
  60. <view v-else class="butBox flex-row-plus">
  61. <view class="addComments-box flex-items-plus" @click="addCommentsClick()">
  62. <tui-icon :size="30" color="#333333" name="edit"></tui-icon>
  63. <label class="mar-left-10 font-color-333">追加评价</label>
  64. </view>
  65. <view class="addPraise-box flex-items-plus" @click="zanTap">
  66. <tui-icon
  67. v-if="detailsCommentVOData.ifLike" :size="30" color="#c5aa7b" name="agree"
  68. ></tui-icon>
  69. <tui-icon
  70. v-else :size="30" color="#cccccc" name="agree"
  71. ></tui-icon>
  72. <label class="mar-left-10" :class="[ detailsCommentVOData.ifLike ? 'font-color-FFEBC4' : 'font-color-DDD' ]">点赞</label>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. </template>
  78. <script>
  79. import { updateLikeOrUnLikeCommentApi } from '../../../api/anotherTFInterface'
  80. export default {
  81. name: 'EvaluateDetails',
  82. data() {
  83. return {
  84. detailsCommentVOData: {},
  85. actionType: true,
  86. imgDataResult: [],
  87. imageList: []
  88. }
  89. },
  90. onLoad() {
  91. uni.$on('sendEvaluateDetailsMsg', (data) => {
  92. if (data.detailsCommentVOData) {
  93. this.detailsCommentVOData = data.detailsCommentVOData
  94. this.commentImgData(this.detailsCommentVOData.image)
  95. this.imgDataResultData(this.detailsCommentVOData.addImage)
  96. }
  97. })
  98. },
  99. methods: {
  100. goGoodsDetails() {
  101. const shopId = this.detailsCommentVOData.shopId
  102. const productId = this.detailsCommentVOData.productId
  103. const skuId = this.detailsCommentVOData.skuId
  104. uni.navigateTo({
  105. url: '/another-tf/another-serve/goodsDetails/index?shopId=' + shopId + '&productId=' + productId + '&skuId=' + skuId
  106. })
  107. },
  108. commentImgData(imgData) {
  109. this.imageList = imgData.split(',')
  110. },
  111. imgDataResultData(imgData) {
  112. this.imgDataResult = imgData.split(',')
  113. },
  114. // 点赞
  115. zanTap() {
  116. uni.showLoading()
  117. this.actionType = this.detailsCommentVOData.ifLike == 1 ? 0 : 1
  118. updateLikeOrUnLikeCommentApi({
  119. commentId: this.detailsCommentVOData.commentId,
  120. ifLike: this.actionType
  121. }).then((res) => {
  122. uni.hideLoading()
  123. this.detailsCommentVOData.ifLike = !this.detailsCommentVOData.ifLike
  124. this.detailsCommentVOData.likes = this.detailsCommentVOData.ifLike ? this.detailsCommentVOData.likes + 1 : this.detailsCommentVOData.likes - 1
  125. if (this.actionType == 1) {
  126. uni.showToast({
  127. title: '点赞成功'
  128. })
  129. } else {
  130. uni.showToast({
  131. title: '已取消点赞',
  132. icon: 'none'
  133. })
  134. }
  135. })
  136. .catch((e) => {
  137. uni.hideLoading()
  138. })
  139. },
  140. // 追加评论
  141. addCommentsClick() {
  142. uni.redirectTo({
  143. url: '/another-tf/another-serve/addEvaluate/index?type=2',
  144. success: () => {
  145. uni.$emit('sendAddEvaluateMsg', { addCommentVOData: this.detailsCommentVOData, commentId: '' })
  146. }
  147. })
  148. },
  149. // 预览图片多张
  150. previewImg(type, index) {
  151. const imgsArray = []
  152. if (type === 1) {
  153. for (let i = 0; i < this.imageList.length - 1; i++) {
  154. imgsArray.push(this.imageList[i])
  155. }
  156. } else {
  157. for (let i = 0; i < this.imgDataResult.length - 1; i++) {
  158. imgsArray.push(this.imgDataResult[i])
  159. }
  160. }
  161. uni.previewImage({
  162. current: index,
  163. urls: imgsArray
  164. })
  165. }
  166. }
  167. }
  168. </script>
  169. <style lang="less" scoped>
  170. .container {
  171. padding-bottom: 30upx;
  172. .evaluate-contentbox {
  173. display: flex;
  174. justify-content: center;
  175. flex-direction: column;
  176. padding: 30upx 30upx;
  177. background-color: #FFFFFF;
  178. .evaluate-content {
  179. width: 670upx;
  180. display: flex;
  181. justify-content: space-between;
  182. .user-headSmallImg {
  183. width: 46upx;
  184. height: 46upx;
  185. border-radius: 50%;
  186. }
  187. }
  188. .evaluateImg-box {
  189. display: flex;
  190. flex-direction: row;
  191. flex-wrap: wrap;
  192. margin-left: -9upx;
  193. .evaluate-Img {
  194. width: 224upx;
  195. height: 224upx;
  196. border-radius: 10upx;
  197. margin-left: 9upx;
  198. margin-top: 9upx;
  199. }
  200. }
  201. .goodsDes-box {
  202. background-color: #F7F7F7;
  203. padding: 20upx 44upx 20upx 20upx;
  204. .goodsDes-img {
  205. width: 180upx;
  206. height: 180upx;
  207. border-radius: 10upx;
  208. }
  209. .goodsDesText-box {
  210. width: 416upx;
  211. margin-left: 30upx;
  212. }
  213. }
  214. .addComments-box {
  215. border-top: 1upx solid #EEEEEE;
  216. margin-top: 35upx;
  217. }
  218. }
  219. .butBox {
  220. padding: 0 30rpx;
  221. display: flex;
  222. justify-content: space-between;
  223. .addComments-box {
  224. height: 100upx;
  225. width: 330upx;
  226. background-color: #FFFFFF;
  227. color: #333333;
  228. border: 2rpx solid #333333;
  229. }
  230. .addPraise-box {
  231. height: 100upx;
  232. width: 330upx;
  233. background: #333333;
  234. color: #FFFFFF;
  235. }
  236. .addPraise-box1 {
  237. height: 100upx;
  238. width: 690upx;
  239. background: #333333;
  240. color: #FFFFFF;
  241. }
  242. }
  243. .linkBox {
  244. position: absolute;
  245. bottom: 20upx;
  246. width: 100%;
  247. }
  248. }
  249. </style>