<template>
  <div>
    <template v-if="screenWidth > 960">
      <div class="inn-uCenter">
        <div class="uCenter-left">
          <ul>
            <li class>
              <a href="/wo/work_todo">
                我的工作
                <i class="badge">2</i>
              </a>
            </li>
            <li>
              <a href="/group">协作群组</a>
            </li>
            <li class="on">
              <a href="/wo/bills">资金账户</a>
            </li>
            <li class>
              <a href="/setting">信息设置</a>
            </li>
            <li class>
              <a href="/wo/services">更多服务</a>
            </li>
            <li>
              <a
                href="https://test-git.gitinn.com/proginn/login?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiIxMDQ2OCIsImN0aW1lIjoxNTY3NDQyODM1LCJleHAiOjE1NzAwMzQ4MzV9.FGghNif93oe7diBlGLpN3LcWVJsp6iM4JxoDnNlDNRU"
              >代码托管GitInn</a>
            </li>
            <li class>
              <a href="/wo/other">其他</a>
            </li>
          </ul>
          <span class="action-btn J_SwitchUser" data-type="2" data-href="/wo/work_todo">前往企业版</span>
        </div>
        <div class="uCenter-main inn-coin">
          <div class="center-box">
            <section class="group-list">
              <div id="order_detailbox">
                <h3 style="font-size:24px">{{inforDetail.product_title}}</h3>
                <span class="lines"></span>
                <div class="order-infos">
                  <span style="font-size:18px;padding:20px 0;">{{inforDetail.order_state_name}}</span>

                  <div class="pays-info">
                    <p>
                      <span class="pays-title">实际金额：</span>
                      <span
                        v-if="inforDetail.real_amount>=0"
                        class="detail-pays green font20"
                      >+{{(inforDetail.real_amount/100).toFixed(2)}}</span>
                      <span
                        v-else
                        class="detail-pays orange font20"
                      >{{(inforDetail.real_amount/100).toFixed(2)}}</span>
                    </p>
                    <p>
                      <span class="pays-title">原始金额：</span>
                      <span v-if="inforDetail.amount>=0" class>+{{inforDetail.amount}}</span>
                      <span v-else class>{{inforDetail.amount}}</span>
                    </p>
                    <p>
                      <span class="pays-title">支付方式：</span>
                      <span>{{inforDetail.channel_name}}</span>
                    </p>
                  </div>
                  <div class="pays-others">
                    <p>
                      <span>创建时间：</span>
                      <span>{{inforDetail.created_at?(formatDate(inforDetail.created_at)):""}}</span>
                    </p>

                    <p>
                      <span>到账时间：</span>
                      <span>{{inforDetail.pay_time?(formatDate(inforDetail.pay_time)):""}}</span>
                    </p>
                    <p>
                      <span>订单编号：</span>
                      <span>{{inforDetail.order_no}}</span>
                    </p>
                    <p>
                      <span>支付编号：</span>
                      <span>{{inforDetail.out_order_id}}</span>
                    </p>

                    <p>
                      <span>备注说明：</span>
                      <span>{{inforDetail.public_comment}}</span>
                    </p>
                  </div>
                  <span class="lines"></span>
                </div>
              </div>
            </section>
          </div>
        </div>
      </div>
    </template>

    <template v-else>
      <div class="business-wrapper">
        <div class="business-content">
          <div class="business-list">
            <section class="group-list group-list-mobile">
              <div id="order_detailbox">
                <h3 style="font-size:24px">{{inforDetail.product_title}}</h3>
                <span class="lines"></span>
                <div class="order-infos">
                  <span
                    style="display:block;padding:30px 0;font-size:18px"
                  >{{inforDetail.order_state_name}}</span>
                  <div class="pays-info">
                    <p>
                      <span class="pays-title">实际金额：</span>
                      <span
                        v-if="inforDetail.real_amount>=0"
                        class="detail-pays green font20"
                      >+{{(inforDetail.real_amount/100).toFixed(2)}}</span>
                      <span
                        v-else
                        class="detail-pays orange font20"
                      >{{(inforDetail.real_amount/100).toFixed(2)}}</span>
                    </p>
                    <p>
                      <span class="pays-title">原始金额：</span>
                      <span v-if="inforDetail.amount>=0" class>+{{inforDetail.amount}}</span>
                      <span v-else class>{{inforDetail.amount}}</span>
                    </p>
                    <p>
                      <span class="pays-title">支付方式：</span>
                      <span>{{inforDetail.channel_name}}</span>
                    </p>
                  </div>
                  <div class="pays-others">
                    <p>
                      <span>创建时间：</span>
                      <span>{{inforDetail.created_at?(formatDate(inforDetail.created_at)):""}}</span>
                    </p>

                    <p>
                      <span>到账时间：</span>
                      <span>{{inforDetail.pay_time?(formatDate(inforDetail.pay_time)):""}}</span>
                    </p>
                    <p>
                      <span>订单编号：</span>
                      <span>{{inforDetail.order_no}}</span>
                    </p>
                    <p>
                      <span>支付编号：</span>
                      <span>{{inforDetail.out_order_id}}</span>
                    </p>

                    <p>
                      <span>备注说明：</span>
                      <span>{{inforDetail.public_comment}}</span>
                    </p>
                  </div>
                  <span class="lines"></span>
                </div>
              </div>
            </section>
          </div>
        </div>
      </div>
    </template>
  </div>
