新增店铺管理员配置及样式优化

This commit is contained in:
chenbo 2020-12-02 14:29:45 +08:00
parent 1f4ad93162
commit b50c1fbb6b
6 changed files with 117 additions and 8 deletions

View File

@ -39,3 +39,10 @@ export function deleteBrand(data) {
data data
}) })
} }
export function listCatAndAdmin() {
return request({
url: '/brand/catAndAdmin',
method: 'get'
})
}

View File

@ -43,3 +43,12 @@ export function replyComment(data) {
data data
}) })
} }
export function listShipChannel() {
return request({
url: '/order/listShipChannel',
method: 'get'
})
}

View File

@ -316,7 +316,7 @@ export const asyncRouterMap = [
name: 'articleEdit', name: 'articleEdit',
meta: { meta: {
perms: ['GET /admin/article/detail', 'POST /admin/article/update'], perms: ['GET /admin/article/detail', 'POST /admin/article/update'],
title: '广告管理', title: '公告通知编辑',
noCache: true noCache: true
}, },
hidden: true hidden: true

View File

@ -29,6 +29,7 @@
<el-table-column align="center" label="操作" width="200" class-name="small-padding fixed-width"> <el-table-column align="center" label="操作" width="200" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="primary" size="mini" @click="shareUrlDetail(scope.row)">推广码</el-button>
<el-button v-permission="['POST /admin/brand/update']" type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button> <el-button v-permission="['POST /admin/brand/update']" type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button v-permission="['POST /admin/brand/delete']" type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button> <el-button v-permission="['POST /admin/brand/delete']" type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button>
</template> </template>
@ -37,12 +38,30 @@
<pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" /> <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
<!-- 店铺二维展示框 -->
<el-dialog :title="textMap[dialogStatus]" :visible.sync="shareUrlDialogVisible" width="700">
<el-form :data="dataForm" label-position="left">
<el-form-item label="推广二维码">
<img :src="dataForm.shareUrl" width="300">
</el-form-item>
</el-form>
</el-dialog>
<!-- 添加或修改对话框 --> <!-- 添加或修改对话框 -->
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible"> <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
<el-form ref="dataForm" :rules="rules" :model="dataForm" status-icon label-position="left" label-width="100px" style="width: 400px; margin-left:50px;"> <el-form ref="dataForm" :rules="rules" :model="dataForm" status-icon label-position="left" label-width="100px" style="width: 400px; margin-left:50px;">
<el-form-item label="品牌商名称" prop="name"> <el-form-item label="品牌商名称" prop="name">
<el-input v-model="dataForm.name"/> <el-input v-model="dataForm.name"/>
</el-form-item> </el-form-item>
<el-form-item label="主营类目">
<el-cascader :options="categoryList" v-model="dataForm.categoryIds" expand-trigger="hover" @change="handleCategoryChange"/>
</el-form-item>
<el-form-item label="管理员">
<el-select v-model="dataForm.adminId">
<el-option v-for="item in adminList" :key="item.value" :label="item.label" :value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="介绍" prop="simpleDesc"> <el-form-item label="介绍" prop="simpleDesc">
<el-input v-model="dataForm.desc"/> <el-input v-model="dataForm.desc"/>
</el-form-item> </el-form-item>
@ -99,7 +118,7 @@
</style> </style>
<script> <script>
import { listBrand, createBrand, updateBrand, deleteBrand } from '@/api/brand' import { listBrand, createBrand, updateBrand, deleteBrand, listCatAndAdmin } from '@/api/brand'
import { uploadPath } from '@/api/storage' import { uploadPath } from '@/api/storage'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
@ -112,6 +131,8 @@ export default {
uploadPath, uploadPath,
list: undefined, list: undefined,
total: 0, total: 0,
categoryList: [],
adminList: [],
listLoading: true, listLoading: true,
listQuery: { listQuery: {
page: 1, page: 1,
@ -126,13 +147,18 @@ export default {
name: '', name: '',
desc: '', desc: '',
floorPrice: undefined, floorPrice: undefined,
picUrl: undefined picUrl: undefined,
categoryIds: [],
defaultCategoryId: undefined,
adminId: undefined
}, },
dialogFormVisible: false, dialogFormVisible: false,
shareUrlDialogVisible: false,
dialogStatus: '', dialogStatus: '',
textMap: { textMap: {
update: '编辑', update: '编辑',
create: '创建' create: '创建',
shareUrl: '店铺推广码'
}, },
rules: { rules: {
name: [ name: [
@ -151,8 +177,15 @@ export default {
}, },
created() { created() {
this.getList() this.getList()
this.init()
}, },
methods: { methods: {
init: function() {
listCatAndAdmin().then(response => {
this.categoryList = response.data.data.categoryList
this.adminList = response.data.data.adminList
})
},
getList() { getList() {
this.listLoading = true this.listLoading = true
listBrand(this.listQuery) listBrand(this.listQuery)
@ -177,7 +210,10 @@ export default {
name: '', name: '',
desc: '', desc: '',
floorPrice: undefined, floorPrice: undefined,
picUrl: undefined picUrl: undefined,
categoryIds: [],
defaultCategoryId: undefined,
adminId: undefined
} }
}, },
handleCreate() { handleCreate() {
@ -264,6 +300,17 @@ export default {
}) })
}) })
}, },
handleCategoryChange(value) {
this.dataForm.defaultCategoryId = value[value.length - 1]
},
shareUrlDetail(row) {
this.dataForm = Object.assign({}, row)
this.dialogStatus = 'shareUrl'
this.shareUrlDialogVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
handleDownload() { handleDownload() {
this.downloadLoading = true this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => { import('@/vendor/Export2Excel').then(excel => {

View File

@ -110,8 +110,10 @@
<!-- 发货对话框 --> <!-- 发货对话框 -->
<el-dialog :visible.sync="shipDialogVisible" title="发货"> <el-dialog :visible.sync="shipDialogVisible" title="发货">
<el-form ref="shipForm" :model="shipForm" status-icon label-position="left" label-width="100px" style="width: 400px; margin-left:50px;"> <el-form ref="shipForm" :model="shipForm" status-icon label-position="left" label-width="100px" style="width: 400px; margin-left:50px;">
<el-form-item label="快递公司" prop="shipChannel"> <el-form-item label="快递公司">
<el-input v-model="shipForm.shipChannel"/> <el-select v-model="shipForm.shipChannel">
<el-option v-for="item in shipChannelList" :key="item.value" :label="item.label" :value="item.value"/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="快递编号" prop="shipSn"> <el-form-item label="快递编号" prop="shipSn">
<el-input v-model="shipForm.shipSn"/> <el-input v-model="shipForm.shipSn"/>
@ -144,7 +146,7 @@
</style> </style>
<script> <script>
import { listOrder, shipOrder, refundOrder, detailOrder } from '@/api/order' import { listOrder, shipOrder, refundOrder, detailOrder , listShipChannel } from '@/api/order'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import checkPermission from '@/utils/permission' // import checkPermission from '@/utils/permission' //
@ -173,6 +175,7 @@ export default {
list: undefined, list: undefined,
total: 0, total: 0,
listLoading: true, listLoading: true,
shipChannelList: [],
listQuery: { listQuery: {
page: 1, page: 1,
limit: 20, limit: 20,
@ -220,6 +223,11 @@ export default {
this.listLoading = false this.listLoading = false
}) })
}, },
getListShipChannel() {
listShipChannel().then(response => {
this.shipChannelList = response.data.data.shipChannelList
})
},
handleFilter() { handleFilter() {
this.listQuery.page = 1 this.listQuery.page = 1
this.getList() this.getList()

View File

@ -70,6 +70,20 @@
<i v-else class="el-icon-plus avatar-uploader-icon"/> <i v-else class="el-icon-plus avatar-uploader-icon"/>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="商品序号或ID">
<el-tag v-for="tag in dataForm.goods" :key="tag" closable type="primary" @close="handleClose(tag)">
{{ tag }}
</el-tag>
<el-input
v-if="newGoodsVisible"
ref="newGoodsInput"
v-model="newGoodIdSn"
class="input-new-goods"
size="small"
@keyup.enter.native="handleInputConfirm"
@blur="handleInputConfirm"/>
<el-button v-else class="button-new-keyword" size="small" type="primary" @click="showInput">+ 增加</el-button>
</el-form-item>
<el-form-item style="width: 700px;" label="专题内容"> <el-form-item style="width: 700px;" label="专题内容">
<editor :init="editorInit" v-model="dataForm.content"/> <editor :init="editorInit" v-model="dataForm.content"/>
</el-form-item> </el-form-item>
@ -112,6 +126,11 @@
line-height: 120px; line-height: 120px;
text-align: center; text-align: center;
} }
.input-new-goods {
width: 90px;
margin-left: 10px;
vertical-align: bottom;
}
.avatar { .avatar {
width: 145px; width: 145px;
height: 145px; height: 145px;
@ -133,6 +152,8 @@ export default {
data() { data() {
return { return {
uploadPath, uploadPath,
newGoodsVisible: false,
newGoodIdSn: '',
list: undefined, list: undefined,
total: 0, total: 0,
listLoading: true, listLoading: true,
@ -327,6 +348,23 @@ export default {
}) })
}) })
}, },
handleClose(tag) {
this.dataForm.goods.splice(this.dataForm.goods.indexOf(tag), 1)
},
showInput() {
this.newGoodsVisible = true
this.$nextTick(_ => {
this.$refs.newGoodsInput.$refs.input.focus()
})
},
handleInputConfirm() {
const newGoodIdSn = this.newGoodIdSn
if (newGoodIdSn) {
this.dataForm.goods.push(newGoodIdSn)
}
this.newGoodsVisible = false
this.newGoodIdSn = ''
},
handleDownload() { handleDownload() {
this.downloadLoading = true this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => { import('@/vendor/Export2Excel').then(excel => {