<template>
  <view class="main">
    <image
        src="@/static/image/paySuccess.png"
        mode="scaleToFill"
        style="width:218rpx;height:54rpx;margin-top:150rpx"
    />
    <view class="info">
      <view>
        <image :src="info.artworkImg" mode="scaleToFill" style="width:191rpx;height:146rpx"/>
      </view>
      <view class="info-right">
        <view class="info-right-item">
          <view class="title">画作编号</view>
          <view class="content">{{ info.artworkNum }}</view>
        </view>
        <view class="info-right-item">
          <view class="title">画作名称</view>
          <view class="content">{{ info.artworkName }}</view>
        </view>
        <view class="info-right-item">
          <view class="title">画家名称</view>
          <view class="content">{{ info.artistName }}</view>
        </view>
        <view class="info-right-item">
          <view class="title">画作平尺数</view>
          <view class="content">{{ info.artworkSquareSize }}</view>
        </view>
      </view>
    </view>
    <view class="order-info">
      <view class="info-right-item">
        <view class="title">订单编号</view>
        <view class="content">{{ info.artworkNum }}</view>
      </view>
      <view class="info-right-item">
        <view class="title">寄存地址</view>
        <view class="content">{{ info.warehouseName }}</view>
      </view>
      <view class="info-right-item">
        <view class="title">寄存时限</view>
        <view class="content">{{ info.cycleName }}</view>
      </view>
      <view class="info-right-item">
        <view class="title">付款金额</view>
        <view class="content">{{ info.money }}</view>
      </view>
    </view>
    <view class="tips">*请携带您的画作在时限之前到达寄存地</view>
    <view class="btns">
      <view @click="goHome" style="width: 280rpx;height:64rpx;border-radius: 40rpx;">
        <u-button text="返回首页" shape="circle" color="#626262"></u-button>
      </view>
      <view @click="goDetails" style="width: 280rpx;height:64rpx;border-radius: 40rpx">
        <u-button text="查看订单详情" shape="circle" color="#699A70"></u-button>
      </view>
    </view>
  </view>
</template>

<script>
import {postDataByParams} from "../../http/service";

export default {
  name: 'paySuccess',
  data() {
    return {
      info: {}
    }
  },
  mounted() {
    this.getData()
  },
  methods: {
    goDetails(){
      uni.navigateTo({
        url: `/pages/order-goods/order-details?ID=${this.$mp.query.ID}`,
      });
    },
    goHome(){
      uni.switchTab({
        url: "/pages/home/index",
      });
    },
    async getData() {
      const data1 = {
        ID: Number(this.$mp.query.ID)
      }
      const res1 = await postDataByParams('/api/warehouse/detail', data1)
      if (res1.code === 200) {
        this.info = res1.data
      }
    }
  }
};
</script>

<style lang="scss" scoped>
.main {
  background: url("https://cdns.fontree.cn/fonchain-main/prod/image/407e7c22-eb62-411e-957b-b6c296fde530/artwork/a8a522e0-ca12-4e1f-8c67-996cb5287f47.png");
  height: 100vh;
  box-sizing: border-box;
  display: flex;
  justify-content: start;
  align-items: center;
  padding: 32rpx;
  flex-direction: column;

  .info-right-item {
    color: #626262;
    display: flex;
    align-items: center;

    .title {
      padding-right: 56rpx;
      border-right: 1rpx solid #e4eaf1;
    }

    .content {
      padding-left: 34rpx;
    }
  }

  .info {
    box-sizing: border-box;
    display: flex;
    width: 100%;
    height: 292rpx;
    border-radius: 20rpx;
    background: #fff;
    margin-top: 182rpx;
    padding: 20rpx;

    .info-right {
      width: 100%;
      margin-left: 34rpx;
      display: flex;
      flex-direction: column;
      color: #626262;
      justify-content: space-between;
    }
  }

  .order-info {
    box-sizing: border-box;
    margin-top: 20rpx;
    width: 100%;
    height: 292rpx;
    border-radius: 20rpx;
    padding: 22rpx 40rpx;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .tips {
    color: #76c458;
    margin-top: 170rpx;
  }

  .btns {
    margin-top: 40rpx;
    width: 100%;
    display: flex;
    justify-content: space-between;
  }
}
</style>