扩展参数
This commit is contained in:
58
src/api/extend.js
Normal file
58
src/api/extend.js
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
import request from "@/utils/request";
|
||||||
|
import editor from "mavon-editor";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function tbShopExtend(params) {
|
||||||
|
return request({
|
||||||
|
url: "/tbShopExtend",
|
||||||
|
method: "get",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增单位
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function addtbShopExtend(data) {
|
||||||
|
return request({
|
||||||
|
url: `/tbShopExtend`,
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 编辑详情
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function edittbShopExtend(data) {
|
||||||
|
return request({
|
||||||
|
url: '/tbShopExtend',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询详情
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function querytbShopExtend(params) {
|
||||||
|
return request({
|
||||||
|
url: `/tbShopExtend/` + params,
|
||||||
|
method: "get",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除商品
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function deletetbShopExtend(params) {
|
||||||
|
return request({
|
||||||
|
url: "/tbShopExtend",
|
||||||
|
method: "delete",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
@change="showChangess($event, scope.row)"></el-switch>
|
@change="showChangess($event, scope.row)"></el-switch>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="下架">
|
<el-table-column label="上架">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-switch v-model="scope.row.isGrounding" :active-value="true" :inactive-value="false"
|
<el-switch v-model="scope.row.isGrounding" :active-value="true" :inactive-value="false"
|
||||||
@change="showChangesss($event, scope.row)"></el-switch>
|
@change="showChangesss($event, scope.row)"></el-switch>
|
||||||
|
|||||||
196
src/views/shop/components/extend.vue
Normal file
196
src/views/shop/components/extend.vue
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-button type="primary" @click="resetting">添加</el-button>
|
||||||
|
<el-table :data="tableData">
|
||||||
|
<el-table-column label="类型" prop="type">
|
||||||
|
<template v-slot="row">
|
||||||
|
{{ row.row.type == 'text' ? '文本' : '图片' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="key" prop="autokey"> </el-table-column>
|
||||||
|
<el-table-column label="value" prop="value">
|
||||||
|
<template v-slot="row">
|
||||||
|
<img v-if="row.row.type == 'img'" :src="row.row.value" style="width: 40px;height: 40px;">
|
||||||
|
<span v-else>{{ row.row.value }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="更新时间" prop="updateTime"> </el-table-column>
|
||||||
|
<el-table-column label="创建时间" prop="createTime"> </el-table-column>
|
||||||
|
<el-table-column label="操作" width="250">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<el-button type="text" size="mini" round icon="el-icon-edit"
|
||||||
|
@click="edit(scope.row.id)">编辑</el-button>
|
||||||
|
<el-popconfirm title="确定删除吗?" @confirm="delHandle([scope.row.id])">
|
||||||
|
<el-button type="text" size="mini" round icon="el-icon-delete" slot="reference">
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</el-popconfirm>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<el-dialog :title="title" :visible.sync="showLocation">
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px" label-position="left">
|
||||||
|
<el-form-item label="类型" v-if="title == '新增'">
|
||||||
|
<el-radio v-model="form.type" label="text">文本</el-radio>
|
||||||
|
<el-radio v-model="form.type" label="img">图片</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="自定义key">
|
||||||
|
<el-input v-model="form.autokey" placeholder="请输入内容"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="上传图片" v-if="form.type == 'img'">
|
||||||
|
<el-upload :headers="headers" class="avatar-uploader" :action="qiNiuUploadApi"
|
||||||
|
:show-file-list="false" :on-success="handleSuccess">
|
||||||
|
<img v-if="imageUrl" :src="imageUrl" class="avatar">
|
||||||
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="文本" v-else>
|
||||||
|
<el-input v-model="form.value" placeholder="请输入内容"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="showLocation = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="doSubmit">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { tbShopExtend, addtbShopExtend, deletetbShopExtend, querytbShopExtend, edittbShopExtend } from '@/api/extend'
|
||||||
|
import { getToken } from "@/utils/auth";
|
||||||
|
import { mapGetters } from "vuex";
|
||||||
|
export default {
|
||||||
|
computed: {
|
||||||
|
...mapGetters(["qiNiuUploadApi"])
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
tableData: [],
|
||||||
|
showLocation: false,
|
||||||
|
fileList: [],
|
||||||
|
form: {
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
imageUrl: '',
|
||||||
|
title: '新增',
|
||||||
|
rules: {
|
||||||
|
},
|
||||||
|
headers: {
|
||||||
|
Authorization: getToken()
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
'form.type': (n, o) => {
|
||||||
|
if (n == 'img') {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleBeforeRemove(file, fileList) {
|
||||||
|
|
||||||
|
},
|
||||||
|
async edit(id) {
|
||||||
|
this.title = '编辑'
|
||||||
|
let res = await querytbShopExtend(id)
|
||||||
|
this.form.id = id
|
||||||
|
this.showLocation = true
|
||||||
|
this.form = res
|
||||||
|
this.imageUrl = res.value
|
||||||
|
},
|
||||||
|
// 删除
|
||||||
|
async delHandle(proId) {
|
||||||
|
let res = await deletetbShopExtend({ idList: proId[0] })
|
||||||
|
this.$message({
|
||||||
|
message: '删除成功',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
this.getList()
|
||||||
|
|
||||||
|
},
|
||||||
|
// 刷新列表数据
|
||||||
|
async doSubmit() {
|
||||||
|
if (this.title == '新增') {
|
||||||
|
let res = await addtbShopExtend({
|
||||||
|
...this.form,
|
||||||
|
shopId: localStorage.getItem('shopId')
|
||||||
|
})
|
||||||
|
this.$message({
|
||||||
|
message: '添加成功',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
|
||||||
|
} else {
|
||||||
|
let res = await edittbShopExtend({
|
||||||
|
...this.form,
|
||||||
|
})
|
||||||
|
this.$message({
|
||||||
|
message: '编辑成功',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.form = null
|
||||||
|
this.form = {
|
||||||
|
type: 'text',
|
||||||
|
}
|
||||||
|
this.imageUrl = ''
|
||||||
|
this.showLocation = false
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
handleSuccess(response, file, fileList) {
|
||||||
|
this.imageUrl = response.data[0];
|
||||||
|
this.form.value = response.data[0]
|
||||||
|
console.log("上传成功", this.form);
|
||||||
|
},
|
||||||
|
|
||||||
|
async getList() {
|
||||||
|
let res = await tbShopExtend({
|
||||||
|
shopId: localStorage.getItem('shopId')
|
||||||
|
})
|
||||||
|
this.tableData = res.content
|
||||||
|
},
|
||||||
|
resetting() {
|
||||||
|
this.title = '新增'
|
||||||
|
this.form = null
|
||||||
|
this.form = {
|
||||||
|
type: 'text',
|
||||||
|
}
|
||||||
|
this.imageUrl = ''
|
||||||
|
this.showLocation = true
|
||||||
|
},
|
||||||
|
addtbShopExtend() { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
.avatar-uploader .el-upload {
|
||||||
|
border: 1px dashed #d9d9d9;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar-uploader .el-upload:hover {
|
||||||
|
border-color: #409EFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar-uploader-icon {
|
||||||
|
font-size: 28px;
|
||||||
|
color: #8c939d;
|
||||||
|
width: 178px;
|
||||||
|
height: 178px;
|
||||||
|
line-height: 178px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
width: 178px;
|
||||||
|
height: 178px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -5,11 +5,14 @@
|
|||||||
<el-tab-pane label="基础配置" name="2"></el-tab-pane>
|
<el-tab-pane label="基础配置" name="2"></el-tab-pane>
|
||||||
<!-- <el-tab-pane label="通知配置" name="3"></el-tab-pane> -->
|
<!-- <el-tab-pane label="通知配置" name="3"></el-tab-pane> -->
|
||||||
<el-tab-pane label="安全设置" name="4"></el-tab-pane>
|
<el-tab-pane label="安全设置" name="4"></el-tab-pane>
|
||||||
|
<el-tab-pane label="扩展参数" name="5"></el-tab-pane>
|
||||||
|
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<shopInfo v-if="activeName == 1" />
|
<shopInfo v-if="activeName == 1" />
|
||||||
<shopSetting v-if="activeName == 2" />
|
<shopSetting v-if="activeName == 2" />
|
||||||
<notice v-if="activeName == 3" />
|
<notice v-if="activeName == 3" />
|
||||||
<securitySetting v-if="activeName == 4" />
|
<securitySetting v-if="activeName == 4" />
|
||||||
|
<extend v-if="activeName == 5" />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -19,12 +22,12 @@ import shopInfo from './components/shopInfo'
|
|||||||
import shopSetting from './components/shopSetting'
|
import shopSetting from './components/shopSetting'
|
||||||
import notice from './components/notice'
|
import notice from './components/notice'
|
||||||
import securitySetting from './components/securitySetting'
|
import securitySetting from './components/securitySetting'
|
||||||
|
import extend from './components/extend'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
shopInfo,
|
shopInfo,
|
||||||
shopSetting,
|
shopSetting,
|
||||||
notice,securitySetting
|
notice,securitySetting,extend
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user