evaluate.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <view>
  3. <!-- 评价 -->
  4. <view class="eva-section">
  5. <view class="eva-box" v-for="(item, index) in list" :key="index">
  6. <image class="portrait" :src="item.avatar" mode="aspectFill"></image>
  7. <view class="right">
  8. <text class="name">{{item.username || '游客'}}</text>
  9. <text class="con">{{item.comment}}</text>
  10. <view class="bot">
  11. <text class="attr" v-if="item.spec != ''">购买类型:{{item.spec}}</text>
  12. <text class="attr" v-else></text>
  13. <text class="time">{{item.createtime_text}}</text>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. export default{
  22. data(){
  23. return {
  24. product_id: 0,
  25. page:1,
  26. pageSize:20,
  27. list:[]
  28. }
  29. },
  30. onLoad(options){
  31. this.product_id = options.product_id;
  32. this.getEvaluete();
  33. },
  34. onPullDownRefresh() {
  35. this.page = 1;
  36. this.list = [];
  37. this.getEvaluete();
  38. },
  39. onReachBottom() {
  40. this.getEvaluete();
  41. },
  42. methods:{
  43. async getEvaluete(){
  44. let comment = await this.$api.request('/product/evaluate', 'GET', {product_id:this.product_id,page:this.page,pagesize:this.pageSize});
  45. uni.stopPullDownRefresh();
  46. if (comment) {
  47. this.page++;
  48. comment.forEach(item=>{
  49. this.list.push(item);
  50. });
  51. }
  52. }
  53. }
  54. }
  55. </script>
  56. <style lang='scss'>
  57. /* 评价 */
  58. .eva-section {
  59. display: flex;
  60. flex-direction: column;
  61. padding: 20upx 30upx;
  62. background: #fff;
  63. margin-top: 16upx;
  64. }
  65. .eva-box {
  66. display: flex;
  67. padding: 20upx 0;
  68. .portrait {
  69. flex-shrink: 0;
  70. width: 80upx;
  71. height: 80upx;
  72. border-radius: 100px;
  73. }
  74. .right {
  75. flex: 1;
  76. display: flex;
  77. flex-direction: column;
  78. font-size: $font-base;
  79. color: $font-color-base;
  80. padding-left: 26upx;
  81. .con {
  82. font-size: $font-base;
  83. color: $font-color-dark;
  84. padding: 20upx 0;
  85. }
  86. .bot {
  87. display: flex;
  88. justify-content: space-between;
  89. font-size: $font-sm;
  90. color: $font-color-light;
  91. }
  92. }
  93. }
  94. </style>