evaluateDetails.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <view class="container">
  3. <global-loading />
  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 v-if="commentVOList.headImage" class="user-headSmallImg" :src="commentVOList.headImage"></image>
  9. <image v-else class="user-headSmallImg" src="../../static/images/origin/storeLogo.png"></image>
  10. <label v-if="commentVOList.name" class="fs28 mar-left-20">{{ commentVOList.name }}</label>
  11. <label v-else class="fs28 mar-left-20">匿名</label>
  12. </view>
  13. <label class="font-color-999 fs22">{{ commentVOList.createTime }}</label>
  14. </view>
  15. <view class="fs22 font-color-999 mar-top-10">
  16. {{ commentVOList.value }}
  17. </view>
  18. <view class="fs26 pad-topbot-20">{{ commentVOList.comment }}</view>
  19. <view v-if="commentVOList.image" class="evaluateImg-box">
  20. <view v-for="(cItem, index) in imageList" :key="index" @click="previewImg(1, index)">
  21. <image class="evaluate-Img" :src="cItem"></image>
  22. </view>
  23. </view>
  24. <view v-if="commentVOList.addComment" class="addComments-box flex-column-plus">
  25. <label class="font-color-C5AA7B mar-top-30">用户追评</label>
  26. <label class="mar-top-20">{{ commentVOList.addComment }}</label>
  27. <view v-if="commentVOList.addImage" class="evaluateImg-box mar-top-20">
  28. <view v-for="(dItem, index) in imgDataResult" :key="index" @click="previewImg(2, index)">
  29. <image class="evaluate-Img" :src="dItem"></image>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="goodsDes-box flex-column-plus mar-top-30">
  34. <view class="flex-row-plus" @click="goGoodsDetails">
  35. <image class="goodsDes-img" :src="commentVOList.productImage"></image>
  36. <view class="goodsDesText-box">
  37. <label class="fs26 goodsDes-text">{{ commentVOList.productName }}</label>
  38. <view class="mar-top-70">
  39. <label>¥ {{ commentVOList.productPrice }}</label>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <!-- {{commentVOList}} -->
  46. <view class="linkBox">
  47. <view v-if="commentVOList.addComment != ''" class="butBox flex-row-plus">
  48. <view class="addPraise-box1 flex-items-plus" @click="zanTap">
  49. <image v-if="!commentVOList.ifLike" class="addPraise-icon" src="../../static/images/origin/addPraiseIcon.png" />
  50. <image v-else class="addPraise-icon" src="../../static/images/origin/addPraiseIcons.png" />
  51. <label class="mar-left-10" :class="[ commentVOList.ifLike ? 'font-color-FFEBC4' : 'font-color-DDD' ]">点赞</label>
  52. </view>
  53. </view>
  54. <view v-else class="butBox flex-row-plus">
  55. <view class="addComments-box flex-items-plus" @click="addCommentsClick()">
  56. <image class="addComments-cion" src="../../static/images/origin/addCommentsIcon.png"></image>
  57. <label class="mar-left-10 font-color-333">追加评价</label>
  58. </view>
  59. <view class="addPraise-box flex-items-plus" @click="zanTap">
  60. <image v-if="!commentVOList.ifLike" class="addPraise-icon" src="../../static/images/origin/addPraiseIcon.png" />
  61. <image v-else class="addPraise-icon" src="../../static/images/origin/addPraiseIcons.png" />
  62. <label class="mar-left-10" :class="[ commentVOList.ifLike ? 'font-color-FFEBC4' : 'font-color-DDD' ]">点赞</label>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </template>
  68. <script>
  69. const NET = require('../../utils/request')
  70. const API = require('../../config/api')
  71. export default {
  72. data() {
  73. return {
  74. commentVOList: {},
  75. actionType: true,
  76. imgDataResult: [],
  77. imageList: []
  78. }
  79. },
  80. onLoad() {
  81. this.commentVOList = uni.getStorageSync('commentVOList')
  82. uni.removeStorageSync('commentVOList')
  83. this.commentImgData(this.commentVOList.image)
  84. this.imgDataResultData(this.commentVOList.addImage)
  85. },
  86. onBackPress(e) {
  87. if (e.from === 'navigateBack') {
  88. return false
  89. }
  90. this.back()
  91. return true
  92. },
  93. methods: {
  94. goGoodsDetails() {
  95. const shopId = this.commentVOList.shopId
  96. const productId = this.commentVOList.productId
  97. const skuId = this.commentVOList.skuId
  98. uni.navigateTo({
  99. url: 'goodsDetails?shopId=' + shopId + '&productId=' + productId + '&skuId=' + skuId
  100. })
  101. },
  102. back() {
  103. uni.navigateTo({
  104. url: 'userEvaluate'
  105. })
  106. },
  107. commentImgData(imgData) {
  108. this.imageList = imgData.split(',')
  109. },
  110. imgDataResultData(imgData) {
  111. this.imgDataResult = imgData.split(',')
  112. },
  113. // 点赞
  114. zanTap() {
  115. // uni.showLoading({
  116. // title:''
  117. // })
  118. this.actionType = this.commentVOList.ifLike == 1 ? 0 : 1
  119. NET.request(API.LikeOrUnLikeComment, {
  120. commentId: this.commentVOList.commentId,
  121. ifLike: this.actionType
  122. }, 'POST').then((res) => {
  123. this.commentVOList.ifLike = !this.commentVOList.ifLike
  124. this.commentVOList.likes = this.commentVOList.ifLike ? this.commentVOList.likes + 1 : this.commentVOList.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((res) => {
  137. uni.hideLoading()
  138. })
  139. .finally(() => { uni.hideLoading() })
  140. },
  141. // 追加评论
  142. addCommentsClick() {
  143. uni.setStorageSync('addCommentVOList', this.commentVOList)
  144. uni.navigateTo({
  145. url: 'addEvaluate?type=2'
  146. })
  147. },
  148. // 查看图片
  149. // previewImg(img) {
  150. // console.log(img, 'img')
  151. // let imgsArray = [];
  152. // imgsArray[0] = img
  153. // uni.previewImage({
  154. // current: 0,
  155. // urls: imgsArray
  156. // });
  157. // },
  158. // 预览图片多张
  159. previewImg(type, index) {
  160. const imgsArray = []
  161. if (type === 1) {
  162. for (let i = 0; i < this.imageList.length - 1; i++) {
  163. imgsArray.push(this.imageList[i])
  164. }
  165. } else {
  166. for (let i = 0; i < this.imgDataResult.length - 1; i++) {
  167. imgsArray.push(this.imgDataResult[i])
  168. }
  169. }
  170. uni.previewImage({
  171. current: index,
  172. urls: imgsArray
  173. })
  174. }
  175. }
  176. }
  177. </script>
  178. <style lang="scss">
  179. .container {
  180. padding-bottom: 30upx;
  181. .evaluate-contentbox {
  182. display: flex;
  183. justify-content: center;
  184. flex-direction: column;
  185. padding: 30upx 30upx;
  186. background-color: #FFFFFF;
  187. .evaluate-content {
  188. width: 670upx;
  189. display: flex;
  190. justify-content: space-between;
  191. .user-headSmallImg {
  192. width: 46upx;
  193. height: 46upx;
  194. border-radius: 50%;
  195. }
  196. }
  197. .evaluateImg-box {
  198. display: flex;
  199. flex-direction: row;
  200. flex-wrap: wrap;
  201. margin-left: -9upx;
  202. .evaluate-Img {
  203. width: 224upx;
  204. height: 224upx;
  205. border-radius: 10upx;
  206. margin-left: 9upx;
  207. margin-top: 9upx;
  208. }
  209. }
  210. .goodsDes-box {
  211. background-color: #F7F7F7;
  212. padding: 20upx 44upx 20upx 20upx;
  213. .goodsDes-img {
  214. width: 180upx;
  215. height: 180upx;
  216. border-radius: 10upx;
  217. }
  218. .goodsDesText-box {
  219. width: 416upx;
  220. margin-left: 30upx;
  221. }
  222. .addCommentsBut {
  223. width: 150upx;
  224. height: 56upx;
  225. border: 1upx solid #FF7800;
  226. border-radius: 28upx;
  227. font-size: 26upx;
  228. line-height: 56upx;
  229. text-align: center;
  230. color: #FF7800;
  231. }
  232. .praise-box {
  233. .praise-icon {
  234. width: 36upx;
  235. height: 36upx;
  236. }
  237. }
  238. }
  239. .addComments-box {
  240. border-top: 1upx solid #EEEEEE;
  241. margin-top: 35upx;
  242. }
  243. }
  244. .butBox {
  245. padding: 0 30rpx;
  246. display: flex;
  247. justify-content: space-between;
  248. .addComments-box {
  249. height: 100upx;
  250. width: 330upx;
  251. background-color: #FFFFFF;
  252. color: #333333;
  253. border: 2rpx solid #333333;
  254. .addComments-cion {
  255. width: 50upx;
  256. height: 50upx;
  257. }
  258. }
  259. .addPraise-box {
  260. height: 100upx;
  261. width: 330upx;
  262. background: #333333;
  263. color: #FFFFFF;
  264. .addPraise-icon {
  265. width: 50upx;
  266. height: 50upx;
  267. }
  268. }
  269. .addPraise-box1 {
  270. height: 100upx;
  271. width: 690upx;
  272. background: #333333;
  273. color: #FFFFFF;
  274. .addPraise-icon {
  275. width: 50upx;
  276. height: 50upx;
  277. }
  278. }
  279. }
  280. }
  281. .linkBox {
  282. position: absolute;
  283. bottom: 20upx;
  284. width: 100%;
  285. }
  286. </style>