广告和协议功能

This commit is contained in:
SjS 2025-04-10 10:46:25 +08:00
parent 3d031b4278
commit 7fbec55ac3
2 changed files with 39 additions and 16 deletions

View File

@ -50,7 +50,7 @@
<dict-tag :options="dict.type.ad_belong" :value="scope.row.belong"/> <dict-tag :options="dict.type.ad_belong" :value="scope.row.belong"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="所属运营区" align="center" prop="area_name"> <el-table-column label="所属运营区" align="center" prop="areaName">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.areaName || '-' }}</span> <span>{{ scope.row.areaName || '-' }}</span>
</template> </template>
@ -97,13 +97,13 @@
<!-- 添加或修改广告对话框 --> <!-- 添加或修改广告对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" label-width="80px"> <el-form ref="form" :model="form" label-width="80px" v-loading="detailLoading">
<el-form-item label="运营区" prop="areaId" > <el-form-item label="运营区" prop="areaId" >
<area-remote-select <area-remote-select
v-model="form.areaId" v-model="form.areaId"
:init-options="initAreaOptions"
v-if="!detailLoading"
placeholder="请选择运营区" placeholder="请选择运营区"
clearable
@change="handleQuery"
style="width: 58%" style="width: 58%"
/> />
</el-form-item> </el-form-item>
@ -161,6 +161,12 @@ const defaultSort = {
export default { export default {
name: "Ad", name: "Ad",
dicts:['ad_type','ad_url_type','ad_belong'], dicts:['ad_type','ad_url_type','ad_belong'],
props:{
id: {
type: [String, Number],
default: null
},
},
mixins: [$showColumns], mixins: [$showColumns],
components: {AreaRemoteSelect, FormCol}, components: {AreaRemoteSelect, FormCol},
data() { data() {
@ -213,8 +219,14 @@ export default {
}, },
// //
form: {}, form: {},
detailLoading: false,
}; };
}, },
computed:{
initAreaOptions() {
return [{id: this.form.areaId, name: this.form.areaName}]
},
},
created() { created() {
this.getList(); this.getList();
}, },
@ -289,10 +301,13 @@ export default {
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const adId = row.adId || this.ids const adId = row.adId || this.ids
this.detailLoading = true;
getAd(adId).then(response => { getAd(adId).then(response => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改广告"; this.title = "修改广告";
}).finally(() => {
this.detailLoading = false;
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */

View File

@ -117,20 +117,19 @@
<!-- 添加或修改协议对话框 --> <!-- 添加或修改协议对话框 -->
<el-dialog :title="title" :visible.sync="open" width="900px" append-to-body :close-on-click-modal="false"> <el-dialog :title="title" :visible.sync="open" width="900px" append-to-body :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px" v-loading="detailLoading">
<el-row> <el-form-item :span="24" label="标题" prop="title">
<form-col :span="24" label="标题" prop="title">
<el-input v-model="form.title" placeholder="请输入标题" /> <el-input v-model="form.title" placeholder="请输入标题" />
</form-col> </el-form-item>
<form-col label="运营区" prop="areaId"> <el-form-item label="运营区" prop="areaId" >
<area-remote-select <area-remote-select
v-model="form.areaId" v-model="form.areaId"
:init-options="initAreaOptions"
v-if="!detailLoading"
placeholder="请选择运营区" placeholder="请选择运营区"
clearable style="width: 58%"
@change="handleQuery"
style="width: 100%"
/> />
</form-col> </el-form-item>
<el-col :span="12"> <el-col :span="12">
<form-col label="协议类型" prop="agreementType"> <form-col label="协议类型" prop="agreementType">
<el-select <el-select
@ -168,8 +167,6 @@
<form-col :span="span" label="内容详情"> <form-col :span="span" label="内容详情">
<editor v-model="form.content" :min-height="200"/> <editor v-model="form.content" :min-height="200"/>
</form-col> </form-col>
</el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
@ -185,6 +182,7 @@ import { $showColumns } from '@/utils/mixins';
import FormCol from "@/components/FormCol/index.vue"; import FormCol from "@/components/FormCol/index.vue";
import Editor from "@/components/Editor/index.vue"; import Editor from "@/components/Editor/index.vue";
import AreaRemoteSelect from "@/components/Business/Area/AreaRemoteSelect.vue"; import AreaRemoteSelect from "@/components/Business/Area/AreaRemoteSelect.vue";
// //
const defaultSort = { const defaultSort = {
prop: "createTime", prop: "createTime",
@ -286,6 +284,7 @@ export default {
}, },
// //
form: {}, form: {},
detailLoading: false,
// //
rules: { rules: {
title: [ title: [
@ -294,6 +293,11 @@ export default {
} }
}; };
}, },
computed:{
initAreaOptions() {
return [{id: this.form.areaId, name: this.form.areaName}]
},
},
created() { created() {
this.getList(); this.getList();
}, },
@ -328,6 +332,7 @@ export default {
this.form = { this.form = {
id: null, id: null,
storeId: null, storeId: null,
areaName:null,
areaId: null, areaId: null,
title: null, title: null,
brief: null, brief: null,
@ -365,10 +370,13 @@ export default {
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const id = row.id || this.ids const id = row.id || this.ids
this.detailLoading = true
getAgreement(id).then(response => { getAgreement(id).then(response => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改协议"; this.title = "修改协议";
}).finally(()=>{
this.detailLoading = false;
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */