10 changed files with 409 additions and 432 deletions
@ -0,0 +1,66 @@ |
|||
import request from '@/utils/request' |
|||
const contentDetail = '/back/contentDetail' |
|||
|
|||
/** |
|||
* 查询内容详情列表 |
|||
* @param params |
|||
* @returns {Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function POST_QUERY_DETAIL(params) { |
|||
return request({ |
|||
url: `${contentDetail}/list`, |
|||
method: 'post', |
|||
data:params |
|||
}).then(res => { |
|||
return res.data |
|||
}) |
|||
} |
|||
|
|||
/** |
|||
* 删除内容详情 |
|||
* @param params |
|||
* @returns {Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DELETE_DETAIL(params) { |
|||
return request({ |
|||
url: `${contentDetail}/delete`, |
|||
method: 'post', |
|||
data:params |
|||
}).then(res => { |
|||
return res.data |
|||
}) |
|||
} |
|||
|
|||
/** |
|||
* 添加内容详情 |
|||
* @param params |
|||
* @returns {Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function ADD_DETAIL(params) { |
|||
return request({ |
|||
url: `${contentDetail}/add`, |
|||
method: 'post', |
|||
data:params |
|||
}).then(res => { |
|||
return res.data |
|||
}) |
|||
} |
|||
|
|||
/** |
|||
* 修改内容详情 |
|||
* @param params |
|||
* @returns {Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function UPDATE_DETAIL(params) { |
|||
return request({ |
|||
url: `${contentDetail}/update`, |
|||
method: 'post', |
|||
data:params |
|||
}).then(res => { |
|||
return res.data |
|||
}) |
|||
} |
@ -1,6 +1,6 @@ |
|||
<template> |
|||
<div class="container"> |
|||
<div class="title">修改轮播图</div> |
|||
<div class="title">{{ showAdd ? '添加' : '修改' }}轮播图</div> |
|||
<el-form :model="formLabelAlign" :rules="rules" ref="ruleForm" label-width="80px" class="demo-ruleForm"> |
|||
<el-form-item label="图片:" prop="url"> |
|||
<el-upload |
@ -1,60 +0,0 @@ |
|||
<template> |
|||
<div class="form-container"> |
|||
<el-form :inline="true" :model="formInline" class="demo-form-inline"> |
|||
<el-form-item label="场地"> |
|||
<el-select v-model="formInline.locationId" value="" placeholder="场地"> |
|||
<el-option label="全部" value=""></el-option> |
|||
<el-option v-for="item in locationId" :label="item.name" :value="item.id"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item style="padding-left:30px"> |
|||
<el-button type="default" @click="resetForm1('formInline')">重置</el-button> |
|||
<el-button type="primary" @click="onSubmit">查询</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import {GET_LOCATIONS} from '@/api/common' |
|||
|
|||
export default { |
|||
name: 'form-container', |
|||
props: ['label'], |
|||
data() { |
|||
return { |
|||
formInline: { |
|||
locationId: '' |
|||
}, |
|||
locationId: '' |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.getLocationId(); |
|||
}, |
|||
methods: { |
|||
getLocationId() { |
|||
GET_LOCATIONS().then(res => { |
|||
this.locationId = res |
|||
}) |
|||
}, |
|||
onSubmit() { |
|||
this.$emit('submit', this.formInline) |
|||
}, |
|||
resetForm1() { |
|||
this.formInline = { |
|||
name: '' |
|||
}; |
|||
this.$emit('resetForm'); |
|||
|
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
.form-container { |
|||
padding: 20px; |
|||
background: #fff; |
|||
} |
|||
</style> |
@ -0,0 +1,162 @@ |
|||
<template> |
|||
<div class="container"> |
|||
<div class="title">{{ showAdd ? '添加' : '修改' }}详情</div> |
|||
<el-form :model="formLabelAlign" :rules="rules" ref="ruleForm" label-width="80px" class="demo-ruleForm"> |
|||
<el-form-item label="位置:" prop="showPage"> |
|||
<el-cascader |
|||
v-model="formLabelAlign.showPage" |
|||
:props="props" |
|||
:options="tabList" |
|||
@change="handleChange"> |
|||
</el-cascader> |
|||
</el-form-item> |
|||
<el-form-item label="正文:" prop="content"> |
|||
<editor /> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button type="primary" @click="submit(formLabelAlign)">确定</el-button> |
|||
<el-button @click="$emit('close')">取消</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import Editor from './editor.vue'; |
|||
import {BASE_API} from '../../config'; |
|||
import {tabList} from '../../filters/code'; |
|||
import { |
|||
ADD_DETAIL, |
|||
UPDATE_DETAIL, |
|||
} from '@/api/carousel'; |
|||
import Alert from "@/utils/alert"; |
|||
|
|||
export default { |
|||
name: "detailsOfDistribution", |
|||
components: { |
|||
Editor, |
|||
}, |
|||
props: ['currList', 'showAdd'], |
|||
data() { |
|||
return { |
|||
labelPosition: 'right', |
|||
formLabelAlign: { |
|||
showPage: ['00', '0000'], |
|||
content: 0 |
|||
}, |
|||
BASE_API, |
|||
tabList, |
|||
props: { |
|||
value: 'code', |
|||
label: 'title', |
|||
children: 'children' |
|||
}, |
|||
rules: { |
|||
showPage: [ |
|||
{ type: 'array', required: true, message: '请选择位置', trigger: 'change' } |
|||
], |
|||
content: [ |
|||
{ required: true, message: '请选择状态', trigger: 'change' } |
|||
], |
|||
} |
|||
} |
|||
}, |
|||
|
|||
mounted() { |
|||
if(this.currList && this.currList && !this.showAdd){ |
|||
const { id, showPage, content } = this.currList |
|||
this.formLabelAlign.id = id; |
|||
this.formLabelAlign.showPage.splice(0, 1, showPage.slice(0, 2)) |
|||
this.formLabelAlign.showPage.splice(1, 1, showPage) |
|||
this.formLabelAlign.content = content; |
|||
}else{ |
|||
const code = localStorage.getItem('code') |
|||
if(!code) return |
|||
this.formLabelAlign.showPage.splice(0, 1, code.slice(0, 2)) |
|||
this.formLabelAlign.showPage.splice(1, 1, code) |
|||
} |
|||
}, |
|||
|
|||
methods: { |
|||
// 位置选择 |
|||
handleChange(value) { |
|||
this.formLabelAlign.showPage = value |
|||
}, |
|||
|
|||
submit(formName) { |
|||
this.$refs.ruleForm.validate((valid) => { |
|||
if (valid) { |
|||
if(this.showAdd){ |
|||
this.addCarousel(formName) |
|||
}else{ |
|||
this.updateCarousel(formName) |
|||
} |
|||
} else { |
|||
console.log('error submit!!'); |
|||
return false; |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
/** |
|||
* 添加轮播图 |
|||
*/ |
|||
async addCarousel(formName){ |
|||
const { showPage, content } = formName; |
|||
const params = { |
|||
showPage: showPage[1], |
|||
content |
|||
}; |
|||
await ADD_DETAIL(params).then((res) => { |
|||
if(res.code === 200){ |
|||
Alert.success('添加成功'); |
|||
this.$emit('close', true) |
|||
}else{ |
|||
Alert.fail(res.msg || '添加失败'); |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* 修改轮播图 |
|||
*/ |
|||
async updateCarousel(formName){ |
|||
const { id, showPage, content } = formName; |
|||
const params = { |
|||
id, |
|||
showPage: showPage[1], |
|||
content |
|||
}; |
|||
await UPDATE_DETAIL(params).then((res) => { |
|||
if(res.code === 200){ |
|||
Alert.success('修改成功'); |
|||
this.$emit('close', true) |
|||
}else{ |
|||
Alert.fail(res.msg || '修改失败'); |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.title{ |
|||
width: 100%; |
|||
margin-bottom: 30px; |
|||
font-size: 20px; |
|||
font-weight: bold; |
|||
text-align: center; |
|||
} |
|||
|
|||
.avatar-uploader-icon { |
|||
display: inline-block; |
|||
border: 1px dashed #d9d9d9; |
|||
font-size: 28px; |
|||
color: #8c939d; |
|||
width: 178px; |
|||
height: 178px; |
|||
line-height: 178px; |
|||
text-align: center; |
|||
} |
|||
</style> |
@ -1,118 +0,0 @@ |
|||
<template> |
|||
<el-row> |
|||
<el-col :span="24" style="margin-bottom: 10px;"> |
|||
<div class="grid-content bg-purple-dark"> |
|||
<el-col :span="12"> |
|||
<div class="grid-content bg-purple">分润对象:</div> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<div class="grid-content bg-purple-light">分润比例:</div> |
|||
</el-col> |
|||
</div> |
|||
</el-col> |
|||
<el-col :span="24" v-for="(item,index) in lists" style="margin-bottom: 10px;"> |
|||
<el-form :inline="true" class="demo-form-inline"> |
|||
<div class="grid-content bg-purple-dark"> |
|||
<el-row :gutter="15"> |
|||
<el-col :span="10"> |
|||
<div class="grid-content bg-purple"> |
|||
<el-select v-model="item.userId" :value="item.userId" placeholder="选择分润对象"> |
|||
<el-option v-for="opi in accounts" :label="opi.name" :value="opi.id"></el-option> |
|||
</el-select> |
|||
</div> |
|||
</el-col> |
|||
<el-col :span="10"> |
|||
<div class="grid-content bg-purple-light"> |
|||
<el-input placeholder="" @input="limitMax(item.rate,index)" v-model="item.rate" max="100" min="1"></el-input> |
|||
</div> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<div class="grid-content bg-purple-light"> |
|||
<el-button type="danger" @click="deleteObj(index)" icon="el-icon-delete"></el-button> |
|||
</div> |
|||
</el-col> |
|||
|
|||
</el-row> |
|||
</div> |
|||
</el-form> |
|||
</el-col> |
|||
<el-button @click="addObj">添加分润对象</el-button> |
|||
</el-row> |
|||
</template> |
|||
|
|||
<script> |
|||
import {GET_ACCOUNT_LIST} from '@/api/privilegeManagement' |
|||
import {DETAIL_FIELD_LIST} from '@/api/distribution' |
|||
import Alert from "@/utils/alert"; |
|||
|
|||
export default { |
|||
name: "detailsOfDistribution", |
|||
props: ['currId'], |
|||
data() { |
|||
return { |
|||
lists: [], |
|||
accounts: [] |
|||
} |
|||
}, |
|||
watch: { |
|||
currId() { |
|||
|
|||
} |
|||
}, |
|||
mounted() { |
|||
this.getAccounts(); |
|||
this.getDetail(); |
|||
}, |
|||
methods: { |
|||
getDetail() { |
|||
let params = { |
|||
id: this.currId |
|||
}; |
|||
DETAIL_FIELD_LIST(params).then(res => { |
|||
this.lists = res |
|||
}) |
|||
}, |
|||
/** |
|||
* 添加分润对象 |
|||
*/ |
|||
addObj() { |
|||
let obj = { |
|||
userId: '', |
|||
rate: '' |
|||
}; |
|||
this.lists.push(obj) |
|||
}, |
|||
|
|||
/** |
|||
* 删除分润对象 |
|||
*/ |
|||
deleteObj(idx) { |
|||
let lists = []; |
|||
this.lists.map((item, index) => { |
|||
if (idx != index) { |
|||
lists.push(item) |
|||
} |
|||
return item; |
|||
}); |
|||
this.lists = lists |
|||
}, |
|||
getAccounts() { |
|||
GET_ACCOUNT_LIST().then(res => { |
|||
this.accounts = res; |
|||
}) |
|||
}, |
|||
limitMax(val, idx) { |
|||
if (val >= 100 || val <= 0) { |
|||
Alert.fail('值不能大于100,小于0'); |
|||
val = '' |
|||
} |
|||
|
|||
this.lists[idx].rate = val; |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
|
|||
</style> |
@ -0,0 +1,3 @@ |
|||
<template> |
|||
<div>55565</div> |
|||
</template> |
@ -1,60 +0,0 @@ |
|||
<template> |
|||
<div class="form-container"> |
|||
<el-form :inline="true" :model="formInline" class="demo-form-inline"> |
|||
<el-form-item label="场地"> |
|||
<el-select v-model="formInline.locationId" value="" placeholder="场地"> |
|||
<el-option label="全部" value=""></el-option> |
|||
<el-option v-for="item in locationId" :label="item.name" :value="item.id"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item style="padding-left:30px"> |
|||
<el-button type="default" @click="resetForm1('formInline')">重置</el-button> |
|||
<el-button type="primary" @click="onSubmit">查询</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import {GET_LOCATIONS} from '@/api/common' |
|||
|
|||
export default { |
|||
name: 'form-container', |
|||
props: ['label'], |
|||
data() { |
|||
return { |
|||
formInline: { |
|||
locationId: '' |
|||
}, |
|||
locationId: '' |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.getLocationId(); |
|||
}, |
|||
methods: { |
|||
getLocationId() { |
|||
GET_LOCATIONS().then(res => { |
|||
this.locationId = res |
|||
}) |
|||
}, |
|||
onSubmit() { |
|||
this.$emit('submit', this.formInline) |
|||
}, |
|||
resetForm1() { |
|||
this.formInline = { |
|||
name: '' |
|||
}; |
|||
this.$emit('resetForm'); |
|||
|
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
.form-container { |
|||
padding: 20px; |
|||
background: #fff; |
|||
} |
|||
</style> |
Loading…
Reference in new issue