|
@@ -8,7 +8,27 @@
|
|
<div class="m-core">
|
|
<div class="m-core">
|
|
<el-form :model="form" ref="form" class="form">
|
|
<el-form :model="form" ref="form" class="form">
|
|
<el-row>
|
|
<el-row>
|
|
- <el-col style="width: 500px">
|
|
|
|
|
|
+ <el-col style="width: 395px">
|
|
|
|
+ <el-form-item
|
|
|
|
+ label="系统类型"
|
|
|
|
+ prop="useSystem"
|
|
|
|
+ :rules="[{ required: true, message: '系统类型' }]"
|
|
|
|
+ >
|
|
|
|
+ <el-select
|
|
|
|
+ :disabled="isDisabled"
|
|
|
|
+ placeholder="系统类型"
|
|
|
|
+ v-model.trim="form.useSystem"
|
|
|
|
+ filterable
|
|
|
|
+ clearable
|
|
|
|
+ style="width: 375px !important"
|
|
|
|
+ @change="onUseSystemChange"
|
|
|
|
+ >
|
|
|
|
+ <el-option value="MALL" label="商城"></el-option>
|
|
|
|
+ <el-option value="MEC" label="管乐迷"></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col style="width: 395px">
|
|
<el-form-item
|
|
<el-form-item
|
|
label="优惠券名称"
|
|
label="优惠券名称"
|
|
prop="name"
|
|
prop="name"
|
|
@@ -23,32 +43,21 @@
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
<el-row>
|
|
<el-row>
|
|
- <el-col style="width: 500px">
|
|
|
|
- <!-- <el-form-item
|
|
|
|
- label="预警值"
|
|
|
|
- prop="warningStockNum"
|
|
|
|
- :rules="[{ required: true, message: '请输入预警值' }]"
|
|
|
|
- >
|
|
|
|
- <el-input :disabled='form.warningStockNum ==-1' v-model="form.warningStockNum" placeholder="请输入预警值">
|
|
|
|
- <template slot="append">张</template>
|
|
|
|
- </el-input>
|
|
|
|
- <el-checkbox v-model="form.warningStockNum" :true-label='-1' false-label='' @change="(val)=>{checkNo(val,'warningStockNum')}" >不限制</el-checkbox>
|
|
|
|
- </el-form-item> -->
|
|
|
|
|
|
+ <el-col style="width: 395px">
|
|
<el-form-item
|
|
<el-form-item
|
|
label="可用分部"
|
|
label="可用分部"
|
|
prop="organId"
|
|
prop="organId"
|
|
:rules="[{ required: true, message: '请选择可用分部' }]"
|
|
:rules="[{ required: true, message: '请选择可用分部' }]"
|
|
>
|
|
>
|
|
- <br/>
|
|
|
|
|
|
+ <br />
|
|
<select-all
|
|
<select-all
|
|
- style="width: 100% !important"
|
|
|
|
|
|
+ style="width: 375px !important"
|
|
class="multiple"
|
|
class="multiple"
|
|
v-model.trim="form.organId"
|
|
v-model.trim="form.organId"
|
|
filterable
|
|
filterable
|
|
multiple
|
|
multiple
|
|
clearable
|
|
clearable
|
|
placeholder="请选择分部"
|
|
placeholder="请选择分部"
|
|
-
|
|
|
|
>
|
|
>
|
|
<el-option
|
|
<el-option
|
|
v-for="(item, index) in selects.branchs"
|
|
v-for="(item, index) in selects.branchs"
|
|
@@ -59,9 +68,7 @@
|
|
</select-all>
|
|
</select-all>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
- </el-row>
|
|
|
|
- <el-row>
|
|
|
|
- <el-col style="width: 500px">
|
|
|
|
|
|
+ <el-col style="width: 395px">
|
|
<el-form-item
|
|
<el-form-item
|
|
label="描述"
|
|
label="描述"
|
|
prop="description"
|
|
prop="description"
|
|
@@ -92,7 +99,7 @@
|
|
v-model.trim="form.issuanceType"
|
|
v-model.trim="form.issuanceType"
|
|
filterable
|
|
filterable
|
|
clearable
|
|
clearable
|
|
- style="width: 355px !important"
|
|
|
|
|
|
+ style="width: 375px !important"
|
|
>
|
|
>
|
|
<el-option :value="0" label="学员主动领取"></el-option>
|
|
<el-option :value="0" label="学员主动领取"></el-option>
|
|
<el-option :value="1" label="后台手动发放"></el-option>
|
|
<el-option :value="1" label="后台手动发放"></el-option>
|
|
@@ -111,13 +118,14 @@
|
|
v-model.trim="form.typeDetail"
|
|
v-model.trim="form.typeDetail"
|
|
filterable
|
|
filterable
|
|
clearable
|
|
clearable
|
|
- style="width: 355px !important"
|
|
|
|
|
|
+ style="width: 375px !important"
|
|
>
|
|
>
|
|
<el-option
|
|
<el-option
|
|
v-for="item in coupontypeDetail"
|
|
v-for="item in coupontypeDetail"
|
|
:key="item.value"
|
|
:key="item.value"
|
|
:value="item.value"
|
|
:value="item.value"
|
|
:label="item.label"
|
|
:label="item.label"
|
|
|
|
+ :disabled="item.disabled"
|
|
></el-option>
|
|
></el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -137,7 +145,7 @@
|
|
filterable
|
|
filterable
|
|
clearable
|
|
clearable
|
|
@change="changeType"
|
|
@change="changeType"
|
|
- style="width: 355px !important"
|
|
|
|
|
|
+ style="width: 375px !important"
|
|
>
|
|
>
|
|
<el-option
|
|
<el-option
|
|
v-for="item in couponTypeList"
|
|
v-for="item in couponTypeList"
|
|
@@ -159,7 +167,9 @@
|
|
placeholder="请输入满减金额"
|
|
placeholder="请输入满减金额"
|
|
:disabled="isDisabled"
|
|
:disabled="isDisabled"
|
|
>
|
|
>
|
|
- <template slot="append">元</template>
|
|
|
|
|
|
+ <template slot="append"
|
|
|
|
+ >元</template
|
|
|
|
+ >
|
|
</el-input>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -174,7 +184,9 @@
|
|
placeholder="请输入面值"
|
|
placeholder="请输入面值"
|
|
:disabled="isDisabled"
|
|
:disabled="isDisabled"
|
|
>
|
|
>
|
|
- <template slot="append">元</template>
|
|
|
|
|
|
+ <template slot="append"
|
|
|
|
+ >元</template
|
|
|
|
+ >
|
|
</el-input>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -190,7 +202,9 @@
|
|
placeholder="请输入折扣"
|
|
placeholder="请输入折扣"
|
|
:disabled="isDisabled"
|
|
:disabled="isDisabled"
|
|
>
|
|
>
|
|
- <template slot="append">%</template>
|
|
|
|
|
|
+ <template slot="append"
|
|
|
|
+ >%</template
|
|
|
|
+ >
|
|
</el-input>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -204,7 +218,7 @@
|
|
:rules="[{ required: true, message: '请选择有效期类型' }]"
|
|
:rules="[{ required: true, message: '请选择有效期类型' }]"
|
|
>
|
|
>
|
|
<el-select
|
|
<el-select
|
|
- style="width: 355px !important"
|
|
|
|
|
|
+ style="width: 375px !important"
|
|
placeholder="优惠券类型"
|
|
placeholder="优惠券类型"
|
|
v-model.trim="form.effectiveType"
|
|
v-model.trim="form.effectiveType"
|
|
filterable
|
|
filterable
|
|
@@ -236,7 +250,9 @@
|
|
placeholder="请输入有效期天数"
|
|
placeholder="请输入有效期天数"
|
|
:disabled="isDisabled"
|
|
:disabled="isDisabled"
|
|
>
|
|
>
|
|
- <template slot="append">天</template>
|
|
|
|
|
|
+ <template slot="append"
|
|
|
|
+ >天</template
|
|
|
|
+ >
|
|
</el-input>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -284,14 +300,16 @@
|
|
v-model="form.stockCount"
|
|
v-model="form.stockCount"
|
|
placeholder="请输入库存总量"
|
|
placeholder="请输入库存总量"
|
|
>
|
|
>
|
|
- <template slot="append">张</template>
|
|
|
|
|
|
+ <template slot="append"
|
|
|
|
+ >张</template
|
|
|
|
+ >
|
|
</el-input>
|
|
</el-input>
|
|
<el-checkbox
|
|
<el-checkbox
|
|
v-model="form.stockCount"
|
|
v-model="form.stockCount"
|
|
:true-label="-1"
|
|
:true-label="-1"
|
|
false-label=""
|
|
false-label=""
|
|
@change="
|
|
@change="
|
|
- (val) => {
|
|
|
|
|
|
+ val => {
|
|
checkNo(val, 'stockCount');
|
|
checkNo(val, 'stockCount');
|
|
}
|
|
}
|
|
"
|
|
"
|
|
@@ -308,8 +326,8 @@
|
|
{
|
|
{
|
|
pattern: /^[1-9][0-9]?$/,
|
|
pattern: /^[1-9][0-9]?$/,
|
|
message: '请输入1-99的正整数',
|
|
message: '请输入1-99的正整数',
|
|
- trigger: 'blur',
|
|
|
|
- },
|
|
|
|
|
|
+ trigger: 'blur'
|
|
|
|
+ }
|
|
]"
|
|
]"
|
|
>
|
|
>
|
|
<span style="color: #606266">
|
|
<span style="color: #606266">
|
|
@@ -326,7 +344,9 @@
|
|
v-model="form.limitExchangeNum"
|
|
v-model="form.limitExchangeNum"
|
|
placeholder="请输入领取上限"
|
|
placeholder="请输入领取上限"
|
|
>
|
|
>
|
|
- <template slot="append">张</template>
|
|
|
|
|
|
+ <template slot="append"
|
|
|
|
+ >张</template
|
|
|
|
+ >
|
|
</el-input>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -367,12 +387,20 @@
|
|
import { addSysCoupon, resetSysCoupon } from "./api.js";
|
|
import { addSysCoupon, resetSysCoupon } from "./api.js";
|
|
import { couponTypeList, coupontypeDetailList } from "@/utils/searchArray";
|
|
import { couponTypeList, coupontypeDetailList } from "@/utils/searchArray";
|
|
import { getTimes } from "@/utils";
|
|
import { getTimes } from "@/utils";
|
|
|
|
+const mallTypeList = [
|
|
|
|
+ {
|
|
|
|
+ value: "MALLCOUPON",
|
|
|
|
+ label: "商城"
|
|
|
|
+ }
|
|
|
|
+];
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
couponTypeList,
|
|
couponTypeList,
|
|
coupontypeDetail: coupontypeDetailList,
|
|
coupontypeDetail: coupontypeDetailList,
|
|
form: {
|
|
form: {
|
|
|
|
+ useSystem: "",
|
|
|
|
+ typeDetail: null,
|
|
name: "",
|
|
name: "",
|
|
description: "",
|
|
description: "",
|
|
type: "FULL_REDUCTION",
|
|
type: "FULL_REDUCTION",
|
|
@@ -384,27 +412,31 @@ export default {
|
|
warningStockNum: "",
|
|
warningStockNum: "",
|
|
limitExchangeNum: "",
|
|
limitExchangeNum: "",
|
|
getTime: [],
|
|
getTime: [],
|
|
- organId: [],
|
|
|
|
|
|
+ organId: []
|
|
},
|
|
},
|
|
activeRow: null,
|
|
activeRow: null,
|
|
isDisabled: false,
|
|
isDisabled: false,
|
|
title: "新增优惠券",
|
|
title: "新增优惠券",
|
|
- warningStockNum: "",
|
|
|
|
|
|
+ warningStockNum: ""
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
this.$store.dispatch("setBranchs");
|
|
this.$store.dispatch("setBranchs");
|
|
if (this.$route.query.row) {
|
|
if (this.$route.query.row) {
|
|
this.activeRow = JSON.parse(this.$route.query.row);
|
|
this.activeRow = JSON.parse(this.$route.query.row);
|
|
- let organIdStr =''
|
|
|
|
- if( this.activeRow.useCondition&&JSON.parse(this.activeRow.useCondition)&&JSON.parse(this.activeRow.useCondition).organId){
|
|
|
|
- organIdStr = JSON.parse(this.activeRow.useCondition).organId;
|
|
|
|
|
|
+ let organIdStr = "";
|
|
|
|
+ if (
|
|
|
|
+ this.activeRow.useCondition &&
|
|
|
|
+ JSON.parse(this.activeRow.useCondition) &&
|
|
|
|
+ JSON.parse(this.activeRow.useCondition).organId
|
|
|
|
+ ) {
|
|
|
|
+ organIdStr = JSON.parse(this.activeRow.useCondition).organId;
|
|
}
|
|
}
|
|
|
|
|
|
let organId = [];
|
|
let organId = [];
|
|
if (organIdStr) {
|
|
if (organIdStr) {
|
|
organId =
|
|
organId =
|
|
- organIdStr.split(",").map((item) => {
|
|
|
|
|
|
+ organIdStr.split(",").map(item => {
|
|
return Number(item);
|
|
return Number(item);
|
|
}) || [];
|
|
}) || [];
|
|
}
|
|
}
|
|
@@ -419,7 +451,7 @@ export default {
|
|
let endDate = this.activeRow.endDate;
|
|
let endDate = this.activeRow.endDate;
|
|
this.$set(this.form, "effectiveTime", [
|
|
this.$set(this.form, "effectiveTime", [
|
|
effectiveStartTime,
|
|
effectiveStartTime,
|
|
- effectiveExpireTime,
|
|
|
|
|
|
+ effectiveExpireTime
|
|
]);
|
|
]);
|
|
this.$set(this.form, "getTime", [startDate, endDate]);
|
|
this.$set(this.form, "getTime", [startDate, endDate]);
|
|
this.title = this.activeRow.name;
|
|
this.title = this.activeRow.name;
|
|
@@ -429,6 +461,30 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ onUseSystemChange(val) {
|
|
|
|
+ if (val === "MALL") {
|
|
|
|
+ this.coupontypeDetail.forEach(item => {
|
|
|
|
+ if (item.value === "MALLCOUPON") {
|
|
|
|
+ item.disabled = false;
|
|
|
|
+ } else {
|
|
|
|
+ item.disabled = true;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ } else if (val === "MEC") {
|
|
|
|
+ this.coupontypeDetail.forEach(item => {
|
|
|
|
+ if (item.value === "MALLCOUPON") {
|
|
|
|
+ item.disabled = true;
|
|
|
|
+ } else {
|
|
|
|
+ item.disabled = false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ this.form.typeDetail = null;
|
|
|
|
+ // 处理显示问题
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.$refs.form.clearValidate("typeDetail");
|
|
|
|
+ }, 0);
|
|
|
|
+ },
|
|
changeType(val) {
|
|
changeType(val) {
|
|
this.form.faceValue = "";
|
|
this.form.faceValue = "";
|
|
this.form.fullAmount = "";
|
|
this.form.fullAmount = "";
|
|
@@ -458,24 +514,24 @@ export default {
|
|
let endDate = this.activeRow.endDate;
|
|
let endDate = this.activeRow.endDate;
|
|
this.$set(this.form, "effectiveTime", [
|
|
this.$set(this.form, "effectiveTime", [
|
|
effectiveStartTime,
|
|
effectiveStartTime,
|
|
- effectiveExpireTime,
|
|
|
|
|
|
+ effectiveExpireTime
|
|
]);
|
|
]);
|
|
this.$set(this.form, "getTime", [startDate, endDate]);
|
|
this.$set(this.form, "getTime", [startDate, endDate]);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
async addCoupon() {
|
|
async addCoupon() {
|
|
- this.$refs.form.validate(async (some) => {
|
|
|
|
|
|
+ this.$refs.form.validate(async some => {
|
|
if (some) {
|
|
if (some) {
|
|
this.$confirm("您确定新增优惠券?", "提示", {
|
|
this.$confirm("您确定新增优惠券?", "提示", {
|
|
confirmButtonText: "确定",
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
cancelButtonText: "取消",
|
|
- type: "warning",
|
|
|
|
|
|
+ type: "warning"
|
|
})
|
|
})
|
|
.then(async () => {
|
|
.then(async () => {
|
|
try {
|
|
try {
|
|
let { effectiveTime, getTime, ...rest } = this.form;
|
|
let { effectiveTime, getTime, ...rest } = this.form;
|
|
let str = JSON.stringify({
|
|
let str = JSON.stringify({
|
|
- organId: this.form.organId.join(","),
|
|
|
|
|
|
+ organId: this.form.organId.join(",")
|
|
});
|
|
});
|
|
let params = {
|
|
let params = {
|
|
...rest,
|
|
...rest,
|
|
@@ -489,7 +545,7 @@ export default {
|
|
["startDate", "endDate"],
|
|
["startDate", "endDate"],
|
|
"YYYY-MM-DD HH:mm:ss"
|
|
"YYYY-MM-DD HH:mm:ss"
|
|
),
|
|
),
|
|
- useCondition:str,
|
|
|
|
|
|
+ useCondition: str
|
|
};
|
|
};
|
|
const res = await addSysCoupon(params);
|
|
const res = await addSysCoupon(params);
|
|
this.$message.success("新增成功");
|
|
this.$message.success("新增成功");
|
|
@@ -503,18 +559,18 @@ export default {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
resetCoupon() {
|
|
resetCoupon() {
|
|
- this.$refs.form.validate(async (some) => {
|
|
|
|
|
|
+ this.$refs.form.validate(async some => {
|
|
if (some) {
|
|
if (some) {
|
|
this.$confirm("您确定修改优惠券?", "提示", {
|
|
this.$confirm("您确定修改优惠券?", "提示", {
|
|
confirmButtonText: "确定",
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
cancelButtonText: "取消",
|
|
- type: "warning",
|
|
|
|
|
|
+ type: "warning"
|
|
})
|
|
})
|
|
.then(async () => {
|
|
.then(async () => {
|
|
try {
|
|
try {
|
|
let { effectiveTime, getTime, ...rest } = this.form;
|
|
let { effectiveTime, getTime, ...rest } = this.form;
|
|
let str = JSON.stringify({
|
|
let str = JSON.stringify({
|
|
- organId: this.form.organId.join(","),
|
|
|
|
|
|
+ organId: this.form.organId.join(",")
|
|
});
|
|
});
|
|
|
|
|
|
let params = {
|
|
let params = {
|
|
@@ -529,7 +585,7 @@ export default {
|
|
["startDate", "endDate"],
|
|
["startDate", "endDate"],
|
|
"YYYY-MM-DD HH:mm:ss"
|
|
"YYYY-MM-DD HH:mm:ss"
|
|
),
|
|
),
|
|
- useCondition: str,
|
|
|
|
|
|
+ useCondition: str
|
|
};
|
|
};
|
|
const res = await resetSysCoupon(params);
|
|
const res = await resetSysCoupon(params);
|
|
this.$message.success("修改成功");
|
|
this.$message.success("修改成功");
|
|
@@ -548,8 +604,8 @@ export default {
|
|
} else {
|
|
} else {
|
|
this.form[type] = null;
|
|
this.form[type] = null;
|
|
}
|
|
}
|
|
- },
|
|
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|