master
271556543@qq.com 4 years ago
parent dfb6c22de4
commit d1f1925fab

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

@ -1,4 +1,6 @@
import request from '@/utils/request'
import axios from 'axios'
import { getToken } from '@/utils/auth'
export function index(params){
return request({
@ -8,20 +10,18 @@ export function index(params){
})
}
export function store(data){
return request({
method:'post',
url:'/api/admin/policy/store',
data
})
let config = {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
'Authorization':"Bearer " + getToken()
}
}
export function store(formData){
return axios.post(`${process.env.VUE_APP_BASE_API}api/admin/policy/store`,formData,config)
}
export function save(data){
return request({
method:'post',
url:'/api/admin/policy/save',
data
})
export function save(formData){
return axios.post(`${process.env.VUE_APP_BASE_API}api/admin/policy/save`,formData,config)
}
export function destroy(data){

File diff suppressed because one or more lines are too long

@ -1,44 +1,586 @@
<template>
<div>
<xy-dialog ref="dialog" :is-show.sync="isShow" type="form" :title="type === 'add' ? '新增月子会所' : '编辑月子会所'" :form="form" :rules="rules">
<xy-dialog :width="74" 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>
<template v-slot:subheading>
<div class="xy-table-item">
<div class="xy-table-item-label">
副标题
</div>
<div class="xy-table-item-content">
<el-input v-model="form.subheading" placeholder="请输入副标题" clearable style="width: 300px;"></el-input>
</div>
</div>
</template>
<template v-slot:merchantId>
<div class="xy-table-item">
<div class="xy-table-item-label">
所属商户
</div>
<div class="xy-table-item-content">
<el-select v-model="form.merchantId" placeholder="请选择所属商户" style="width: 300px">
<el-option v-for="item in merchants" :value="item.id" :key="item.id" :label="item.name"></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:featuredLabel>
<div class="xy-table-item">
<div class="xy-table-item-label">
特色标签
</div>
<div class="xy-table-item-content">
<div class="xy-table-item-content-label">
<template v-for="(item,index) in form.featuredLabel">
<el-tag type="primary" closable @close="labelClose(index)" style="margin-right: 6px;margin-bottom: 4px;">{{item}}</el-tag>
</template>
<div style="margin-top: 15px;">
<el-input clearable placeholder="请填写并添加特色标签" style="width: 300px" ref="labelInput" v-model="labelText">
<el-button type="primary" slot="append" icon="el-icon-plus" @click="appendLabel"></el-button>
</el-input>
</div>
</div>
</div>
</div>
</template>
<template v-slot:relLabel>
<div class="xy-table-item">
<div class="xy-table-item-label">
关联标签
</div>
<div class="xy-table-item-content">
<el-select multiple v-model="form.relLabel" placeholder="请选择关联标签" style="width: 300px">
<el-option v-for="item in labels" :value="item.id" :key="item.id" :label="item.value"></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:reach>
<div class="xy-table-item">
<div class="xy-table-item-label">
是否到店
</div>
<div class="xy-table-item-content">
<el-switch v-model="form.reach" type="primary"></el-switch>
</div>
</div>
</template>
<template v-slot:state>
<div class="xy-table-item">
<div class="xy-table-item-label">
是否启用
</div>
<div class="xy-table-item-content">
<el-switch v-model="form.state" type="primary"></el-switch>
</div>
</div>
</template>
<template v-slot:sortNumber>
<div class="xy-table-item">
<div class="xy-table-item-label">
排序
</div>
<div class="xy-table-item-content">
<el-input-number :precision="0" :controls="false" v-model="form.sortNumber" placeholder="请输入排序" clearable style="width: 300px;"></el-input-number>
</div>
</div>
</template>
<template v-slot:content>
<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">
<tinymce ref="tinymce" :height="200" v-model="form.content" id='tinymce'></tinymce>
</div>
</div>
</template>
<template v-slot:recommend>
<div class="xy-table-item">
<div class="xy-table-item-label">
是否推荐主页
</div>
<div class="xy-table-item-content">
<el-switch v-model="form.recommend" type="primary"></el-switch>
</div>
</div>
</template>
<template v-slot:videoFile>
<div class="xy-table-item">
<div class="xy-table-item-label">
宣传视频
</div>
<div class="xy-table-item-content">
<div v-if="form.videoFile" style="position: relative;">
<video :src="form.videoFile" class="avatar" />
<Button
shape="circle"
icon="md-close"
type="error"
size="small"
class="img__delete"
@click="form.videoFile = ''"></Button>
</div>
<el-upload
v-else
:limit="1"
accept="video/*"
class="avatar-uploader"
list-type="picture-card"
:action="action"
:show-file-list="true"
:on-error="uploadFailVideo"
:on-success="uploadSuccessVideo"
:before-upload="uploadBeforeVideo">
<i class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</div>
</div>
</template>
<template v-slot:coverPicture>
<div class="xy-table-item">
<div class="xy-table-item-label">
封面图
</div>
<div class="xy-table-item-content">
<div v-if="form.coverPicture" style="position: relative;">
<img :src="form.coverPicture" class="avatar">
<Button
shape="circle"
icon="md-close"
type="error"
size="small"
class="img__delete"
@click="form.coverPicture = ''"></Button>
</div>
<el-upload
v-else
accept="picture"
:limit="1"
class="avatar-uploader"
list-type="picture-card"
:action="action"
:show-file-list="true"
:on-error="uploadFailPic"
:on-success="uploadSuccessPic"
:before-upload="uploadBeforePic">
<i class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</div>
</div>
</template>
<template v-slot:address>
<div style="display: flex;flex-wrap: wrap">
<div class="xy-table-item" style="margin-bottom: 20px;">
<div class="xy-table-item-label">
地址选择
</div>
<div class="xy-table-item-content">
<avue-input-map style="width: 300px;" :params="option" placeholder="请选择地图" v-model="map" ></avue-input-map>
</div>
</div>
<div class="xy-table-item">
<div class="xy-table-item-label">
地址
</div>
<div class="xy-table-item-content">
<el-input clearable placeholder="请填写地址" v-model="form.address" style="width: 300px;"/>
</div>
</div>
</div>
</template>
<template v-slot:lng>
<div class="xy-table-item">
<div class="xy-table-item-label">
经度
</div>
<div class="xy-table-item-content">
<el-input readonly v-model="form.lng" placeholder="请输入经度" clearable style="width: 120px;"></el-input>
</div>
</div>
</template>
<template v-slot:lat>
<div class="xy-table-item">
<div class="xy-table-item-label">
纬度
</div>
<div class="xy-table-item-content">
<el-input readonly v-model="form.lat" placeholder="请输入纬度" clearable style="width: 120px;"></el-input>
</div>
</div>
</template>
<template v-slot:functionary>
<div class="xy-table-item">
<div class="xy-table-item-label">
负责人
</div>
<div class="xy-table-item-content">
<el-input v-model="form.functionary" placeholder="请输入负责人" clearable style="width: 300px;"></el-input>
</div>
</div>
</template>
<template v-slot:functionaryPhone>
<div class="xy-table-item">
<div class="xy-table-item-label">
负责人电话
</div>
<div class="xy-table-item-content">
<el-input v-model="form.functionaryPhone" placeholder="请输入负责人电话" clearable style="width: 300px;"></el-input>
</div>
</div>
</template>
<template v-slot:linkman>
<div class="xy-table-item">
<div class="xy-table-item-label">
联系人
</div>
<div class="xy-table-item-content">
<el-input v-model="form.linkman" placeholder="请输入联系人" clearable style="width: 300px;"></el-input>
</div>
</div>
</template>
<template v-slot:linkmanPhone>
<div class="xy-table-item">
<div class="xy-table-item-label">
联系人电话
</div>
<div class="xy-table-item-content">
<el-input v-model="form.linkmanPhone" placeholder="请输入联系人电话" clearable style="width: 300px;"></el-input>
</div>
</div>
</template>
<template v-slot:workTime>
<div class="xy-table-item">
<div class="xy-table-item-label">
工作时间
</div>
<div class="xy-table-item-content">
<el-time-picker
is-range
v-model="form.workTime"
:picker-options="{
start: '00:00',
end: '23:59',
}"
range-separator="-"
start-placeholder="开始时间"
end-placeholder="结束时间"
placeholder="选择时间范围">
</el-time-picker>
</div>
</div>
</template>
<template v-slot:extraFormBottom>
<el-divider></el-divider>
<div>
商铺图片
</div>
<el-upload
class="upload-demo"
:action="action"
:before-upload="uploadBeforePic"
:on-success="handleSuccess"
:on-preview="handlePreview"
:on-remove="handleRemove"
:file-list="fileList"
list-type="picture">
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过2M</div>
</el-upload>
</template>
</xy-dialog>
</div>
</template>
<script>
import {store} from '@/api/confinementClub'
import {index as merchantIndex} from '@/api/merchant'
import {getparameter} from "@/api/system/dictionary"
import { Message } from 'element-ui'
import tinymce from '@/components/Tinymce'
export default {
components:{
tinymce
},
data() {
return {
id:'',
isShow:false,
type:'',
merchants:[],
labels:[],
action:`${process.env.VUE_APP_BASE_API}api/admin/upload-file`,
form:{
labelText:'',
map:{
},
option: {
column: [
{
label: '坐标',
prop: 'map',
type: 'map',
//
params:{
zoom: 10,
// zoomEnable: false,
// dragEnable: false,
}
}]
},
form:{
name:'',
subheading:'',
merchantId:'',
featuredLabel:[],//
relLabel:'',//
reach:false,//,
state:true,//
sortNumber:0,
content:'',
recommend:true,
videoFile:'',
coverPicture:'',
address:'',
lat:'',//
lng:'',//
functionary:'',//
functionaryPhone:'',
linkman:'',
linkmanPhone:'',
workTime:'',
},
pictures:[],
fileList:[],
rules:{
name:[
{required:true,message:'请填写会所名称'}
],
content:[
{required:true,message:'请填写内容'}
],
functionaryPhone:[
{pattern: /^[1][3-9][\d]{9}/,message:'手机号格式错误'}
],
linkmanPhone:[
{pattern: /^[1][3-9][\d]{9}/,message:'手机号格式错误'}
]
}
}
},
methods: {
//
uploadFailVideo(err){
console.log(err)
},
uploadSuccessVideo(response){
console.log(response)
this.form.videoFile = response.url
},
uploadBeforeVideo(file){
if((file.size/1000) > 10240){
Message({
type:'warning',
message:'上传视频大小超过10M'
})
return false
}
},
uploadFailPic(err){
console.log(err)
},
uploadSuccessPic(response){
console.log(response)
this.form.coverPicture = response.url
},
uploadBeforePic(file){
if((file.size/1000) > 2048){
Message({
type:'warning',
message:'上传图片大小超过2M'
})
return false
}
},
handleSuccess(res){
this.pictures.push(res.url)
},
handleRemove(file, fileList) {
console.log(this.pictures)
console.log(file, fileList);
},
handlePreview(file) {
console.log(this.pictures)
console.log(file);
},
//
appendLabel(){
if(!this.$refs['labelInput'].getInput().value) return
this.form.featuredLabel.push(this.$refs['labelInput'].getInput().value)
this.labelText = ''
},
//
labelClose(index){
this.form.featuredLabel.splice(index,1)
},
async getLabels(){
const res = await getparameter({number:'label'})
this.labels = res?.detail
},
async getMerchants(){
const res = await merchantIndex({
page:1,
pageSize:999
})
//console.log(res)
this.merchants = res?.data
},
submit(){
if(this.type === 'add'){
console.log(this.form)
store({
name:this.form.name,
merchant_id:this.form.merchantId,
state:this.form.state ? 1 : 0,
reach:this.form.reach ? 1 : 0,
sort_number:this.form.sortNumber,
featured_label:this.form.featuredLabel.toString(),
rel_label:this.form.relLabel.toString(),
content:this.form.content,
subheading:this.form.subheading,
recommend:this.form.recommend,
video_file:this.form.videoFile,
cover_picture:this.form.coverPicture,
latitude:this.form.lat,
longitude:this.form.lng,
address:this.form.address,
functionary:this.form.functionary,
functionary_phone:this.form.functionaryPhone,
linkman:this.form.linkman,
linkman_phone:this.form.linkmanPhone,
workTime: this.form.workTime.toString()
}).then(res => {
Message({
type:'success',
message:'新增月子会所商户成功'
})
this.isShow = false
this.$emit('refresh')
})
}
}
},
watch:{
isShow(newVal){
if(newVal){
this.pictures = []
this.getMerchants()
this.getLabels()
}else{
this.id = ''
this.type = ''
this.$refs['dialog'].reset()
this.$refs['tinymce'].setContent(' ')
}
},
map(newVal){
this.form.lng = newVal[0]
this.form.lat = newVal[1]
this.form.address = newVal[2]
}
}
}
</script>
<style scoped lang="scss">
.xy-table-item{
&-label{
width: 160px;
}
&-content{
&-label{
width: 300px;
display: flex;
flex-wrap: wrap;
flex: 0;
}
}
}
::v-deep .el-input__inner{
text-align: left;
}
</style>
<style>
.avatar-uploader .el-upload {
width: 110px;
height: 110px;
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
}
.avatar-uploader .el-upload:hover {
border-color: #BF617C;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 110px;
height: 110px;
line-height: 110px;
text-align: center;
}
.avatar {
width: 110px;
display: block;
border-radius: 6px;
}
.img__delete{
transform: scale(0.7,0.7);
position: absolute;
top: 1px;
left: 4%;
}
</style>

@ -34,7 +34,7 @@
</div>
<div class="xy-table-item-content-items-item">
<div class="xy-table-item-content-items-item__label">对订单操作</div>
<el-select multiple v-model="item.operations" style="width: 160px;">
<el-select multiple v-model="item.operations" style="width: 300px;">
<el-option v-for="(value,key) of operations" :value="key" :label="value"></el-option>
</el-select>
</div>
@ -57,7 +57,7 @@
<script>
import {store,save} from '@/api/policy'
import { Message } from 'element-ui'
import { Message,Loading } from 'element-ui'
export default {
data() {
var itemsCheck = (rule, value, callback) => {
@ -76,6 +76,7 @@ export default {
}
}
return {
token:'',
id:'',
isShow:false,
type:'',
@ -122,6 +123,7 @@ export default {
},
methods: {
getDetail(){
this.id = this.detail.id
this.form.name = this.detail.name
this.form.items = this.detail.items.map(item => {
return {
@ -157,11 +159,23 @@ export default {
this.form.items.forEach(item => {
item.operations = item.operations.toString()
})
console.log(this.form)
store({
name:this.form.name,
items:this.form.items
}).then(res => {
let loading;
loading = Loading.service({
lock:true,
background:"rgba(0,0,0,0.4)",
text:"正在加载中..."
})
let formData = new FormData()
formData.append('name',this.form.name)
this.form.items.forEach((item,index) => {
formData.append(`action[${index}]`,item.action)
formData.append(`timer[${index}]`,item.timer)
formData.append(`operations[${index}][]`,item.operations)
formData.append(`fee_ratio[${index}]`,item.fee_ratio)
})
store(formData).then(res => {
loading.close()
Message({
type:'success',
message:'添加政策成功'
@ -175,12 +189,24 @@ export default {
this.form.items.forEach(item => {
item.operations = item.operations.toString()
})
console.log(this.form)
save({
id:this.id,
name:this.form.name,
items:this.form.items
}).then(res => {
let loading;
loading = Loading.service({
lock:true,
background:"rgba(0,0,0,0.4)",
text:"正在加载中..."
})
let formData = new FormData()
formData.append('name',this.form.name)
formData.append('id',this.id)
this.form.items.forEach((item,index) => {
formData.append(`action[${index}]`,item.action)
formData.append(`timer[${index}]`,item.timer)
formData.append(`operations[${index}][]`,item.operations)
formData.append(`fee_ratio[${index}]`,item.fee_ratio)
})
save(formData).then(res => {
loading.close()
Message({
type:'success',
message:'编辑政策成功'
@ -188,7 +214,6 @@ export default {
this.isShow = false
this.$emit('refresh')
})
return
}
}
@ -209,7 +234,7 @@ export default {
this.$refs['dialog'].reset()
}
}
}
},
}
</script>

@ -191,7 +191,7 @@ export default {
this.$refs['tinymce'].setContent(this.form.content)
},
async getLabel(){
const res = await getparameter({number:'strategyLabel'})
const res = await getparameter({number:'label'})
this.labels = res.detail
},
async getStrategyTypes(){

@ -18,11 +18,13 @@
<xy-table :total="total" :list="list" :table-item="table" @pageSizeChange="e => select.pageSize = e"></xy-table>
<addConfinementClub ref="addConfinementClub"></addConfinementClub>
<addConfinementClub ref="addConfinementClub" @refresh="getClubs"></addConfinementClub>
</div>
</template>
<script>
import {index} from '@/api/confinementClub'
import addConfinementClub from '@/views/productService/components/addConfinementClub'
export default {
components:{
@ -43,8 +45,18 @@ export default {
}
},
methods: {}
methods: {
async getClubs(){
const res = await index({
page:this.select.page,
pageSize:this.select.pageSize
})
console.log(res)
}
},
mounted() {
this.getClubs()
}
}
</script>

Loading…
Cancel
Save