刘翔宇-旅管家 3 years ago
parent 7d114add6c
commit b96a6146f4

@ -0,0 +1,34 @@
import request from "@/utils/request";
export function index(params) {
return request({
method: 'get',
url: '/api/admin/activity-list-config/index',
params
})
}
export function save(data) {
return request({
url: '/api/admin/activity-list-config/save',
method: 'post',
data
})
}
export function show(params) {
return request({
method: 'get',
url: '/api/admin/activity-list-config/show',
params
})
}
export function destroy(params) {
return request({
method: 'get',
url: '/api/admin/activity-list-config/destroy',
params
})
}

@ -1,7 +1,40 @@
<template>
<div>
<!-- 编辑-->
<xy-dialog :is-show.sync="isShow" title="活动配置" ref="addActivityConfig">
<xy-dialog :is-show.sync="isShow" title="活动配置" type="normal" ref="addActivityConfig" @on-ok="editor">
<div class="table-tree">
<div style="display: flex;justify-content: flex-end;margin-right: 20px;margin-bottom: 10px;">
<Button type="primary" @click="addRow()" size="small" style="margin-left: 10px;" ghost>新增参数</Button>
</div>
<el-table :data="list" height="400" class="v-table" style="width: 100%;margin-bottom: 20px;">
<el-table-column type="index" align="center">
</el-table-column>
<el-table-column prop="name" label="名称">
<template slot-scope="scope">
<el-input v-model="scope.row.name">
</el-input>
</template>
</el-table-column>
<el-table-column prop="key" label="标识" width="240">
<template slot-scope="scope">
<el-input v-model="scope.row.key">
</el-input>
</template>
</el-table-column>
<el-table-column prop="value" label="数据值" width="120">
<template slot-scope="scope">
<el-input v-model="scope.row.value">
</el-input>
</template>
</el-table-column>
<el-table-column label="操作" width="100" align="center">
<template slot-scope="scope">
<Button type="error" @click="delRow(scope.row,scope.$index)" size="small" style="margin-left: 10px;"
ghost>删除</Button>
</template>
</el-table-column>
</el-table>
</div>
</xy-dialog>
@ -9,8 +42,157 @@
</div>
</template>
<script>
import {
save,
show,
index,
destroy
} from "@/api/activity/components/addActivityConfig";
import {
show as activityInfo
} from "@/api/activity/index";
export default {
data() {
return {
isShow: false,
list: [{
name: "",
key: "",
value: ""
}],
detail: {},
id: ""
}
},
watch: {
isShow(newVal) {
if (newVal) {
this.load();
this.activityInfo();
}
}
},
methods: {
async activityInfo() {
let res = await activityInfo({
id: this.id
})
Object.assign(this.detail, res);
},
async load() {
let res = await index({
activity_list_id: this.id
})
this.list = res.data;
},
editor() {
this.list.map(item => {
item.activity_list_id = this.id
if (item.name != "" && item.key != "" && item.value != "") {
save(item).then(res => {
})
}
})
this.isShow = false
this.$Message.success("操作成功");
this.$emit('refresh')
},
addRow() {
this.list.push({
name: "",
key: "",
value: ""
})
},
delRow(obj, index) {
if (obj.id) {
destroy({
id: obj.id
}).then(response => {
this.$message.success("操作成功");
this.list.splice(index, 1);
}).catch(error => {
//reject(error)
this.$message.error("操作失败");
})
} else {
this.list.splice(index, 1);
}
}
},
computed: {
},
mounted() {
let that = this;
}
}
</script>
<style>
<style scoped lang="scss">
.contract-add-plan {
min-height: 30px;
border: 1px solid #dcdee2;
border-radius: 4px;
display: flex;
flex-wrap: wrap;
align-items: center;
align-content: center;
padding: 0 8px;
&-no-plan {
height: 30px;
line-height: 30px;
color: #CDD0D5;
}
}
.xy-table-item-label {
width: 140px;
}
.xy-table-item-price {
position: relative;
&::after {
z-index: 1;
position: absolute;
right: 0;
top: 0;
content: '(元)'
}
::v-deep .el-input__clear {
position: relative;
right: 30px;
z-index: 2;
}
}
.xy-table-item-price-wan {
position: relative;
&::after {
position: absolute;
right: 0;
top: 0;
content: '(万元)'
}
::v-deep .el-input__clear {
position: relative;
right: 46px;
z-index: 2;
}
}
</style>

@ -81,7 +81,8 @@
prop: 'total',
label: '总数',
align: 'right'
}, {
},
{
prop: 'rate',
label: '概率',
align: 'right'

@ -23,10 +23,11 @@
<xy-table :list="list" :table-item="table">
<template v-slot:btns>
<el-table-column fixed="right" header-align="center" label="操作" width="200">
<el-table-column fixed="right" header-align="center" align="center" label="操作" width="300">
<template slot-scope="scope">
<div class="slot-btns">
<Button type="primary" @click="edit(scope.row)"></Button>
<Button type="primary" @click="config(scope.row)" style="margin-left: 10px;">配置</Button>
<Button type="error" @click="deleteitem(scope.row)" style="margin-left: 10px;">删除</Button>
</div>
</template>
@ -35,6 +36,9 @@
</xy-table>
<addActivity ref="addActivity" @refresh="load()"></addActivity>
<addActivityConfig ref="addActivityConfig" @refresh="load()"></addActivityConfig>
</div>
</template>
@ -47,9 +51,12 @@
} from "@/api/activity/index";
import addActivity from '@/views/activity/components/addActivity'
import addActivityConfig from '@/views/activity/components/addActivityConfig'
export default {
components: {
addActivity
addActivity,
addActivityConfig
},
data() {
return {
@ -66,13 +73,13 @@
align: 'left',
fixed: 'left',
},{
}, {
prop: 'tag',
label: '活动标识',
align: 'left',
fixed: 'left',
}, {
}, {
prop: 'start_time',
label: '活动开始时间',
align: 'center'
@ -134,6 +141,11 @@
this.$refs['addActivity'].id = row.id;
this.$refs['addActivity'].isShow = true;
this.$refs['addActivity'].type = 'editor'
},
config(row){
this.$refs['addActivityConfig'].id = row.id;
this.$refs['addActivityConfig'].isShow = true;
this.$refs['addActivityConfig'].type = 'editor'
},
pageChange(e) {
this.select.page = e

Loading…
Cancel
Save