viewcomment.vue 3.6 KB

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