createActive.vue 7.2 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
            <van-popup v-model="startShow" position="bottom" :overlay="true">
              <van-datetime-picker
                v-model="startTime"
xd's avatar
xd committed
107
                type="date"
xd's avatar
xd committed
108
                @cancel="startShow = false"
xd's avatar
xd committed
109
                @confirm="handleStartTime"
xd's avatar
xd committed
110 111 112 113
                @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
            <van-popup v-model="endShow" position="bottom" :overlay="true">
              <van-datetime-picker
                v-model="endTime"
xd's avatar
xd committed
129
                type="date"
xd's avatar
xd committed
130
                @cancel="endShow = false"
xd's avatar
xd committed
131
                @confirm="handleEndTime"
xd's avatar
xd committed
132 133 134 135
                @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
      startTime: new Date(),
      startTime1: "",
xd's avatar
xd committed
169
      endTime: new Date(),
xd's avatar
xd committed
170 171 172
      endTime1: "",
      startShow: false,
      endShow: false,
173
      message: ""
xd's avatar
xd committed
174 175 176
    };
  },
  methods: {
xd's avatar
xd committed
177 178 179 180 181 182 183
    timeFormat(time) {
      let year = 1900 + time.getYear();
      let month = "0" + (time.getMonth() + 1);
      let date = "0" + time.getDate();
      return year + "-" + month.substring(month.length-2, month.length)  + "-" + date.substring(date.length-2, date.length)
       + " "
    },
xd's avatar
xd committed
184
    startTimeChange(e) {
185
      let startTimeArr = e.getValues();
xd's avatar
xd committed
186 187 188 189 190 191 192 193 194
      this.startTime1 = `${startTimeArr[0]}-${startTimeArr[1]}-${startTimeArr[2]}`;
    },
    handleStartTime(value) {
      this.startTime1 = this.timeFormat(value)
      this.startShow = false
    },
    handleEndTime(value) {
      this.endTime1 = this.timeFormat(value)
      this.endShow = false
xd's avatar
xd committed
195
    },
xd's avatar
xd committed
196
    endTimeChange(e) {
197
      let endTimeArr = e.getValues();
xd's avatar
xd committed
198
      this.endTime1 = `${endTimeArr[0]}-${endTimeArr[1]}-${endTimeArr[2]}`;
xd's avatar
xd committed
199
    }
xd's avatar
xd committed
200
  },
201
  mounted() {}
xd's avatar
xd committed
202 203
};
</script>
204
<style></style>
xd's avatar
xd committed
205

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

xd's avatar
xd committed
255 256 257 258 259 260 261 262
.title {
  background-color: #f8f8f8;
  height: 36px;
  line-height: 36px;
  font-size: 12px;
  padding-left: 16px;
  color: #2d476a;
}
xd's avatar
xd committed
263 264 265 266 267 268
[data-v-08d4afe1] .van-cell {
  height: 100%;
  font-size: 14px;
}
.right {
  padding: 0;
269 270 271
}
.van-cell__title {
  color: #2d476a !important;
xd's avatar
xd committed
272
}
xd's avatar
xd committed
273
</style>