活动分类

master
lion 2 years ago
parent 033173c8a8
commit 2c19ac9772

@ -2,5 +2,5 @@
ENV = 'development'
# base api
#VUE_APP_BASE_API = https://yybtest.ali251.langye.net/
VUE_APP_BASE_API = https://yunyubang.ali251.langye.net/
VUE_APP_BASE_API = https://yybtest.ali251.langye.net/
#VUE_APP_BASE_API = https://yunyubang.ali251.langye.net/

@ -0,0 +1,42 @@
import request from '@/utils/request'
export function index(params){
return request({
method:'get',
url:'/api/admin/active-types/index',
params
})
}
export function show(params){
return request({
method:'get',
url:'/api/admin/active-types/show',
params
})
}
export function save(data){
return request({
method:'post',
url:'/api/admin/active-types/save',
data
})
}
export function store(data){
return request({
method:'post',
url:'/api/admin/active-types/store',
data
})
}
export function destroy(data){
return request({
method:'post',
url:'/api/admin/active-types/destroy',
data
})
}

@ -0,0 +1,93 @@
<template>
<div style="padding: 0 20px">
<div ref="lxHeader">
<lx-header icon="md-apps" text="活动关联方" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<slot>
<div style="display: flex;justify-content: flex-start;flex-wrap: wrap;">
<Button icon="ios-add" type="primary" style="margin-right: 10px;" @click="$refs['addActivityType'].isShow = true,$refs['addActivityType'].type = 'add'">添加</Button>
</div>
</slot>
</lx-header>
</div>
<xy-table
:list="list"
:total="total"
:table-item="table"
:isPage='false'
@delete="deleteActivity"
@editor="editorActivity"></xy-table>
<addActivityType ref="addActivityType" @refresh="getActivities"></addActivityType>
</div>
</template>
<script>
import {index,destroy} from "@/api/activityType"
import addActivityType from '@/views/activity/component/addActivityType'
import { Message } from 'element-ui'
export default {
components:{
addActivityType
},
data() {
return {
select:{
pageSize:99,
pageIndex:1
},
total:0,
list:[],
table:[
{
label:"分类名称",
prop:'name',
align:'left',
},
{
label:"id",
// width: 220,
prop:'id',
align:'left',
// fixed:'left',
}
]
}
},
methods: {
async getActivities(){
const res = await index({
rows:this.select.pageSize,
page:this.select.pageIndex
})
this.list = res
// this.total = res.total
},
deleteActivity(row){
destroy({id:row.id}).then(res => {
Message({
type:'success',
message:'删除成功'
})
this.getActivities()
})
},
editorActivity(row){
this.$refs['addActivityType'].id = row.id
this.$refs['addActivityType'].editName = row.name
this.$refs['addActivityType'].type = 'editor'
this.$refs['addActivityType'].isShow = true
}
},
mounted() {
this.getActivities()
}
}
</script>
<style scoped lang="scss">
</style>

