<template>
  <div class="mine">
    <div class="left">
      <div class="user-info">
        <div class="user-img">
          <img :src="userInfo.avatar_url"
               alt />
        </div>
        <div class="user-span">
          <div class="name">
            昵称：
            <span>{{userInfo.nickname}}</span>
          </div>
          <div class="sex">
            性别：
            <span>{{userInfo.sex==1?'男':'女'}}</span>
          </div>
          <div class="age">
            肤龄：
            <span>{{userInfo.age||'--'}}</span>
          </div>
          <div class="skin-type">
            肤质：
            <span>{{userInfo.skin}}</span>
          </div>
        </div>
      </div>

      <div class="personage-data">
        <div class="myDataList">
          肌肤得分：
          <span class="bigSixe">{{userInfo.scorec}}分</span>
        </div>
        <div class="myDataList">
          皮肤状态：
          <span>{{userInfo.skin_status}}</span>
        </div>
        <div class="myDataList">
          上传检测时间：
          <span>{{userInfo.check_time}}</span>
        </div>
        <div class="myDataList">
          出生日期：
          <span>{{userInfo.birthday}}</span>
        </div>
        <div class="myDataList">
          联系电话：
          <span>{{userInfo.mobile}}</span>
        </div>

        <div class="myDataList">
          所在地：
          <span>{{userInfo.city}}</span>
        </div>

        <div class="myDataList">
          开卡店铺：
          <span>{{userInfo.store_name}}</span>
        </div>

        <div class="myDataList">
          卡卷数量：
          <span>{{userInfo.card_num}}</span>
        </div>

        <div class="myDataList">
          储值金额：
          <span class="JEcolor">
            ￥
            <span class="bigSixe">{{userInfo.amount}}</span>
            <!-- .00 -->
          </span>
        </div>
        <div class="myDataList">
          积分：
          <span>{{userInfo.coin}}</span>
        </div>
      </div>
    </div>
    <div class="right">
      <div class="right-top">
        <div class="right-top-data">
          <div class="lable">
            <div class="lable-title">面诊标签</div>
            <div class="lable-list">
              <div v-for="(item,index) in lableList"
                   :key="index"
                   class="lable-info">{{item.text}}</div>
            </div>
          </div>
          <div class="ps">
            <div class="ps-title">备注</div>
            <div class="ps-text">{{remarks | ellipsis(20)}}</div>
          </div>
        </div>
        <div class="right-top-list">
          <div class="dataList"
               @click="toOrder(1)">
            <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/project_icon.png" />
            <p>项目订单</p>
            <span>{{order_total.project}}</span>
          </div>
          <div class="dataList"
               style="margin:18px 0px"
               @click="toOrder(2)">
            <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/coupon_icon.png" />
            <p>优惠券</p>
            <span>{{order_total.coupon}}</span>
          </div>
          <div class="dataList"
               @click="toOrder(3)">
            <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/order_total_icon.png" />
            <p>商品订单</p>
            <span>{{order_total.goods}}</span>
          </div>
        </div>
      </div>
      <div class="right-bottom">
        <div class="programme">
          <div class="tab">
            <div class="tab-title">执行方案</div>
          </div>
          <div class="programme-list">
            <div :class="['programme-info',item.onSelect?'programme-active':'']"
                 v-for="(item,index) in programmeList"
                 :key="index"
                 @click="onOperation(index)">
              <div class="programme-left">
                <div class="programme-img">
                  <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/make.png"
                       alt />
                </div>
                <div class="programme-tips">
                  <div class="tips-title">{{'【清洁补水】华熙智慧…'|ellipsis(9)}}</div>
                  <div class="tips-title">{{'美白、祛痘、抗皱'|ellipsis(9)}}</div>
                  <div class="tips-title">
                    仪器：
                    <span>{{'无创水光'|ellipsis(9)}}</span>
                  </div>
                </div>
              </div>
              <div class="programme-right">
                <div class="frequency">
                  执行频率：
                  <span>一周一次</span>
                </div>
                <div class="duration">
                  持续时长：
                  <span>28天</span>
                </div>
              </div>
              <div class="operation"
                   v-if="item.onSelect">
                <div class="edit">编辑</div>
                <div class="delete">删除</div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import api from "../../../server/home";