</template>

<script>
import { Pagination } from "element-ui";
import moment from "moment";

import Pullup from "@better-scroll/pull-up";
import PullDown from "@better-scroll/pull-down";

import { Indicator } from "mint-ui";
import "mint-ui/lib/style.css";

export default {
  data() {
    return {
      screenWidth: 1920,
      successTF: true,
      statusTF: true,
      centerDialogVisible: false,
      ids: "",
      inforDetail: { related_project: "" },
      status: 1,
      iconUrl: "",
      nikeName: "",
      ids: ""
    };
  },
  // watch: {
  //   orderList() {
  //     if (this.screenWidth <= 960) {
  //       this.$nextTick(() => {
  //         this.createScroll();
  //       });
  //     }
  //   }
  // },
  mounted() {
    this.screenWidth = window.screen.width;
    this.getFinanceList();
  },
  created() {
    // this.ids = this.$route.query.id;
    // console.log(this.ids);
  },
  methods: {
    formatDate(time) {
      if (time === '0') {
        return '--'
      }
      var now = new Date(time * 1000);
      var year = now.getFullYear();
      var month = now.getMonth() + 1;
      var date = now.getDate();
      var hour = now.getHours();
      var minute = now.getMinutes();
      var second = now.getSeconds();
      return (
        year +
        "-" +
        month +
        "-" +
        date +
        " " +
        hour +
        ":" +
        minute +
        ":" +
        second
      );
    },

    async getFinanceList() {
      var url = window.location.href;
      var index = url.lastIndexOf("/");
      var str = url.substring(index + 1, url.length);
      this.ids = str;

      // let res = await new Promise(resolve => {
      //   setTimeout(() => {
      //     this.$axios
      //       .$post("/api/account/get_orders", {
      //         page: this.page,
      //         page_size: 15
      //       })
      //       .then(data => {
      //         resolve(data);
      //       });
      //   }, 1000);
      // });

      const res = await this.$axios.$post("/api/order/get", {
        order_no: this.ids
      });

      var data = res.data;
      this.inforDetail = data;
      (this.iconUrl = data.user_info.icon_url),
        (this.nikeName = data.user_info.nickname),
        (this.status = res.status);
    }
  }
};
</script>

<style lang="scss" scope>
.inn-uCenter::after {
  display: table;
  content: "";
  clear: both;
}

.inn-uCenter em,
.inn-uCenter i {
  font-style: normal;
}

.inn-uCenter .ui.breadcrumb {
  margin-bottom: 10px;
  font-size: 0;
}

.inn-uCenter .ui.breadcrumb > * {
  font-size: 14px !important;
}

.inn-uCenter .ui.breadcrumb .icon.divider {
  vertical-align: baseline;
}

.inn-uCenter .panel {
  border: 1px solid #eee;
  background-color: #fff;
}

.inn-uCenter .panel h3.title {
  height: 56px;
  margin: 0;
  line-height: 56px;
  border-bottom: 1px solid #f1f2f4;
  padding: 0 20px;
}

