createActive.vue 6.79 KB
Newer Older
xd's avatar
xd committed
1
<template>
xd's avatar
xd committed
2
  <div class="container">
xd's avatar
xd committed
3
    <div class="title">基础设置</div>
xd's avatar
xd committed
4
    <van-cell-group class="all">
xd's avatar
xd committed
5
      <van-cell title="活动标题" style="font-size:14px;">
6 7 8 9 10 11 12
        <template slot="default">
          <van-field
            v-model="title"
            placeholder="请输入活动标题"
            class="right"
            style="font-size:14px;"
          />
xd's avatar
xd committed
13 14
        </template>
      </van-cell>
xd's avatar
xd committed
15 16
      <van-cell title="消费后领券" style="font-size:14px;">
        <template slot="default">
17
          <van-switch v-model="coupon" size="20px" class="right" />
xd's avatar
xd committed
18 19 20 21
        </template>
      </van-cell>
      <van-cell title="新客专享" style="font-size:14px;">
        <template slot="default">
22
          <van-switch v-model="newCustomer" size="20px" class="right" />
xd's avatar
xd committed
23 24 25 26
        </template>
      </van-cell>
      <van-cell title="领券条件" style="font-size:14px;">
        <template slot="default">
xd's avatar
xd committed
27 28 29 30
          <div class="condition">
            <span class="phone">手机号必填</span>
            <van-switch v-model="condition" size="20px" />
          </div>
xd's avatar
xd committed
31 32 33 34
        </template>
      </van-cell>
    </van-cell-group>
    <div class="title">券设置</div>
xd's avatar
xd committed
35
    <van-cell-group class="all">
xd's avatar
xd committed
36 37
      <van-cell title="活动标题" style="font-size:14px;">
        <template slot="default">
38 39 40 41 42 43
          <van-field
            v-model="title2"
            placeholder="请输入活动标题"
            class="right"
            style="font-size:14px;"
          />
xd's avatar
xd committed
44 45
        </template>
      </van-cell>
xd's avatar
xd committed
46 47
      <van-cell title="券类型" style="font-size:14px;">
        <template slot="default">
48
          <van-radio-group v-model="type" class="right">
xd's avatar
xd committed
49 50 51 52 53 54 55
            <van-radio name="1" style="float:left;">代金券</van-radio>
            <van-radio name="2" style="float:right;">折扣券</van-radio>
          </van-radio-group>
        </template>
      </van-cell>
      <van-cell title="代金券金额" style="font-size:14px;">
        <template slot="default">
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
          <div class="npbr">
            <van-field
              class="right noborder"
              readonly
              clickable
              :value="cashCoupon"
              placeholder="输入代金券金额"
              @touchstart.native.stop="show = true"
            />
            <van-number-keyboard
              v-model="cashCoupon"
              :show="show"
              :maxlength="6"
              @blur="show = false"
            />
          </div>
xd's avatar
xd committed
72 73 74 75
        </template>
      </van-cell>
      <van-cell title="使用门槛" style="font-size:14px;">
        <template slot="default">
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
          <div class="npbr">
            <van-field
              class="right noborder"
              readonly
              clickable
              :value="limit"
              placeholder="输入使用门槛"
              @touchstart.native.stop="show2 = true"
            />
            <van-number-keyboard
              v-model="limit"
              :show="show2"
              :maxlength="6"
              @blur="show2 = false"
            />
          </div>
xd's avatar
xd committed
92 93
        </template>
      </van-cell>
xd's avatar
xd committed
94 95
      <van-cell title="活动开始时间" style="font-size:14px;">
        <template slot="default">
xd's avatar
xd committed
96 97 98 99 100 101 102
          <div class="npbr">
            <van-field
              class="right"
              v-model="startTime1"
              placeholder="选择活动开始时间"
              readonly="readonly"
              @click="startShow = true"
xd's avatar
xd committed
103
            />
xd's avatar
xd committed
104 105 106 107 108 109 110 111 112 113
            <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>
          </div>
xd's avatar
xd committed
114 115 116 117
        </template>
      </van-cell>
      <van-cell title="活动结束时间" style="font-size:14px;">
        <template slot="default">
xd's avatar
xd committed
118 119 120 121 122 123 124
          <div class="npbr">
            <van-field
              class="right"
              v-model="endTime1"
              placeholder="选择活动结束时间"
              readonly="readonly"
              @click="endShow = true"
xd's avatar
xd committed
125
            />
xd's avatar
xd committed
126 127 128 129 130 131 132 133 134 135
            <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>
          </div>