export default {
  data () {
    return {
      userInfo: {
        image:
          "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/make.png",
        name: "张三",
        sex: "女",
        age: "23",
        skinType: "中性皮肤"
      },
      //面部标签
      lableList: [],
      //执行方案
      programmeList: [],

      remarks: {},
      //项目列表
      projectList: [],

      order_total: {},

      timesInfo: "",
      projectInfo: "",
      weekInfo: "",
      programmeIndex: "",
      remarks: "",
      isPupop: false
    };
  },
  computed: {},
  watch: {},

  methods: {
    getPadUserInfo () {
      api.getPadUserInfo({ id: this.id }).then(res => {
        this.userInfo = res.data.user;
        this.remarks = res.data.remark;
        this.lableList = res.data.tags;
        this.order_total = res.data.order_total;
        this.programmeList = res.data.scheme_list;
        // this.programmeList = res.data.order_data.project_list;
        // this.coupon_list = res.data.order_data.coupon_list;
      });
    },

    onOperation (index) {
      if (this.programmeList[index].onSelect) {
        this.$set(
          this.programmeList[index],
          "onSelect",
          !this.programmeList[index].onSelect
        );
      } else {
        this.$set(this.programmeList[index], "onSelect", true);
      }
    },
    toOrder (index) {
      let activeName = 'first'
      if (index == 3) {
        activeName = 'third'
      } else if (index == 2) {
        activeName = 'second'
      }
      this.$router.push({
        path: "/customerMan/projectOrder",
        query: {
          id: this.id,
          activeName: activeName
        }
      });
    },
  },

  created () {
    let id = this.$route.query.id;
    this.id = id;
    this.getPadUserInfo();
  },

  mounted () { }
};
</script>