.inn-uCenter .uCenter-left {
  float: left;
  width: 160px;
  padding: 20px 0;
  border: 1px solid #eee;
  background-color: #fff;
}

.inn-uCenter .uCenter-left a {
  color: #333;
}

.inn-uCenter .uCenter-left li a {
  display: block;
  padding: 10px 0 10px 30px;
}

.inn-uCenter .uCenter-left li.on,
.inn-uCenter .uCenter-left li:hover {
  background-color: #f5f5f5;
}

.inn-uCenter .uCenter-left li .badge {
  display: inline-block;
  position: relative;
  top: -1px;
  left: 6px;
  padding: 1px 5px;
  line-height: 1.1;
  border-radius: 12px;
  background-color: #ffc240;
  color: #fff;
  font-size: 12px;
}

.inn-uCenter .uCenter-left .action-btn {
  display: block;
  width: 115px;
  height: 30px;
  line-height: 30px;
  border-radius: 15px;
  // background-color: #1094ee;
  margin-left: 25px;
  margin-top: 10px;
  text-align: center;
  color: #fff;
  cursor: pointer;
}

.inn-uCenter .uCenter-main {
  float: left;
  width: 830px;
  margin-left: 10px;
}

.inn-uCenter .center-box {
  background-color: #fff;
  margin-bottom: 20px;
}

.inn-uCenter .center-box .hd {
  padding-right: 30px;
  height: 68px;
  line-height: 68px;
  // background-color: #258ce8;
  color: #fff;
}

.inn-uCenter .center-box .hd em {
  position: relative;
  top: -5px;
  vertical-align: middle;
  font-size: 32px;
  font-style: normal;
}

.inn-uCenter .center-box .hd li {
  float: left;
  margin-left: 30px;
  font-size: 16px;
}

.inn-uCenter .center-box .recharge {
  background-color: #ebbb27;
  border-radius: 17px;
  display: inline-block;
  padding: 10px 0;
  width: 100px;
  line-height: 1;
  text-align: center;
  color: #fff;
  font-size: 16px;
}

.inn-uCenter .center-box .hd-left {
  overflow: hidden;
  float: left;
}

.inn-uCenter .center-box .hd-right {
  overflow: hidden;
  float: right;
}

.inn-uCenter .center-box .hd-right a {
  color: #fff;
}

.inn-uCenter .center-box .hd-right .on {
  background-color: #fff;
  border-radius: 17px;
  display: inline-block;
  padding: 10px 15px;
  line-height: 1;
  text-align: center;
  color: #2f9ffc;
  font-size: 14px;
}

.inn-uCenter .center-box .bd {
  border: 1px solid #eee;
  padding: 40px;
  box-sizing: border-box;
}

.inn-uCenter .center-table {
  margin-bottom: 20px;
}

.inn-uCenter .center-table table {
  width: 100%;
  border: 1px solid #eee;
}

.inn-uCenter .center-table th {
  font-size: 16px;
}

.inn-uCenter .center-table td,
.inn-uCenter .center-table th {
  padding: 20px;
  text-align: center;
}

