123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <template>
- <div>
- <el-form ref="form" :model="form" :rules="rules" label-width="120px">
- <el-form-item label="优惠券数量" >
- {{ids.length}}个
- </el-form-item>
- <el-form-item label="优惠券开始时间" prop="startTime">
- <el-date-picker clearable size="small" style="width: 200px"
- v-model="form.startTime"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="选择开始时间">
- </el-date-picker>
- </el-form-item>
- <el-form-item label="优惠券结束时间" prop="limitTime">
- <el-date-picker clearable size="small" style="width: 200px"
- v-model="form.limitTime"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="选择结束时间">
- </el-date-picker>
- </el-form-item>
- <el-form-item label="优惠券领取数量" prop="totalCount">
- <el-input-number v-model="form.totalCount" :min="0" placeholder="请输入优惠券领取数量" />
- </el-form-item>
- </el-form>
- <div class="footer">
- <el-button type="primary" @click="submitForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </div>
- </template>
- <script>
- import { batchPublishCoupon } from "@/api/store/storeCoupon";
- export default {
- name: "batchPublish",
- data() {
- return {
- statusOptions:[],
- ids:[],
- // 表单参数
- form: {},
- // 表单校验
- rules: {
- totalCount: [
- { required: true, message: "数量不能为空", trigger: "blur" }
- ],
- startTime: [
- { required: true, message: "开始时间不能为空", trigger: "blur" }
- ],
- limitTime: [
- { required: true, message: "结束时间不能为空", trigger: "blur" }
- ],
- }
- };
- },
- created() {
- },
- methods: {
- cancel(){
- this.$emit('close');
- },
- handleBatch(ids) {
- console.log(ids)
- this.ids=ids;
- },
- /** 提交按钮 */
- submitForm() {
- this.$refs["form"].validate(valid => {
- if (valid) {
- this.myloading = this.$loading({
- lock: true,
- text: '处理中...',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- });
- this.form.ids=this.ids.toString();
- batchPublishCoupon(this.form).then(response => {
- this.myloading.close()
- if (response.code === 200) {
- this.msgSuccess("发布成功");
- this.$emit('close');
- }
- });
- }
- });
- },
- }
- };
- </script>
- <style lang="scss" scoped>
- .contents{
- height: 100%;
- background-color: #fff;
- padding: 20px;
- }
- .footer{
- display: flex;
- align-items: center;
- justify-content: flex-end;
- }
- </style>
|