| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- <template>
- <view>
- <!-- <view class="top-fixed">
- <u-tabs
- :scrollable="false"
- :list="tabs"
- :current="current"
- lineColor="#2583EB"
- @change="tabChange">
- </u-tabs>
- </view> -->
- <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
- <view class="evaluate">
- <evaluateItem :showLine="0" v-for="(item,index) in dataList" :key="index" :item="item"></evaluateItem>
- </view>
- </mescroll-body>
- </view>
- </template>
- <script>
- import evaluateItem from "@/components/evaluateItem";
- import {selectCommentByUser} from '@/api/myStoreOrder.js'
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- export default {
- mixins: [MescrollMixin],
- components: {
- evaluateItem
- },
- data() {
- return {
- tabs:[
- {
- id:0,
- name:'待评价'
- },
- {
- id:1,
- name:'已评价'
- }
- ],
- current: 0,
- mescroll: null,
- downOption: { //下拉刷新
- use:true,
- auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
- },
- upOption: {
- onScroll:true,
- use: true, // 是否启用上拉加载; 默认true
- page: {
- num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
- size: 10 // 每页数据的数量,默认10
- },
- noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
- empty: {
- icon:'https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/empty_icon.png',
- tip: '暂无数据',
-
- },
- textNoMore:"已经到底了",
- },
- // 列表数据
- dataList: [],
- orderId: '',
- productIds: '',
- storeId: '',
- }
- },
- onLoad(option) {
- this.orderId = option.orderId || ''
- this.productIds = option.productIds || ''
- this.storeId = option.storeId || ''
- },
- methods: {
- tabChange(item){
- this.current=item.index
- this.mescroll.resetUpScroll()
- },
- preview(img, current) {
- const urls = img.split(',')
- uni.previewImage({
- urls,
- current
- });
- },
- mescrollInit(mescroll) {
- this.mescroll = mescroll;
- },
- upCallback(page) {
- //联网加载数据
- var that = this;
- var data = {
- page: page.num,
- pageSize: page.size,
- storeId:this.storeId,
- orderId:this.orderId,
- productIds:this.productIds,
- userId: uni.getStorageSync('userId'),
- showSelf: this.orderId ? 1 : 0
- };
- selectCommentByUser(data).then(res => {
- if(res.code==200){
- //设置列表数据
- if (page.num == 1) {
- that.dataList = res.data.list;
-
- } else {
- that.dataList = that.dataList.concat(res.data.list);
-
- }
- that.mescroll.endBySize(res.data.list.length, res.data.total);
-
- }else{
- uni.showToast({
- icon:'none',
- title: "请求失败",
- });
- that.dataList = null;
- that.mescroll.endErr();
- }
- });
- },
- }
- }
- </script>
- <style scoped lang="scss">
- .top-fixed{
- width: 100%;
- position: fixed;
- top: 0;
- left: 0;
- z-index: 10;
- height: 88upx;
- background-color: #fff;
- }
- .evaluate {
- padding: 24rpx;
- ::v-deep {
- .comment-item {
- padding: 24rpx;
- border-radius: 16rpx;
- }
- }
- }
- </style>
|