This commit is contained in:
SjS 2025-04-27 15:23:10 +08:00
parent d13c81526d
commit 38091d2cf0
3 changed files with 113 additions and 14 deletions

View File

@ -51,3 +51,23 @@ export function handleAudit(data){
data: data
})
}
// 广告启用
export function enableAd(id) {
return request({
url: '/bst/ad/enable',
method: 'put',
data: id
})
}
// 广告禁用
export function disableAd(id) {
return request({
url: '/bst/ad/disable',
method: 'put',
data: id
})
}

View File

@ -305,7 +305,7 @@ export const BonusStatus = {
// 加盟商申请状态
export const MchApplyStatus = {
APPROVING: "1", // 审核中
PASSED: "2", // 审核通过
PASSED: "2", // 审核通过
REJECTED: "3", // 审核驳回
}
@ -317,6 +317,12 @@ export const FaultStatus = {
COMPLETED: "3", // 已完成
}
// 广告状态
export const AdStatus = {
DISABLED: "0", // 禁用
ENABLE: "1", // 启用
}
// 提现手续费类型
export const WithdrawServiceType = {
POINT: "1", // 按比例

View File

@ -71,6 +71,11 @@
</template>
</el-table-column>
<el-table-column label="跳转链接" align="center" prop="url" />
<el-table-column label="广告状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.ad_status" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
@ -88,14 +93,22 @@
@click="handleView(scope.row)"
v-else
>查看详情</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-view"-->
<!-- @click="handleView(scope.row)"-->
<!-- v-hasPermi="['bst:ad:edit']">-->
<!-- {{ scope.row.auditStatus === '1' ? '审核' : '查看详情' }}-->
<!-- </el-button>-->
<el-button
size="mini"
type="text"
icon="el-icon-close"
@click="handleDisable(scope.row)"
v-has-permi="['bst:ad:disable']"
v-show="AdStatus.ENABLE.includes(scope.row.status)"
>禁用</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-check"
@click="handleEnable(scope.row)"
v-has-permi="['bst:ad:enable']"
v-show="AdStatus.DISABLED.includes(scope.row.status)"
>启用</el-button>
<el-button
size="mini"
type="text"
@ -138,13 +151,16 @@
<el-descriptions-item label="广告图片" :span="2">
<image-preview :src="detailForm.picture" :width="100" :height="100" />
</el-descriptions-item>
<el-descriptions-item label="跳转链接" :span="24">{{ detailForm.url }}</el-descriptions-item>
<el-descriptions-item label="跳转类型" :span="2">
<dict-tag :options="dict.type.ad_url_type" :value="detailForm.urlType"/>
</el-descriptions-item>
<el-descriptions-item label="审核状态">
<dict-tag :value="detailForm.auditStatus" :options="dict.type.ad_audit_status"/>
</el-descriptions-item>
<el-descriptions-item label="广告状态">
<dict-tag :value="detailForm.status" :options="dict.type.ad_status"/>
</el-descriptions-item>
<el-descriptions-item label="跳转类型" :span="2">
<dict-tag :options="dict.type.ad_url_type" :value="detailForm.urlType"/>
</el-descriptions-item>
<el-descriptions-item label="跳转链接" :span="24">{{ detailForm.url }}</el-descriptions-item>
</el-descriptions>
</div>
<!-- 审核区块 -->
@ -205,6 +221,12 @@
<image-upload v-model="form.picture" :limit="1"/>
</div>
</el-form-item>
<el-form-item label="广告状态" prop="status">
<template>
<el-radio v-model="form.status" label="1">启用</el-radio>
<el-radio v-model="form.status" label="0">禁用</el-radio>
</template>
</el-form-item>
<el-form-item label="跳转类型" prop="urlType">
<el-select v-model="form.urlType" placeholder="请选择跳转类型">
<el-option
@ -237,6 +259,8 @@
import AreaRemoteSelect from "@/components/Business/Area/AreaRemoteSelect.vue";
import {isSysAdmin} from "@/utils/permission";
import {handleAudit} from "@/api/bst/ad";
import {AdStatus} from "@/utils/enums";
import {enableDevice} from "@/api/bst/device";
//
const defaultSort = {
@ -246,7 +270,7 @@
export default {
name: "Ad",
dicts:['ad_type','ad_url_type','ad_belong','ad_audit_status'],
dicts:['ad_type','ad_url_type','ad_belong','ad_audit_status','ad_status'],
props:{
id: {
type: [String, Number],
@ -271,6 +295,9 @@
//{key: 'urlType', visible: true, label: '12', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
],
rules: {
status: [
{ required: true, message: '广告状态不能为空', trigger: 'blur' }
],
picture: [
{ required: true, message: '广告图片不能为空', trigger: 'change' }
],
@ -315,6 +342,7 @@
picture: null,
url: null,
deleted: null,
status: null,
urlType: null,
belong: null
},
@ -324,6 +352,9 @@
};
},
computed:{
AdStatus() {
return AdStatus
},
initAreaOptions() {
return [{id: this.form.areaId, name: this.form.areaName}]
},
@ -437,6 +468,48 @@
this.open = true;
this.title = "添加广告";
},
// 广
handleEnable(row) {
let msg = '是否确认一键启用?';
let ids = this.ids;
if (row != null) {
ids = [row.id];
msg = '是否确认启用广告';
}
this.$confirm(msg, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
enableDevice(ids).then((res) => {
if (res.code === 200) {
this.$message.success("操作成功,共启用" + res.data + "台设备");
this.getList();
}
})
})
},
// 广
handleDisable(row) {
let msg = '是否确认一键启用?';
let ids = this.ids;
if (row != null) {
ids = [row.id];
msg = '是否确认启用广告?';
}
this.$confirm(msg, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
enableDevice(ids).then((res) => {
if (res.code === 200) {
this.$message.success("操作成功,共启用" + res.data + "台设备");
this.getList();
}
})
})
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();