@ -147,6 +147,40 @@
</div>
</div>
</template>
<template v-slot:active_type_id>
<div class="xy-table-item">
<div class="xy-table-item-label">
活动分类
</div>
<div class="xy-table-item-content">
<el-select style="width: 300px;" v-model="form.active_type_id" placeholder="请选择">
<el-option
v-for="item in activeTypeList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:template>
<div class="xy-table-item">
<div class="xy-table-item-label">
活动模板
</div>
<div class="xy-table-item-content">
<el-select style="width: 300px;" v-model="form.template" placeholder="请选择">
<el-option
v-for="item in [{value:'旧',label:'旧'},{value:'新',label:'新'}]"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:date>
<div class="xy-table-item">
<div class="xy-table-item-label">
@ -339,6 +373,7 @@
<script>
import {index as companyIndex} from "@/api/activitycompany"
import {store,show,save} from "@/api/activity"
import {index as indexType} from "@/api/activityType"
import { Message } from 'element-ui'
import { getparameter } from "@/api/system/dictionary";
import xyTinymce from "@/components/XyTinymce/index.vue";
@ -350,6 +385,7 @@ export default {
},
data() {
return {
activeTypeList:[],
isShow:false,
type:'add',
id:'',
@ -365,13 +401,15 @@ companykeyword:"",
recommend:"",
//slogan:"",
active_tag:'',
active_type_id:'',
template:'',
date:"",
applyDate:[],
address:'',
relationName:"",
phoneNumber:"",
group:"",
memberSum:"",
memberSum:"",
startMemberSum:"",
greatServices:"",
@ -492,6 +530,7 @@ companykeyword:"",
this.getLabels()
},
methods: {
//
uploadFail(err){
console.log(err)
@ -521,6 +560,8 @@ companykeyword:"",
number: "activeCompanyType",
});
this.types = res?.detail;
const res1 = await indexType()
this.activeTypeList = res1
},
async getCompanys(){
@ -554,6 +595,8 @@ companykeyword:"",
recommend:res.recommend,
//slogan:res.slogan,
active_tag:res?.active_tag,
active_type_id:res?.active_type_id,
template:res?.template,
date:[`${res.start_date}/${res.start_time}`,`${res.end_date}/${res.end_time}`],
address:res.address,
relationName:res.relation_name,
@ -607,6 +650,8 @@ companykeyword:"",
recommend:this.form.recommend,
//slogan:this.form.slogan,
active_tag:this.form.active_tag,
active_type_id:this.form.active_type_id,
template:this.form.template,
start_date:this.form.date[0]?.split('/')[0],
start_time:this.form.date[0]?.split('/')[1],
end_date:this.form.date[1]?.split('/')[0],
@ -647,6 +692,8 @@ companykeyword:"",
recommend:this.form.recommend,
//slogan:this.form.slogan,
active_tag:this.form.active_tag,
active_type_id:this.form.active_type_id,
template:this.form.template,
start_date:this.form.date[0]?.split('/')[0],
start_time:this.form.date[0]?.split('/')[1],
end_date:this.form.date[1]?.split('/')[0],

@ -0,0 +1,154 @@
<template>
<div>
<xy-dialog ref="dialog" :is-show.sync="isShow" type="form" :title="type === 'add' ? '新增活动分类' : '编辑活动分类'" :form="form" :rules="rules" @submit="submit">
<template v-slot:name>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>分类名称
</div>
<div class="xy-table-item-content">
<el-input v-model="form.name" placeholder="请输入活动分类名称" clearable style="width: 300px;"></el-input>
</div>
</div>
</template>
</xy-dialog>
</div>
</template>
<script>
import {store,show,save} from "@/api/activityType"
import { Message } from 'element-ui'
export default {
data() {
return {
isShow:false,
type:'add',
id:'',
editName:'',
// types:[],
form:{
name:"",
},
rules:{
name:[
{required:true,message:'请输入活动分类名称'}
],
}
}
},
created(){
},
methods: {
async getDetail(){
// const res = await show({id:this.id})
this.form = {
name:this.editName,
}
},
submit(){
if(this.type === 'add'){
store({
pid:0,
name:this.form.name,
}).then(res => {
Message({
type:'success',
message:'新增活动分类成功'
})
this.isShow = false
this.$emit('refresh')
})
return
}
if(this.type === 'editor'){
save({
pid:0,
id:this.id,
name:this.form.name
}).then(res => {
Message({
type:'success',
message:'编辑活动分类成功'
})
this.isShow = false
this.$emit('refresh')
})
}
}
},
watch:{
isShow(newVal){
if(newVal){
if(this.type === 'editor'){
this.getDetail()
}
}else{
this.id = ''
this.type = ''
this.editName = ''
this.$refs['dialog'].reset()
}
}
}
}
</script>
<style scoped lang="scss">
.xy-table-item-label{
width: 160px;
}
.img__delete{
transform: scale(0.8,0.8);
position: absolute;
top: 4px;
right: 4px;
}
::v-deep .avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
::v-deep .avatar-uploader .el-upload:hover {
border-color: #409EFF;
}
::v-deep .el-upload--picture-card {
font-size: 28px;
color: #8c939d;
width: 80px !important;
height: 80px !important;
line-height: 80px !important;
text-align: center;
}
::v-deep .avatar-uploader-icon{
font-size: 28px;
color: #8c939d;
width: 80px !important;
height: 80px !important;
line-height: 80px !important;
text-align: center;
}
::v-deep .avatar {
width: 80px !important;
display: block;
border-radius: 6px;
}
::v-deep .xy-table-item-label{
width: 160px !important;
}
::v-deep .el-date-editor .el-range-separator{
width: auto !important;
}
::v-deep .el-input-number .el-input__inner{
text-align: left !important;
}
</style>

@ -236,7 +236,8 @@
prop: "order_name",
label: "订单名称",
width: 220,
align: 'left'
align: 'left',
fixed: 'left'
},
{
prop: 'bookable_name',

Loading…
Cancel
Save