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

289 lines
8.2 KiB

2 years ago
  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 class="user-headSmallImg" v-if="commentVOList.headImage" :src="commentVOList.headImage"></image>
  9. <image class="user-headSmallImg" src="https://ceres.zkthink.com/static/images/storeLogo.png" v-else ></image>
  10. <label class="fs28 mar-left-20" v-if="commentVOList.name">{{commentVOList.name}}</label>
  11. <label class="fs28 mar-left-20" v-else>匿名</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 class="evaluateImg-box" v-if="commentVOList.image">
  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 class="addComments-box flex-column-plus" v-if="commentVOList.addComment">
  25. <label class="font-color-C5AA7B mar-top-30">用户追评</label>
  26. <label class="mar-top-20">{{commentVOList.addComment}}</label>
  27. <view class="evaluateImg-box mar-top-20" v-if="commentVOList.addImage">
  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 class="butBox flex-row-plus" v-if="commentVOList.addComment != ''">
  48. <view class="addPraise-box1 flex-items-plus" @click="zanTap">
  49. <image class="addPraise-icon" src="https://ceres.zkthink.com/static/images/addPraiseIcon.png" v-if="!commentVOList.ifLike"/>
  50. <image class="addPraise-icon" src="https://zk-cereshop.oss-cn-shenzhen.aliyuncs.com/zkthink/2022-03-10/415f93719fa64af58b8d7cafb734ec4a_22.png" v-else/>
  51. <label :class="['mar-left-10',commentVOList.ifLike?'font-color-FFEBC4':'font-color-DDD']">点赞</label>
  52. </view>
  53. </view>
  54. <view class="butBox flex-row-plus" v-else>
  55. <view class="addComments-box flex-items-plus" @click="addCommentsClick()">
  56. <image class="addComments-cion" src="https://ceres.zkthink.com/static/images/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 class="addPraise-icon" src="https://ceres.zkthink.com/static/images/addPraiseIcon.png" v-if="!commentVOList.ifLike"/>
  61. <image class="addPraise-icon" src="https://zk-cereshop.oss-cn-shenzhen.aliyuncs.com/zkthink/2022-03-10/415f93719fa64af58b8d7cafb734ec4a_22.png" v-else/>
  62. <label :class="['mar-left-10',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. let shopId = this.commentVOList.shopId
  96. let productId = this.commentVOList.productId
  97. let 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. }).catch(res => {
  136. uni.hideLoading()
  137. }).finally(()=>{uni.hideLoading()})
  138. },
  139. //追加评论
  140. addCommentsClick(){
  141. uni.setStorageSync('addCommentVOList', this.commentVOList);
  142. uni.navigateTo({
  143. url:'addEvaluate?type=2'
  144. })
  145. },
  146. // 查看图片
  147. // previewImg(img) {
  148. // console.log(img, 'img')
  149. // let imgsArray = [];
  150. // imgsArray[0] = img
  151. // uni.previewImage({
  152. // current: 0,
  153. // urls: imgsArray
  154. // });
  155. // },
  156. // 预览图片多张
  157. previewImg(type, index) {
  158. let imgsArray = [];
  159. if (type === 1) {
  160. for (let i = 0; i < this.imageList.length - 1; i++) {
  161. imgsArray.push(this.imageList[i]);
  162. }
  163. } else {
  164. for (let i = 0; i < this.imgDataResult.length - 1; i++) {
  165. imgsArray.push(this.imgDataResult[i]);
  166. }
  167. }
  168. uni.previewImage({
  169. current: index,
  170. urls: imgsArray,
  171. });
  172. },
  173. }
  174. }
  175. </script>
  176. <style lang="scss">
  177. .container{
  178. padding-bottom: 30upx;
  179. .evaluate-contentbox{
  180. display: flex;
  181. justify-content: center;
  182. flex-direction: column;
  183. padding: 30upx 30upx;
  184. background-color: #FFFFFF;
  185. .evaluate-content{
  186. width: 670upx;
  187. display: flex;
  188. justify-content: space-between;
  189. .user-headSmallImg{
  190. width: 46upx;
  191. height: 46upx;
  192. border-radius: 50%;
  193. }
  194. }
  195. .evaluateImg-box{
  196. display: flex;
  197. flex-direction: row;
  198. flex-wrap: wrap;
  199. margin-left: -9upx;
  200. .evaluate-Img{
  201. width: 224upx;
  202. height: 224upx;
  203. border-radius: 10upx;
  204. margin-left: 9upx;
  205. margin-top: 9upx;
  206. }
  207. }
  208. .goodsDes-box{
  209. background-color: #F7F7F7;
  210. padding: 20upx 44upx 20upx 20upx;
  211. .goodsDes-img{
  212. width: 180upx;
  213. height: 180upx;
  214. border-radius: 10upx;
  215. }
  216. .goodsDesText-box{
  217. width: 416upx;
  218. margin-left: 30upx;
  219. }
  220. .addCommentsBut{
  221. width: 150upx;
  222. height: 56upx;
  223. border: 1upx solid #FF7800;
  224. border-radius: 28upx;
  225. font-size: 26upx;
  226. line-height: 56upx;
  227. text-align: center;
  228. color: #FF7800;
  229. }
  230. .praise-box{
  231. .praise-icon{
  232. width: 36upx;
  233. height: 36upx;
  234. }
  235. }
  236. }
  237. .addComments-box{
  238. border-top: 1upx solid #EEEEEE;
  239. margin-top: 35upx;
  240. }
  241. }
  242. .butBox{
  243. padding: 0 30rpx;
  244. display: flex;
  245. justify-content: space-between;
  246. .addComments-box{
  247. height: 100upx;
  248. width: 330upx;
  249. background-color: #FFFFFF;
  250. color: #333333;
  251. border: 2rpx solid #333333;
  252. .addComments-cion{
  253. width: 50upx;
  254. height: 50upx;
  255. }
  256. }
  257. .addPraise-box{
  258. height: 100upx;
  259. width: 330upx;
  260. background: #333333;
  261. color: #FFFFFF;
  262. .addPraise-icon{
  263. width: 50upx;
  264. height: 50upx;
  265. }
  266. }
  267. .addPraise-box1{
  268. height: 100upx;
  269. width: 690upx;
  270. background: #333333;
  271. color: #FFFFFF;
  272. .addPraise-icon{
  273. width: 50upx;
  274. height: 50upx;
  275. }
  276. }
  277. }
  278. }
  279. .linkBox{
  280. position: absolute;
  281. bottom: 20upx;
  282. width: 100%;
  283. }
  284. </style>