<style lang='less' scoped>
.mine {
  height: 100%;
  display: flex;
  .left {
    width: 276px;
    padding: 12px 12px 0 12px;
    background: #ffffff;
    box-shadow: 0px 2px 4px 0px rgba(184, 191, 198, 0.2);
    border-radius: 8px;
    font-size: 13px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #999999;
    line-height: 18px;
    overflow: scroll;
    height: 100%;
    .user-info {
      display: flex;
      align-items: center;
      .user-img {
        width: 98px;
        img {
          width: 100%;
          display: block;
        }
      }
      .user-span {
        margin-left: 12px;
        .sex {
          margin-top: 8px;
        }
        .age {
          margin-top: 8px;
        }
        .skin-type {
          margin-top: 8px;
        }

        span {
          color: #333333;
        }
      }
    }
    .personage-data {
      margin-top: 30px;
      .myDataList {
        margin-top: 15px;
        .bigSixe {
          font-size: 18px;
          color: #fa7d22;
        }
        span {
          color: #333333;
        }
        .JEcolor {
          color: #fa7d22;
        }
      }
    }
  }

  .right {
    margin-left: 18px;
    position: relative;
    flex: 1;
    .right-top {
      height: 205px;
      // border: 1px solid red;
      display: flex;
      .right-top-list {
        width: 239ppx;
        margin-left: 18px;
        display: flex;
        flex-direction: column;
        .dataList {
          height: 56px;
          // width: 239ppx;
          background: #ffffff;
          box-shadow: 0px 2px 4px 0px rgba(184, 191, 198, 0.2);
          border-radius: 8px;
          padding: 16px 12px 12px 12px;
          display: flex;
          align-items: center;
          img {
            width: 33px;
            height: 33px;
          }
          p {
            font-size: 14px;
            margin-left: 14px;
            margin-right: 80px;
          }
          span {
            font-size: 16px;
            margin-right: 20px;
          }
        }
      }
      .right-top-data {
        background: #ffffff;
        box-shadow: 0px 2px 4px 0px rgba(184, 191, 198, 0.2);
        border-radius: 8px;
        padding: 16px 12px 12px 12px;
        width: 310px;
        height: 100%;
        .lable {
          //   margin-top: 23px;
          width: 100%;
          overflow: scroll;
          background: #ffffff;
          .lable-title {
            font-size: 14px;
            font-family: PingFangSC-Medium, PingFang SC;
            font-weight: 500;
            color: #333333;
            line-height: 20px;
            margin-bottom: 14px;
          }
          .lable-list {
            width: 100%;
            min-height: 105rpx;
            .lable-info {
              display: inline-block;
              padding: 0 12px;
              margin-left: 10px;
              height: 24px;
              line-height: 24px;
              border-radius: 2px;
              border: 1px solid #d6d6d6;
              margin-bottom: 10px;
            }
            .add-lable {
              display: inline-block;
              width: 27px;
              height: 24px;
              line-height: 24px;
              font-size: 12px;
              font-family: PingFang-SC-Regular, PingFang-SC;
              font-weight: 400;
              color: #333333;
              text-align: center;
              margin-left: 10px;
              border-radius: 2px;
              border: 1px solid #d6d6d6;
            }
          }
          .remarks {
            /deep/ .el-textarea__inner:focus {
              border-color: #fa852f;
            }
          }
        }
        .ps {
          font-size: 14px;
          font-family: PingFangSC-Medium, PingFang SC;
          font-weight: 500;
          color: #333333;
          line-height: 20px;
          .ps-text {
            margin-top: 10px;
            font-size: 12px;
            font-weight: 400;
            color: #666666;
            line-height: 17px;
          }
        }
      }
    }
    .right-bottom {
      margin-top: 18px;
      background: #ffffff;
      box-shadow: 0px 2px 4px 0px rgba(184, 191, 198, 0.2);
      border-radius: 8px;
      padding: 16px 61px 12px 12px;
      .programme {
        //   margin-top: 20px;
        width: 100%;
        background: #ffffff;
        border-radius: 8px;

        .tab {
          display: flex;
          align-items: center;
          justify-content: space-between;
          .tab-title {
            font-size: 14px;
            font-family: PingFangSC-Medium, PingFang SC;
            font-weight: 500;
            color: #333333;
            line-height: 20px;
          }
        }
        .programme-list {
          margin-top: 10px;
          position: relative;
          z-index: 1;
          .programme-info {
            position: relative;
            margin-bottom: 10px;
            border-radius: 4px;
            border: 1px solid #f5f5f5;
            display: flex;
            justify-content: space-between;
            padding: 8px 8px 8px 10px;
            align-items: center;
            .programme-left {
              display: flex;
              align-items: center;
              .programme-img {
                width: 48px;
                display: inline-block;
                img {
                  width: 100%;
                  display: block;
                }
              }
              .programme-tips {
                display: inline-block;
                margin-left: 10px;
                font-size: 10px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: #999999;
                line-height: 14px;
                zoom: 0.83;
              }
            }
            .programme-right {
              font-size: 12px;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: #333333;
              line-height: 17px;
              .duration {
                margin-top: 14px;
              }
            }
            .operation {
              position: absolute;
              left: 50%;
              transform: translateX(-50%);
              top: 10px;
              z-index: 10;
              width: 44px;
              background: #ffffff;
              box-shadow: 0px 9px 28px 8px rgba(0, 0, 0, 0.05),
                0px 6px 16px 0px rgba(0, 0, 0, 0.08),
                0px 3px 6px -4px rgba(0, 0, 0, 0.12);
              border-radius: 2px;
              padding: 10px;
              font-size: 12px;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: #333333;
              line-height: 17px;
              .delete {
                margin-top: 20px;
              }
            }
          }
          .programme-active {
            border: 1px solid #fa852f;
          }
        }
      }
    }
  }
}
</style>
