|
@@ -15,14 +15,20 @@ const props = defineProps({
|
|
|
default:[]
|
|
|
},
|
|
|
})
|
|
|
+const rules = {
|
|
|
+ SourceId:[{required:true,message:'请选择品种'}],
|
|
|
+ Price:[{required:true,message:'请输入价格'}],
|
|
|
+ ProductName:[{required:true,message:'请输入套餐名称'}],
|
|
|
+ ValidDays:[{required:true,message:'请输入有效时长'}],
|
|
|
+}
|
|
|
const emits = defineEmits(["close"])
|
|
|
const formRef = ref(null)
|
|
|
const packageData = reactive({
|
|
|
- SourceId:'',
|
|
|
+ SourceId:null,
|
|
|
Type:'',
|
|
|
ProductName:'',
|
|
|
CoverSrc:'',
|
|
|
- ValidDays:'',
|
|
|
+ ValidDays:null,
|
|
|
Price:'',
|
|
|
Description:'',
|
|
|
RiskLevel:'',
|
|
@@ -37,7 +43,7 @@ watch(show,(newval)=>{
|
|
|
}
|
|
|
}else{
|
|
|
Object.assign(packageData,{
|
|
|
- SourceId:'',
|
|
|
+ SourceId:null,
|
|
|
Type:'',
|
|
|
ProductName:'',
|
|
|
CoverSrc:'',
|
|
@@ -67,6 +73,9 @@ function getRiskLevel() {
|
|
|
|
|
|
|
|
|
async function handleSubmitForm() {
|
|
|
+ try{
|
|
|
+ await formRef.value?.validate()
|
|
|
+ }catch(e){ return }
|
|
|
const packageParams = {
|
|
|
SourceId:Array.isArray(packageData.SourceId) ? packageData.SourceId[packageData.SourceId.length-1] : packageData.SourceId,
|
|
|
Type: 'package',
|
|
@@ -124,9 +133,9 @@ function handleValidPrice() {
|
|
|
:title="isAdd?'添加套餐':'编辑'"
|
|
|
>
|
|
|
<div class="dialog-content">
|
|
|
- <el-form label-width="100px" ref="formRef" class="form">
|
|
|
+ <el-form label-width="100px" ref="formRef" :model="packageData" class="form" :rules="rules">
|
|
|
<div class="left">
|
|
|
- <el-form-item label="品种">
|
|
|
+ <el-form-item label="品种" prop="SourceId" :label-width="150">
|
|
|
<!-- <el-input v-model="packageData.Price" placeholder="请选择品种" /> -->
|
|
|
<el-cascader
|
|
|
filterable
|
|
@@ -143,13 +152,13 @@ function handleValidPrice() {
|
|
|
clearable>
|
|
|
</el-cascader>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="套餐名称">
|
|
|
+ <el-form-item label="套餐名称" prop="ProductName" :label-width="150">
|
|
|
<el-input v-model="packageData.ProductName" placeholder="请输入套餐名称"/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="商品价格(元)">
|
|
|
+ <el-form-item label="商品价格(元)" prop="Price" :label-width="150">
|
|
|
<el-input v-model="packageData.Price" placeholder="请输入价格" @keyup="handleValidPrice()"/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="有效时长(天)">
|
|
|
+ <el-form-item label="有效时长(天)" prop="ValidDays" :label-width="150">
|
|
|
<el-input v-model="packageData.ValidDays" min="0" class="no-spinner" placeholder="请输入有效时长" @keyup="handleValidValidDays()" />
|
|
|
</el-form-item>
|
|
|
<div class="tips" v-if="!isAdd">
|