<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.name }}</div>
        </div>
        <div class="df right"
             style="margin-left: 170px">
          <div>机构编码：</div>
          <div>{{ datas.coding }}</div>
        </div>
      </div>

      <div class="df">
        <div class="df left">
          <div>商家类型：</div>
          <div>{{ datas.typeValue }}</div>
        </div>
        <div class="df right"
             style="margin-left: 170px">
          <div>商家性质：</div>
          <div>{{ datas.natureValue }}</div>
        </div>
      </div>

      <div class="df">
        <div class="df left">
          <div>联系人：</div>
          <div>{{ datas.contact }}</div>
        </div>
        <div class="df right"
             style="margin-left: 170px">
          <div>联系电话：</div>
          <div>{{ datas.contactPhone }}</div>
        </div>
      </div>
      <div class="df">
        <div class="df left">
          <div>所在城市：</div>
          <div>{{ datas.provinceName }}{{ datas.cityName }}</div>
        </div>
        <div class="df right"
             style="margin-left: 170px">
          <div>联系邮箱：</div>
          <div>{{ datas.email }}</div>
        </div>
      </div>
      <div class="df">
        <div class="df left">
          <div>状态：</div>
          <div>{{ datas.stateValue }}</div>
        </div>
        <div class="df right"
             style="margin-left: 170px">
          <div>创建时间：</div>
          <div>{{ datas.createTime }}</div>
        </div>
      </div>

    </div>
  </d2-container>
</template>

<script>
import { getOneCustomer, 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.getOneCustomer(this.openId);
    },
    async getOneCustomer(openId) {
      const res = await this.$api.GET(`${getOneCustomer.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>
