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

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
})
}
export function listCatAndAdmin() {
return request({
url: '/brand/catAndAdmin',
method: 'get'
})
}

View File

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

View File

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

View File

@ -29,6 +29,7 @@
<el-table-column align="center" label="操作" width="200" class-name="small-padding fixed-width">
<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/delete']" type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button>
</template>
@ -37,12 +38,30 @@
<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-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-input v-model="dataForm.name"/>
</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-input v-model="dataForm.desc"/>
</el-form-item>
@ -99,7 +118,7 @@
</style>
<script>
import { listBrand, createBrand, updateBrand, deleteBrand } from '@/api/brand'
import { listBrand, createBrand, updateBrand, deleteBrand, listCatAndAdmin } from '@/api/brand'
import { uploadPath } from '@/api/storage'
import { getToken } from '@/utils/auth'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
@ -112,6 +131,8 @@ export default {
uploadPath,
list: undefined,
total: 0,
categoryList: [],
adminList: [],
listLoading: true,
listQuery: {
page: 1,
@ -126,13 +147,18 @@ export default {
name: '',
desc: '',
floorPrice: undefined,
picUrl: undefined
picUrl: undefined,
categoryIds: [],
defaultCategoryId: undefined,
adminId: undefined
},
dialogFormVisible: false,
shareUrlDialogVisible: false,
dialogStatus: '',
textMap: {
update: '编辑',
create: '创建'
create: '创建',
shareUrl: '店铺推广码'
},
rules: {
name: [
@ -151,8 +177,15 @@ export default {
},
created() {
this.getList()
this.init()
},
methods: {
init: function() {
listCatAndAdmin().then(response => {
this.categoryList = response.data.data.categoryList
this.adminList = response.data.data.adminList
})
},
getList() {
this.listLoading = true
listBrand(this.listQuery)
@ -177,7 +210,10 @@ export default {
name: '',
desc: '',
floorPrice: undefined,
picUrl: undefined
picUrl: undefined,
categoryIds: [],
defaultCategoryId: undefined,
adminId: undefined
}
},
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() {
this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => {

View File

@ -110,8 +110,10 @@
<!-- 发货对话框 -->
<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-item label="快递公司" prop="shipChannel">
<el-input v-model="shipForm.shipChannel"/>
<el-form-item label="快递公司">
<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 label="快递编号" prop="shipSn">
<el-input v-model="shipForm.shipSn"/>
@ -144,7 +146,7 @@
</style>
<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 checkPermission from '@/utils/permission' //
@ -173,6 +175,7 @@ export default {
list: undefined,
total: 0,
listLoading: true,
shipChannelList: [],
listQuery: {
page: 1,
limit: 20,
@ -220,6 +223,11 @@ export default {
this.listLoading = false
})
},
getListShipChannel() {
listShipChannel().then(response => {
this.shipChannelList = response.data.data.shipChannelList
})
},
handleFilter() {
this.listQuery.page = 1
this.getList()

View File

@ -70,6 +70,20 @@
<i v-else class="el-icon-plus avatar-uploader-icon"/>
</el-upload>
</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="专题内容">
<editor :init="editorInit" v-model="dataForm.content"/>
</el-form-item>
@ -112,6 +126,11 @@
line-height: 120px;
text-align: center;
}
.input-new-goods {
width: 90px;
margin-left: 10px;
vertical-align: bottom;
}
.avatar {
width: 145px;
height: 145px;
@ -133,6 +152,8 @@ export default {
data() {
return {
uploadPath,
newGoodsVisible: false,
newGoodIdSn: '',
list: undefined,
total: 0,
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() {
this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => {