viewcomment.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view class="page-wrap">
  3. <u-navbar
  4. title="商品评价"
  5. :autoBack="true"
  6. :safeAreaInsetTop="true"
  7. >
  8. </u-navbar>
  9. <view class="content">
  10. <view class="product u-flex">
  11. <u--image :showLoading="true" :src="goodsDetails.mainImg" width="180rpx" height="180rpx"></u--image>
  12. <view class="text">
  13. <view class="up">
  14. <view class="name ellipsis-2">{{goodsDetails.goodsName}}</view>
  15. <view class="info u-flex u-row-between">
  16. <view class="">
  17. <text v-if="goodsDetails.specification">{{goodsDetails.specification}}</text>
  18. <text v-if="goodsDetails.unit">{{goodsDetails.unit}}</text>
  19. </view>
  20. <view class="">共{{goodsDetails.quantity}}件</view>
  21. </view>
  22. </view>
  23. <!-- <view class="down u-flex u-row-between">
  24. <view class="left">
  25. <text class="price">¥ <text class="price-num">{{goodsDetails.price}}</text></text>
  26. </view>
  27. </view> -->
  28. </view>
  29. </view>
  30. <view class="comment">
  31. <view class="item u-flex u-row-between">
  32. <view class="left">商品评价</view>
  33. <view class="right">
  34. <u-rate count="5" v-model="commentDetails.star" :readonly="true" active-color="#FFBE00" r size="20"></u-rate>
  35. </view>
  36. </view>
  37. <view class="item u-flex u-row-between">
  38. <view class="left">文字补充</view>
  39. <view class="right">{{commentDetails.contentText||'暂无补充'}}</view>
  40. </view>
  41. <view class="item u-flex u-col-top" :class="{'u-row-between':commentDetails.contentImgs.length<1}">
  42. <view class="left">图片补充</view>
  43. <view class="right" style="margin-left: 40rpx;">
  44. <text v-if="commentDetails.contentImgs.length<1">暂无补充</text>
  45. <view v-else class="">
  46. <u-album :urls="commentDetails.contentImgs"></u-album>
  47. <!-- <u--image
  48. v-for="(img,index) in commentDetails.contentImgs" :key="index"
  49. :showLoading="true"
  50. :src="img"
  51. width="180rpx"
  52. height="180rpx">
  53. </u--image> -->
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. export default {
  63. data() {
  64. return {
  65. goodsId:'',
  66. orderDetailId:'',
  67. goodsDetails:{},
  68. commentDetails:{contentImgs:[]},
  69. goodsDetails:{},
  70. }
  71. },
  72. onShow() {
  73. },
  74. onLoad(page) {
  75. this.goodsId = page.goodsId;
  76. this.orderDetailId = page.orderDetailId;
  77. this.goodsDetails = JSON.parse(page.goods);
  78. console.log('this.goodsDetails',this.goodsDetails);
  79. // this.getGoodsDetails(this.goodsId);
  80. this.getCommentDetails(this.orderDetailId);
  81. },
  82. methods: {
  83. getGoodsDetails(id){
  84. this.$u.api.memberGoodDetails({id:id}).then(res=>{
  85. this.goodsDetails = res.data
  86. console.log('memberGoodDetails',JSON.parse(JSON.stringify(res.data)));
  87. }).catch(err=>{
  88. console.log('getGoodsDetails',err);
  89. })
  90. },
  91. getCommentDetails(id){
  92. this.$u.api.getOrderDetailComment({orderDetailId:id}).then(res=>{
  93. this.commentDetails = res.data;
  94. this.commentDetails.contentImgs = this.commentDetails.contentImgs.split(",");
  95. console.log('getCommentDetails',JSON.parse(JSON.stringify(res.data)));
  96. }).catch(err=>{
  97. console.log('getCommentDetails',err);
  98. })
  99. },
  100. }
  101. }
  102. </script>
  103. <style>
  104. page{
  105. background-color: #F5F5F5;
  106. }
  107. </style>
  108. <style lang="scss" scoped>
  109. .content{
  110. background-color: #fff;
  111. border-radius: 8rpx;
  112. padding: 20rpx;
  113. }
  114. .product{
  115. .info{
  116. font-size: 24rpx;
  117. font-weight: 400;
  118. color: #666666;
  119. line-height: 33rpx;
  120. }
  121. }
  122. .comment{
  123. .item{
  124. margin-bottom: 30rpx;
  125. .left{
  126. font-size: 30rpx;
  127. font-weight: 600;
  128. color: #333333;
  129. line-height: 38rpx;
  130. }
  131. .right{
  132. color: #666;
  133. }
  134. }
  135. }
  136. </style>