You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bsdgy-front/src/pages/activity/selectStoreStep.vue

134 lines
3.7 KiB
Vue

5 years ago
<template>
<div class="use_box">
5 years ago
<Modal :scrollable="false"
v-model="showUse"
title="使用活动"
@on-cancel="cancel"
:loading="true"
width="70%">
<Steps style="padding: 40px;"
:current="currentStep">
<Step :title="isModify ? '修改零售公司' : '选择零售公司'"
content></Step>
<Step :title="isModify ? '修改店铺' : '选择店铺'"
content></Step>
5 years ago
</Steps>
5 years ago
<useActivityStepTwo :schedule="schedule"
:isModify="isModify"
v-if="currentStep == 0"></useActivityStepTwo>
<useActivityStepThree :schedule="schedule"
:isModify="isModify"
v-if="currentStep == 1"></useActivityStepThree>
5 years ago
<div slot="footer">
5 years ago
<Button v-if="currentStep !== 0"
type="primary"
shape="circle"
:loading="modal_loading"
@click="back">上一步</Button>
<Button v-if="currentStep !== 1"
type="primary"
shape="circle"
:loading="modal_loading"
@click="next">下一步</Button>
<Button v-if="currentStep == 1"
type="primary"
shape="circle"
:loading="modal_loading"
@click="finish">完成</Button>
5 years ago
</div>
</Modal>
</div>
</template>
<script>
import useActivityStepOne from "./useActivityStepOne";
import useActivityStepTwo from "./useActivityStepTwo";
import useActivityStepThree from "./useActivityStepThree";
import useActivityStepFoure from "./useActivityStepFoure";
import ActivityManager from "../../services/ActivityManager/ActivityManager";
import store from "../../store/index";
5 years ago
import { formatDate } from "../../utils/Common";
5 years ago
export default {
name: "useTable",
components: {
useActivityStepOne,
useActivityStepTwo,
useActivityStepThree,
5 years ago
useActivityStepFoure
5 years ago
},
5 years ago
data () {
5 years ago
return {
5 years ago
currentStep: -1,
5 years ago
modal_loading: false,
5 years ago
showUse: false
5 years ago
};
},
props: {
id: String,
schedule: Object,
show: Boolean,
isModify: {
type: Boolean,
default: false
}
},
watch: {
5 years ago
show () {
5 years ago
this.showUse = this.show;
5 years ago
this.currentStep = 0;
5 years ago
this.modal_loading = false;
5 years ago
},
5 years ago
schedule () {
5 years ago
store.getters.useData.scheduleId = this.schedule.id;
5 years ago
}
5 years ago
},
5 years ago
mounted () { },
5 years ago
methods: {
5 years ago
cancel () {
5 years ago
this.currentStep = 0;
5 years ago
// if (!this.isModify) {
// store.commit("RSET_useData");
// }
5 years ago
this.$emit("doShow", false);
this.modal_loading = false;
this.showUse = false;
this.currentStep = 0;
},
5 years ago
next () {
5 years ago
let data = store.getters.useData;
5 years ago
console.log("data1", data);
5 years ago
if (this.currentStep === 0) {
if (!data.company || data.company.length === 0) {
this.$Message.error("请至少选择1家公司");
return;
}
}
if (this.currentStep === 2) {
if (!data.stores || data.stores.length === 1) {
this.$Message.error("请至少选择1家店铺");
return;
}
}
if (typeof data.beginTime == "object") {
data.beginTime = formatDate(data.beginTime);
}
if (typeof data.endTime == "object") {
data.endTime = formatDate(data.endTime);
}
5 years ago
console.log("data", data);
5 years ago
store.commit("SET_useData", data);
this.currentStep = this.currentStep + 1;
},
5 years ago
back () {
5 years ago
this.currentStep = this.currentStep - 1;
},
5 years ago
finish () {
5 years ago
let that = this;
this.modal_loading = true;
that.$emit("doShow", false);
5 years ago
}
}
5 years ago
};
</script>
<style></style>