EvaluateList.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <seller-base :show="false"><view style="position: absolute;top:0;right:0;left:0;bottom:0" class="scroll-view-wrapper div container">
  3. <view class="div common-header-wrap">
  4. <view class="status-holder"></view>
  5. <view :style="'height:'+navHeight+'px'"></view>
  6. <view class="common-header-holder"></view>
  7. <view class="common-header-fixed">
  8. <title-header />
  9. <uni-nav-bar title="评价管理" class="common-header" left-icon="back" @clickLeft="goBack()">
  10. </uni-nav-bar>
  11. </view>
  12. </view>
  13. <view class="scroll-view div" style="position:relative">
  14. <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" class="div" @scrolltolower="loadMore" scroll-y="true">
  15. <view class="div" v-if="evaluate_list.length > 0">
  16. <view class="div mb-5 evaluate-item" v-for="(item, index) in evaluate_list" :key="index">
  17. <view class="div evaluate-info">
  18. <view class="div p-img">
  19. <image mode="aspectFit" class="img" :src="item.geval_goodsimage_url"/>
  20. </view>
  21. <view class="div p-info">
  22. <uni-rate :size="18" :readonly="true" :value="item.geval_scores"/>
  23. <view class="div name">{{item.geval_content}}</view>
  24. <view class="div explain">{{item.geval_explain}}</view>
  25. </view>
  26. </view>
  27. <view class="div evaluate-btn">
  28. <view class="div buyer-info">{{item.geval_frommembername}} 发表于 {{ $moment.unix(item.geval_addtime).format('YYYY年MM月DD日') }}</view>
  29. <view class="div btn-wrapper"><view class="div common-btn ds-button-small btn" v-if="!item.geval_explain" @click="goExplain(item.geval_id)">解释</view></view>
  30. </view>
  31. </view>
  32. </view>
  33. <empty-record v-else></empty-record>
  34. </scroll-view>
  35. </view>
  36. </view>
  37. <uni-popup background-color="#fff" ref="confirm" type="dialog">
  38. <uni-popup-dialog :mode="dialog.mode" :title="dialog.title" :content="dialog.content" :placeholder="dialog.content" @confirm="confirmDialog" @close="closeDialog"></uni-popup-dialog>
  39. </uni-popup>
  40. </seller-base>
  41. </template>
  42. <script>
  43. import {getFontSize} from '@/util/common'
  44. import TitleHeader from '../../TitleHeader'
  45. import SellerBase from '../SellerBase'
  46. import EmptyRecord from '../../EmptyRecord'
  47. import { getEvaluateList, addExplain } from '../../../api/sellerEvaluate'
  48. export default {
  49. name: 'Goodsonline',
  50. computed:{
  51. fontSize(){
  52. return getFontSize()
  53. },
  54. },
  55. data(){
  56. return {
  57. navHeight: 0,
  58. dialog:{},
  59. params: { 'page': 0, 'per_page': 10 },
  60. loading: false, // 是否加载更多
  61. isMore: true, // 是否有更多
  62. pageTotal: 1, // 总页数
  63. evaluate_list: [], // 商品列表
  64. keyword: '',
  65. goods_type: '',
  66. search_type: ''
  67. }
  68. },
  69. components:{
  70. TitleHeader,
  71. SellerBase,
  72. EmptyRecord
  73. },
  74. created () {
  75. this.loadMore()
  76. },
  77. mounted(){
  78. // #ifdef MP-WEIXIN
  79. this.navHeight = uni.getMenuButtonBoundingClientRect().height
  80. // #endif
  81. },
  82. methods:{
  83. closeDialog(){
  84. },
  85. confirmDialog(value){
  86. addExplain(this.dialog.data, value).then(res => {
  87. uni.showToast({icon:'none',title: res.message})
  88. this.reload()
  89. }).catch(function (error) {
  90. uni.showToast({icon:'none',title: error.message})
  91. })
  92. },
  93. goBack(){uni.navigateBack({delta:1})},
  94. setOrderNavActive (index) {
  95. this.goods_type = index
  96. this.reload()
  97. },
  98. getGoodsList (ispush) {
  99. uni.showLoading({ title: '加载中' })
  100. let params = this.params
  101. getEvaluateList(params).then(res => {
  102. uni.hideLoading()
  103. if (ispush) {
  104. this.evaluate_list = this.evaluate_list.concat(res.result.goodsevallist)
  105. } else {
  106. this.evaluate_list = res.result.goodsevallist
  107. }
  108. this.pageTotal = res.result.page_total
  109. if (res.result.hasmore) {
  110. this.isMore = true
  111. } else {
  112. this.isMore = false
  113. }
  114. }).catch(error=>{
  115. uni.hideLoading()
  116. uni.showToast({icon:'none',title: error.message})
  117. })
  118. },
  119. loadMore () {
  120. this.loading = true
  121. this.params.page = ++this.params.page
  122. if (this.isMore && this.params.page <= this.pageTotal) {
  123. this.loading = false
  124. this.getGoodsList(true)
  125. }
  126. },
  127. goExplain (geval_id) {
  128. this.dialog={mode:'input',content:'请输入解释',data:geval_id}
  129. this.$refs.confirm.open()
  130. },
  131. reload () {
  132. // 重新加载数据
  133. this.params.page = 0
  134. this.isMore = true
  135. this.evaluate_list = []
  136. this.loadMore()
  137. }
  138. }
  139. }
  140. </script>
  141. <style scoped lang="scss">
  142. .scroll-view-wrapper{display: flex;flex-direction: column;}
  143. .scroll-view{flex:1}
  144. .evaluate-item{background:#fff;}
  145. .evaluate-info{padding:.5rem;display: flex}
  146. .evaluate-info .p-img{width:4rem;}
  147. .evaluate-info .p-img .img{width:4rem;height:4rem;border-radius:.4rem}
  148. .evaluate-info .p-info{flex:1;margin-left:1rem;}
  149. .evaluate-info .p-info .name{font-size:$subFontSize;}
  150. .evaluate-info .p-info .explain{font-size:$subFontSize;color:$primaryColor;margin-top:.5rem}
  151. .evaluate-btn{padding:.5rem;border-top:1px solid #e4e4e4;display: flex}
  152. .evaluate-btn .btn-wrapper{width:3rem;}
  153. .evaluate-btn .btn{float: right}
  154. .evaluate-btn .buyer-info{flex:1;font-size:$subFontSize;line-height:1.65rem}
  155. </style>