|
|
@@ -28,6 +28,18 @@
|
|
|
class="w100">
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="活动描述" prop="remark" class="w100">
|
|
|
+ <el-input
|
|
|
+ maxlength="500"
|
|
|
+ show-word-limit
|
|
|
+ type="textarea"
|
|
|
+ :rows="3"
|
|
|
+ v-model.trim="state.ruleForm.activityDesc"
|
|
|
+ placeholder="活动描述"
|
|
|
+ clearable
|
|
|
+ class="w100">
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="开始时间" prop="startTime">
|
|
|
<ext-date-picker
|
|
|
v-model.trim="state.ruleForm.startTime"
|
|
|
@@ -131,6 +143,70 @@
|
|
|
|
|
|
|
|
|
<el-divider content-position="left">关联权益</el-divider>
|
|
|
+ <el-button size="small" plain type="success" class="ml10" @click="handleAddRightsItem">
|
|
|
+ <SvgIcon name="ele-FolderAdd"/>
|
|
|
+ 新增权益
|
|
|
+ </el-button>
|
|
|
+
|
|
|
+ <el-card v-for="(rights,idx) in state.ruleForm.rechargeRightsList" :key="idx" class="mt10" shadow="hover">
|
|
|
+ <template #header>
|
|
|
+ <div class="card-header">
|
|
|
+ <el-button class="button" plain type="danger" size="small" v-auth="'activity.modify'" @click="handleRemoveRightsItem(idx)">删除</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <el-form-item label="权益描述" prop="rightsDesc" class="w100">
|
|
|
+ <el-input
|
|
|
+ maxlength="500"
|
|
|
+ show-word-limit
|
|
|
+ type="textarea"
|
|
|
+ :rows="2"
|
|
|
+ v-model.trim="rights.rightsDesc"
|
|
|
+ placeholder="权益描述"
|
|
|
+ clearable
|
|
|
+ class="w100">
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="最小充值金额" prop="amountMin" >
|
|
|
+ <el-input-number
|
|
|
+ controls-position="right"
|
|
|
+ v-model.trim="rights.amountMin"
|
|
|
+ placeholder="最小充值金额"
|
|
|
+ clearable
|
|
|
+ :min="0"
|
|
|
+ class="wd200">
|
|
|
+ </el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="最大充值金额" prop="amountMin" >
|
|
|
+ <el-input-number
|
|
|
+ controls-position="right"
|
|
|
+ v-model.trim="rights.amountMax"
|
|
|
+ placeholder="最大充值金额"
|
|
|
+ clearable
|
|
|
+ :min="0"
|
|
|
+ class="wd200">
|
|
|
+ </el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <el-form-item label="折扣" prop="amountMin" >
|
|
|
+ <el-input
|
|
|
+ type="number"
|
|
|
+ v-model.trim="rights.discount"
|
|
|
+ placeholder="折扣:100代表无折扣,75代表75折"
|
|
|
+ clearable
|
|
|
+ class="wd200">
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-card>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
@@ -160,7 +236,8 @@ const formRef = ref();
|
|
|
const initState = () => ({
|
|
|
action:'',
|
|
|
ruleForm: {
|
|
|
- id: 0
|
|
|
+ id: 0,
|
|
|
+ rechargeRightsList:[] as Array<any>
|
|
|
},
|
|
|
btnLoading: false,
|
|
|
dialog: {
|
|
|
@@ -209,6 +286,16 @@ const onCancel = () => {
|
|
|
};
|
|
|
// 提交
|
|
|
const onSubmit = () => {
|
|
|
+ let rechargeRightsList = state.ruleForm.rechargeRightsList;
|
|
|
+ if(!u.isEmptyOrNull(rechargeRightsList)){
|
|
|
+ for (let i = 0; i < rechargeRightsList.length; i++){
|
|
|
+ const item: any = rechargeRightsList[i];
|
|
|
+ if(item.amountMin>item.amountMax){
|
|
|
+ Msg.message(`权益最小充值金额不能大于最大充值金额`,'error')
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
formRef.value.validate((valid:boolean) => {
|
|
|
if(valid){
|
|
|
state.btnLoading = true;
|
|
|
@@ -235,6 +322,7 @@ const handleFormChange = (formData: any) => {
|
|
|
const loadData = (id: number) => {
|
|
|
$get(`activity/${id}`).then((res: any) => {
|
|
|
state.ruleForm = res;
|
|
|
+ state.ruleForm.rechargeRightsList = res.rechargeRightsList||[]
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -246,6 +334,19 @@ const handleStationChange = (applyStation:number)=>{
|
|
|
|
|
|
}
|
|
|
|
|
|
+const handleAddRightsItem = ()=>{
|
|
|
+ state.ruleForm.rechargeRightsList.unshift({
|
|
|
+ rightsDesc:'',
|
|
|
+ amountMin:0,
|
|
|
+ amountMax:0,
|
|
|
+ discount:100,
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const handleRemoveRightsItem= (idx:number)=>{
|
|
|
+ state.ruleForm.rechargeRightsList.splice(idx,1)
|
|
|
+}
|
|
|
+
|
|
|
// 暴露变量
|
|
|
defineExpose({
|
|
|
open
|