<template>
  <view class="content">
  <view class="actives">
      <view
        class="notice-content-box"
        v-for="(item, index) in heatList"
        :key="index"
        style="justify-content: start; padding: 30rpx 0 30rpx 30rpx;border-radius: 0;"
        @click="goPayDeatil(item.code)" >
        <image
          src="/static/order-poster.svg"
          style="
            width: 112rpx;
            height: 112rpx;
            margin-right: 20rpx;
            border-radius: 10%;
          "
        ></image>
        <view class="notice-content" style="width: 75%">
          <view class="notice-content-font">{{
            item.name
          }}</view>
          <view class="display-flex-start" style="margin-top: 20rpx">
            <view class="notice-content-time color-a7adba">
				{{item.estate_name  + item.building_name + item.unit + item.room}}
			</view>
			<view class="notice-content-time display-flex-start">
				<text class="color-a7adba">￥：</text>
				<text class="order-money">{{item.total_fee}}</text>
			</view>
          </view>
          <view class="display-between" style="margin-top: 20rpx">
			<view class="notice-content-time color-a7adba" style="visibility: hidden;">
				{{item.time}}
			</view>  
			<view class="display-flex-start">
				<view class="notice-content-time" :style="{color:statusColor[item.status]}">{{statusObj[item.status]}}</view>
			</view>
          </view>
        </view>
      </view>
     <image src="../../static/nodata.svg" mode="aspectFit" style="width: 100%;" v-if="activityList.length === 0"></image>
	 <view class="noLogin-box" v-if="owner_id == 0">
	 		 <view>{{!isAuth ? '未登录': '未关联'}}</view>
	 		 <view>{{!isAuth ? '请先完成授权登录': '请先完成关联住房'}}</view>
	 		 <view class="withHouseBtn" @click="goHouse" v-show="isAuth">关联住房</view>
	 		 <view class="withHouseBtn" @click="goAuth" v-show="!isAuth">授权登录</view>
	 </view>
  </view>
  </view>
</template>

<script>
import md5 from "@/common/md5.js";
export default {
  data() {
    return {
      message: "缴费订单",
      themeColor: "#007AFF",
      heatList: [],
	  statusObj:getApp().globalData.statusObj,
	  statusColor:getApp().globalData.statusColor,
	  isAuth: true,
	  owner_id : 0,
	  
    };
  },
  onLoad() {
    this.getHeatList();
	this.isAuth = getApp().globalData.isAuth;
  },
  methods: {
    goPayDeatil(id) {
      uni.navigateTo({
        url: "/pages/heatingPage/pay?id=" + id,
      });
    },
    getHeatList() {
      
	  let url = getApp().makeApiUrl("user",'user','get_order_list');
      let postData = {
        // page: 1,
        // page_size: 2,
		openId:getApp().globalData.open_id
      };
      uni.request({
        url: url,
        method: "POST",
        header: {
          "content-type": "application/x-www-form-urlencoded",
        },
        data: postData,
        success: (res) => {
          console.log(res);
          if (res.data.code === 200) {
            this.heatList = res.data.data.list;
			this.owner_id = res.data.data.owner_id;
          }
        },
        fail: () => {
          console.log("连接失败");
        },
      });
    },
    goHouse(){
    	uni.navigateTo({
    	  url: "/pages/selfCenter/with_house",
    	}); 
    },
    goAuth() {
      uni.navigateTo({
        url: "/pages/auth/index",
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  .choose-box {
    padding: 20rpx 0;
    width: 100%;
    display: flex;
    // position: fixed;
    height: 50rpx;
    top: 0;
    // margin-bottom: 50rpx;
    .type,
    .state {
      width: 50%;
      display: flex;
      justify-content: center;
      position: relative;
      .packer {
        width: 100%;
        .picker_title {
          z-index: 99;
          width: 100%;
          height: 100%;
          display: flex;
          justify-content: center;
        }
      }
    }

    .type::after,
    .state::after {
      z-index: -1;
      content: "";
      position: absolute;
      right: 30%;
      top: 20%;
      width: 0;
      height: 0;
      border-top: 15rpx solid rgb(173, 173, 173);
      border-left: 15rpx solid transparent;
      border-right: 15rpx solid transparent;
    }
  }
  .actives {
    width: 90%;
    // margin-top: 50rpx;
    display: flex;
    flex-direction: column;
    align-items: center;
    .actives-item {
      width: 100%;
      // height: 150rpx;
      box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
      border-radius: 32rpx;
      // margin-top: 20px;
      padding: 20rpx;
      display: flex;
      flex-direction: column;
	  margin-top: 20rpx;
	  margin-bottom: 10rpx;

      .readShare {
        display: flex;
        justify-content: flex-end;
        font-size: 26rpx;
        color: rgba(0, 0, 0, 0.3);
        margin-top: 20rpx;
        align-items: center;
        .active-tips-box {
          font-size: 28rpx;
          padding: 10rpx;
          border-radius: 10rpx;
          color: #fff;
          margin-right: 50rpx;
        }
        .wait-color {
          background-color: #aee359;
        }
        .ing-color {
          background-color: #00a8ea;
        }
        .end-color {
          background-color: #d7d7d7;
        }
        .read {
			width: 20%;
			text-align: center;
          // margin-right: 60rpx;
        }
		.share {
			width: 20%;
			text-align: center;
		}
      }
    }
  }
}
.active {
  color: $uni-color-primary;
}
.color {
  background-color: #589cff !important;
}
.notice-content-box {
  display: flex;
  padding: 30rpx 20rpx 30rpx 20rpx;
  background-color: #ffffff;
  box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  border-radius: 32rpx;
  margin-top: 20rpx;
  justify-content: space-between;
  width: 96%;
  .notice-content-font {
	font-size: 32rpx;
	color: #0d1937;
	/* font-weight: 600; */
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
  }
  .notice-content-time {
	font-size: 26rpx;
	letter-spacing: 0.02em;
	color: #333333;
  }
  .order-money {
  	color: #d9001b;
  	font-size: 36rpx;
  	font-weight: 500;
  }
}

.noLogin-box {
	width: 100%;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	align-items: center;
	margin-top: 160rpx;
	color: #a7adba;
}

.withHouseBtn {
	color: #589cff;
	cursor: pointer;
	margin-top: 40rpx;
}
</style>
