|
@@ -24,6 +24,43 @@
|
|
|
</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-form-item
|
|
|
+ label="可用分部"
|
|
|
+ prop="organId"
|
|
|
+ :rules="[{ required: true, message: '请选择可用分部' }]"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ style="width: 100% !important"
|
|
|
+ class="multiple"
|
|
|
+ v-model.trim="form.organId"
|
|
|
+ filterable
|
|
|
+ multiple
|
|
|
+ clearable
|
|
|
+ placeholder="请选择分部"
|
|
|
+
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in selects.branchs"
|
|
|
+ :key="index"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col style="width: 500px">
|
|
|
<el-form-item
|
|
|
label="描述"
|
|
|
prop="description"
|
|
@@ -202,7 +239,10 @@
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col style="width: 395px" v-if="form.effectiveType == 'TIME_BUCKET'">
|
|
|
+ <el-col
|
|
|
+ style="width: 395px"
|
|
|
+ v-if="form.effectiveType == 'TIME_BUCKET'"
|
|
|
+ >
|
|
|
<el-form-item
|
|
|
prop="effectiveTime"
|
|
|
:rules="[{ required: true, message: '请选择有效期' }]"
|
|
@@ -258,18 +298,7 @@
|
|
|
>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <!-- <el-col style="width: 395px">
|
|
|
- <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> -->
|
|
|
+
|
|
|
<el-col style="width: 395px">
|
|
|
<el-form-item
|
|
|
prop="limitExchangeNum"
|
|
@@ -354,6 +383,7 @@ export default {
|
|
|
warningStockNum: "",
|
|
|
limitExchangeNum: "",
|
|
|
getTime: [],
|
|
|
+ organId: [],
|
|
|
},
|
|
|
activeRow: null,
|
|
|
isDisabled: false,
|
|
@@ -362,9 +392,19 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
+ this.$store.dispatch("setBranchs");
|
|
|
if (this.$route.query.row) {
|
|
|
this.activeRow = JSON.parse(this.$route.query.row);
|
|
|
- this.form = { ...this.activeRow };
|
|
|
+ let organIdStr = JSON.parse(this.activeRow.useCondition).organId;
|
|
|
+ let organId = [];
|
|
|
+ if (organIdStr) {
|
|
|
+ organId =
|
|
|
+ organIdStr.split(",").map((item) => {
|
|
|
+ return Number(item);
|
|
|
+ }) || [];
|
|
|
+ }
|
|
|
+
|
|
|
+ this.form = { ...this.activeRow, organId };
|
|
|
// 优惠券只能时满减
|
|
|
this.form.type = "FULL_REDUCTION";
|
|
|
|
|
@@ -400,7 +440,13 @@ export default {
|
|
|
resetForm() {
|
|
|
this.$refs.form.resetFields();
|
|
|
if (this.activeRow) {
|
|
|
- this.form = { ...this.activeRow };
|
|
|
+ let organIdStr = JSON.parse(this.activeRow.useCondition);
|
|
|
+ let organId = [];
|
|
|
+ if (organIdStr) {
|
|
|
+ organId = organIdStr.split(",") || [];
|
|
|
+ }
|
|
|
+
|
|
|
+ this.form = { ...this.activeRow, organId };
|
|
|
let effectiveStartTime = this.activeRow.effectiveStartTime;
|
|
|
let effectiveExpireTime = this.activeRow.effectiveExpireTime;
|
|
|
let startDate = this.activeRow.startDate;
|
|
@@ -423,6 +469,9 @@ export default {
|
|
|
.then(async () => {
|
|
|
try {
|
|
|
let { effectiveTime, getTime, ...rest } = this.form;
|
|
|
+ let str = JSON.stringify({
|
|
|
+ organId: this.form.organId.join(","),
|
|
|
+ });
|
|
|
let params = {
|
|
|
...rest,
|
|
|
...getTimes(
|
|
@@ -435,6 +484,7 @@ export default {
|
|
|
["startDate", "endDate"],
|
|
|
"YYYY-MM-DD HH:mm:ss"
|
|
|
),
|
|
|
+ useCondition:str,
|
|
|
};
|
|
|
const res = await addSysCoupon(params);
|
|
|
this.$message.success("新增成功");
|
|
@@ -458,6 +508,10 @@ export default {
|
|
|
.then(async () => {
|
|
|
try {
|
|
|
let { effectiveTime, getTime, ...rest } = this.form;
|
|
|
+ let str = JSON.stringify({
|
|
|
+ organId: this.form.organId.join(","),
|
|
|
+ });
|
|
|
+
|
|
|
let params = {
|
|
|
...rest,
|
|
|
...getTimes(
|
|
@@ -470,9 +524,10 @@ export default {
|
|
|
["startDate", "endDate"],
|
|
|
"YYYY-MM-DD HH:mm:ss"
|
|
|
),
|
|
|
+ useCondition: str,
|
|
|
};
|
|
|
const res = await resetSysCoupon(params);
|
|
|
- this.$message.success("新增成功");
|
|
|
+ this.$message.success("修改成功");
|
|
|
this.onCancel();
|
|
|
} catch (e) {
|
|
|
console.log(e);
|