.inn-uCenter .center-table tbody tr {
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.inn-uCenter .center-table tbody tr:hover {
  background-color: #f4f9fe;
}

.inn-uCenter .load-more,
.inn-uCenter .more-loading {
  font-size: 14px;
  text-align: center;
  color: #2790ed;
  cursor: pointer;
}

.inn-uCenter .load-more {
  display: none;
}

img,
legend {
  border: 0;
}

body,
h1,
h2,
h3,
h4,
h5,
legend,
td,
th {
  padding: 0;
}

.ui.button,
.ui.menu .item,
a {
  text-decoration: none;
}

.ui.button,
.ui.divider {
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.ui.button:focus .icon,
.ui.button:hover .icon {
  opacity: 0.85;
}

.ui.button,
.ui.button > .icon,
sub,
sup {
  vertical-align: baseline;
}

.ui.button,
button,
select {
  text-transform: none;
}

.ui.button,
.ui.divider,
.ui.menu .item {
  -webkit-tap-highlight-color: transparent;
}

.ui.buttons:after,
.ui.icon.header:after,
.ui.segment:after {
  visibility: hidden;
  clear: both;
}

.ui.table,
table {
  border-spacing: 0;
}

input[type="text"],
input[type="email"],
input[type="search"],
input[type="password"] {
  -webkit-appearance: none;
  -moz-appearance: none;
}

/*! normalize.css v3.0.1 | MIT License | git.io/normalize */ /*! normalize.css v3.0.1 | MIT License | git.io/normalize */
html {
  font-family: sans-serif;
  -ms-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
nav,
section,
summary {
  display: block;
}

audio,
canvas,
progress,
video {
  display: inline-block;
  vertical-align: baseline;
}

audio:not([controls]) {
  display: none;
  height: 0;
}

[hidden],
template {
  display: none;
}

a {
  background: 0;
}

a:active,
a:hover {
  outline: 0;
}

abbr[title] {
  border-bottom: 1px dotted;
}

b,
optgroup,
strong {
  font-weight: 700;
}

dfn {
  font-style: italic;
}

mark {
  background: #ff0;
  color: #000;
}

small {
  font-size: 80%;
}

sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
}

svg:not(:root) {
  overflow: hidden;
}

figure {
  margin: 1em 40px;
}

hr {
  box-sizing: content-box;
  height: 0;
}

pre,
textarea {
  overflow: auto;
}

code,
kbd,
pre,
samp {
  font-family: monospace, monospace;
  font-size: 1em;
}

button,
input,
optgroup,
select,
textarea {
  color: inherit;
  font: inherit;
  margin: 0;
}

body,
html {
  font-size: 14px;
}

body,
p {
  line-height: 1.33;
}

.ui.button,
.ui.header,
h1,
h2,
h3,
h4,
h5 {
  font-family: Lato, "Helvetica Neue", Arial, Helvetica, sans-serif;
}

button {
  overflow: visible;
}

button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
  -webkit-appearance: button;
  cursor: pointer;
}

button[disabled],
html input[disabled] {
  cursor: default;
}

button::-moz-focus-inner,
input::-moz-focus-inner {
  border: 0;
  padding: 0;
}

input {
  line-height: normal;
}

input[type="checkbox"],
input[type="radio"] {
  box-sizing: border-box;
  padding: 0;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  height: auto;
}

input[type="search"] {
  -webkit-appearance: textfield;
  box-sizing: content-box;
}

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}

table {
  border-collapse: collapse;
}

*,
:after,
:before {
  box-sizing: border-box;
}

body,
html {
  height: 100%;
}

body {
  margin: 0;
  min-width: 278px;
  background: #f7f7f7;
  color: rgba(0, 0, 0, 0.8);
}

p:first-child {
  margin-top: 0;
}

p:last-child {
  margin-bottom: 0;
}

a:hover {
  color: #00b2f3;
}

body {
  font-family: tahoma, Helvetica, Arial, "Hiragino Sans GB", "Microsoft Yahei",
    "\5FAE\8F6F\96C5\9ED1", "\5b8b\4f53", sans-serif;
}

.order-status {
  display: inline-block;
  padding: 2px;
  border: 1px solid #000000;
}

.business-wrapper {
  overflow: hidden;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.business-list {
  width: 100%;
}

.business-item {
  margin: 0 auto;
  width: 7.1rem;
  height: 1.52rem;
  box-shadow: 0rem -0.01rem 0rem 0rem rgba(243, 243, 243, 1);
}

.business-item-top {
  padding-top: 0.38rem;
  display: flex;
  align-items: center;
}

.business-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 3.3rem;
  font-size: 0.3rem;
  color: #333333;
  line-height: 0.42rem;
}

.business-item-status {
  flex: 1;
  display: flex;
  align-items: center;
}

.business-item-status span {
  display: inline-block;
  padding: 0.04rem 0.12rem;
  line-height: 0.28rem;
  font-weight: 600;
  font-size: 0.2rem;
  color: #666666;
  border-radius: 0.02rem;
  border: 0.01rem solid rgba(153, 153, 153, 0.9);
}

.business-item-price {
  line-height: 0.42rem;
  font-weight: 600;
  font-size: 0.3rem;
}

