<template>
  <div class="main">
    <div class="shopList">
      <div
        class="shopItem"
        v-for="(item, index) in detailObj.List"
        :key="index"
        @click="handleGoEvaluate(item)"
      >
        <div class="leftShopItem">
          <image class="img" :src="item.IMAGE_PATH" />
        </div>
        <div class="rightShopItem">
          <view class="shopName">{{ item.COMMODITY_NAME || "-" }}</view>
          <view class="status">{{
            item.COMMENT_STATE === 0
              ? "待评价"
              : item.COMMENT_STATE === 1
              ? "已评价"
              : ""
          }}</view>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      sellchildid: "",
      orderInternal: "",
      detailObj: {},
    };
  },
  onLoad(option) {
    console.log("option", option);
    if (option.sellchildid) {
      this.sellchildid = option.sellchildid;
    }
    this.orderInternal = option.orderInternal;
  },
  onShow() {
    // 获取订单详情
    this.handleGetOrderInfo();
  },
  methods: {
    handleGetOrderInfo() {
      let _this = this;
      _this.$api
        .getCoop({
          action_type: "GetOrderDetail",
          salebillId: _this.orderInternal,
          saleBillChildId: _this.sellchildid,
        })
        .then((res) => {
          // console.log(res)
          if (res.ResultCode === "100") {
            let _data = res.Data;
            console.log("订单详情", _data);
            _this.detailObj = _data;
          }
        });
    },
    // 跳转去单个的评价
    handleGoEvaluate(obj) {
      uni.navigateTo({
        url: `/pages/evaluateList/addEvaluate?evaluateType=more&id=${obj.COMMODITY_ID}&sellchildid=${this.sellchildid}&orderInternal=${this.orderInternal}`,
      });
    },
  },
};
</script>

<style lang="less" scoped>
.main {
  width: 100vw;
  height: 100vh;
  overflow-y: scroll;
  box-sizing: border-box;
  padding: 24rpx;
  .shopList {
    width: 100%;
    height: 100%;
    .shopItem {
      width: 100%;
      box-sizing: border-box;
      padding: 16rpx;
      background: #fff;
      border-radius: 16rpx;
      margin-bottom: 16rpx;
      display: flex;
      align-items: flex-start;
      .leftShopItem {
        width: 104rpx;
        height: 104rpx;
        border-radius: 16rpx;
        overflow: hidden;
        margin-right: 16rpx;
        .img {
          width: 100%;
          height: 100%;
        }
      }
      .rightShopItem {
        width: calc(100% - 120rpx);
        height: 100%;
        .shopName {
          font-family: PingFangSC, PingFang SC;
          font-weight: 400;
          font-size: 28rpx;
          color: #130f05;
          line-height: 44rpx;
          text-align: left;
          font-style: normal;
          width: 100%;
          text-overflow: ellipsis;
          overflow: hidden;
          white-space: nowrap;
        }
        .status {
          font-size: 28rpx;
          font-family: "PingFang SC";
          line-height: 40rpx;
          color: #1890ff;
        }
      }
    }
  }
}
.main::-webkit-scrollbar {
  display: none;
}
</style>