Unverified Commit b68151cb authored by Menethil's avatar Menethil Committed by GitHub
Browse files

Merge pull request #1 from linlinjava/master

update
parents 126d027a 02679509
......@@ -3,50 +3,94 @@
<!-- 查询和其他操作 -->
<div class="filter-container">
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入用户ID" v-model="listQuery.userId">
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入商品编号" v-model="listQuery.goodsSn">
</el-input>
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入商品ID" v-model="listQuery.goodsId">
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入商品名称" v-model="listQuery.name">
</el-input>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-edit">添加</el-button>
<el-button class="filter-item" type="primary" :loading="downloadLoading" v-waves icon="el-icon-download" @click="handleDownload">导出</el-button>
<el-button class="filter-item" type="primary" :loading="downloadLoading" icon="el-icon-download" @click="handleDownload">导出</el-button>
</div>
<!-- 查询结果 -->
<el-table size="small" :data="list" v-loading="listLoading" element-loading-text="正在查询中。。。" border fit highlight-current-row>
<el-table-column align="center" width="100px" label="购物车ID" prop="id" sortable>
</el-table-column>
<el-table-column align="center" min-width="100px" label="用户ID" prop="userId">
</el-table-column>
<el-table-column align="center" min-width="100px" label="商品ID" prop="goodsId">
<el-table-column type="expand">
<template slot-scope="props">
<el-form label-position="left" class="table-expand">
<el-form-item label="宣传画廊">
<img class="gallery" v-for="pic in props.row.gallery" :key="pic" :src="pic"/>
</el-form-item>
<el-form-item label="商品介绍">
<span>{{ props.row.brief }}</span>
</el-form-item>
<el-form-item label="商品单位">
<span>{{ props.row.unit }}</span>
</el-form-item>
<el-form-item label="关键字">
<span>{{ props.row.keyword }}</span>
</el-form-item>
<el-form-item label="类目ID">
<span>{{ props.row.categoryId }}</span>
</el-form-item>
<el-form-item label="品牌商ID">
<span>{{ props.row.brandId }}</span>
</el-form-item>
</el-form>
</template>
</el-table-column>
<el-table-column align="center" min-width="100px" label="商品编" prop="goodsSn">
<el-table-column align="center" label="商品编" prop="goodsSn">
</el-table-column>
<el-table-column align="center" min-width="100px" label="商品名称" prop="goodsName">
<el-table-column align="center" min-width="100" label="名称" prop="name">
</el-table-column>
<el-table-column align="center" min-width="100px" label="商品图片" prop="picUrl">
<el-table-column align="center" property="iconUrl" label="图片">
<template slot-scope="scope">
<img :src="scope.row.picUrl" width="40"/>
</template>
</el-table-column>
<el-table-column align="center" min-width="100px" label="货品ID" prop="productId">
<el-table-column align="center" label="详情" prop="desc">
<template slot-scope="scope">
<el-dialog title="商品详情" :visible.sync="descDialogVisible">
<div v-html="descDetail"></div>
</el-dialog>
<el-button type="primary" size="mini" @click="showDesc(scope.row.desc)">查看</el-button>
</template>
</el-table-column>
<el-table-column align="center" min-width="100px" label="货品价格" prop="retailPrice">
<el-table-column align="center" label="专柜价格" prop="counterPrice">
</el-table-column>
<el-table-column align="center" min-width="100px" label="货品数量" prop="number">
<el-table-column align="center" label="当前价格" prop="retailPrice">
</el-table-column>
<el-table-column align="center" label="操作" width="250" class-name="small-padding fixed-width">
<el-table-column align="center" label="是否新品" prop="isNew">
<template slot-scope="scope">
<el-tag :type="scope.row.isNew ? 'success' : 'error' ">{{scope.row.isNew ? '新品' : '非新品'}}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="是否热品" prop="isHot">
<template slot-scope="scope">
<el-tag :type="scope.row.isHot ? 'success' : 'error' ">{{scope.row.isHot ? '热品' : '非热品'}}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="是否在售" prop="isOnSale">
<template slot-scope="scope">
<el-tag :type="scope.row.isOnSale ? 'success' : 'error' ">{{scope.row.isOnSale ? '在售' : '未售'}}</el-tag>
</template>
</el-table-column>
<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="handleUpdate(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table-column>
</el-table>
<!-- 分页 -->
......@@ -56,67 +100,53 @@
</el-pagination>
</div>
<!-- 添加或修改对话框 -->
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
<el-form :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
<el-form-item label="用户ID" prop="userId">
<el-input v-model="dataForm.userId"></el-input>
</el-form-item>
<el-form-item label="商品ID" prop="goodsId">
<el-input v-model="dataForm.goodsId"></el-input>
</el-form-item>
<el-form-item label="商品编码" prop="goodsId">
<el-input v-model="dataForm.goodsId"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
<el-button v-if="dialogStatus=='create'" type="primary" @click="createData">确定</el-button>
<el-button v-else type="primary" @click="updateData">确定</el-button>
</div>
</el-dialog>
<el-tooltip placement="top" content="返回顶部">
<back-to-top :visibilityHeight="100" ></back-to-top>
</el-tooltip>
</div>
</template>
<style>
.table-expand {
font-size: 0;
}
.table-expand label {
width: 100px;
color: #99a9bf;
}
.table-expand .el-form-item {
margin-right: 0;
margin-bottom: 0;
}
.gallery {
width: 80px;
margin-right: 10px;
}
</style>
<script>
import { listCart, createCart, updateCart, deleteCart } from '@/api/cart'
import waves from '@/directive/waves' // 水波纹指令
import { listGoods, deleteGoods } from '@/api/goods'
import BackToTop from '@/components/BackToTop'
export default {
name: 'FootPrint',
directives: {
waves
},
name: 'GoodsList',
components: { BackToTop },
data() {
return {
list: null,
total: null,
list: [],
total: 0,
listLoading: true,
listQuery: {
page: 1,
limit: 20,
userId: undefined,
goodsId: undefined,
sort: '+id'
},
dataForm: {
id: undefined,
userId: '',
goodsId: '',
productId: ''
},
dialogFormVisible: false,
dialogStatus: '',
textMap: {
update: '编辑',
create: '创建'
},
rules: {
userId: [{ required: true, message: '用户ID不能为空', trigger: 'blur' }],
goodsId: [{ required: true, message: '商品ID不能为空', trigger: 'blur' }],
productId: [{ required: true, message: '货品ID不能为空', trigger: 'blur' }]
goodsSn: undefined,
name: undefined,
sort: 'add_time',
order: 'desc'
},
descDetail: '',
descDialogVisible: false,
downloadLoading: false
}
},
......@@ -126,7 +156,7 @@ export default {
methods: {
getList() {
this.listLoading = true
listCart(this.listQuery).then(response => {
listGoods(this.listQuery).then(response => {
this.list = response.data.data.items
this.total = response.data.data.total
this.listLoading = false
......@@ -148,70 +178,18 @@ export default {
this.listQuery.page = val
this.getList()
},
resetForm() {
this.dataForm = {
id: undefined,
userId: '',
goodsId: '',
productId: ''
}
},
handleCreate() {
this.resetForm()
this.dialogStatus = 'create'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
createData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
createCart(this.dataForm).then(response => {
this.list.unshift(response.data.data)
this.dialogFormVisible = false
this.$notify({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
})
})
}
})
this.$router.push({ path: '/goods/create' })
},
handleUpdate(row) {
this.dataForm = Object.assign({}, row)
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
this.$router.push({ path: '/goods/edit', query: { id: row.id }})
},
updateData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
updateCart(this.dataForm).then(() => {
for (const v of this.list) {
if (v.id === this.dataForm.id) {
const index = this.list.indexOf(v)
this.list.splice(index, 1, this.dataForm)
break
}
}
this.dialogFormVisible = false
this.$notify({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
})
})
}
})
showDesc(desc) {
this.descDetail = desc
this.descDialogVisible = true
},
handleDelete(row) {
deleteCart(row).then(response => {
deleteGoods(row).then(response => {
this.$notify({
title: '成功',
message: '删除成功',
......@@ -225,9 +203,9 @@ export default {
handleDownload() {
this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['购物车ID', '用户ID', '商品ID', '商品名称', '商品编号', '商品图片', '货品ID', '货品价格', '货品数量']
const filterVal = ['id', 'userId', 'goodsId', 'goodsName', 'goodsSn', 'pic_url', 'productId', 'retailPrice', 'number']
excel.export_json_to_excel2(tHeader, this.list, filterVal, '用户购物车信息')
const tHeader = ['商品ID', '商品编号', '名称', '专柜价格', '当前价格', '是否新品', '是否热品', '是否在售', '首页主图', '宣传图片列表', '商品介绍', '详细介绍', '商品图片', '商品单位', '关键字', '类目ID', '品牌商ID']
const filterVal = ['id', 'goodsSn', 'name', 'counterPrice', 'retailPrice', 'isNew', 'isHot', 'isOnSale', 'listPicUrl', 'gallery', 'brief', 'desc', 'picUrl', 'goodsUnit', 'keywords', 'categoryId', 'brandId']
excel.export_json_to_excel2(tHeader, this.list, filterVal, '商品信息')
this.downloadLoading = false
})
}
......
<template>
<div class="app-container calendar-list-container">
<!-- 查询和其他操作 -->
<div class="filter-container">
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入商品ID" v-model="listQuery.goodsId">
</el-input>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-edit" @click="handleCreate">添加</el-button>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-download" @click="handleDownload" :loading="downloadLoading">导出</el-button>
</div>
<!-- 查询结果 -->
<el-table size="small" :data="list" v-loading="listLoading" element-loading-text="正在查询中。。。" border fit highlight-current-row>
<el-table-column type="expand">
<template slot-scope="props">
</template>
</el-table-column>
<el-table-column align="center" width="100px" label="货品ID" prop="id" sortable>
</el-table-column>
<el-table-column align="center" min-width="100px" label="商品ID" prop="goodsId">
</el-table-column>
<el-table-column align="center" min-width="150px" label="商品规格ID列表" prop="goodsSpecificationIds">
<template slot-scope="scope">
{{ scope.row.goodsSpecificationIds.join(',') }}
</template>
</el-table-column>
<el-table-column align="center" min-width="100px" label="货品数量" prop="goodsNumber">
</el-table-column>
<el-table-column align="center" min-width="100px" label="货品价格" prop="retailPrice">
</el-table-column>
<el-table-column align="center" min-width="200px" label="货品图片" prop="url">
</el-table-column>
<el-table-column align="center" label="操作" width="250" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.page"
:page-sizes="[10,20,30,50]" :page-size="listQuery.limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
<el-dialog title="添加货品" :visible.sync="createDialogFormVisible">
<el-form :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
<el-form-item label="商品ID" prop="goodsId">
<el-input v-model="dataForm.goodsId"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="createDialogFormVisible = false">取消</el-button>
<el-button type="primary" @click="createData">确定</el-button>
</div>
</el-dialog>
<!-- 修改对话框 -->
<el-dialog title="修改货品" :visible.sync="editDialogFormVisible">
<el-form :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
<el-form-item label="商品ID" prop="goodsId">
<el-input v-model="dataForm.goodsId" :disabled="true"></el-input>
</el-form-item>
<el-form-item label="商品规格ID列表" prop="goodsSpecificationIds">
<el-input v-model="dataForm.goodsSpecificationIds" :disabled="true"></el-input>
</el-form-item>
<el-form-item label="货品数量" prop="goodsNumber">
<el-input v-model="dataForm.goodsNumber"></el-input>
</el-form-item>
<el-form-item label="货品价格" prop="retailPrice">
<el-input v-model="dataForm.retailPrice"></el-input>
</el-form-item>
<el-form-item label="货品图片" prop="url">
<el-input v-model="dataForm.url"></el-input>
<el-upload action="#" list-type="picture" :show-file-list="false" :limit="1" :http-request="uploadUrl">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="editDialogFormVisible = false">取消</el-button>
\ <el-button type="primary" @click="updateData">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<style>
.demo-table-expand {
font-size: 0;
}
.demo-table-expand label {
width: 200px;
color: #99a9bf;
}
.demo-table-expand .el-form-item {
margin-right: 0;
margin-bottom: 0;
}
</style>
<script>
import { listProduct, createProduct, updateProduct, deleteProduct } from '@/api/product'
import { createStorage } from '@/api/storage'
import waves from '@/directive/waves' // 水波纹指令
export default {
name: 'Product',
directives: {
waves
},
data() {
return {
list: undefined,
total: undefined,
listLoading: true,
listQuery: {
page: 1,
limit: 20,
goodsId: undefined,
sort: '+id'
},
createDialogFormVisible: false,
editDialogFormVisible: false,
dataForm: {
id: undefined,
goodsId: undefined,
goodsSpecificationIds: undefined,
goodsNumber: 0,
retailPrice: 0,
url: undefined
},
rules: {
goodsId: [{ required: true, message: '商品ID不能为空', trigger: 'blur' }],
goodsSpecificationIds: [{ required: true, message: '商品规格ID列表不能为空', trigger: 'blur' }]
},
downloadLoading: false
}
},
created() {
this.getList()
},
methods: {
getList() {
this.listLoading = true
listProduct(this.listQuery).then(response => {
this.list = response.data.data.items
this.total = response.data.data.total
this.listLoading = false
}).catch(() => {
this.list = []
this.total = 0
this.listLoading = false
})
},
handleFilter() {
this.listQuery.page = 1
this.getList()
},
handleSizeChange(val) {
this.listQuery.limit = val
this.getList()
},
handleCurrentChange(val) {
this.listQuery.page = val
this.getList()
},
resetForm() {
this.dataForm = {
id: undefined,
goodsId: undefined,
goodsSpecificationIds: undefined,
goodsNumber: 0,
retailPrice: 0,
url: undefined
}
},
uploadUrl(item) {
const formData = new FormData()
formData.append('file', item.file)
createStorage(formData).then(res => {
this.dataForm.url = res.data.data.url
}).catch(() => {
this.$message.error('上传失败,请重新上传')
})
},
handleCreate() {
this.resetForm()
this.createDialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
createData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
createProduct(this.dataForm).then(response => {
this.getList()
this.createDialogFormVisible = false
this.$notify({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
})
})
}
})
},
handleUpdate(row) {
this.dataForm = Object.assign({}, row)
this.editDialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
updateData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
updateProduct(this.dataForm).then(() => {
for (const v of this.list) {
if (v.id === this.dataForm.id) {
const index = this.list.indexOf(v)
this.list.splice(index, 1, this.dataForm)
break
}
}
this.editDialogFormVisible = false
this.$notify({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
})
})
}
})
},
handleDelete(row) {
deleteProduct(row).then(response => {
this.$notify({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
})
},
handleDownload() {
this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['货品ID', '商品ID', '商品规格ID列表', '货品数量', '货品价格', '货品图片']
const filterVal = ['id', 'goodsId', 'goodsSpecificationIds', 'goodsNumber', 'retailPrice', 'url']
excel.export_json_to_excel2(tHeader, this.list, filterVal, '货品信息')
this.downloadLoading = false
})
}
}
}
</script>
<template>
<div class="app-container calendar-list-container">
<!-- 查询和其他操作 -->
<div class="filter-container">
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入商品ID" v-model="listQuery.goodsId">
</el-input>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-edit">添加</el-button>
<el-button class="filter-item" type="primary" :loading="downloadLoading" v-waves icon="el-icon-download" @click="handleDownload">导出</el-button>
</div>
<!-- 查询结果 -->
<el-table size="small" :data="list" v-loading="listLoading" element-loading-text="正在查询中。。。" border fit highlight-current-row>
<el-table-column align="center" width="150px" label="商品参数ID" prop="id" sortable>
</el-table-column>
<el-table-column align="center" min-width="100px" label="商品ID" prop="goodsId">
</el-table-column>
<el-table-column align="center" min-width="100px" label="商品规格名称" prop="specification">
</el-table-column>
<el-table-column align="center" min-width="200px" label="商品规格值" prop="value">
</el-table-column>
<el-table-column align="center" min-width="200px" label="商品规格图片" prop="picUrl">
</el-table-column>
<el-table-column align="center" label="操作" width="250" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.page"
:page-sizes="[10,20,30,50]" :page-size="listQuery.limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
<!-- 添加或修改对话框 -->
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
<el-form :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
<el-form-item label="商品ID" prop="goodsId">
<el-input v-model="dataForm.goodsId"></el-input>
</el-form-item>
<el-form-item label="商品规格名" prop="specification">
<el-input v-model="dataForm.specification"></el-input>
</el-form-item>
<el-form-item label="商品规格值" prop="value">
<el-input v-model="dataForm.value"></el-input>
</el-form-item>
<el-form-item label="商品规格图片" prop="picUrl">
<el-input v-model="dataForm.picUrl"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
<el-button v-if="dialogStatus=='create'" type="primary" @click="createData">确定</el-button>
<el-button v-else type="primary" @click="updateData">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listGoodsSpecification, createGoodsSpecification, updateGoodsSpecification, deleteGoodsSpecification } from '@/api/goods-specification'
import waves from '@/directive/waves' // 水波纹指令
export default {
name: 'GoodsSpecification',
directives: {
waves
},
data() {
return {
list: null,
total: null,
listLoading: true,
listQuery: {
page: 1,
limit: 10,
goodsId: undefined,
sort: '+id'
},
dataForm: {
id: undefined,
goodsId: undefined,
specification: undefined,
value: undefined,
picUrl: undefined
},
dialogFormVisible: false,
dialogStatus: '',
textMap: {
update: '编辑',
create: '创建'
},
rules: {
goodsId: [{ required: true, message: '商品ID不能为空', trigger: 'blur' }],
specification: [{ required: true, message: '商品规格名称不能为空', trigger: 'blur' }],
value: [{ required: true, message: '商品规格值不能为空', trigger: 'blur' }]
},
downloadLoading: false
}
},
created() {
this.getList()
},
methods: {
getList() {
this.listLoading = true
listGoodsSpecification(this.listQuery).then(response => {
this.list = response.data.data.items
this.total = response.data.data.total
this.listLoading = false
}).catch(() => {
this.list = []
this.total = 0
this.listLoading = false
})
},
handleFilter() {
this.listQuery.page = 1
this.getList()
},
handleSizeChange(val) {
this.listQuery.limit = val
this.getList()
},
handleCurrentChange(val) {
this.listQuery.page = val
this.getList()
},
resetForm() {
this.dataForm = {
id: undefined,
goodsId: undefined,
specification: undefined,
value: undefined,
picUrl: undefined
}
},
handleCreate() {
this.resetForm()
this.dialogStatus = 'create'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
createData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
createGoodsSpecification(this.dataForm).then(response => {
this.list.unshift(response.data.data)
this.dialogFormVisible = false
this.$notify({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
})
})
}
})
},
handleUpdate(row) {
this.dataForm = Object.assign({}, row)
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
updateData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
updateGoodsSpecification(this.dataForm).then(() => {
for (const v of this.list) {
if (v.id === this.dataForm.id) {
const index = this.list.indexOf(v)
this.list.splice(index, 1, this.dataForm)
break
}
}
this.dialogFormVisible = false
this.$notify({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
})
})
}
})
},
handleDelete(row) {
deleteGoodsSpecification(row).then(response => {
this.$notify({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
})
},
handleDownload() {
this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['商品规格ID', '商品ID', '商品规格名称', '商品规格值', '商品规格图片']
const filterVal = ['id', 'goodsId', 'specification', 'value', 'picUrl']
excel.export_json_to_excel2(tHeader, this.list, filterVal, '商品规格信息')
this.downloadLoading = false
})
}
}
}
</script>
<script>
export default {
name: 'authredirect',
created() {
const hash = window.location.search.slice(1)
window.opener.location.href = window.location.origin + '/login#' + hash
window.close()
}
}
</script>
......@@ -2,7 +2,7 @@
<div class="login-container">
<el-form class="login-form" autoComplete="on" :model="loginForm" :rules="loginRules" ref="loginForm" label-position="left">
<div class="title-container">
<h3 class="title">系统登录</h3>
<h3 class="title">管理员登录</h3>
</div>
<el-form-item prop="username">
<span class="svg-container svg-container_login">
......@@ -27,26 +27,13 @@
<span>管理员用户名 : admin123</span>
<span>管理员密码 : admin123</span>
</div>
<el-button class="thirdparty-button" type="primary" @click="showDialog=true">第三方登录</el-button>
</el-form>
<el-dialog title="第三方登录" :visible.sync="showDialog" append-to-body>
本地不能模拟,请结合自己业务进行模拟!!!
<br/>
<br/>
<br/>
<social-sign />
</el-dialog>
</div>
</template>
<script>
import SocialSign from './socialsignin'
export default {
components: { SocialSign },
name: 'login',
data() {
const validateUsername = (rule, value, callback) => {
......@@ -73,8 +60,7 @@ export default {
password: [{ required: true, trigger: 'blur', validator: validatePassword }]
},
passwordType: 'password',
loading: false,
showDialog: false
loading: false
}
},
methods: {
......@@ -99,31 +85,7 @@ export default {
return false
}
})
},
afterQRScan() {
// const hash = window.location.hash.slice(1)
// const hashObj = getQueryObject(hash)
// const originUrl = window.location.origin
// history.replaceState({}, '', originUrl)
// const codeMap = {
// wechat: 'code',
// tencent: 'code'
// }
// const codeName = hashObj[codeMap[this.auth_type]]
// if (!codeName) {
// alert('第三方登录失败')
// } else {
// this.$store.dispatch('LoginByThirdparty', codeName).then(() => {
// this.$router.push({ path: '/' })
// })
// }
}
},
created() {
// window.addEventListener('hashchange', this.afterQRScan)
},
destroyed() {
// window.removeEventListener('hashchange', this.afterQRScan)
}
}
</script>
......@@ -210,12 +172,6 @@ $light_gray:#eee;
text-align: center;
font-weight: bold;
}
.set-language {
color: #fff;
position: absolute;
top: 5px;
right: 0px;
}
}
.show-pwd {
position: absolute;
......@@ -226,10 +182,5 @@ $light_gray:#eee;
cursor: pointer;
user-select: none;
}
.thirdparty-button {
position: absolute;
right: 35px;
bottom: 28px;
}
}
</style>
<template>
<div class="social-signup-container">
<div class="sign-btn" @click="wechatHandleClick('wechat')">
<span class="wx-svg-container"><svg-icon icon-class="wechat" class="icon"></svg-icon></span> 微信
</div>
<div class="sign-btn" @click="tencentHandleClick('tencent')">
<span class="qq-svg-container"><svg-icon icon-class="qq" class="icon"></svg-icon></span> QQ
</div>
</div>
</template>
<script>
import openWindow from '@/utils/openWindow'
export default {
name: 'social-signin',
methods: {
wechatHandleClick(thirdpart) {
this.$store.commit('SET_AUTH_TYPE', thirdpart)
const appid = 'xxxxx'
const redirect_uri = encodeURIComponent('xxx/redirect?redirect=' + window.location.origin + '/authredirect')
const url = 'https://open.weixin.qq.com/connect/qrconnect?appid=' + appid + '&redirect_uri=' + redirect_uri + '&response_type=code&scope=snsapi_login#wechat_redirect'
openWindow(url, thirdpart, 540, 540)
},
tencentHandleClick(thirdpart) {
this.$store.commit('SET_AUTH_TYPE', thirdpart)
const client_id = 'xxxxx'
const redirect_uri = encodeURIComponent('xxx/redirect?redirect=' + window.location.origin + '/authredirect')
const url = 'https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=' + client_id + '&redirect_uri=' + redirect_uri
openWindow(url, thirdpart, 540, 540)
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.social-signup-container {
margin: 20px 0;
.sign-btn {
display: inline-block;
cursor: pointer;
}
.icon {
color: #fff;
font-size: 30px;
margin-top: 6px;
}
.wx-svg-container,
.qq-svg-container {
display: inline-block;
width: 40px;
height: 40px;
line-height: 40px;
text-align: center;
padding-top: 1px;
border-radius: 4px;
margin-bottom: 20px;
margin-right: 5px;
}
.wx-svg-container {
background-color: #8dc349;
}
.qq-svg-container {
background-color: #6BA2D6;
margin-left: 50px;
}
}
</style>
......@@ -7,44 +7,33 @@
</el-input>
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入品牌商名称" v-model="listQuery.name">
</el-input>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-edit" @click="handleCreate">添加</el-button>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-download" @click="handleDownload" :loading="downloadLoading">导出</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-download" @click="handleDownload" :loading="downloadLoading">导出</el-button>
</div>
<!-- 查询结果 -->
<el-table size="small" :data="list" v-loading="listLoading" element-loading-text="正在查询中。。。" border fit highlight-current-row>
<el-table-column type="expand">
<template slot-scope="props">
</template>
</el-table-column>
<el-table-column align="center" width="150px" label="品牌商ID" prop="id" sortable>
</el-table-column>
<el-table-column align="center" min-width="100px" label="品牌商名称" prop="name">
</el-table-column>
<el-table-column align="center" min-width="300px" label="介绍" prop="simpleDesc">
<el-table-column align="center" label="品牌商ID" prop="id">
</el-table-column>
<el-table-column align="center" min-width="50px" label="底价" prop="floorPrice">
<el-table-column align="center" label="品牌商名称" prop="name">
</el-table-column>
<el-table-column align="center" min-width="100px" label="是否显示" prop="isShow">
<el-table-column align="center" property="picUrl" label="品牌商图片">
<template slot-scope="scope">
<el-tag :type="scope.row.isShow ? 'success' : 'error' ">{{scope.row.isShow ? '可显示' : '不显示'}}</el-tag>
<img :src="scope.row.picUrl" width="80" v-if="scope.row.picUrl"/>
</template>
</el-table-column>
<el-table-column align="center" min-width="100px" label="是否新上" prop="isNew">
<template slot-scope="scope">
<el-tag :type="scope.row.isNew ? 'success' : 'error' ">{{scope.row.isShow ? '' : ''}}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" min-width="400px" label="介绍" prop="desc">
</el-table-column>
<el-table-column align="center" label="操作" width="250" class-name="small-padding fixed-width">
<el-table-column align="center" label="底价" prop="floorPrice">
</el-table-column>
<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="handleUpdate(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button>
......@@ -66,51 +55,17 @@
<el-input v-model="dataForm.name"></el-input>
</el-form-item>
<el-form-item label="介绍" prop="simpleDesc">
<el-input v-model="dataForm.simpleDesc"></el-input>
<el-input v-model="dataForm.desc"></el-input>
</el-form-item>
<el-form-item label="品牌商图片" prop="picUrl">
<el-input v-model="dataForm.picUrl"></el-input>
<el-upload action="#" list-type="picture" :show-file-list="false" :limit="1" :http-request="uploadPicUrl">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
<el-form-item label="宣传图片" prop="listPicUrl">
<el-input v-model="dataForm.listPicUrl"></el-input>
<el-upload action="#" list-type="picture" :show-file-list="false" :limit="1" :http-request="uploadListPicUrl">
<el-button size="small" type="primary">点击上传</el-button>
<el-upload class="avatar-uploader" :action='uploadPath' list-type="picture-card" :show-file-list="false" accept=".jpg,.jpeg,.png,.gif" :on-success="uploadPicUrl">
<img v-if="dataForm.picUrl" :src="dataForm.picUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
<el-form-item label="APP宣传图片" prop="appListPicUrl">
<el-input v-model="dataForm.appListPicUrl"></el-input>
<el-upload action="#" list-type="picture" :show-file-list="false" :limit="1" :http-request="uploadAppListPicUrl">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
</el-form-item>
<el-form-item label="底价" prop="floorPrice">
<el-input v-model="dataForm.floorPrice"></el-input>
</el-form-item>
<el-form-item label="是否显示" prop="isShow">
<el-select v-model="dataForm.isShow" placeholder="请选择">
<el-option label="显示" :value="true">
</el-option>
<el-option label="不显示" :value="false">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="是否新上" prop="isNew">
<el-select v-model="dataForm.isNew" placeholder="请选择">
<el-option label="新上" :value="true">
</el-option>
<el-option label="不是新上" :value="false">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="新上宣传图片" prop="newPicUrl" v-if="dataForm.isNew === 'true'">
<el-input v-model="dataForm.newPicUrl"></el-input>
<el-upload action="#" list-type="picture" :show-file-list="false" :limit="1" :http-request="uploadNewPicUrl">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
......@@ -123,31 +78,40 @@
</template>
<style>
.demo-table-expand {
font-size: 0;
}
.demo-table-expand label {
width: 200px;
color: #99a9bf;
}
.demo-table-expand .el-form-item {
margin-right: 0;
margin-bottom: 0;
}
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #20a0ff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 120px;
height: 120px;
line-height: 120px;
text-align: center;
}
.avatar {
width: 120px;
height: 120px;
display: block;
}
</style>
<script>
import { listBrand, createBrand, updateBrand, deleteBrand } from '@/api/brand'
import { createStorage } from '@/api/storage'
import waves from '@/directive/waves' // 水波纹指令
import { uploadPath } from '@/api/storage'
export default {
name: 'Brand',
directives: {
waves
},
data() {
return {
uploadPath,
list: undefined,
total: undefined,
listLoading: true,
......@@ -156,19 +120,15 @@ export default {
limit: 20,
id: undefined,
name: undefined,
sort: '+id'
sort: 'add_time',
order: 'desc'
},
dataForm: {
id: undefined,
name: '',
simpleDesc: '',
desc: '',
floorPrice: undefined,
picUrl: undefined,
listPicUrl: undefined,
appListPicUrl: undefined,
isShow: undefined,
isNew: undefined,
newPicUrl: undefined
picUrl: undefined
},
dialogFormVisible: false,
dialogStatus: '',
......@@ -177,7 +137,7 @@ export default {
create: '创建'
},
rules: {
name: [{ required: true, message: '类目名称不能为空', trigger: 'blur' }]
name: [{ required: true, message: '品牌商名称不能为空', trigger: 'blur' }]
},
downloadLoading: false
}
......@@ -214,14 +174,9 @@ export default {
this.dataForm = {
id: undefined,
name: '',
simpleDesc: '',
desc: '',
floorPrice: undefined,
picUrl: undefined,
listPicUrl: undefined,
appListPicUrl: undefined,
isShow: undefined,
isNew: undefined,
newPicUrl: undefined
picUrl: undefined
}
},
handleCreate() {
......@@ -232,41 +187,8 @@ export default {
this.$refs['dataForm'].clearValidate()
})
},
uploadPicUrl(item) {
const formData = new FormData()
formData.append('file', item.file)
createStorage(formData).then(res => {
this.dataForm.picUrl = res.data.data.url
}).catch(() => {
this.$message.error('上传失败,请重新上传')
})
},
uploadListPicUrl(item) {
const formData = new FormData()
formData.append('file', item.file)
createStorage(formData).then(res => {
this.dataForm.listPicUrl = res.data.data.url
}).catch(() => {
this.$message.error('上传失败,请重新上传')
})
},
uploadAppListPicUrl(item) {
const formData = new FormData()
formData.append('file', item.file)
createStorage(formData).then(res => {
this.dataForm.appListPicUrl = res.data.data.url
}).catch(() => {
this.$message.error('上传失败,请重新上传')
})
},
uploadNewPicUrl(item) {
const formData = new FormData()
formData.append('file', item.file)
createStorage(formData).then(res => {
this.dataForm.newPicUrl = res.data.data.url
}).catch(() => {
this.$message.error('上传失败,请重新上传')
})
uploadPicUrl: function(response) {
this.dataForm.picUrl = response.data.url
},
createData() {
this.$refs['dataForm'].validate((valid) => {
......@@ -329,8 +251,8 @@ export default {
handleDownload() {
this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['品牌商ID', '品牌商名称', '介绍', '低价', '是否显示', '品牌商图片', '宣传图片', 'APP宣传图片', '是否新上', '新上宣传图片']
const filterVal = ['id', 'name', 'simpleDesc', 'floorPrice', 'isShow', 'picUrl', 'listPicUrl', 'appListPicUrl', 'isNew', 'newPicUrl']
const tHeader = ['品牌商ID', '品牌商名称', '介绍', '低价', '品牌商图片']
const filterVal = ['id', 'name', 'desc', 'floorPrice', 'picUrl']
excel.export_json_to_excel2(tHeader, this.list, filterVal, '品牌商信息')
this.downloadLoading = false
})
......
......@@ -7,62 +7,49 @@
</el-input>
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入类目名称" v-model="listQuery.name">
</el-input>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-edit">添加</el-button>
<el-button class="filter-item" type="primary" :loading="downloadLoading" v-waves icon="el-icon-download" @click="handleDownload">导出</el-button>
<el-button class="filter-item" type="primary" :loading="downloadLoading" icon="el-icon-download" @click="handleDownload">导出</el-button>
</div>
<!-- 查询结果 -->
<el-table size="small" :data="list" v-loading="listLoading" element-loading-text="正在查询中。。。" border fit highlight-current-row>
<el-table-column type="expand">
<template slot-scope="props">
<el-form label-position="left" class="demo-table-expand">
<el-form-item label="首页页面类目图标">
<img :src="props.row.iconUrl">
</el-form-item>
<el-form-item label="首页页面类目横幅图片">
<img :src="props.row.bannerUrl">
</el-form-item>
<el-form-item label="类目页标题">
<span>{{ props.row.frontName }}</span>
</el-form-item>
<el-form-item label="类目页介绍">
<span>{{ props.row.frontDesc }}</span>
</el-form-item>
<el-form-item label="类目页横幅">
<img :src="props.row.wapBannerUrl">
</el-form-item>
</el-form>
</template>
<el-table-column align="center" label="类目ID" prop="id">
</el-table-column>
<el-table-column align="center" width="100px" label="类目ID" prop="id" sortable>
<el-table-column align="center" label="类目" prop="name">
</el-table-column>
<el-table-column align="center" min-width="100px" label="名称" prop="name">
<el-table-column align="center" property="iconUrl" label="类目图标">
<template slot-scope="scope">
<img :src="scope.row.iconUrl" width="40" v-if="scope.row.iconUrl"/>
</template>
</el-table-column>
<el-table-column align="center" property="picUrl" label="类目图片">
<template slot-scope="scope">
<img :src="scope.row.picUrl" width="80" v-if="scope.row.picUrl"/>
</template>
</el-table-column>
<el-table-column align="center" min-width="100px" label="关键字" prop="keyword">
<el-table-column align="center" label="关键字" prop="keyword">
</el-table-column>
<el-table-column align="center" min-width="100px" label="级别" prop="level"
<el-table-column align="center" min-width="100" label="简介" prop="desc">
</el-table-column>
<el-table-column align="center" label="级别" prop="level"
:filters="[{ text: '一级类目', value: 'L1' }, { text: '二级类目', value: 'L2' }]" :filter-method="filterLevel">
<template slot-scope="scope">
<el-tag :type="scope.row.level === 'L1' ? 'primary' : 'info' ">{{scope.row.level === 'L1' ? '一级类目' : '二级类目'}}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" min-width="100px" label="父类目ID" prop="parentId">
<el-table-column align="center" label="父类目ID" prop="pid">
</el-table-column>
<el-table-column align="center" min-width="100px" label="是否显示" prop="isShow">
<template slot-scope="scope">
<el-tag :type="scope.row.isShow ? 'success' : 'error' ">{{scope.row.isShow ? '可显示' : '不显示'}}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="250" class-name="small-padding fixed-width">
<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="handleUpdate(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button>
......@@ -83,47 +70,38 @@
<el-form-item label="类目名称" prop="name">
<el-input v-model="dataForm.name"></el-input>
</el-form-item>
<el-form-item label="类目关键字" prop="keyword">
<el-form-item label="关键字" prop="keyword">
<el-input v-model="dataForm.keyword"></el-input>
</el-form-item>
<el-form-item label="类目级别" prop="level">
<el-select v-model="dataForm.level" placeholder="请选择">
<el-form-item label="级别" prop="level">
<el-select v-model="dataForm.level" @change="onLevelChange">
<el-option label="一级类目" value="L1">
</el-option>
<el-option label="二级类目" value="L2">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="父类目" prop="parentId" v-if="dataForm.level === 'L2'">
<el-select v-model="dataForm.parentId" placeholder="请选择">
<el-option v-for="(key, val) in catL1" :key="key" :label="key" :value="val">
<el-form-item label="父类目" prop="pid" v-if="dataForm.level === 'L2'">
<el-select v-model="dataForm.pid">
<el-option v-for="item in catL1" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="图标" prop="iconUrl">
<el-input v-model="dataForm.iconUrl"></el-input>
<el-upload action="http://localhost:8080/storage/create" :show-file-list="false" :on-success="handleIconUrl">
<el-button size="small" type="primary">点击上传</el-button>
<el-form-item label="类目图标" prop="iconUrl">
<el-upload class="avatar-uploader" :action='uploadPath' list-type="picture-card" :show-file-list="false" accept=".jpg,.jpeg,.png,.gif" :on-success="uploadIconUrl">
<img v-if="dataForm.iconUrl" :src="dataForm.iconUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
<el-form-item label="首页横幅" prop="bannerUrl">
<el-input v-model="dataForm.bannerUrl"></el-input>
<el-upload action="http://localhost:8080/storage/create" :show-file-list="false" :on-success="handleBannerUrl">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
<el-form-item label="类目页标题" prop="frontName">
<el-input v-model="dataForm.frontName"></el-input>
</el-form-item>
<el-form-item label="类目页介绍" prop="frontDesc">
<el-input v-model="dataForm.frontDesc"></el-input>
</el-form-item>
<el-form-item label="类目页横幅" prop="wapBannerUrl">
<el-input v-model="dataForm.wapBannerUrl"></el-input>
<el-upload action="http://localhost:8080/storage/create" :show-file-list="false" :on-success="handleWapBannerUrl">
<el-button size="small" type="primary">点击上传</el-button>
<el-form-item label="类目图片" prop="picUrl">
<el-upload class="avatar-uploader" :action='uploadPath' list-type="picture-card" :show-file-list="false" accept=".jpg,.jpeg,.png,.gif" :on-success="uploadPicUrl">
<img v-if="dataForm.picUrl" :src="dataForm.picUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
<el-form-item label="类目简介" prop="desc">
<el-input v-model="dataForm.desc"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
......@@ -136,30 +114,40 @@
</template>
<style>
.demo-table-expand {
font-size: 0;
}
.demo-table-expand label {
width: 200px;
color: #99a9bf;
}
.demo-table-expand .el-form-item {
margin-right: 0;
margin-bottom: 0;
}
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #20a0ff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 120px;
height: 120px;
line-height: 120px;
text-align: center;
}
.avatar {
width: 120px;
height: 120px;
display: block;
}
</style>
<script>
import { listCategory, listCatL1, createCategory, updateCategory, deleteCategory } from '@/api/category'
import waves from '@/directive/waves' // 水波纹指令
import { uploadPath } from '@/api/storage'
export default {
name: 'Category',
directives: {
waves
},
data() {
return {
uploadPath,
list: undefined,
total: undefined,
listLoading: true,
......@@ -168,21 +156,19 @@ export default {
limit: 20,
id: undefined,
name: undefined,
sort: '+id'
sort: 'add_time',
order: 'desc'
},
catL1: {},
dataForm: {
id: undefined,
name: '',
keyword: '',
level: 'L1',
parentId: '',
isShow: 'true',
frontName: '',
frontDesc: '',
level: 'L2',
pid: undefined,
desc: '',
iconUrl: undefined,
bannerUrl: undefined,
wapBannerUrl: undefined
picUrl: undefined
},
dialogFormVisible: false,
dialogStatus: '',
......@@ -191,8 +177,7 @@ export default {
create: '创建'
},
rules: {
name: [{ required: true, message: '类目名称不能为空', trigger: 'blur' }],
keyword: [{ required: true, message: '类目关键字不能为空', trigger: 'blur' }]
name: [{ required: true, message: '类目名不能为空', trigger: 'blur' }]
},
downloadLoading: false
}
......@@ -236,19 +221,21 @@ export default {
id: undefined,
name: '',
keyword: '',
level: 'L1',
parentId: '',
isShow: 'true',
frontName: '',
frontDesc: '',
level: 'L2',
pid: undefined,
desc: '',
iconUrl: undefined,
bannerUrl: undefined,
wapBannerUrl: undefined
picUrl: undefined
}
},
filterLevel(value, row) {
filterLevel: function(value, row) {
return row.level === value
},
onLevelChange: function(value) {
if (value === 'L1') {
this.pid = undefined
}
},
handleCreate() {
this.resetForm()
this.dialogStatus = 'create'
......@@ -257,20 +244,11 @@ export default {
this.$refs['dataForm'].clearValidate()
})
},
handleIconUrl(response, file, fileList) {
if (response.errno === 0) {
this.dataForm.iconUrl = response.data.url
}
},
handleBannerUrl(response, file, fileList) {
if (response.errno === 0) {
this.dataForm.bannerUrl = response.data.url
}
uploadIconUrl: function(response) {
this.dataForm.iconUrl = response.data.url
},
handleWapBannerUrl(response, file, fileList) {
if (response.errno === 0) {
this.dataForm.wapBannerUrl = response.data.url
}
uploadPicUrl: function(response) {
this.dataForm.picUrl = response.data.url
},
createData() {
this.$refs['dataForm'].validate((valid) => {
......@@ -333,8 +311,8 @@ export default {
handleDownload() {
this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['类目ID', '名称', '关键字', '级别', '父类目ID', '是否显示', '图标', '首页横幅', '类目页标题', '类目页介绍', '类目页横幅']
const filterVal = ['id', 'name', 'keyword', 'level', 'parentId', 'isShow', 'iconUrl', 'bannerUrl', 'frontName', 'frontDesc', 'wapBannerUrl']
const tHeader = ['类目ID', '名称', '关键字', '级别', '父类目ID', '类目图标', '类目图片', '简介']
const filterVal = ['id', 'name', 'keyword', 'level', 'pid', 'iconUrl', 'picUrl', 'desc']
excel.export_json_to_excel2(tHeader, this.list, filterVal, '商品类目信息')
this.downloadLoading = false
})
......
......@@ -5,9 +5,9 @@
<div class="filter-container">
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入问题" v-model="listQuery.question">
</el-input>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-edit">添加</el-button>
<el-button class="filter-item" type="primary" :loading="downloadLoading" v-waves icon="el-icon-download" @click="handleDownload">导出</el-button>
<el-button class="filter-item" type="primary" :loading="downloadLoading" icon="el-icon-download" @click="handleDownload">导出</el-button>
</div>
<!-- 查询结果 -->
......@@ -58,13 +58,9 @@
<script>
import { listIssue, createIssue, updateIssue, deleteIssue } from '@/api/issue'
import waves from '@/directive/waves' // 水波纹指令
export default {
name: 'Issue',
directives: {
waves
},
data() {
return {
list: null,
......@@ -74,7 +70,8 @@ export default {
page: 1,
limit: 20,
question: undefined,
sort: '+id'
sort: 'add_time',
order: 'desc'
},
dataForm: {
id: undefined,
......
......@@ -7,9 +7,9 @@
</el-input>
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入跳转链接" v-model="listQuery.url">
</el-input>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-edit" @click="handleCreate">添加</el-button>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-download" @click="handleDownload" :loading="downloadLoading">导出</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-download" @click="handleDownload" :loading="downloadLoading">导出</el-button>
</div>
<!-- 查询结果 -->
......@@ -24,7 +24,7 @@
<el-table-column align="center" min-width="300px" label="跳转链接" prop="url">
</el-table-column>
<el-table-column align="center" min-width="100px" label="是否热门" prop="isHot">
<el-table-column align="center" min-width="100px" label="是否推荐" prop="isHot">
<template slot-scope="scope">
<el-tag :type="scope.row.isHot ? 'success' : 'error' ">{{scope.row.isHot ? '' : ''}}</el-tag>
</template>
......@@ -36,12 +36,6 @@
</template>
</el-table-column>
<el-table-column align="center" min-width="100px" label="是否显示" prop="isShow">
<template slot-scope="scope">
<el-tag :type="scope.row.isShow ? 'success' : 'error' ">{{scope.row.isShow ? '可显示' : '不显示'}}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="250" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
......@@ -66,11 +60,11 @@
<el-form-item label="跳转链接" prop="url">
<el-input v-model="dataForm.url"></el-input>
</el-form-item>
<el-form-item label="是否热门" prop="isHot">
<el-form-item label="是否推荐" prop="isHot">
<el-select v-model="dataForm.isHot" placeholder="请选择">
<el-option label="热门" :value="true">
<el-option label="推荐" :value="true">
</el-option>
<el-option label="非热门" :value="false">
<el-option label="普通" :value="false">
</el-option>
</el-select>
</el-form-item>
......@@ -82,14 +76,6 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="是否显示" prop="isShow">
<el-select v-model="dataForm.isShow" placeholder="请选择">
<el-option label="显示" :value="true">
</el-option>
<el-option label="不显示" :value="false">
</el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
......@@ -101,29 +87,11 @@
</div>
</template>
<style>
.demo-table-expand {
font-size: 0;
}
.demo-table-expand label {
width: 200px;
color: #99a9bf;
}
.demo-table-expand .el-form-item {
margin-right: 0;
margin-bottom: 0;
}
</style>
<script>
import { listKeyword, createKeyword, updateKeyword, deleteKeyword } from '@/api/keyword'
import waves from '@/directive/waves' // 水波纹指令
export default {
name: 'Keyword',
directives: {
waves
},
data() {
return {
list: undefined,
......@@ -134,15 +102,15 @@ export default {
limit: 20,
keyword: undefined,
url: undefined,
sort: '+id'
sort: 'add_time',
order: 'desc'
},
dataForm: {
id: undefined,
keyword: undefined,
url: undefined,
isNew: undefined,
isDefault: undefined,
isShow: undefined
isHot: undefined,
isDefault: undefined
},
dialogFormVisible: false,
dialogStatus: '',
......@@ -151,8 +119,7 @@ export default {
create: '创建'
},
rules: {
keyword: [{ required: true, message: '关键词不能为空', trigger: 'blur' }],
url: [{ required: true, message: '跳转链接称不能为空', trigger: 'blur' }]
keyword: [{ required: true, message: '关键词不能为空', trigger: 'blur' }]
},
downloadLoading: false
}
......@@ -190,9 +157,8 @@ export default {
id: undefined,
keyword: undefined,
url: undefined,
isNew: undefined,
isDefault: undefined,
isShow: undefined
isHot: undefined,
isDefault: undefined
}
},
handleCreate() {
......@@ -264,9 +230,9 @@ export default {
handleDownload() {
this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['关键词ID', '关键词', '跳转链接', '是否新上', '是否默认', '是否显示']
const filterVal = ['id', 'keyword', 'url', 'isNew', 'isDefault', 'isShow']
excel.export_json_to_excel2(tHeader, this.list, filterVal, '关键词信息')
const tHeader = ['关键词ID', '关键词', '跳转链接', '是否推荐', '是否默认']
const filterVal = ['id', 'keyword', 'url', 'isHot', 'isDefault']
excel.export_json_to_excel2(tHeader, this.list, filterVal, '关键词设置')
this.downloadLoading = false
})
}
......
......@@ -7,8 +7,8 @@
</el-input>
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入订单编号" v-model="listQuery.orderSn">
</el-input>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-download" @click="handleDownload" :loading="downloadLoading">导出</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-download" @click="handleDownload" :loading="downloadLoading">导出</el-button>
</div>
<!-- 查询结果 -->
......@@ -25,17 +25,14 @@
<el-table-column align="center" min-width="100px" label="用户ID" prop="userId">
</el-table-column>
<el-table-column align="center" min-width="100px" label="订单编号" prop="orderSn">
<el-table-column align="center" min-width="200px" label="订单编号" prop="orderSn">
</el-table-column>
<el-table-column align="center" min-width="100px" label="订单状态" prop="orderStatus">
</el-table-column>
<el-table-column align="center" min-width="100px" label="是否删除" prop="isDelete">
<template slot-scope="scope">
<el-tag :type="scope.row.isDelete ? 'success' : 'error' ">{{scope.row.isDelete ? '未删除' : '已删除'}}</el-tag>
<el-tag>{{scope.row.orderStatus | orderStatusFilter}}</el-tag>
</template>
</el-table-column>
</el-table-column>
<el-table-column align="center" min-width="100px" label="订单费用" prop="orderPrice">
</el-table-column>
......@@ -43,10 +40,10 @@
<el-table-column align="center" min-width="100px" label="实际费用" prop="actualPrice">
</el-table-column>
<el-table-column align="center" label="操作" width="250" class-name="small-padding fixed-width">
<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="handleSend(scope.row)">发货</el-button>
<el-button type="primary" size="mini" @click="handleRecv(scope.row)">收货</el-button>
<el-button type="primary" size="mini" @click="handleShip(scope.row)" v-if="scope.row.orderStatus==201">发货</el-button>
<el-button type="primary" size="mini" @click="handleRefund(scope.row)" v-if="scope.row.orderStatus==202">退款</el-button>
</template>
</el-table-column>
</el-table>
......@@ -59,46 +56,31 @@
</div>
<!-- 发货对话框 -->
<el-dialog title="发货" :visible.sync="sendDialogFormVisible">
<el-form ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
<el-dialog title="发货" :visible.sync="shipDialogVisible">
<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="dataForm.shipChannel"></el-input>
<el-input v-model="shipForm.shipChannel"></el-input>
</el-form-item>
<el-form-item label="快递编号" prop="shipSn">
<el-input v-model="dataForm.shipSn"></el-input>
</el-form-item>
<el-form-item label="快递发货时间" prop="shipStartTime">
<el-date-picker v-model="dataForm.shipStartTime" type="datetime" placeholder="选择日期时间">
</el-date-picker>
<el-input v-model="shipForm.shipSn"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="sendDialogFormVisible = false">取消</el-button>
<el-button type="primary" @click="sendData">确定</el-button>
<el-button @click="shipDialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirmShip">确定</el-button>
</div>
</el-dialog>
<!-- 收货对话框 -->
<el-dialog title="收货" :visible.sync="recvDialogFormVisible">
<el-form ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
<el-form-item label="快递公司" prop="shipChannel">
<el-input disabled v-model="dataForm.shipChannel"></el-input>
</el-form-item>
<el-form-item label="快递编号" prop="shipSn">
<el-input disabled v-model="dataForm.shipSn"></el-input>
</el-form-item>
<el-form-item label="快递发货时间" prop="shipStartTime">
<el-date-picker disabled v-model="dataForm.shipStartTime" type="datetime" placeholder="选择日期时间">
</el-date-picker>
</el-form-item>
<el-form-item label="快递收货时间" prop="shipEndTime">
<el-date-picker v-model="dataForm.shipEndTime" type="datetime" placeholder="选择日期时间">
</el-date-picker>
<!-- 退款对话框 -->
<el-dialog title="退款" :visible.sync="refundDialogVisible">
<el-form ref="refundForm" :model="refundForm" status-icon label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
<el-form-item label="退款金额" prop="refundMoney">
<el-input v-model="refundForm.refundMoney" :disabled="true"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="recvDialogFormVisible = false">取消</el-button>
<el-button type="primary" @click="recvData">确定</el-button>
<el-button @click="refundDialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirmRefund">确定</el-button>
</div>
</el-dialog>
......@@ -120,14 +102,10 @@
</style>
<script>
import { listOrder, updateOrder } from '@/api/order'
import waves from '@/directive/waves' // 水波纹指令
import { listOrder, shipOrder, refundOrder } from '@/api/order'
export default {
name: 'Order',
directives: {
waves
},
data() {
return {
list: undefined,
......@@ -138,20 +116,39 @@ export default {
limit: 20,
id: undefined,
name: undefined,
sort: '+id'
sort: 'add_time',
order: 'desc'
},
dataForm: {
id: undefined,
shipForm: {
orderId: undefined,
shipChannel: undefined,
shipSn: undefined,
shipStartTime: undefined,
shipEndTime: undefined
shipSn: undefined
},
shipDialogVisible: false,
refundForm: {
orderId: undefined,
refundMoney: undefined
},
sendDialogFormVisible: false,
recvDialogFormVisible: false,
refundDialogVisible: false,
downloadLoading: false
}
},
filters: {
orderStatusFilter(status) {
const statusMap = {
'101': '未付款',
'102': '已取消',
'103': '已取消',
'201': '已付款',
'202': '申请退款',
'203': '已退款',
'301': '已发货',
'401': '确认收货',
'402': '确认收货'
}
return statusMap[status]
}
},
created() {
this.getList()
},
......@@ -180,69 +177,53 @@ export default {
this.listQuery.page = val
this.getList()
},
resetForm(row) {
this.dataForm.id = row.id
this.dataForm.shipChannel = row.shipChannel
this.dataForm.shipSn = row.shipSn
this.dataForm.shipStartTime = row.shipStartTime
this.dataForm.shipEndTime = row.shipEndTime
},
handleSend(row) {
this.resetForm(row)
this.sendDialogFormVisible = true
handleShip(row) {
this.shipForm.orderId = row.id
this.shipForm.shipChannel = row.shipChannel
this.shipForm.shipSn = row.shipSn
this.shipDialogVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
this.$refs['shipForm'].clearValidate()
})
},
sendData() {
this.$refs['dataForm'].validate((valid) => {
confirmShip() {
this.$refs['shipForm'].validate((valid) => {
if (valid) {
updateOrder(this.dataForm).then(response => {
const updatedOrder = response.data.data
for (const v of this.list) {
if (v.id === updatedOrder.id) {
const index = this.list.indexOf(v)
this.list.splice(index, 1, updatedOrder)
break
}
}
this.sendDialogFormVisible = false
shipOrder(this.shipForm).then(response => {
this.shipDialogVisible = false
this.$notify({
title: '成功',
message: '更新成功',
message: '确认发货成功',
type: 'success',
duration: 2000
})
this.getList()
})
}
})
},
handleRecv(row) {
this.resetForm(row)
this.recvDialogFormVisible = true
handleRefund(row) {
this.refundForm.orderId = row.id
this.refundForm.refundMoney = row.actualPrice
this.refundDialogVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
this.$refs['refundForm'].clearValidate()
})
},
recvData() {
this.$refs['dataForm'].validate((valid) => {
confirmRefund() {
this.$refs['refundForm'].validate((valid) => {
if (valid) {
updateOrder(this.dataForm).then(response => {
const updatedOrder = response.data.data
for (const v of this.list) {
if (v.id === updatedOrder.id) {
const index = this.list.indexOf(v)
this.list.splice(index, 1, updatedOrder)
break
}
}
this.recvDialogFormVisible = false
refundOrder(this.refundForm).then(response => {
this.refundDialogVisible = false
this.$notify({
title: '成功',
message: '更新成功',
message: '确认退款成功',
type: 'success',
duration: 2000
})
this.getList()
})
}
})
......
......@@ -7,8 +7,8 @@
</el-input>
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入行政区域编码" v-model="listQuery.code">
</el-input>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-download" @click="handleDownload" :loading="downloadLoading">导出</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-download" @click="handleDownload" :loading="downloadLoading">导出</el-button>
</div>
<!-- 查询结果 -->
......@@ -46,13 +46,9 @@
<script>
import { listRegion } from '@/api/region'
import waves from '@/directive/waves' // 水波纹指令
export default {
name: 'Keyword',
directives: {
waves
},
data() {
return {
list: undefined,
......@@ -62,8 +58,7 @@ export default {
page: 1,
limit: 20,
name: undefined,
code: undefined,
sort: '+id'
code: undefined
},
downloadLoading: false
}
......
......@@ -7,40 +7,43 @@
</el-input>
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入广告内容" v-model="listQuery.content">
</el-input>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-edit" @click="handleCreate">添加</el-button>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-download" @click="handleDownload" :loading="downloadLoading">导出</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-download" @click="handleDownload" :loading="downloadLoading">导出</el-button>
</div>
<!-- 查询结果 -->
<el-table size="small" :data="list" v-loading="listLoading" element-loading-text="正在查询中。。。" border fit highlight-current-row>
<el-table-column align="center" width="100px" label="广告ID" prop="id" sortable>
<el-table-column align="center" label="广告ID" prop="id" sortable>
</el-table-column>
<el-table-column align="center" min-width="100px" label="广告标题" prop="name">
<el-table-column align="center" label="广告标题" prop="name">
</el-table-column>
<el-table-column align="center" min-width="200px" label="广告内容" prop="content">
<el-table-column align="center" label="广告内容" prop="content">
</el-table-column>
<el-table-column align="center" min-width="200px" label="广告图片" prop="url">
<el-table-column align="center" label="广告图片" prop="url">
<template slot-scope="scope">
<img :src="scope.row.url" width="80" v-if="scope.row.url"/>
</template>
</el-table-column>
<el-table-column align="center" min-width="50px" label="广告位置" prop="position">
<el-table-column align="center" label="广告位置" prop="position">
</el-table-column>
<el-table-column align="center" min-width="200px" label="活动链接" prop="link">
<el-table-column align="center" label="活动链接" prop="link">
</el-table-column>
<el-table-column align="center" min-width="100px" label="是否启用" prop="enabled">
<el-table-column align="center" label="是否启用" prop="enabled">
<template slot-scope="scope">
<el-tag :type="scope.row.enabled ? 'success' : 'error' ">{{ scope.row.enabled ? '启用' : '不启用' }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="250" class-name="small-padding fixed-width">
<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="handleUpdate(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button>
......@@ -65,9 +68,9 @@
<el-input v-model="dataForm.content"></el-input>
</el-form-item>
<el-form-item label="广告图片" prop="url">
<el-input v-model="dataForm.url"></el-input>
<el-upload action="#" list-type="picture" :show-file-list="false" :limit="1" :http-request="uploadUrl">
<el-button size="small" type="primary">点击上传</el-button>
<el-upload class="avatar-uploader" :action="uploadPath" list-type="picture-card" :show-file-list="false" accept=".jpg,.jpeg,.png,.gif" :on-success="uploadUrl">
<img v-if="dataForm.url" :src="dataForm.url" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
<el-form-item label="广告位置" prop="position">
......@@ -99,31 +102,40 @@
</template>
<style>
.demo-table-expand {
font-size: 0;
}
.demo-table-expand label {
width: 200px;
color: #99a9bf;
}
.demo-table-expand .el-form-item {
margin-right: 0;
margin-bottom: 0;
}
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #20a0ff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 120px;
height: 120px;
line-height: 120px;
text-align: center;
}
.avatar {
width: 120px;
height: 120px;
display: block;
}
</style>
<script>
import { listAd, createAd, updateAd, deleteAd } from '@/api/ad'
import { createStorage } from '@/api/storage'
import waves from '@/directive/waves' // 水波纹指令
import { uploadPath } from '@/api/storage'
export default {
name: 'Ad',
directives: {
waves
},
data() {
return {
uploadPath,
list: undefined,
total: undefined,
listLoading: true,
......@@ -132,7 +144,8 @@ export default {
limit: 20,
name: undefined,
content: undefined,
sort: '+id'
sort: 'add_time',
order: 'desc'
},
dataForm: {
id: undefined,
......@@ -204,14 +217,8 @@ export default {
this.$refs['dataForm'].clearValidate()
})
},
uploadUrl(item) {
const formData = new FormData()
formData.append('file', item.file)
createStorage(formData).then(res => {
this.dataForm.url = res.data.data.url
}).catch(() => {
this.$message.error('上传失败,请重新上传')
})
uploadUrl: function(response) {
this.dataForm.url = response.data.url
},
createData() {
this.$refs['dataForm'].validate((valid) => {
......
......@@ -7,39 +7,41 @@
</el-input>
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入专题子标题" v-model="listQuery.subtitle">
</el-input>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-edit" @click="handleCreate">添加</el-button>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-download" @click="handleDownload" :loading="downloadLoading">导出</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-download" @click="handleDownload" :loading="downloadLoading">导出</el-button>
</div>
<!-- 查询结果 -->
<el-table size="small" :data="list" v-loading="listLoading" element-loading-text="正在查询中。。。" border fit highlight-current-row>
<el-table-column align="center" width="100px" label="专题ID" prop="id" sortable>
</el-table-column>
<el-table-column align="center" min-width="100px" label="专题标题" prop="title">
<el-table-column align="center" label="专题标题" prop="title">
</el-table-column>
<el-table-column align="center" min-width="100px" label="专题子内容" prop="subtitle">
<el-table-column align="center" label="专题子标题" min-width="200" prop="subtitle">
</el-table-column>
<el-table-column align="center" min-width="400px" label="内容" prop="content">
<el-table-column align="center" property="picUrl" label="图片">
<template slot-scope="scope">
<img :src="scope.row.picUrl" width="80"/>
</template>
</el-table-column>
<el-table-column align="center" min-width="80px" label="底价" prop="priceInfo">
<el-table-column align="center" label="专题详情" prop="content">
<template slot-scope="scope">
<el-dialog title="专题详情" :visible.sync="contentDialogVisible">
<div v-html="contentDetail"></div>
</el-dialog>
<el-button type="primary" size="mini" @click="showContent(scope.row.content)">查看</el-button>
</template>
</el-table-column>
<el-table-column align="center" min-width="80px" label="阅读数量" prop="readCount">
<el-table-column align="center" label="底价" prop="price">
</el-table-column>
<el-table-column align="center" min-width="100px" label="是否显示" prop="isShow">
<template slot-scope="scope">
<el-tag :type="scope.row.isShow ? 'success' : 'error' ">{{scope.row.isShow ? '显示' : '不显示'}}</el-tag>
</template>
<el-table-column align="center" label="阅读数量" prop="readCount">
</el-table-column>
<el-table-column align="center" label="操作" width="250" class-name="small-padding fixed-width">
<el-table-column align="center" label="操作" min-width="200" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button>
......@@ -67,23 +69,21 @@
<el-form-item label="专题子标题" prop="subtitle">
<el-input v-model="dataForm.subtitle"></el-input>
</el-form-item>
<el-form-item label="专题图片" prop="picUrl">
<el-upload class="avatar-uploader" :action="uploadPath" list-type="picture-card" :show-file-list="false" accept=".jpg,.jpeg,.png,.gif" :on-success="uploadPicUrl">
<img v-if="dataForm.picUrl" :src="dataForm.picUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
<el-form-item style="width: 700px;" label="专题内容">
<editor :init="editorInit" v-model="dataForm.content"></editor>
</el-form-item>
<el-form-item label="商品低价" prop="priceInfo">
<el-input v-model="dataForm.priceInfo"></el-input>
<el-form-item label="商品低价" prop="price">
<el-input v-model="dataForm.price"></el-input>
</el-form-item>
<el-form-item label="阅读量" prop="readCount">
<el-input v-model="dataForm.readCount"></el-input>
</el-form-item>
<el-form-item label="是否显示" prop="isShow">
<el-select v-model="dataForm.isShow" placeholder="请选择">
<el-option label="显示" :value="true">
</el-option>
<el-option label="不显示" :value="false">
</el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
......@@ -96,37 +96,46 @@
</template>
<style>
.demo-table-expand {
font-size: 0;
}
.demo-table-expand label {
width: 200px;
color: #99a9bf;
}
.demo-table-expand .el-form-item {
margin-right: 0;
margin-bottom: 0;
}
.el-dialog {
width: 800px;
}
}
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #20a0ff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 120px;
height: 120px;
line-height: 120px;
text-align: center;
}
.avatar {
width: 120px;
height: 120px;
display: block;
}
</style>
<script>
import { listTopic, createTopic, updateTopic, deleteTopic } from '@/api/topic'
import { createStorage } from '@/api/storage'
import waves from '@/directive/waves' // 水波纹指令
import { createStorage, uploadPath } from '@/api/storage'
import BackToTop from '@/components/BackToTop'
import Editor from '@tinymce/tinymce-vue'
export default {
name: 'Topic',
components: { BackToTop, Editor },
directives: {
waves
},
data() {
return {
uploadPath,
list: undefined,
total: undefined,
listLoading: true,
......@@ -135,17 +144,21 @@ export default {
limit: 20,
title: undefined,
subtitle: undefined,
sort: '+id'
sort: 'add_time',
order: 'desc'
},
dataForm: {
id: undefined,
titile: undefined,
subtitle: undefined,
picUrl: undefined,
content: '',
priceInfo: undefined,
price: undefined,
readCount: undefined,
isShow: false
goods: []
},
contentDetail: '',
contentDialogVisible: false,
dialogFormVisible: false,
dialogStatus: '',
textMap: {
......@@ -207,10 +220,11 @@ export default {
id: undefined,
titile: undefined,
subtitle: undefined,
picUrl: undefined,
content: '',
priceInfo: undefined,
price: undefined,
readCount: undefined,
isShow: false
goods: []
}
},
handleCreate() {
......@@ -221,14 +235,8 @@ export default {
this.$refs['dataForm'].clearValidate()
})
},
uploadUrl(item) {
const formData = new FormData()
formData.append('file', item.file)
createStorage(formData).then(res => {
this.dataForm.url = res.data.data.url
}).catch(() => {
this.$message.error('上传失败,请重新上传')
})
uploadPicUrl: function(response) {
this.dataForm.picUrl = response.data.url
},
createData() {
this.$refs['dataForm'].validate((valid) => {
......@@ -246,6 +254,10 @@ export default {
}
})
},
showContent(content) {
this.contentDetail = content
this.contentDialogVisible = true
},
handleUpdate(row) {
this.dataForm = Object.assign({}, row)
this.dialogStatus = 'update'
......@@ -291,8 +303,8 @@ export default {
handleDownload() {
this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['专题ID', '专题标题', '专题子标题', '专题内容', '商品低价', '阅读量', '是否显示']
const filterVal = ['id', 'title', 'subtitle', 'content', 'priceInfo', 'readCount', 'isShow']
const tHeader = ['专题ID', '专题标题', '专题子标题', '专题内容', '专题图片', '商品低价', '阅读量', '专题商品']
const filterVal = ['id', 'title', 'subtitle', 'content', 'picUrl', 'price', 'readCount', 'goods']
excel.export_json_to_excel2(tHeader, this.list, filterVal, '专题信息')
this.downloadLoading = false
})
......
<template>
<div class="app-container calendar-list-container">
<ve-line :extend="chartExtend" :data="chartData" :settings="chartSettings"></ve-line>
</div>
</template>
<script>
import { statGoods } from '@/api/stat'
import VeLine from 'v-charts/lib/line'
export default {
components: { VeLine },
data() {
return {
chartData: {},
chartSettings: {},
chartExtend: {}
}
},
created() {
statGoods().then(response => {
this.chartData = response.data.data
this.chartSettings = {
labelMap: {
'orders': '订单量',
'products': '下单货品数量',
'amount': '下单货品总额'
}
}
this.chartExtend = {
xAxis: { boundaryGap: true }
}
})
}
}
</script>
\ No newline at end of file
<template>
<div class="app-container calendar-list-container">
<ve-line :extend="chartExtend" :data="chartData" :settings="chartSettings"></ve-line>
</div>
</template>
<script>
import { statOrder } from '@/api/stat'
import VeLine from 'v-charts/lib/line'
export default {
components: { VeLine },
data() {
return {
chartData: {},
chartSettings: {},
chartExtend: {}
}
},
created() {
statOrder().then(response => {
this.chartData = response.data.data
this.chartSettings = {
labelMap: {
'orders': '订单量',
'customers': '下单用户',
'amount': '订单总额',
'pcr': '客单价'
}
}
this.chartExtend = {
xAxis: { boundaryGap: true }
}
})
}
}
</script>
\ No newline at end of file
<template>
<div class="app-container calendar-list-container">
<ve-histogram :extend="chartExtend" :data="chartData" :settings="chartSettings"></ve-histogram>
</div>
</template>
<script>
import { statUser } from '@/api/stat'
import VeHistogram from 'v-charts/lib/histogram'
export default {
components: { VeHistogram },
data() {
return {
chartData: {},
chartSettings: {},
chartExtend: {}
}
},
created() {
statUser().then(response => {
this.chartData = response.data.data
this.chartSettings = {
labelMap: {
'users': '用户增长数'
}
}
this.chartExtend = {
xAxis: { boundaryGap: true },
series: {
label: { show: true, position: 'top' }
}
}
})
}
}
</script>
\ No newline at end of file
......@@ -5,23 +5,26 @@
<div class="filter-container">
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入管理员名称" v-model="listQuery.username">
</el-input>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-edit">添加</el-button>
<el-button class="filter-item" type="primary" :loading="downloadLoading" v-waves icon="el-icon-download" @click="handleDownload">导出</el-button>
<el-button class="filter-item" type="primary" :loading="downloadLoading" icon="el-icon-download" @click="handleDownload">导出</el-button>
</div>
<!-- 查询结果 -->
<el-table size="small" :data="list" v-loading="listLoading" element-loading-text="正在查询中。。。" border fit highlight-current-row>
<el-table-column align="center" width="100px" label="管理员ID" prop="id" sortable>
<el-table-column align="center" label="管理员ID" prop="id" sortable>
</el-table-column>
<el-table-column align="center" min-width="100px" label="管理员名称" prop="username">
<el-table-column align="center" label="管理员名称" prop="username">
</el-table-column>
<el-table-column align="center" min-width="100px" label="管理员头像" prop="avatar">
<el-table-column align="center" label="管理员头像" prop="avatar">
<template slot-scope="scope">
<img :src="scope.row.avatar" width="40" v-if="scope.row.avatar"/>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="250" class-name="small-padding fixed-width">
<el-table-column align="center" label="操作" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button>
......@@ -49,9 +52,9 @@
<el-input type="password" v-model="dataForm.checkPassword" auto-complete="off"></el-input>
</el-form-item>
<el-form-item label="管理员头像" prop="avatar">
<el-input v-model="dataForm.avatar"></el-input>
<el-upload action="#" list-type="picture" :show-file-list="false" :limit="1" :http-request="uploadAvatar">
<el-button size="small" type="primary">点击上传</el-button>
<el-upload class="avatar-uploader" :action="uploadPath" list-type="picture-card" :show-file-list="false" accept=".jpg,.jpeg,.png,.gif" :on-success="uploadAvatar">
<img v-if="dataForm.avatar" :src="dataForm.avatar" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
</el-form>
......@@ -65,16 +68,38 @@
</div>
</template>
<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: #20a0ff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 120px;
height: 120px;
line-height: 120px;
text-align: center;
}
.avatar {
width: 120px;
height: 120px;
display: block;
}
</style>
<script>
import { listAdmin, createAdmin, updateAdmin, deleteAdmin } from '@/api/admin'
import { createStorage } from '@/api/storage'
import waves from '@/directive/waves' // 水波纹指令
import { uploadPath } from '@/api/storage'
export default {
name: 'Admin',
directives: {
waves
},
data() {
var validatePass = (rule, value, callback) => {
if (value === '') {
......@@ -96,6 +121,7 @@ export default {
}
}
return {
uploadPath,
list: null,
total: null,
listLoading: true,
......@@ -103,7 +129,8 @@ export default {
page: 1,
limit: 20,
username: undefined,
sort: '+id'
sort: 'add_time',
order: 'desc'
},
dataForm: {
id: undefined,
......@@ -169,14 +196,8 @@ export default {
avatar: undefined
}
},
uploadAvatar(item) {
const formData = new FormData()
formData.append('file', item.file)
createStorage(formData).then(res => {
this.dataForm.avatar = res.data.data.url
}).catch(() => {
this.$message.error('上传失败,请重新上传')
})
uploadAvatar: function(response) {
this.dataForm.avatar = response.data.url
},
handleCreate() {
this.resetForm()
......
......@@ -7,32 +7,36 @@
</el-input>
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入对象名称" v-model="listQuery.name">
</el-input>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-edit">添加</el-button>
<el-button class="filter-item" type="primary" :loading="downloadLoading" v-waves icon="el-icon-download" @click="handleDownload">导出</el-button>
<el-button class="filter-item" type="primary" :loading="downloadLoading" icon="el-icon-download" @click="handleDownload">导出</el-button>
</div>
<!-- 查询结果 -->
<el-table size="small" :data="list" v-loading="listLoading" element-loading-text="正在查询中。。。" border fit highlight-current-row>
<el-table-column align="center" width="100px" label="存储ID" prop="id" sortable>
</el-table-column>
<el-table-column align="center" min-width="100px" label="对象KEY" prop="key">
<el-table-column align="center" label="对象KEY" prop="key">
</el-table-column>
<el-table-column align="center" min-width="100px" label="对象名称" prop="name">
<el-table-column align="center" label="对象名称" prop="name">
</el-table-column>
<el-table-column align="center" min-width="100px" label="对象类型" prop="type">
<el-table-column align="center" label="对象类型" prop="type">
</el-table-column>
<el-table-column align="center" min-width="100px" label="对象大小" prop="size">
<el-table-column align="center" label="对象大小" prop="size">
</el-table-column>
<el-table-column align="center" min-width="100px" label="访问链接" prop="url">
</el-table-column>
<el-table-column align="center" property="url" label="图片">
<template slot-scope="scope">
<img :src="scope.row.url" width="40"/>
</template>
</el-table-column>
<el-table-column align="center" label="图片链接" prop="url">
</el-table-column>
<el-table-column align="center" label="操作" width="250" class-name="small-padding fixed-width">
<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="handleUpdate(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button>
......@@ -72,13 +76,9 @@
<script>
import { listStorage, createStorage, updateStorage, deleteStorage } from '@/api/storage'
import waves from '@/directive/waves' // 水波纹指令
export default {
name: 'Storage',
directives: {
waves
},
data() {
return {
list: null,
......@@ -89,7 +89,8 @@ export default {
limit: 20,
key: undefined,
name: undefined,
sort: '+id'
sort: 'add_time',
order: 'desc'
},
createDialogVisible: false,
dataForm: {
......
......@@ -7,9 +7,9 @@
</el-input>
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入收货人名称" v-model="listQuery.name">
</el-input>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-edit">添加</el-button>
<el-button class="filter-item" type="primary" :loading="downloadLoading" v-waves icon="el-icon-download" @click="handleDownload">导出</el-button>
<el-button class="filter-item" type="primary" :loading="downloadLoading" icon="el-icon-download" @click="handleDownload">导出</el-button>
</div>
<!-- 查询结果 -->
......@@ -104,13 +104,9 @@
<script>
import { listAddress, createAddress, updateAddress, deleteAddress } from '@/api/address'
import { listSubRegion } from '@/api/region'
import waves from '@/directive/waves' // 水波纹指令
export default {
name: 'UserAddress',
directives: {
waves
},
data() {
return {
list: null,
......@@ -121,7 +117,8 @@ export default {
limit: 20,
name: undefined,
userId: undefined,
sort: '+id'
sort: 'add_time',
order: 'desc'
},
provinces: {},
cities: {},
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment