<template>
  <d2-container v-loading="isLoading">
    <div>
      <div class="providerOrderList-container">
        <div class="d-f-j"
             style="background: #f2f3f5">
          <div>
            <div class="name">订单信息</div>
          </div>
          <!-- <div class="name modify"
               @click="basicModiy()">修改</div> -->
        </div>
      </div>
      <div class="df"
           style="margin-top: 20px">
        <div class="df left">
          <div>采购单号：</div>
          <div>{{ datas.orderNum }}</div>
        </div>
        <div class="df right"
             style="margin-left: 170px">
          <div>客户名称：</div>
          <div>{{ datas.customerId }}</div>
        </div>
      </div>

      <div class="df">
        <div class="df left">
          <div>计划采购：</div>
          <div>{{ datas.plannedPurchase }}</div>
        </div>
        <div class="df right"
             style="margin-left: 170px">
          <div>入库数量：</div>
          <div>{{ datas.bindNum }}</div>
        </div>
      </div>

      <div class="df">
        <div class="df left">
          <div>付费模式：</div>
          <div>{{ datas.paymentModelValue }}</div>
        </div>
        <div class="df right"
             style="margin-left: 170px">
          <div>生产状态：</div>
          <div>{{ datas.productionStateValue}}</div>
        </div>
      </div>
      <div class="df">
        <div class="df left">
          <div>预计交货：</div>
          <div>{{ datas.estimatedDeliveryTime }}</div>
        </div>
        <div class="df right"
             style="margin-left: 170px">
          <div>下单时间：</div>
          <div>{{ datas.createTime }}</div>
        </div>
      </div>
      <div class="df">
        <div class="df left">
          <div>订单备注：</div>
          <div>{{ datas.remark }}</div>
        </div>

      </div>
      <div class="providerOrderList-container">
        <div class="d-f-j"
             style="background: #f2f3f5">
          <div>
            <div class="name">基本信息</div>
          </div>
          <!-- <div class="name modify"
               @click="basicModiy()">修改</div> -->
        </div>
      </div>
      <div class="df"
           style="margin-top: 20px">
        <div class="df left">
          <div>产品名称：</div>
          <div>{{ datas.productName }}</div>
        </div>
        <div class="df right"
             style="margin-left: 170px">
          <div>设备状态：</div>
          <div>{{ datas.deviceStateValue }}</div>
        </div>
      </div>

      <div class="df">
        <div class="df left">
          <div>产品类型：</div>
          <div>{{ datas.productTypeValue }}</div>
        </div>
        <div class="df right"
             style="margin-left: 170px">
          <div>产品型号：</div>
          <div>{{ datas.productModel }}</div>
        </div>
      </div>
    </div>
  </d2-container>
</template>

<script>
import { getOneOrderNum, modifyPws } from "@/libs/common/constant";
export default {
  data() {
    return {
      isLoading: false,
      datas: {},
      isShow: true,
      lunchTime: "",
      dinnerTime: "",
      imge: "",

      openId: this.$route.params.id,
      isShowImage: false,
      img: "",

      isModifyPassword: false,
    };
  },
  async created() {
    await this.getData();
  },
  methods: {
    async getData() {
      this.isLoading = true;
      await this.getOneOrderNum(this.openId);
    },
    async getOneOrderNum(openId) {
      const res = await this.$api.GET(`${getOneOrderNum.url}${openId}`);
      this.datas = res;
      this.isLoading = false;
      console.log(res, "11");
    },
    lookImage(type) {
      console.log(type);
      if (type == "logo") {
        this.img = this.datas.logImage;
        // 这是logo
      } else if (type == "license") {
        // 这是营业执照
        this.img = this.datas.businessImage;
      }
      this.isShowImage = true;
    },
    noShowImg() {
      this.isShowImage = false;
    },
    async modifyPsw(data) {
      const pages = {
        loginName: this.datas.loginName,
        supplierOpenId: this.openId,
        loginPwd: data.password,
      };
      const res = await this.$api.POST(`${modifyPws.url}`, pages);
      console.log(res, "修改结果");
      this.isModifyPassword = false;
    },
    async noModify() {
      this.isModifyPassword = false;
    },
    // 设置基本信息
    basicModiy() {
      this.$router.push({
        path: `/basicModiy/${this.openId}`,
      });
    },

    // 联系信息设置
    contactModiy() {
      this.$router.push({
        path: `/contactModiy/${this.openId}`,
      });
    },
    // 收款信息 设置
    chargeModiy() {
      this.$router.push({
        path: `/chargeModiy/${this.openId}`,
      });
    },

    // 商家介绍
    lookIntroduce() {
      this.$router.push({
        path: `/businessIntroduce/${this.openId}`,
      });
    },
    // 重置密码
    resetting() {
      this.isModifyPassword = true;
    },
  },
};
</script>

<style lang="scss" scoped>
.d-f-j {
  display: flex;
  justify-content: space-between;
}
.df {
  display: flex;
}
.name {
  height: 50px;
  line-height: 50px;
  margin-left: 10px;
}
.modify {
  margin-right: 20px;
  color: blue;
  cursor: pointer;
}
.button {
  margin-top: 20px;
  margin-right: 10px;
}
.left {
  width: 400px;
  line-height: 40px;
  margin-left: 30px;
}
.right {
  line-height: 40px;
  margin-right: 30px;
}
</style>