.business-item-channel {
  margin-top: 0.06rem;
  line-height: 0.32rem;
  font-size: 0.22rem;
  color: #999999;
  display: flex;
  align-items: center;
}

.business-item-time {
  margin-left: 0.2rem;
}

.pulldown-wrapper {
  position: absolute;
  width: 100%;
  padding: 0 0.2rem;
  box-sizing: border-box;
  transform: translateY(-100%) translateZ(0);
  text-align: center;
  font-size: 0.3rem;
  color: #999;
  z-index: -1;
}
.pullup-wrapper {
  padding: 20px;
  text-align: center;
  font-size: 0.3rem;
  color: #999;
}
.group-list {
  display: flex;
  flex-direction: column;
  width: 816px;
  padding: 20px;
  background: white;
}
.group-list-mobile {
  width: 100%;
  box-sizing: border-box;
}
.top {
  display: flex;
  justify-content: space-between;
  height: 40px;
}
.info {
  display: flex;
  align-items: center;
}
.info p {
  margin-left: 12px;
  color: #999;
  font-size: 14px;
}
.el-button {
  width: 100px;
  // background: var(--mainColor);
}
.list {
  display: flex;
  flex-wrap: wrap;
}
.group-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 250px;
  height: 220px;
  border-radius: 4px;
  border: 1px solid rgba(220, 223, 230, 1);
  margin-top: 20px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  margin: 20px 4px 0;
}
.group-item:nth-child(n + 2) {
  /* margin-right: 0; */
}
.group-item:hover {
  border: 1px solid var(--mainColor);
}
.imgs {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 48px;
  height: 78px;
}
.img {
  width: 48px;
  height: 48px;
  border: 2px solid white;
  border-radius: 50%;
}
.two {
  position: absolute;
}
.two:nth-child(1) {
  top: 0;
  left: 0;
}
.two:nth-child(2) {
  top: 30px;
  left: 0;
}
.three {
  position: absolute;
}
.three:nth-child(1) {
  top: 0;
  left: 0;
}
.three:nth-child(2) {
  top: 30px;
  left: -20px;
}
.three:nth-child(3) {
  top: 30px;
  left: 20px;
}
.name {
  margin: 14px 0 10px;
}
.count {
  color: #999;
}
.el-pagination {
  margin-top: 20px;
  text-align: center;
}
#order_detailbox {
  padding: 30px;
  font-size: 14px;
}

#order_detailbox .lines {
  padding-top: 30px;
  display: block;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.orange {
  color: rgba(255, 152, 0, 1);
}
.green {
  color: rgba(37, 155, 36, 1);
}
.blue {
  color: #005fef;
}
.font20 {
  font-size: 20px;
}

.pays-others {
  font-size: 13px;
  color: #666666;
}
.pays-others h3 {
  padding-top: 20px;
  color: black;
  font-size: 16px;
}

.point {
  cursor: pointer;
}
.mark-width {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
  width: 350px;
}
.floatl {
  float: left;
}
.clear::after {
  clear: both;
  display: block;
  content: "";
}
.el-button--default {
  background: transparent !important;
}
#order_detailbox {
  padding: 30px;
  font-size: 14px;
}
#order_detailbox h3 {
  /* font-size: 24px; */
}

#order_detailbox .icons-s {
  color: #5dc945;
  font-size: 34px;
  padding: 25px 0;
  vertical-align: middle;
}
#order_detailbox .icons-f {
  color: red;
  font-size: 34px;
  padding: 30px 0;
  vertical-align: middle;
}
.pays-info .pays-title {
  color: #1d2a3a;
  font-weight: bold;
}

.pays-info > p,
.pays-others > p {
  padding-bottom: 6px;
}
.pays-others {
  font-size: 13px;
  color: #666666;
}

.point {
  cursor: pointer;
}
.mark-width {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
  width: 350px;
}
.floatl {
  float: left;
}
.clear::after {
  clear: both;
  display: block;
  content: "";
}
.person-img {
  padding: 20px 30px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  position: absolute;
  top: 120px;
  left: 600px;
}
.person-img p {
  padding-top: 10px;
}
.person-img > img {
  width: 80px;
  border-radius: 50%;
}
</style>