xd's avatar
xd committed
136 137
        </template>
      </van-cell>
138
      <div class="des">描述</div>
xd's avatar
xd committed
139 140 141
      <van-field
        class="area"
        v-model="message"
xd's avatar
xd committed
142
        rows="3"
xd's avatar
xd committed
143 144 145 146 147
        autosize
        type="textarea"
        placeholder="请输入描述"
        show-word-limit
      />
xd's avatar
xd committed
148
    </van-cell-group>
xd's avatar
xd committed
149
    <div class="creat">创建活动</div>
xd's avatar
xd committed
150 151 152 153 154 155 156
  </div>
</template>

<script>
export default {
  data() {
    return {
xd's avatar
xd committed
157 158
      title: "",
      title2: "",
xd's avatar
xd committed
159 160 161 162 163 164 165 166
      coupon: "",
      newCustomer: "",
      condition: "",
      type: "",
      show: false,
      show2: false,
      cashCoupon: "",
      limit: "",
xd's avatar
xd committed
167 168 169 170 171 172
      startTime: new Date(),
      startTime1: "",
      endTime: "",
      endTime1: "",
      startShow: false,
      endShow: false,
173
      message: ""
xd's avatar
xd committed
174 175 176
    };
  },
  methods: {
xd's avatar
xd committed
177
    startTimeChange(e) {
178 179
      let startTimeArr = e.getValues();
      this.startTime1 = `${startTimeArr[0]}-${startTimeArr[1]}-${startTimeArr[2]}  ${startTimeArr[3]}:${startTimeArr[4]}:00`;
xd's avatar
xd committed
180
    },
xd's avatar
xd committed
181
    endTimeChange(e) {
182 183
      let endTimeArr = e.getValues();
      this.endTime1 = `${endTimeArr[0]}-${endTimeArr[1]}-${endTimeArr[2]}  ${endTimeArr[3]}:${endTimeArr[4]}:00`;
xd's avatar
xd committed
184
    }
xd's avatar
xd committed
185
  },
186
  mounted() {}
xd's avatar
xd committed
187 188
};
</script>
189
<style></style>
xd's avatar
xd committed
190

191
<style scoped>
xd's avatar
xd committed
192 193 194 195 196 197
.condition {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}
.phone {
xd's avatar
xd committed
198
  margin-right: 10px;
xd's avatar
xd committed
199
}
xd's avatar
xd committed
200 201 202 203 204 205
.all >>> input {
  text-align: right;
}
.noborder >>> .van-cell:not(:last-child)::after {
  display: none !important;
}
206 207
.npbr .van-cell:not(:last-child)::after {
  display: none !important;
xd's avatar
xd committed
208 209 210
}
.creat {
  margin-top: 80px;
211 212 213 214
  width: 96%;
  height: 40px;
  background: rgba(117, 178, 253, 1);
  border-radius: 10px;
xd's avatar
xd committed
215 216
  text-align: center;
  line-height: 40px;
217 218
  font-size: 16px;
  font-weight: bold;
xd's avatar
xd committed
219 220
  color: #fff;
  margin-left: 2%;
xd's avatar
xd committed
221
  margin-bottom: 16px;
xd's avatar
xd committed
222 223
}
.container {
xd's avatar
xd committed
224 225 226
  height: auto;
  display: flex;
  flex-direction: column;
227
  background: rgba(248, 248, 248, 1);
xd's avatar
xd committed
228
  min-height: 100%;
xd's avatar
xd committed
229
}
xd's avatar
xd committed
230 231 232
.area >>> .van-field__control {
  background: #f8f8f8;
  padding: 12px;
xd's avatar
xd committed
233 234
}
.des {
xd's avatar
xd committed
235
  padding: 5px 18px 0px;
xd's avatar
xd committed
236
  font-size: 14px;
237
  color: #2d476a;
xd's avatar
xd committed
238
}
xd's avatar
xd committed
239

xd's avatar
xd committed
240 241 242 243 244 245 246 247
.title {
  background-color: #f8f8f8;
  height: 36px;
  line-height: 36px;
  font-size: 12px;
  padding-left: 16px;
  color: #2d476a;
}
xd's avatar
xd committed
248 249 250 251 252 253
[data-v-08d4afe1] .van-cell {
  height: 100%;
  font-size: 14px;
}
.right {
  padding: 0;
254 255 256
}
.van-cell__title {
  color: #2d476a !important;
xd's avatar
xd committed
257
}
xd's avatar
xd committed
258
</style>