+广告属性

This commit is contained in:
yulixing 2019-08-08 15:09:23 +08:00
parent dd8e50744f
commit ab71289373

View File

@ -102,6 +102,34 @@
/> />
<span class="ipt-tip"></span> <span class="ipt-tip"></span>
</el-form-item> </el-form-item>
<el-form-item
label="广告优先级"
prop="ad_sort"
>
<el-select
v-model="adForm.ad_sort"
placeholder="请选择广告优先级"
class="w100"
:disabled="!writeable"
>
<el-option
label="按固定次数推广"
:value="0"
/>
<el-option
label="个性化推荐"
:value="1"
/>
<el-option
label="长期推广"
:value="2"
/>
<el-option
label="系统默认推广"
:value="3"
/>
</el-select>
</el-form-item>
<el-form-item <el-form-item
label="广告标题" label="广告标题"
prop="ad_title" prop="ad_title"
@ -161,6 +189,7 @@
v-model="adForm.jump_status" v-model="adForm.jump_status"
:active-value="1" :active-value="1"
:inactive-value="0" :inactive-value="0"
:disabled="!writeable"
> >
</el-switch> </el-switch>
</el-form-item> </el-form-item>
@ -175,34 +204,17 @@
:disabled="!writeable" :disabled="!writeable"
/> />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="广告优先级" label="是否抖动"
prop="ad_sort" prop="ad_property.is_shake"
> >
<el-select <el-switch
v-model="adForm.ad_sort" v-model="adForm.ad_property.is_shake"
placeholder="请选择广告优先级" :active-value="1"
class="w100" :inactive-value="0"
:disabled="!writeable" :disabled="!writeable"
> >
<el-option </el-switch>
label="按固定次数推广"
:value="0"
/>
<el-option
label="个性化推荐"
:value="1"
/>
<el-option
label="长期推广"
:value="2"
/>
<el-option
label="系统默认推广"
:value="3"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@ -211,7 +223,10 @@
@click="submit('adForm')" @click="submit('adForm')"
v-if="writeable" v-if="writeable"
>提交</el-button> >提交</el-button>
<el-button @click="resetForm('adForm')" v-if="writeable">重置</el-button> <el-button
@click="resetForm('adForm')"
v-if="writeable"
>重置</el-button>
<el-button @click="goBack">返回</el-button> <el-button @click="goBack">返回</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -265,7 +280,10 @@ export default {
ad_sort: 0, ad_sort: 0,
status: 0, status: 0,
dateRange: [], dateRange: [],
companyid: 0 companyid: 0,
ad_property: {
is_shake: 0
} //
}, },
adFormRules: { adFormRules: {
name: [{ required: true, message: '请输入广告名称', trigger: 'blur' }], name: [{ required: true, message: '请输入广告名称', trigger: 'blur' }],
@ -286,7 +304,10 @@ export default {
{ required: true, validator: validateJumpParams, trigger: 'blur' } { required: true, validator: validateJumpParams, trigger: 'blur' }
], ],
ad_num: [ ad_num: [
{ type: 'number', message: '计划书必须是数值', trigger: 'blur' } { type: 'number', message: '计划数必须是数值', trigger: 'blur' }
],
'ad_property.is_shake': [
{ type: 'number', message: '该项必须是数值', trigger: 'blur' }
] ]
} }
} }
@ -296,10 +317,6 @@ export default {
this.modeList = modeList this.modeList = modeList
this.typeList = typeList this.typeList = typeList
const areaListRes = await this.getAdAreaList() const areaListRes = await this.getAdAreaList()
areaListRes.adAreaList.map(item => { areaListRes.adAreaList.map(item => {
this.areaList[item.area_id] = item.name this.areaList[item.area_id] = item.name
@ -336,6 +353,15 @@ export default {
this.formDate(adData.end_time) this.formDate(adData.end_time)
] ]
this.adForm = adData this.adForm = adData
this.adForm.ad_property = this.adForm.ad_property
? JSON.parse(this.adForm.ad_property)
: ''
if (typeof this.adForm.ad_property !== 'object') {
this.adForm.ad_property = {
is_shake: 0
}
}
const gameid = this.adForm.gameid const gameid = this.adForm.gameid
const locationid = this.adForm.locationid const locationid = this.adForm.locationid
this.changePlatform(this.adForm.channelid) this.changePlatform(this.adForm.channelid)
@ -355,10 +381,9 @@ export default {
this.changeGame() this.changeGame()
} }
// 广 // 广
this.writeable = (this.adForm.status === 2 || !hasAd) ? true : false this.writeable = this.adForm.status === 2 || !hasAd ? true : false
}, },
methods: { methods: {
// common // common
@ -513,6 +538,9 @@ export default {
this.$message.error('请按要求填写表单') this.$message.error('请按要求填写表单')
return return
} }
this.adForm.ad_property = JSON.stringify(this.adForm.ad_property)
this.adForm.begin_time = this.adForm.dateRange[0] this.adForm.begin_time = this.adForm.dateRange[0]
this.adForm.end_time = this.adForm.dateRange[1] this.adForm.end_time = this.adForm.dateRange[1]
// delete this.adForm.dateRange // delete this.adForm.dateRange