goodGrounding.vue 7 KB
Newer Older
xd's avatar
xd committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<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">
xd's avatar
xd committed
19
            <van-radio-group v-model="type" @change="handleChooseChange">
xd's avatar
xd committed
20 21 22
              <van-radio name="1" style="float:left;">固定金额</van-radio>
              <van-radio name="2" style="float:right;">成交价比例</van-radio>
            </van-radio-group>
xd's avatar
xd committed
23 24
            <div class="fr" v-if="type == 1">
              <span class="fr" style="margin-top:18px;"></span>
xd's avatar
xd committed
25 26 27 28 29 30 31 32 33 34 35 36 37
              <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"
              />
xd's avatar
xd committed
38 39 40
            </div>
            <div class="fr" v-if="type == 2">
              <span class="fr" style="margin-top:18px;">%</span>
xd's avatar
xd committed
41 42 43 44 45 46 47 48 49 50 51 52 53
              <van-field
                class="price"
                readonly
                clickable
                :value="percent"
                placeholder="请输入百分比"
                @touchstart.native.stop="show3 = true"
              />
              <van-number-keyboard
                v-model="percent"
                :show="show3"
                @blur="show3 = false"
              />
xd's avatar
xd committed
54
            </div>
xd's avatar
xd committed
55 56 57 58 59
          </div>
        </div>
      </van-cell>
      <van-cell title="活动开始时间" style="font-size:14px;">
        <template slot="default">
xd's avatar
xd committed
60 61 62 63 64 65 66
          <div class="jpsl">
            <van-field
              v-model="startTime1"
              placeholder="选择活动开始时间"
              readonly="readonly"
              @click="startShow = true"
              class="nop"
xd's avatar
xd committed
67
            />
xd's avatar
xd committed
68 69 70 71 72 73 74 75 76 77
            <van-popup v-model="startShow" position="bottom" :overlay="true">
              <van-datetime-picker
                v-model="startTime"
                type="datetime"
                @cancel="startShow = false"
                @confirm="handleStartTime"
                @change="startTimeChange"
              />
            </van-popup>
          </div>
xd's avatar
xd committed
78 79 80 81
        </template>
      </van-cell>
      <van-cell title="活动结束时间" style="font-size:14px;">
        <template slot="default">
xd's avatar
xd committed
82 83 84 85 86 87 88
          <div class="jpsl">
            <van-field
              v-model="endTime1"
              placeholder="选择活动结束时间"
              readonly="readonly"
              @click="endShow = true"
              class="nop"
xd's avatar
xd committed
89
            />
xd's avatar
xd committed
90 91 92 93 94 95 96 97 98 99
            <van-popup v-model="endShow" position="bottom" :overlay="true">
              <van-datetime-picker
                v-model="endTime"
                type="datetime"
                @cancel="endShow = false"
                @confirm="handleEndTime"
                @change="endTimeChange"
              />
            </van-popup>
          </div>
xd's avatar
xd committed
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
        </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: "",
xd's avatar
xd committed
130
      endTime: new Date(),
xd's avatar
xd committed
131 132 133 134
      endTime1: "",
      startShow: false,
      endShow: false,
      number: "",
xd's avatar
xd committed
135
      type: "1",
xd's avatar
xd committed
136 137
      show: false,
      show2: false,
xd's avatar
xd committed
138 139 140
      show3: false,
      price: "",
      percent: ""
xd's avatar
xd committed
141 142 143
    };
  },
  methods: {
xd's avatar
xd committed
144 145 146 147
    timeFormat(time) {
      let year = 1900 + time.getYear();
      let month = "0" + (time.getMonth() + 1);
      let date = "0" + time.getDate();
xd's avatar
xd committed
148 149 150 151 152 153 154 155
      return (
        year +
        "-" +
        month.substring(month.length - 2, month.length) +
        "-" +
        date.substring(date.length - 2, date.length) +
        " "
      );
xd's avatar
xd committed
156
    },
xd's avatar
xd committed
157 158
    startTimeChange(e) {
      let startTimeArr = e.getValues();
xd's avatar
xd committed
159
      this.startTime1 = `${startTimeArr[0]}-${startTimeArr[1]}-${startTimeArr[2]}`;
xd's avatar
xd committed
160 161 162
    },
    endTimeChange(e) {
      let endTimeArr = e.getValues();
xd's avatar
xd committed
163
      this.endTime1 = `${endTimeArr[0]}-${endTimeArr[1]}-${endTimeArr[2]}`;
xd's avatar
xd committed
164 165
    },
    handleStartTime(value) {
xd's avatar
xd committed
166 167
      this.startTime1 = this.timeFormat(value);
      this.startShow = false;
xd's avatar
xd committed
168 169
    },
    handleEndTime(value) {
xd's avatar
xd committed
170 171
      this.endTime1 = this.timeFormat(value);
      this.endShow = false;
xd's avatar
xd committed
172 173 174 175
    },
    handleChooseChange(e) {
      this.price = ''
      this.percent = ''
xd's avatar
xd committed
176
    }
xd's avatar
xd committed
177 178 179 180 181
  }
};
</script>

<style scoped>
xd's avatar
xd committed
182 183 184
.jpsl >>> .van-cell:not(:last-child)::after {
  display: none;
}
xd's avatar
xd committed
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
.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;
xd's avatar
xd committed
220 221 222 223
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
xd's avatar
xd committed
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
}
.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;
}
xd's avatar
xd committed
267 268 269
.option {
  margin-top: 10px;
}
xd's avatar
xd committed
270 271 272 273 274 275 276 277 278 279
.option >>> .van-field__control {
  text-align: right;
}
.nob >>> .van-cell:not(:last-child)::after {
  border: none;
}
.price >>> .van-field__control {
  text-align: center;
}
.creat {
xd's avatar
xd committed
280 281 282 283
  width: 96%;
  height: 40px;
  background: rgba(117, 178, 253, 1);
  border-radius: 10px;
xd's avatar
xd committed
284 285
  text-align: center;
  line-height: 40px;
xd's avatar
xd committed
286 287
  font-size: 16px;
  font-weight: bold;
xd's avatar
xd committed
288 289 290 291 292 293
  color: #fff;
  margin-left: 2%;
  position: absolute;
  bottom: 16px;
}
</style>