|
@@ -9,6 +9,9 @@
|
|
|
<el-option v-for="shop in shopList" :key="shop.shopId" :label="shop.shopName" :value="shop.shopId"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="商家免单比例(现金)" prop="shopExemptionRatio">
|
|
|
+ <el-input placeholder="请填写免单比例,范围0 - 1,保留两位小数" v-model="form.shopExemptionRatio"></el-input>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="发起方" prop="isPlatformInit">
|
|
|
<el-radio-group size="mini" v-model="form.isPlatformInit">
|
|
|
<el-radio :label="1">平台</el-radio>
|
|
@@ -39,11 +42,27 @@ export default {
|
|
|
id: undefined,
|
|
|
activitiesName: '', // 活动名称
|
|
|
shopIds: [],
|
|
|
- isPlatformInit: 1 // 是否为平台发起 0:商家
|
|
|
+ isPlatformInit: 1, // 是否为平台发起 0:商家
|
|
|
+ shopExemptionRatio: ''
|
|
|
},
|
|
|
rules: {
|
|
|
activitiesName: [{ required: true, message: '请输入活动名称', trigger: 'blur' }],
|
|
|
shopIds: [{ required: true, type: 'array', message: '请选择商家', trigger: 'change' }],
|
|
|
+ shopExemptionRatio: [
|
|
|
+ { required: true, message: '请填写商家免单比例', trigger: 'blur' },
|
|
|
+ {
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ if (value === undefined || value === '') {
|
|
|
+ callback(new Error('请输入 aaa 值'))
|
|
|
+ } else if (isNaN(value) || value < 0 || value > 1) {
|
|
|
+ callback(new Error('免单比例值必须是 0 到 1 之间的小数'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
+ ],
|
|
|
isPlatformInit: [{ required: true, message: '请选择是否是平台发起', trigger: 'change' }]
|
|
|
},
|
|
|
shopList: [],
|
|
@@ -59,8 +78,9 @@ export default {
|
|
|
this.form.isPlatformInit = Number(row.isPlatformInit)
|
|
|
this.form.activitiesName = row.activitiesName
|
|
|
this.form.shopIds = row.shopIds ? row.shopIds.split(',') : []
|
|
|
+ this.form.shopExemptionRatio = row.shopExemptionRatio || ''
|
|
|
this.dialogTitle = '编辑排队免单'
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
this.dialogTitle = '新增排队免单'
|
|
|
}
|
|
|
this.freeQueuingModalVisible = true
|
|
@@ -97,6 +117,7 @@ export default {
|
|
|
await this.$refs.freeQueuingModalRef.validate()
|
|
|
const api = this.form.id ? updateFreeQueuingApi : createFreeQueuingApi
|
|
|
const data = JSON.parse(JSON.stringify(this.form))
|
|
|
+ data.shopExemptionRatio = (data.shopExemptionRatio * 1).toFixed(2)
|
|
|
data.shopIds = data.shopIds.join(',')
|
|
|
await api(data)
|
|
|
this.$message.success(data.id ? '编辑成功' : '发起排队免单成功')
|
|
@@ -122,7 +143,8 @@ export default {
|
|
|
id: undefined,
|
|
|
activitiesName: '', // 活动名称
|
|
|
shopIds: [],
|
|
|
- isPlatformInit: 1 // 是否为平台发起 0:商家
|
|
|
+ isPlatformInit: 1, // 是否为平台发起 0:商家
|
|
|
+ shopExemptionRatio: ""
|
|
|
}
|
|
|
}
|
|
|
}
|