<template>
  <div class="container">
    <div class="list">
      <div class="good">
        <div class="left">
          <img src="../../../public/img/goods.png" />
        </div>
        <div class="center">
          <div class="name">商品名称商品名称商品名称商品名称商品</div>
          <h3>￥888</h3>
        </div>
      </div>
    </div>
    <van-cell-group class="option">
      <van-cell class="nop">
        <div class="type">
          <div class="t-l">佣金类型</div>
          <div class="t-r">
            <van-radio-group v-model="type">
              <van-radio name="1" style="float:left;">固定金额</van-radio>
              <van-radio name="2" style="float:right;">成交价比例</van-radio>
            </van-radio-group>
            <div class="fr">
              <span class="fr" style="margin-top:16px;">元</span>
                <van-field
                  class="price"
                  readonly
                  clickable
                  :value="price"
                  placeholder="请输入金额"
                  @touchstart.native.stop="show2 = true"
                />
                <van-number-keyboard
                  v-model="price"
                  :show="show2"
                  @blur="show2 = false"
                />
              </div>
          </div>
        </div>
      </van-cell>
      <van-cell title="活动开始时间" style="font-size:14px;">
        <template slot="default">
          <van-field
            v-model="startTime1"
            placeholder="选择活动结束时间"
            readonly="readonly"
            @click="startShow = true"
            class="nop"
          />
          <van-popup v-model="startShow" position="bottom" :overlay="true">
            <van-datetime-picker
              v-model="startTime"
              type="datetime"
              @cancel="startShow = false"
              @confirm="startShow = false"
              @change="startTimeChange"
            />
          </van-popup>
        </template>
      </van-cell>
      <van-cell title="活动结束时间" style="font-size:14px;">
        <template slot="default">
          <van-field
            v-model="endTime1"
            placeholder="选择活动结束时间"
            readonly="readonly"
            @click="endShow = true"
            class="nop"
          />
          <van-popup v-model="endShow" position="bottom" :overlay="true">
            <van-datetime-picker
              v-model="endTime"
              type="datetime"
              @cancel="endShow = false"
              @confirm="endShow = false"
              @change="endTimeChange"
            />
          </van-popup>
        </template>
      </van-cell>
      <van-cell title="上架数量" style="font-size:14px;" class="nob">
        <template slot="default">
          <van-field
            class="nop"
            readonly
            clickable
            :value="number"
            placeholder="请输入数量"
            @touchstart.native.stop="show = true"
          />
          <van-number-keyboard
            v-model="number"
            :show="show"
            @blur="show = false"
          />
        </template>
      </van-cell>
    </van-cell-group>
    <div class="creat">立即上架</div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      startTime: new Date(),
      startTime1: "",
      endTime: "",
      endTime1: "",
      startShow: false,
      endShow: false,
      number: "",
      type: "",
      show: false,
      show2: false,
      price: ""
    };
  },
  methods: {
    startTimeChange(e) {
      let startTimeArr = e.getValues();
      this.startTime1 = `${startTimeArr[0]}-${startTimeArr[1]}-${startTimeArr[2]}  ${startTimeArr[3]}:${startTimeArr[4]}:00`;
    },
    endTimeChange(e) {
      let endTimeArr = e.getValues();
      this.endTime1 = `${endTimeArr[0]}-${endTimeArr[1]}-${endTimeArr[2]}  ${endTimeArr[3]}:${endTimeArr[4]}:00`;
    }
  }
};
</script>

<style scoped>

.price {
  width: 88px;
  height: 36px;
  line-height: 36px;
  /* text-align: center; */
  background: #f8f8f8;
  float: right;
  margin-top: 12px;
  border-radius: 10px;
  color: rgba(45, 71, 106, 0.6);
  padding: 0;
}
.nop {
  padding: 0;
}
.t-l {
  width: 120px;
}
.t-r {
  width: 70%;
}
.type {
  padding: 14px;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}
h3 {
  font-size: 14px;
  color: rgba(208, 2, 27, 1);
  margin-top: 18px;
}
.container {
  height: 100%;
  background-color: #f8f8f8;
}
.name {
  font-size: 14px;
  font-weight: bold;
  color: rgba(45, 71, 106, 1);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.good {
  height: 108px;
  border-bottom: 1px solid rgba(238, 238, 238, 1);
  width: 100%;
  padding: 12px 0;
  display: flex;
  justify-content: space-between;
}
.list {
  padding: 0 16px;
  box-sizing: border-box;
  background-color: #fff;
  box-shadow: 0px 1px 3px 0px rgba(221, 221, 221, 1);
}
.left,
.right,
.center {
  height: 80px;
}
.left {
  width: 80px;
  border-radius: 4px;
}
.left img {
  width: 100%;
}
.center {
  width: 70%;
}

.phone {
  float: left;
}
.option >>> .van-field__control {
  text-align: right;
}
.nob >>> .van-cell:not(:last-child)::after {
  border: none;
}
.price >>> .van-field__control {
  text-align: center;
}
.creat {
  width:96%;
  height:40px;
  background:rgba(117,178,253,1);
  border-radius:10px;
  text-align: center;
  line-height: 40px;
  font-size:16px;
  font-weight:bold;
  color: #fff;
  margin-left: 2%;
  position: absolute;
  bottom: 16px;
}
</style>
