<template>
  <view class="page" :style="themeColor">
    <view class="flex benben-position-layout flex flex-wrap align-center myEvaluation_flex_0"
      :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
      <view class='flex flex-wrap align-center justify-between flex-sub myEvaluation_fd0_0'>
        <view class='flex flex-wrap align-center' @tap.stop="handleJumpDiy" data-type="back" data-url="1">
          <text class='fu-iconfont2  myEvaluation_fd0_0_c0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">&#xE794;</text>
        </view>
        <view class='flex flex-wrap align-stretch justify-center flex-sub'>
          <text class='myEvaluation_fd0_0_c1_c0'>我的评价</text>
        </view>
        <view class='flex flex-wrap align-center myEvaluation_fd0_0_c2'>
        </view>
      </view>

    </view>
    <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
    <!---flex布局flex布局开始-->
    <fu-loading v-if="isShowLoading"></fu-loading>
    <fu-empty-ui v-if="list.length === 0 && isInit"></fu-empty-ui>
    <view class="flex benben-flex-layout flex-wrap align-center myEvaluation_flex_1" v-for="(item, index) in list" :key="index">
      <view class='flex flex-wrap align-start flex-sub myEvaluation_fd1_0' >
        <view class='flex flex-wrap align-center myEvaluation_fd1_0_c0'>
          <image class='myEvaluation_fd1_0_c0_c0' mode="aspectFill" :src='item.logo'></image>
        </view>
        <view class='flex flex-direction flex-wrap align-stretch flex-sub myEvaluation_fd1_0_c1'>
          <view class='flex flex-wrap align-center justify-between'>
            <text class='myEvaluation_fd1_0_c1_c0_c0'>{{item.store_store_name}}</text>
            <text class='myEvaluation_fd1_0_c1_c0_c1'>{{item.create_time}}</text>
          </view>
          <view class='flex flex-wrap align-center justify-between myEvaluation_fd1_0_c1_c1'>
            <view class='flex flex-wrap align-center'>
              <text class='myEvaluation_fd1_0_c1_c1_c0_c0'>商家：</text>
              <view class='flex flex-wrap align-center'>
                <template v-for="starNum in [1,2,3,4,5]">
                  <image v-if="item.score >= starNum" :key="starNum" class='myEvaluation_star1fd1_0_c1_c1_c0_c1'
                    mode="aspectFit" :src='STATIC_URL+"31.png"'></image>
                  <image v-else :key="starNum" class='myEvaluation_star1fd1_0_c1_c1_c0_c1' mode="aspectFit"
                    :src='STATIC_URL+"164.png"'></image>
                </template>
              </view>
            </view>
            <view class='flex flex-wrap align-center'>
              <view class='flex flex-wrap align-center myEvaluation_fd1_0_c1_c1_c1_c0'>
                <text class='myEvaluation_fd1_0_c1_c1_c1_c0_c0'>态度：</text>
                <text class='myEvaluation_fd1_0_c1_c1_c1_c0_c1'>{{item.service_score}}</text>
                <text class='myEvaluation_fd1_0_c1_c1_c1_c0_c2'>星</text>
              </view>
              <view class='flex flex-wrap align-center myEvaluation_fd1_0_c1_c1_c1_c1'>
                <text class='myEvaluation_fd1_0_c1_c1_c1_c1_c0'>口味：</text>
                <text class='myEvaluation_fd1_0_c1_c1_c1_c1_c1'>{{item.goods_score}}</text>
                <text class='myEvaluation_fd1_0_c1_c1_c1_c1_c2'>星</text>
              </view>
              <!-- <view class='flex flex-wrap align-center myEvaluation_fd1_0_c1_c1_c1_c2'>
                <text class='myEvaluation_fd1_0_c1_c1_c1_c2_c0'>配送：</text>
                <text class='myEvaluation_fd1_0_c1_c1_c1_c2_c1'>5</text>
                <text class='myEvaluation_fd1_0_c1_c1_c1_c2_c2'>星</text>
              </view> -->
            </view>
          </view>
          <view class='flex flex-wrap align-center'>
            <text class='myEvaluation_fd1_0_c1_c2_c0'>{{item.content}}</text>
          </view>
          <view class='flex flex-wrap align-center myEvaluation_fd1_0_c1_c3'>
            <image @tap.stop="ViewImage(item.images,inx)" v-for="(img, inx) in item.images" :key="inx" class='myEvaluation_fd1_0_c1_c3_c0' mode="aspectFill" :src='img'></image>

          </view>
          <view class="flex replay-content" v-if="item.reply_content">
            <view class="replay-desc"> 商家回复: </view>
            <view class="replay-text text-269">{{item.reply_content}}</view>
          </view>
          <view class='flex flex-wrap align-center justify-end myEvaluation_fd1_0_c1_c4'>
            <view class='flex flex-wrap align-center' @tap.stop="delOrder(item)">
              <image class='myEvaluation_fd1_0_c1_c4_c0_c0' mode="aspectFit" :src='STATIC_URL+"35.png"'></image>
              <text class='myEvaluation_fd1_0_c1_c4_c0_c1'>删除</text>
            </view>
          </view>
        </view>
      </view>
    </view>
    <uni-load-more v-if="list.length !=0 " :status="status"></uni-load-more>
    <!---flex布局flex布局结束-->
    <benben-popup v-model="popupShow1684468397365" :mask="true" mode='center'>
      <!---删除评价flex布局开始-->
      <view class="flex flex-direction flex-wrap align-center myEvaluation_flex_2"
        @tap.stop="popupShow1650940432200=true">
        <text class='myEvaluation_fd2_0'>提示</text>
        <text class='myEvaluation_fd2_1'>确定要删除此条评价吗？</text>
        <view class='flex flex-wrap align-center myEvaluation_fd2_2'>
          <button class='myEvaluation_fd2_2_c0' @tap.stop="popupShow1684468397365=false">取消</button>
          <button class='myEvaluation_fd2_2_c1'>确定</button>
        </view>
      </view>

      <!---删除评价flex布局结束-->

    </benben-popup>


  </view>
</template>
<script>
  export default {
    components: {},


    data() {
      return {
        "popupShow1684468397365": false,
        "fd1_0_c1_c1_c0_c1": "4",
        lat: '',
        lng: '',
        list: [],
        isShowLoading: false,
        isInit: false,
        status: 'more', // 表示是否有数据可以请求
        page: 1,
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {

    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {
      this.isShowLoading = false;
      this.status = 'more';
      this.page = 1;
      this.isInit = false;
      this.list = [];
      this.getCommentList(true);
    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {
      this.getCommentList();
    },
    onPageScroll(e) {

    },
    methods: {
			ViewImage(list, index) {
			  uni.previewImage({
			    urls: list,
			    current: index
			  });
			},
      /**
       * @description 删除评价
       */
      delOrder(item) {
        this.$util.showModal({
          title:'提示',
          content: '确认删除此评价?',
          success: res => {
            if (res.confirm) {
              this.$api
                .post(global.apiUrls.post649e2989f16bd, {
                  order_sn: item.order_sn
                })
                .then(res => {
                  let data = res.data;
                  if (data.code == 1) {
                    this.$message.info('删除成功');
                    this.isShowLoading = false;
                    this.status = 'more';
                    this.page = 1;
                    this.isInit = false;
                    this.list = [];
                    this.getCommentList(true);
                  } else {
                    this.$message.info(data.msg);
                  }
                })
                .catch(err => {
                  console.log('err: ' + JSON.stringify(err));
                });
            }
          }
        });
      },
      /**
       * 获取列表
       * @param {Object} value
       */
      getCommentList(value) {
        if (this.status != 'more') return;
        this.status = 'loading';
        let data = {
          list_rows: 20,
          page: this.page
        };
        // console.log('请求的数据', data);
        if (this.page == 1 && value) {
          this.isShowLoading = true;
        }
        this.$api
          .post(global.apiUrls.getCommentList, data)
          .then(res => {
            console.log('订单列表', res);
            this.isShowLoading = false;
            if (res.data.code == 1) {
              var curPageData = res.data.data.data;
              if (this.page == 1) this.list = [];
              this.list = this.list.concat(curPageData);
              console.log('上拉加载', curPageData.length, this.size);
              if (res.data.data.last_page > this.page) {
                this.status = 'more';
                this.page++;
              } else {
                this.status = 'noMore';
              }
            } else {
              this.$message.info(res.data.msg);
            }
            this.isInit = true;
            uni.stopPullDownRefresh();
          })
          .catch(err => {
            this.isShowLoading = false;
            uni.stopPullDownRefresh();
          });
      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: rgba(255, 255, 255, 1);
    background-size: 100% auto !important;
  }

  .replay-content {
    margin-top: 32rpx;
    padding: 24rpx 16rpx;
    border-radius: 10rpx;
    background: #F8F8F8;
    opacity: 1;
    font-size: 28rpx;

    .replay-desc {
      width: 190rpx;
      white-space: nowrap;
      color: #496A9D !important;
    }

    .replay-text {
      width: 100%;
      line-height: 40rpx;
    }
  }

  .myEvaluation_flex_0 {
    border-bottom: 1px solid #eee;
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .myEvaluation_fd0_0_c2 {
    width: 32rpx;
    height: 32rpx;
  }

  .myEvaluation_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 500;
    color: #333;
    line-height: 88rpx;
  }

  .myEvaluation_fd0_0_c0_c0 {
    font-size: 32rpx;
    font-weight: 500;
    color: #333;
    line-height: 88rpx;
  }

  .myEvaluation_fd0_0 {
    margin: 0rpx 32rpx 0rpx 32rpx;
  }

  .myEvaluation_flex_1 {
    padding: 32rpx 24rpx 0rpx 32rpx;
  }

  .myEvaluation_fd1_0_c1_c4_c0_c1 {
    color: #F54848;
    font-size: 24rpx;
    font-weight: 400;
    line-height: 24rpx;
  }

  .myEvaluation_fd1_0_c1_c4_c0_c0 {
    width: 24rpx;
    height: 28rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 16rpx 0rpx 0rpx;
  }

  .myEvaluation_fd1_0_c1_c4 {
    margin: 32rpx 0rpx 0rpx 0rpx;
  }

  .myEvaluation_fd1_0_c1_c3_c0 {
    width: 196rpx;
    height: 196rpx;
    border-radius: 8rpx;
    margin: 5rpx 5rpx 0rpx 0rpx;
  }

  .myEvaluation_fd1_0_c1_c3 {
    margin: 11rpx 0rpx 0rpx 0rpx;
  }

  .myEvaluation_fd1_0_c1_c2_c0 {
    color: #333333;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 35rpx;
    margin: 24rpx 0rpx 0rpx 0rpx;
  }

  .myEvaluation_fd1_0_c1_c1_c1_c2_c2 {
    color: #333333;
    font-size: 24rpx;
    font-weight: 400;
    line-height: 24rpx;
  }

  .myEvaluation_fd1_0_c1_c1_c1_c2_c1 {
    color: #333333;
    font-size: 24rpx;
    font-weight: 400;
    line-height: 24rpx;
  }

  .myEvaluation_fd1_0_c1_c1_c1_c2_c0 {
    color: rgba(153, 153, 153, 1);
    font-size: 24rpx;
    font-weight: 400;
    line-height: 24rpx;
  }

  .myEvaluation_fd1_0_c1_c1_c1_c2 {
    margin: 0rpx 8rpx 0rpx 0rpx;
  }

  .myEvaluation_fd1_0_c1_c1_c1_c1_c2 {
    color: #333333;
    font-size: 24rpx;
    font-weight: 400;
    line-height: 24rpx;
  }

  .myEvaluation_fd1_0_c1_c1_c1_c1_c1 {
    color: #333333;
    font-size: 24rpx;
    font-weight: 400;
    line-height: 24rpx;
  }

  .myEvaluation_fd1_0_c1_c1_c1_c1_c0 {
    color: rgba(153, 153, 153, 1);
    font-size: 24rpx;
    font-weight: 400;
    line-height: 24rpx;
  }

  .myEvaluation_fd1_0_c1_c1_c1_c1 {
    margin: 0rpx 8rpx 0rpx 0rpx;
  }

  .myEvaluation_fd1_0_c1_c1_c1_c0_c2 {
    color: #333333;
    font-size: 24rpx;
    font-weight: 400;
    line-height: 24rpx;
  }

  .myEvaluation_fd1_0_c1_c1_c1_c0_c1 {
    color: #333333;
    font-size: 24rpx;
    font-weight: 400;
    line-height: 24rpx;
  }

  .myEvaluation_fd1_0_c1_c1_c1_c0_c0 {
    color: rgba(153, 153, 153, 1);
    font-size: 24rpx;
    font-weight: 400;
    line-height: 24rpx;
  }

  .myEvaluation_fd1_0_c1_c1_c1_c0 {
    margin: 0rpx 8rpx 0rpx 0rpx;
  }

  .myEvaluation_star1fd1_0_c1_c1_c0_c1 {
    height: 16rpx;
    margin: 0rpx 5rpx 0rpx 5rpx;
    width: 16rpx;
  }

  .myEvaluation_star1fd1_0_c1_c1_c0_c1 {
    width: 16rpx;
    height: 16rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 5rpx 0rpx 5rpx;
  }

  .myEvaluation_fd1_0_c1_c1_c0_c0 {
    color: #333333;
    font-size: 24rpx;
    font-weight: 400;
    line-height: 24rpx;
  }

  .myEvaluation_fd1_0_c1_c1 {
    margin: 16rpx 0rpx 0rpx 0rpx;
  }

  .myEvaluation_fd1_0_c1_c0_c1 {
    color: #999999;
    font-size: 24rpx;
    font-weight: 400;
    line-height: 24rpx;
  }

  .myEvaluation_fd1_0_c1_c0_c0 {
    color: #333333;
    font-size: 32rpx;
    font-weight: 500;
    line-height: 32rpx;
  }

  .myEvaluation_fd1_0_c1 {
    padding: 13rpx 0rpx 0rpx 0rpx;
  }

  .myEvaluation_fd1_0_c0_c0 {
    width: 72rpx;
    height: 72rpx;
    border-radius: 36rpx;
  }

  .myEvaluation_fd1_0_c0 {
    margin: 0rpx 16rpx 0rpx 0rpx;
  }

  .myEvaluation_fd1_0 {
    border-bottom: 1px solid #eee;
    margin: 0rpx 0rpx 32rpx 0rpx;
    padding: 0rpx 0rpx 32rpx 0rpx;
  }

  .myEvaluation_flex_2 {
    background: #fff;
    width: 540rpx;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
  }

  .myEvaluation_fd2_2_c1 {
    border-top: 1px solid #eee;
    border-left: 1px solid #eee;
    background: #fff;
    line-height: 110rpx;
    border-radius: 0rpx 0rpx 16rpx 0rpx;
    font-size: 32rpx;
    color: rgba(245, 72, 72, 1);
    width: 270rpx;
  }

  .myEvaluation_fd2_2_c0 {
    border-top: 1px solid #eee;
    background: #fff;
    line-height: 110rpx;
    border-radius: 0rpx 0rpx 0rpx 16rpx;
    font-size: 32rpx;
    color: rgba(153, 153, 153, 1);
    padding: 0rpx 103rpx 0rpx 103rpx;
  }

  .myEvaluation_fd2_2 {
    margin: 37rpx 0rpx 0rpx 0rpx;
  }

  .myEvaluation_fd2_1 {
    line-height: 44rpx;
    font-size: 32rpx;
    font-weight: 500;
    color: #333333;
  }

  .myEvaluation_fd2_0 {
    font-size: 36rpx;
    font-weight: 800;
    line-height: 44rpx;
    color: #333333;
    margin: 40rpx 0rpx 40rpx 0rpx;
  }
</style>
