mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-12-01 06:30:49 +00:00
2022.8.6
This commit is contained in:
parent
b9ee4638d5
commit
a8234cdbba
2
resources/frontend/package-lock.json
generated
2
resources/frontend/package-lock.json
generated
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "hello-world",
|
||||
"name": "ERP系统",
|
||||
"version": "0.1.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
"axios": "^0.21.1",
|
||||
"core-js": "^3.6.5",
|
||||
"echarts": "^5.3.2",
|
||||
"element-ui": "^2.15.8",
|
||||
"element-ui": "^2.15.6",
|
||||
"js-cookie": "^3.0.1",
|
||||
"nprogress": "^0.2.0",
|
||||
"vue": "^2.6.11",
|
||||
|
||||
@ -1,19 +1,17 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<router-view/>
|
||||
<router-view />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getToken } from '@/util/auth'
|
||||
export default {
|
||||
created () {
|
||||
import { getToken } from "@/util/auth";
|
||||
export default {
|
||||
created() {
|
||||
if (!getToken()) {
|
||||
this.$router.push({ name: 'logo' })
|
||||
this.$router.push({ name: "logo" });
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
||||
<style lang="scss"></style>
|
||||
|
||||
101
resources/frontend/src/api/rankingData.js
vendored
101
resources/frontend/src/api/rankingData.js
vendored
@ -7,7 +7,7 @@
|
||||
* @FilePath: /glxt/src/api/rankingData.js
|
||||
*/
|
||||
|
||||
import http from '@/util/http.js'
|
||||
import http from "@/util/http.js";
|
||||
// export function rankingData(data) {
|
||||
// // 传递参数
|
||||
// return http({
|
||||
@ -17,92 +17,91 @@ import http from '@/util/http.js'
|
||||
// });
|
||||
// }
|
||||
|
||||
export function postadd (params) {
|
||||
export function postadd(params) {
|
||||
// 传递id
|
||||
return http({
|
||||
url: '/api/admin/auth/login', // 传递id
|
||||
method: 'post',
|
||||
params: params
|
||||
})
|
||||
url: "/api/admin/auth/login", // 传递id
|
||||
method: "post",
|
||||
params: params,
|
||||
});
|
||||
}
|
||||
|
||||
// 列表
|
||||
export function store_list (params) {
|
||||
export function store_list(params) {
|
||||
return http({
|
||||
url: '/api/admin/shopGroups',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
url: "/api/admin/shopGroups",
|
||||
method: "get",
|
||||
params: params,
|
||||
});
|
||||
}
|
||||
|
||||
export function storeDetail (params) {
|
||||
export function storeDetail(params) {
|
||||
return http({
|
||||
url: '/storess/show',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
url: "/storess/show",
|
||||
method: "get",
|
||||
params: params,
|
||||
});
|
||||
}
|
||||
// 鲜花项目接口从这里开始
|
||||
// 商品种类列表
|
||||
export function goods_types (data) {
|
||||
export function goods_types(data) {
|
||||
return http({
|
||||
url: '/api/goods_types',
|
||||
method: 'get',
|
||||
data
|
||||
})
|
||||
url: "/api/goods_types",
|
||||
method: "get",
|
||||
data,
|
||||
});
|
||||
}
|
||||
// 商品种类列表删除
|
||||
export function Delgoods_types (id) {
|
||||
export function Delgoods_types(id) {
|
||||
return http({
|
||||
url: `/api/goods_types/${id}`,
|
||||
method: 'delete'
|
||||
|
||||
})
|
||||
method: "delete",
|
||||
});
|
||||
}
|
||||
// 新增种类
|
||||
export function Addgoods_types (data) {
|
||||
export function Addgoods_types(data) {
|
||||
return http({
|
||||
url: '/api/goods_types/',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
url: "/api/goods_types/",
|
||||
method: "post",
|
||||
data,
|
||||
});
|
||||
}
|
||||
// 编辑种类
|
||||
export function editGoods_types (id, data) {
|
||||
export function editGoods_types(id, data) {
|
||||
return http({
|
||||
url: `/api/goods_types/${id}`,
|
||||
method: 'patch',
|
||||
data
|
||||
})
|
||||
method: "patch",
|
||||
data,
|
||||
});
|
||||
}
|
||||
// 商品品牌列表
|
||||
export function Brand_goods_types (data) {
|
||||
export function Brand_goods_types(data) {
|
||||
return http({
|
||||
url: '/api/goods_brands',
|
||||
method: 'get',
|
||||
data
|
||||
})
|
||||
url: "/api/goods_brands",
|
||||
method: "get",
|
||||
data,
|
||||
});
|
||||
}
|
||||
// 商品品牌列表删除
|
||||
export function DelBrand_goods_types (id) {
|
||||
export function DelBrand_goods_types(id) {
|
||||
return http({
|
||||
url: `/api/goods_brands/${id}`,
|
||||
method: 'delete'
|
||||
})
|
||||
method: "delete",
|
||||
});
|
||||
}
|
||||
// 新增品牌
|
||||
export function AddBrandgoods_types (data) {
|
||||
export function AddBrandgoods_types(data) {
|
||||
return http({
|
||||
url: '/api/goods_brands',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
url: "/api/goods_brands",
|
||||
method: "post",
|
||||
data,
|
||||
});
|
||||
}
|
||||
// 编辑品牌
|
||||
export function editBrand_types (id, data) {
|
||||
export function editBrand_types(id, data) {
|
||||
return http({
|
||||
url: `/api/goods_brands/${id}`,
|
||||
method: 'patch',
|
||||
data
|
||||
})
|
||||
method: "patch",
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
5
resources/frontend/src/util/http.js
vendored
5
resources/frontend/src/util/http.js
vendored
@ -28,7 +28,7 @@ instance.interceptors.request.use(
|
||||
// config.headers['content-type'] = 'application/json'
|
||||
config.headers.Authorization = 'Bearer ' + getToken() // 请求头
|
||||
NProgress.start()
|
||||
console.log(config, '1111') // for debug
|
||||
// console.log(config, '1111') // for debug
|
||||
|
||||
return config
|
||||
},
|
||||
@ -45,14 +45,13 @@ instance.interceptors.response.use(
|
||||
NProgress.done()
|
||||
const res = response.status
|
||||
// 对响应数据做点什么
|
||||
console.log(response, '33333') // for debug
|
||||
// console.log(response, '33333') // for debug
|
||||
if (res === 200 || res === 201) {
|
||||
return response
|
||||
} else {
|
||||
Message({
|
||||
message: 'Error',
|
||||
type: 'error'
|
||||
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
@ -1,148 +1,154 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<el-button type="primary"
|
||||
@click="handAdd">新增</el-button>
|
||||
<el-table ref="multipleTable"
|
||||
:data="tableData"
|
||||
tooltip-effect="dark"
|
||||
style="width: 100%"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection"
|
||||
width="55">
|
||||
</el-table-column>
|
||||
<el-table-column prop="name"
|
||||
label="商品种类">
|
||||
</el-table-column>
|
||||
<el-table-column prop=""
|
||||
label="操作">
|
||||
<div class="conent">
|
||||
<!-- 新增按钮 -->
|
||||
<div class="btn">
|
||||
<el-button type="primary" @click="handAdd">新增</el-button>
|
||||
</div>
|
||||
<!-- 列表 -->
|
||||
<div class="table">
|
||||
<el-table
|
||||
ref="multipleTable"
|
||||
:data="tableData"
|
||||
tooltip-effect="dark"
|
||||
style="width: 100%"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55"> </el-table-column>
|
||||
<el-table-column prop="name" label="商品品牌"> </el-table-column>
|
||||
<el-table-column prop="" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary"
|
||||
@click="handEdit(scope.row.id,scope.row)">编辑</el-button>
|
||||
<el-button type="danger"
|
||||
@click="handdel(scope.row.id)">删除</el-button>
|
||||
<el-button type="primary" @click="handEdit(scope.row.id, scope.row)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button type="danger" @click="handdel(scope.row.id)"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<el-pagination @size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="page"
|
||||
:page-sizes="[10, 20, 30, 40]"
|
||||
:page-size="per_page"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
<!-- 新增种类对话框 -->
|
||||
<el-dialog title="新增种类"
|
||||
:visible.sync="dialogFormVisible">
|
||||
<el-dialog title="新增种类" :visible.sync="dialogFormVisible">
|
||||
<el-form :model="form">
|
||||
<el-form-item label="商品种类"
|
||||
:label-width="formLabelWidth">
|
||||
<el-input v-model="form.kindName"
|
||||
autocomplete="off"></el-input>
|
||||
<el-form-item label="商品种类" :label-width="formLabelWidth">
|
||||
<el-input v-model="form.kindName" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer"
|
||||
class="dialog-footer">
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||
<el-button type="primary"
|
||||
@click="addSubmit">确 定</el-button>
|
||||
<el-button type="primary" @click="addSubmit">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 编辑 -->
|
||||
<el-dialog title="编辑"
|
||||
:visible.sync="dialogFormVisible1">
|
||||
<el-dialog title="编辑" :visible.sync="dialogFormVisible1">
|
||||
<el-form :model="form1">
|
||||
<el-form-item label="编辑种类"
|
||||
:label-width="formLabelWidth1">
|
||||
<el-input v-model="form1.kindName1"
|
||||
autocomplete="off"></el-input>
|
||||
<el-form-item label="编辑种类" :label-width="formLabelWidth1">
|
||||
<el-input v-model="form1.kindName1" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer"
|
||||
class="dialog-footer">
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible1 = false">取 消</el-button>
|
||||
<el-button type="primary"
|
||||
@click="EditSubmit">确 定</el-button>
|
||||
<el-button type="primary" @click="EditSubmit">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 分页功能 -->
|
||||
<div class="block">
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="current_page"
|
||||
:page-sizes="[15, 50, 100]"
|
||||
:page-size="per_page"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="Paginationdata.total"
|
||||
>
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
Brand_goods_types,
|
||||
// Brand_goods_types,
|
||||
DelBrand_goods_types,
|
||||
AddBrandgoods_types,
|
||||
editBrand_types,
|
||||
} from '../../api/rankingData'
|
||||
} from "../../api/rankingData";
|
||||
import axios from "axios";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
id: '', //每一项的id
|
||||
page: 1,
|
||||
per_page: 15,
|
||||
id: "", //每一项的id
|
||||
tableData: [],
|
||||
multipleSelection: [],
|
||||
currentPage4: 4,
|
||||
dialogFormVisible: false,
|
||||
dialogFormVisible1: false,
|
||||
form: {
|
||||
kindName: '', //种类名
|
||||
kindName: "", //种类名
|
||||
},
|
||||
form1: {
|
||||
kindName1: '', //种类名
|
||||
kindName1: "", //种类名
|
||||
},
|
||||
formLabelWidth: '120px',
|
||||
formLabelWidth1: '120px',
|
||||
formLabelWidth: "120px",
|
||||
formLabelWidth1: "120px",
|
||||
newKind: [],
|
||||
}
|
||||
Paginationdata: {}, //分页相关数据
|
||||
current_page: 1, //当前页
|
||||
per_page: 15, //每页显示数量
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getGoods_types()
|
||||
this.getGoods_types();
|
||||
},
|
||||
methods: {
|
||||
// 复选框按钮
|
||||
handleSelectionChange(val) {
|
||||
console.log(val)
|
||||
this.multipleSelection = val
|
||||
console.log(val);
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
// 分页
|
||||
//分页功能
|
||||
handleSizeChange(val) {
|
||||
console.log(`每页 ${val} 条`)
|
||||
//当前条数
|
||||
this.per_page = val;
|
||||
console.log(1111, val);
|
||||
this.getGoods_types();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
console.log(`当前页: ${val}`)
|
||||
//当前页
|
||||
this.current_page = val;
|
||||
console.log(2222, val);
|
||||
this.getGoods_types();
|
||||
},
|
||||
// 新增
|
||||
handAdd() {
|
||||
this.form.kindName = ''
|
||||
this.dialogFormVisible = true
|
||||
this.form.kindName = "";
|
||||
this.dialogFormVisible = true;
|
||||
},
|
||||
// 确认新增
|
||||
addSubmit() {
|
||||
var string
|
||||
string = this.form.kindName.replace(/\s/g, ',').split(',')
|
||||
console.log(string, 'lkkkk')
|
||||
var string;
|
||||
string = this.form.kindName.replace(/\s/g, ",").split(",");
|
||||
console.log(string, "lkkkk");
|
||||
AddBrandgoods_types({
|
||||
names: string,
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '添加成功',
|
||||
})
|
||||
this.getGoods_types()
|
||||
})
|
||||
this.dialogFormVisible = false
|
||||
type: "success",
|
||||
message: "添加成功",
|
||||
});
|
||||
this.getGoods_types();
|
||||
});
|
||||
this.dialogFormVisible = false;
|
||||
},
|
||||
// 编辑
|
||||
handEdit(id, item) {
|
||||
this.id = id
|
||||
console.log('item', item)
|
||||
this.form1.kindName1 = item.name
|
||||
this.dialogFormVisible1 = true
|
||||
this.id = id;
|
||||
console.log("item", item);
|
||||
this.form1.kindName1 = item.name;
|
||||
this.dialogFormVisible1 = true;
|
||||
},
|
||||
// 编辑确定按钮
|
||||
EditSubmit() {
|
||||
@ -150,50 +156,93 @@ export default {
|
||||
name: this.form1.kindName1,
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '编辑成功',
|
||||
})
|
||||
this.getGoods_types()
|
||||
})
|
||||
this.dialogFormVisible1 = false
|
||||
type: "success",
|
||||
message: "编辑成功",
|
||||
});
|
||||
this.getGoods_types();
|
||||
});
|
||||
this.dialogFormVisible1 = false;
|
||||
},
|
||||
// 删除
|
||||
handdel(id) {
|
||||
this.$confirm('确定删除此条商品种类吗?', '确认删除', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
this.$confirm("确定删除此条商品种类吗?", "确认删除", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
DelBrand_goods_types(id).then((res) => {
|
||||
this.getGoods_types()
|
||||
})
|
||||
this.getGoods_types();
|
||||
});
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!',
|
||||
})
|
||||
type: "success",
|
||||
message: "删除成功!",
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除',
|
||||
})
|
||||
})
|
||||
type: "info",
|
||||
message: "已取消删除",
|
||||
});
|
||||
});
|
||||
},
|
||||
// 获取列表
|
||||
getGoods_types() {
|
||||
Brand_goods_types({
|
||||
page: this.page,
|
||||
per_page: this.per_page,
|
||||
}).then((res) => {
|
||||
console.log('res=>>>>>>>>', res)
|
||||
this.tableData = res.data.data
|
||||
this.total = res.data.data.length
|
||||
})
|
||||
// Brand_goods_types({
|
||||
// // page: this.current_page,
|
||||
// // per_page: this.per_page,
|
||||
// data: {
|
||||
// page: this.current_page,
|
||||
// per_page: this.per_page,
|
||||
// },
|
||||
// }).then((res) => {
|
||||
// console.log(res);
|
||||
// this.tableData = res.data.data;
|
||||
// this.Paginationdata = res.data.data.length;
|
||||
// });
|
||||
axios
|
||||
.get("/api/goods_brands", {
|
||||
headers: {
|
||||
Authorization:
|
||||
"Bearer w1rr6IsxZIud46dIrGIivNAroFpqN52sSpXhk3azpPq2ZTbUXhgKTOLheoRm",
|
||||
},
|
||||
params: {
|
||||
page: this.current_page,
|
||||
per_page: this.per_page,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
// console.log(res);
|
||||
this.tableData = res.data.data;
|
||||
this.Paginationdata = res.data.meta;
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
<style lang="scss" scoped>
|
||||
.conent {
|
||||
width: 100%;
|
||||
min-height: calc(100vh - 200px);
|
||||
position: relative;
|
||||
}
|
||||
.btn {
|
||||
height: 104px;
|
||||
border-radius: 5px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.el-button {
|
||||
width: 114px;
|
||||
height: 44px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
}
|
||||
.table {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.block {
|
||||
margin-top: 30px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,153 +1,156 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<el-button type="primary"
|
||||
@click="handAdd">新增</el-button>
|
||||
<el-table ref="multipleTable"
|
||||
:data="tableData"
|
||||
tooltip-effect="dark"
|
||||
style="width: 100%"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection"
|
||||
width="55">
|
||||
</el-table-column>
|
||||
<el-table-column prop="name"
|
||||
label="商品种类">
|
||||
</el-table-column>
|
||||
<el-table-column prop=""
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary"
|
||||
@click="handEdit(scope.row.id,scope.row)">编辑</el-button>
|
||||
<el-button type="danger"
|
||||
@click="handdel(scope.row.id)">删除</el-button>
|
||||
</template>
|
||||
<div class="conent">
|
||||
<!-- 新增按钮 -->
|
||||
<div class="btn">
|
||||
<el-button type="primary" @click="handAdd">新增</el-button>
|
||||
</div>
|
||||
|
||||
<!-- 列表 -->
|
||||
<div class="table">
|
||||
<el-table
|
||||
ref="multipleTable"
|
||||
:data="tableData"
|
||||
tooltip-effect="dark"
|
||||
style="width: 100%"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55"> </el-table-column>
|
||||
<el-table-column prop="name" label="商品种类"> </el-table-column>
|
||||
<el-table-column prop="" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" @click="handEdit(scope.row.id, scope.row)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button type="danger" @click="handdel(scope.row.id)"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<el-pagination @size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="page"
|
||||
:page-size="per_page"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
<!-- 新增种类对话框 -->
|
||||
<el-dialog title="新增"
|
||||
:visible.sync="dialogFormVisible">
|
||||
<el-dialog title="新增" :visible.sync="dialogFormVisible">
|
||||
<el-form :model="form">
|
||||
<el-form-item label="商品种类"
|
||||
:label-width="formLabelWidth">
|
||||
<el-input v-model="form.kindName"
|
||||
autocomplete="off"></el-input>
|
||||
<el-form-item label="商品种类" :label-width="formLabelWidth">
|
||||
<el-input v-model="form.kindName" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer"
|
||||
class="dialog-footer">
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||
<el-button type="primary"
|
||||
@click="addSubmit">确 定</el-button>
|
||||
<el-button type="primary" @click="addSubmit">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 编辑 -->
|
||||
<el-dialog title="编辑"
|
||||
:visible.sync="dialogFormVisible1">
|
||||
<el-dialog title="编辑" :visible.sync="dialogFormVisible1">
|
||||
<el-form :model="form1">
|
||||
<el-form-item label="编辑种类"
|
||||
:label-width="formLabelWidth1">
|
||||
<el-input v-model="form1.kindName1"
|
||||
autocomplete="off"></el-input>
|
||||
<el-form-item label="编辑种类" :label-width="formLabelWidth1">
|
||||
<el-input v-model="form1.kindName1" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer"
|
||||
class="dialog-footer">
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible1 = false">取 消</el-button>
|
||||
<el-button type="primary"
|
||||
@click="EditSubmit">确 定</el-button>
|
||||
<el-button type="primary" @click="EditSubmit">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 分页功能 -->
|
||||
<div class="block">
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="current_page"
|
||||
:page-sizes="[15, 50, 100]"
|
||||
:page-size="per_page"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="Paginationdata.total"
|
||||
>
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
goods_types,
|
||||
// goods_types,
|
||||
Delgoods_types,
|
||||
Addgoods_types,
|
||||
editGoods_types,
|
||||
} from '../../api/rankingData'
|
||||
} from "../../api/rankingData";
|
||||
import axios from "axios";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
id: '', //每一项的id
|
||||
page: 1, //开始页
|
||||
per_page: 10, //一页多少数据
|
||||
total: 1,
|
||||
id: "", //每一项的id
|
||||
tableData: [],
|
||||
multipleSelection: [],
|
||||
currentPage4: 4,
|
||||
dialogFormVisible: false,
|
||||
dialogFormVisible1: false,
|
||||
form: {
|
||||
kindName: '', //种类名
|
||||
kindName: "", //种类名
|
||||
},
|
||||
form1: {
|
||||
kindName1: '', //种类名
|
||||
kindName1: "", //种类名
|
||||
},
|
||||
formLabelWidth: '120px',
|
||||
formLabelWidth1: '120px',
|
||||
formLabelWidth: "120px",
|
||||
formLabelWidth1: "120px",
|
||||
newKind: [],
|
||||
}
|
||||
Paginationdata: {}, //分页相关数据
|
||||
current_page: 1, //当前页
|
||||
per_page: 15, //每页显示数量
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getGoods_types()
|
||||
this.getGoods_types();
|
||||
},
|
||||
methods: {
|
||||
// 复选框按钮
|
||||
handleSelectionChange(val) {
|
||||
console.log(val)
|
||||
this.multipleSelection = val
|
||||
console.log(val);
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
// 分页
|
||||
|
||||
//分页功能
|
||||
handleSizeChange(val) {
|
||||
console.log(`每页 ${val} 条`)
|
||||
this.per_page = val
|
||||
this.page = 1
|
||||
this.getGoods_types()
|
||||
//当前条数
|
||||
this.per_page = val;
|
||||
console.log(1111, val);
|
||||
this.getGoods_types();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
console.log(`当前页: ${val}`)
|
||||
this.page = val
|
||||
this.getGoods_types()
|
||||
//当前页
|
||||
this.current_page = val;
|
||||
console.log(2222, val);
|
||||
this.getGoods_types();
|
||||
},
|
||||
// 新增
|
||||
handAdd() {
|
||||
this.form.kindName = ''
|
||||
this.dialogFormVisible = true
|
||||
this.form.kindName = "";
|
||||
this.dialogFormVisible = true;
|
||||
},
|
||||
// 确认新增
|
||||
addSubmit() {
|
||||
var string
|
||||
string = this.form.kindName.replace(/\s/g, ',').split(',')
|
||||
console.log(string, 'lkkkk')
|
||||
var string;
|
||||
string = this.form.kindName.replace(/\s/g, ",").split(",");
|
||||
console.log(string, "lkkkk");
|
||||
Addgoods_types({
|
||||
names: string,
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '添加成功',
|
||||
})
|
||||
this.getGoods_types()
|
||||
})
|
||||
this.dialogFormVisible = false
|
||||
type: "success",
|
||||
message: "添加成功",
|
||||
});
|
||||
this.getGoods_types();
|
||||
});
|
||||
this.dialogFormVisible = false;
|
||||
},
|
||||
// 编辑
|
||||
handEdit(id, item) {
|
||||
this.id = id
|
||||
console.log('item', item)
|
||||
this.form1.kindName1 = item.name
|
||||
this.dialogFormVisible1 = true
|
||||
this.id = id;
|
||||
console.log("item", item);
|
||||
this.form1.kindName1 = item.name;
|
||||
this.dialogFormVisible1 = true;
|
||||
},
|
||||
// 编辑确定按钮
|
||||
EditSubmit() {
|
||||
@ -155,52 +158,90 @@ export default {
|
||||
name: this.form1.kindName1,
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '编辑成功',
|
||||
})
|
||||
this.getGoods_types()
|
||||
})
|
||||
this.dialogFormVisible1 = false
|
||||
type: "success",
|
||||
message: "编辑成功",
|
||||
});
|
||||
this.getGoods_types();
|
||||
});
|
||||
this.dialogFormVisible1 = false;
|
||||
},
|
||||
// 删除
|
||||
handdel(id) {
|
||||
this.$confirm('确定删除此条商品种类吗?', '确认删除', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
this.$confirm("确定删除此条商品种类吗?", "确认删除", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
Delgoods_types(id).then((res) => {
|
||||
this.getGoods_types()
|
||||
})
|
||||
this.getGoods_types();
|
||||
});
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!',
|
||||
})
|
||||
type: "success",
|
||||
message: "删除成功!",
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除',
|
||||
})
|
||||
})
|
||||
type: "info",
|
||||
message: "已取消删除",
|
||||
});
|
||||
});
|
||||
},
|
||||
// 获取列表
|
||||
getGoods_types() {
|
||||
goods_types({
|
||||
page: this.page,
|
||||
per_page: this.per_page,
|
||||
}).then((res) => {
|
||||
console.log('res=>>>>>>>>', res)
|
||||
this.tableData = res.data.data
|
||||
this.total = res.data.data.length
|
||||
this.page = res.meta.current_page
|
||||
this.per_page = res.meta.per_page
|
||||
})
|
||||
// goods_types({
|
||||
// page: this.page,
|
||||
// per_page: this.per_page,
|
||||
// }).then((res) => {
|
||||
// console.log('res=>>>>>>>>', res)
|
||||
// this.tableData = res.data.data
|
||||
// this.total = res.data.data.length
|
||||
// this.page = res.meta.current_page
|
||||
// this.per_page = res.meta.per_page
|
||||
// })
|
||||
axios
|
||||
.get("/api/goods_types", {
|
||||
headers: {
|
||||
Authorization:
|
||||
"Bearer w1rr6IsxZIud46dIrGIivNAroFpqN52sSpXhk3azpPq2ZTbUXhgKTOLheoRm",
|
||||
},
|
||||
params: {
|
||||
page: this.current_page,
|
||||
per_page: this.per_page,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
// console.log(res);
|
||||
this.tableData = res.data.data;
|
||||
this.Paginationdata = res.data.meta;
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.conent {
|
||||
width: 100%;
|
||||
min-height: calc(100vh - 200px);
|
||||
position: relative;
|
||||
}
|
||||
.btn {
|
||||
height: 104px;
|
||||
border-radius: 5px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.el-button {
|
||||
width: 114px;
|
||||
height: 44px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
}
|
||||
.table {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
<style>
|
||||
</style>
|
||||
.block {
|
||||
margin-top: 30px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -112,7 +112,7 @@ export default {
|
||||
// table构造
|
||||
$route: {
|
||||
handler: function (val) {
|
||||
console.log(val, 99999)
|
||||
// console.log(val, 99999)
|
||||
this.titie = val.matched
|
||||
this.head = val.name
|
||||
this.levelData.push({ name: val.name, path: val.path })
|
||||
|
||||
@ -50,11 +50,13 @@ export default {
|
||||
type: "error",
|
||||
});
|
||||
} else {
|
||||
let token = localStorage.getItem("token");
|
||||
axios
|
||||
.post("/api/auth/login", this.form, {
|
||||
headers: {
|
||||
Authorization:
|
||||
"Bearer w1rr6IsxZIud46dIrGIivNAroFpqN52sSpXhk3azpPq2ZTbUXhgKTOLheoRm",
|
||||
token: token,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
|
||||
192
resources/frontend/src/views/shuju/record.vue
Normal file
192
resources/frontend/src/views/shuju/record.vue
Normal file
@ -0,0 +1,192 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card class="box-card">
|
||||
<div class="goods"
|
||||
style="margin:20px">
|
||||
<el-form ref="form"
|
||||
:inline="true"
|
||||
:model="form">
|
||||
<el-form-item label="查询类别:">
|
||||
<el-select v-model="form.name1"
|
||||
placeholder="全部">
|
||||
<el-option v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品编号">
|
||||
<el-input v-model="input"
|
||||
placeholder="输入商品编号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品名称">
|
||||
<el-input v-model="input"
|
||||
placeholder="输入商品名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品种类:">
|
||||
<el-select v-model="form.name1"
|
||||
placeholder="输入商品种类">
|
||||
<el-option v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品规格:">
|
||||
<el-select v-model="form.name1"
|
||||
placeholder="输入商品规格">
|
||||
<el-option v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品品牌:">
|
||||
<el-select v-model="form.name1"
|
||||
placeholder="输入商品品牌">
|
||||
<el-option v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="操作时间:">
|
||||
<el-date-picker v-model="value1"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="起"
|
||||
end-placeholder="止"
|
||||
align="right">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary">查询</el-button>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
|
||||
</div>
|
||||
|
||||
</el-card>
|
||||
<el-card style="margin-top:30px"
|
||||
class="box-card">
|
||||
<div>
|
||||
<span></span>
|
||||
<span>历史记录</span>
|
||||
<span>(共800条)</span>
|
||||
<span>——玫瑰花</span>
|
||||
</div>
|
||||
<el-table :data="tableData"
|
||||
style="width: 100%">
|
||||
<el-table-column prop="date"
|
||||
label="序号"
|
||||
width="180">
|
||||
</el-table-column>
|
||||
<el-table-column prop="name"
|
||||
label="时间"
|
||||
width="180">
|
||||
</el-table-column>
|
||||
<el-table-column prop="address"
|
||||
label="类别">
|
||||
</el-table-column>
|
||||
<el-table-column prop="address"
|
||||
label="操作前">
|
||||
</el-table-column>
|
||||
<el-table-column prop="address"
|
||||
label="操作后">
|
||||
</el-table-column>
|
||||
<el-table-column prop="address"
|
||||
label="操作人">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
</el-card>
|
||||
<el-pagination @size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="currentPage4"
|
||||
:page-sizes="[100, 200, 300, 400]"
|
||||
:page-size="100"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="400">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
options: [
|
||||
{
|
||||
value: '选项1',
|
||||
label: '黄金糕',
|
||||
},
|
||||
{
|
||||
value: '选项2',
|
||||
label: '双皮奶',
|
||||
},
|
||||
{
|
||||
value: '选项3',
|
||||
label: '蚵仔煎',
|
||||
},
|
||||
{
|
||||
value: '选项4',
|
||||
label: '龙须面',
|
||||
},
|
||||
{
|
||||
value: '选项5',
|
||||
label: '北京烤鸭',
|
||||
},
|
||||
],
|
||||
tableData: [
|
||||
{
|
||||
date: '2016-05-02',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1518 弄',
|
||||
},
|
||||
{
|
||||
date: '2016-05-04',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1517 弄',
|
||||
},
|
||||
{
|
||||
date: '2016-05-01',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1519 弄',
|
||||
},
|
||||
{
|
||||
date: '2016-05-03',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1516 弄',
|
||||
},
|
||||
],
|
||||
currentPage4: 4,
|
||||
form: {
|
||||
name1: '',
|
||||
name2: '',
|
||||
name3: '',
|
||||
name4: '',
|
||||
name5: '',
|
||||
name6: '',
|
||||
},
|
||||
input: '',
|
||||
value1: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleSizeChange(val) {
|
||||
console.log(`每页 ${val} 条`)
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
console.log(`当前页: ${val}`)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
@ -1,164 +1,163 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 筛选框 -->
|
||||
<el-card class="box-card">
|
||||
<div class="goods"
|
||||
style="margin:20px">
|
||||
<el-form ref="form"
|
||||
:inline="true"
|
||||
:model="form">
|
||||
<div class="goods" style="margin: 20px">
|
||||
<el-form ref="form" :inline="true" :model="form">
|
||||
<el-form-item label="查询类别:">
|
||||
<el-select v-model="form.name1"
|
||||
placeholder="全部">
|
||||
<el-option v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
<el-select v-model="form.name1" placeholder="全部">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="操作用户">
|
||||
<el-select v-model="form.name2"
|
||||
placeholder="输入操作用户">
|
||||
<el-option v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
<el-select v-model="form.name2" placeholder="输入操作用户">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="操作时间:">
|
||||
<el-date-picker v-model="value1"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="起"
|
||||
end-placeholder="止"
|
||||
align="right">
|
||||
<el-date-picker
|
||||
v-model="value1"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="起"
|
||||
end-placeholder="止"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary">查询</el-button>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
|
||||
</div>
|
||||
|
||||
</el-card>
|
||||
<el-card style="margin-top:30px"
|
||||
class="box-card">
|
||||
<div>
|
||||
<span></span>
|
||||
<span>历史记录</span>
|
||||
<span>(共800条)</span>
|
||||
<span>——玫瑰花</span>
|
||||
</div>
|
||||
<el-table :data="tableData"
|
||||
style="width: 100%">
|
||||
<el-table-column prop="date"
|
||||
label="序号"
|
||||
width="180">
|
||||
</el-table-column>
|
||||
<el-table-column prop="name"
|
||||
label="时间"
|
||||
width="180">
|
||||
</el-table-column>
|
||||
<el-table-column prop="address"
|
||||
label="类别">
|
||||
</el-table-column>
|
||||
<el-table-column prop="address"
|
||||
label="操作前">
|
||||
</el-table-column>
|
||||
<el-table-column prop="address"
|
||||
label="操作后">
|
||||
</el-table-column>
|
||||
<el-table-column prop="address"
|
||||
label="操作人">
|
||||
</el-table-column>
|
||||
|
||||
<!-- 表格 -->
|
||||
<el-card style="margin-top: 30px" class="box-card">
|
||||
<el-table :data="tableData" style="width: 100%">
|
||||
<el-table-column prop="id" label="序号"> </el-table-column>
|
||||
<el-table-column prop="created_at" label="时间"> </el-table-column>
|
||||
<el-table-column prop="target_field" label="类别"> </el-table-column>
|
||||
<el-table-column prop="before_update" label="操作前"> </el-table-column>
|
||||
<el-table-column prop="after_update" label="操作后"> </el-table-column>
|
||||
<el-table-column prop="user.name" label="操作人"> </el-table-column>
|
||||
</el-table>
|
||||
|
||||
</el-card>
|
||||
<el-pagination @size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="currentPage4"
|
||||
:page-sizes="[100, 200, 300, 400]"
|
||||
:page-size="100"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="400">
|
||||
</el-pagination>
|
||||
|
||||
<!-- 分页功能 -->
|
||||
<div class="block">
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="current_page"
|
||||
:page-sizes="[15, 50, 100]"
|
||||
:page-size="per_page"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="Paginationdata.total"
|
||||
>
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from "axios";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
options: [
|
||||
{
|
||||
value: '选项1',
|
||||
label: '黄金糕',
|
||||
value: "选项1",
|
||||
label: "黄金糕",
|
||||
},
|
||||
{
|
||||
value: '选项2',
|
||||
label: '双皮奶',
|
||||
value: "选项2",
|
||||
label: "双皮奶",
|
||||
},
|
||||
{
|
||||
value: '选项3',
|
||||
label: '蚵仔煎',
|
||||
value: "选项3",
|
||||
label: "蚵仔煎",
|
||||
},
|
||||
{
|
||||
value: '选项4',
|
||||
label: '龙须面',
|
||||
value: "选项4",
|
||||
label: "龙须面",
|
||||
},
|
||||
{
|
||||
value: '选项5',
|
||||
label: '北京烤鸭',
|
||||
value: "选项5",
|
||||
label: "北京烤鸭",
|
||||
},
|
||||
],
|
||||
tableData: [
|
||||
{
|
||||
date: '2016-05-02',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1518 弄',
|
||||
},
|
||||
{
|
||||
date: '2016-05-04',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1517 弄',
|
||||
},
|
||||
{
|
||||
date: '2016-05-01',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1519 弄',
|
||||
},
|
||||
{
|
||||
date: '2016-05-03',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1516 弄',
|
||||
},
|
||||
],
|
||||
currentPage4: 4,
|
||||
form: {
|
||||
name1: '',
|
||||
name2: '',
|
||||
name3: '',
|
||||
name4: '',
|
||||
name5: '',
|
||||
name6: '',
|
||||
name1: "",
|
||||
name2: "",
|
||||
name3: "",
|
||||
name4: "",
|
||||
name5: "",
|
||||
name6: "",
|
||||
},
|
||||
input: '',
|
||||
value1: '',
|
||||
}
|
||||
input: "",
|
||||
value1: "",
|
||||
|
||||
tableData: [], //列表数据
|
||||
Paginationdata: {}, //分页相关数据
|
||||
current_page: 1, //当前页
|
||||
per_page: 15, //每页显示数量
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
//请求列表数据
|
||||
getList() {
|
||||
axios
|
||||
.get("/api/logs", {
|
||||
headers: {
|
||||
Authorization:
|
||||
"Bearer w1rr6IsxZIud46dIrGIivNAroFpqN52sSpXhk3azpPq2ZTbUXhgKTOLheoRm",
|
||||
},
|
||||
params: {
|
||||
page: this.current_page,
|
||||
per_page: this.per_page,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
this.tableData = res.data.data;
|
||||
this.Paginationdata = res.data.meta;
|
||||
});
|
||||
},
|
||||
|
||||
//分页功能
|
||||
handleSizeChange(val) {
|
||||
console.log(`每页 ${val} 条`)
|
||||
//当前条数
|
||||
this.per_page = val;
|
||||
// console.log(1111, val);
|
||||
this.getList();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
console.log(`当前页: ${val}`)
|
||||
//当前页
|
||||
this.current_page = val;
|
||||
// console.log(2222, val);
|
||||
this.getList();
|
||||
},
|
||||
},
|
||||
}
|
||||
mounted() {
|
||||
this.getList();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.block {
|
||||
margin-top: 30px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,115 +1,177 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-button type="primary"
|
||||
@click="handAdd">新增</el-button>
|
||||
<el-table :data="tableData"
|
||||
border
|
||||
style="width: 100%">
|
||||
<el-table-column prop="id"
|
||||
label="ID"
|
||||
width="180">
|
||||
</el-table-column>
|
||||
<el-table-column prop="name"
|
||||
label="店铺名称"
|
||||
width="180">
|
||||
</el-table-column>
|
||||
<el-table-column prop="plat_id"
|
||||
label="所属平台">
|
||||
</el-table-column>
|
||||
<el-table-column prop="address"
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary"
|
||||
@click="handEdit(scope.row.id,scope.row)">编辑</el-button>
|
||||
<el-button type="danger"
|
||||
@click="handdel(scope.row.id)">授权</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="conent">
|
||||
<!-- 新增按钮 -->
|
||||
<div class="btn">
|
||||
<el-button type="primary" @click="handAdd">新增</el-button>
|
||||
</div>
|
||||
|
||||
<div class="table">
|
||||
<el-table :data="tableData" style="width: 100%">
|
||||
<el-table-column prop="id" label="ID" width="180"> </el-table-column>
|
||||
<el-table-column prop="name" label="店铺名称" width="180">
|
||||
</el-table-column>
|
||||
<el-table-column prop="plat_id" label="所属平台"> </el-table-column>
|
||||
<el-table-column prop="address" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" @click="handEdit(scope.row.id, scope.row)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button type="danger" @click="handdel(scope.row.id)"
|
||||
>授权</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<!-- 新增店铺 -->
|
||||
<el-dialog title="新增店铺"
|
||||
:visible.sync="dialogFormVisible">
|
||||
<el-dialog title="新增店铺" :visible.sync="dialogFormVisible">
|
||||
<el-form :model="form">
|
||||
<el-form-item label="店铺名称">
|
||||
<el-input v-model="form.name"
|
||||
placeholder="输入店铺名称"></el-input>
|
||||
<el-input v-model="form.name" placeholder="输入店铺名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="店铺平台">
|
||||
<el-select v-model="form.plat_id"
|
||||
placeholder="输入店铺平台">
|
||||
<el-option v-for="(item,index) in storeId"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="index">
|
||||
<el-select v-model="form.plat_id" placeholder="输入店铺平台">
|
||||
<el-option
|
||||
v-for="(item, index) in storeId"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="index"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer"
|
||||
class="dialog-footer">
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||
<el-button type="primary"
|
||||
@click="addSubmit">确 定</el-button>
|
||||
<el-button type="primary" @click="addSubmit">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 分页功能 -->
|
||||
<div class="block">
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="current_page"
|
||||
:page-sizes="[15, 50, 100]"
|
||||
:page-size="per_page"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="Paginationdata.total"
|
||||
>
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { shopListId, shopAdd, storeList } from '../../api/shop'
|
||||
import { shopListId, shopAdd } from "../../api/shop";
|
||||
import axios from "axios";
|
||||
export default {
|
||||
name: 'GlxtStore',
|
||||
|
||||
data() {
|
||||
return {
|
||||
dialogFormVisible: false,
|
||||
form: {
|
||||
name: '',
|
||||
plat_id: '',
|
||||
name: "",
|
||||
plat_id: "",
|
||||
},
|
||||
storeId: [], // 店铺id
|
||||
tableData: [],
|
||||
}
|
||||
Paginationdata: {}, //分页相关数据
|
||||
current_page: 1, //当前页
|
||||
per_page: 15, //每页显示数量
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// 获取平台
|
||||
shopListId().then((res) => {
|
||||
this.storeId = res.data.data
|
||||
})
|
||||
this.storeId = res.data.data;
|
||||
});
|
||||
// 展示店铺列表
|
||||
this.getStoreList()
|
||||
this.getStoreList();
|
||||
},
|
||||
methods: {
|
||||
// 点击新增
|
||||
handAdd() {
|
||||
this.form.name = ''
|
||||
this.form.plat_id = ''
|
||||
this.dialogFormVisible = true
|
||||
this.form.name = "";
|
||||
this.form.plat_id = "";
|
||||
this.dialogFormVisible = true;
|
||||
},
|
||||
// 新增商品
|
||||
addSubmit() {
|
||||
const datas = this.form
|
||||
const datas = this.form;
|
||||
shopAdd(datas).then((res) => {
|
||||
if (res.status == 200) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '添加成功',
|
||||
})
|
||||
type: "success",
|
||||
message: "添加成功",
|
||||
});
|
||||
}
|
||||
})
|
||||
this.dialogFormVisible = false
|
||||
this.getStoreList()
|
||||
this.getStoreList();
|
||||
});
|
||||
this.dialogFormVisible = false;
|
||||
},
|
||||
// 店铺列表
|
||||
getStoreList() {
|
||||
storeList().then((res) => {
|
||||
this.tableData = res.data.data
|
||||
console.log(res, 'kkk')
|
||||
})
|
||||
// storeList().then((res) => {
|
||||
// this.tableData = res.data.data;
|
||||
// console.log(res, "kkk");
|
||||
// });
|
||||
axios
|
||||
.get("/api/shops", {
|
||||
headers: {
|
||||
Authorization:
|
||||
"Bearer w1rr6IsxZIud46dIrGIivNAroFpqN52sSpXhk3azpPq2ZTbUXhgKTOLheoRm",
|
||||
},
|
||||
params: {
|
||||
page: this.current_page,
|
||||
per_page: this.per_page,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
this.tableData = res.data.data;
|
||||
this.Paginationdata = res.data.meta;
|
||||
});
|
||||
},
|
||||
//分页功能
|
||||
handleSizeChange(val) {
|
||||
//当前条数
|
||||
this.per_page = val;
|
||||
// console.log(1111, val);
|
||||
this.getStoreList();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
//当前页
|
||||
this.current_page = val;
|
||||
// console.log(2222, val);
|
||||
this.getStoreList();
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.conent {
|
||||
width: 100%;
|
||||
min-height: calc(100vh - 200px);
|
||||
position: relative;
|
||||
}
|
||||
.btn {
|
||||
height: 104px;
|
||||
border-radius: 5px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.el-button {
|
||||
width: 114px;
|
||||
height: 44px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
}
|
||||
.table {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.block {
|
||||
margin-top: 30px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
权限管理(废弃)
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@ -1,45 +1,176 @@
|
||||
<template>
|
||||
<div class="conent">
|
||||
<!-- 新增按钮 -->
|
||||
<div class="btn">
|
||||
<el-button type="primary">新增</el-button>
|
||||
<el-button type="primary" @click="dialogVisible2 = true">新增</el-button>
|
||||
</div>
|
||||
|
||||
<!-- 点击新增弹出表单 -->
|
||||
<div class="from">
|
||||
<el-dialog title="新增角色" :visible.sync="dialogVisible2" width="30%">
|
||||
<div>
|
||||
<el-form label-width="80px">
|
||||
<el-form-item label="角色名称">
|
||||
<el-input v-model="newrole"></el-input>
|
||||
</el-form-item>
|
||||
<div class="from-btn">
|
||||
<el-button type="danger" @click="dialogVisible2 = false"
|
||||
>取消</el-button
|
||||
>
|
||||
<el-button @click="onSubmit">确认</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
<!-- 角色表单 -->
|
||||
<div class="table">
|
||||
<el-table :data="tableList" style="width: 100%">
|
||||
<el-table-column prop="id" label="ID" width="400"> </el-table-column>
|
||||
<el-table-column prop="name" label="角色名称" width="400">
|
||||
</el-table-column>
|
||||
<el-table-column prop="guard_name" label="权限内容" width="400">
|
||||
</el-table-column>
|
||||
<el-table-column prop="id" label="ID"> </el-table-column>
|
||||
<el-table-column prop="name" label="角色名称"> </el-table-column>
|
||||
<el-table-column prop="name" label="权限内容"> </el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<el-button>编辑</el-button>
|
||||
<template slot-scope="scope">
|
||||
<el-button @click="onEdit(scope.row)">编辑</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<!-- 点击编辑弹出权限框 -->
|
||||
<el-dialog title="编辑权限" :visible.sync="dialogVisible" width="30%">
|
||||
<el-tree
|
||||
:data="Role_Permission"
|
||||
show-checkbox
|
||||
:default-expand-all="false"
|
||||
node-key="id"
|
||||
ref="tree"
|
||||
highlight-current
|
||||
:props="defaultProps"
|
||||
v-model="permissionIds"
|
||||
>
|
||||
</el-tree>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="getCheckedKeys">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from "axios";
|
||||
export default {
|
||||
name: "GlxtUsers",
|
||||
|
||||
data() {
|
||||
return {
|
||||
id: "", //点击角色的id
|
||||
tableList: [], //列表数据
|
||||
newrole: "", //添加角色框input
|
||||
dialogVisible: false, //编辑按钮打开表单变量
|
||||
dialogVisible2: false, //新增按钮打开表单变量
|
||||
permissionIds: [], //复选框选中权限的ID
|
||||
allpermissionIds: {}, //id数组添加进对象
|
||||
Role_Permission: [], //权限列表数据
|
||||
defaultProps: {
|
||||
children: "children",
|
||||
label: "name",
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
//角色表单数据请求
|
||||
axios({
|
||||
method: "get",
|
||||
params: {},
|
||||
url: "http://doc.ii090.com/mock/267/api/users",
|
||||
}).then((res) => {
|
||||
this.tableList = res.data.data;
|
||||
});
|
||||
this.getroleList();
|
||||
this.getJurisdiction();
|
||||
},
|
||||
methods: {
|
||||
//角色表单数据请求
|
||||
getroleList() {
|
||||
axios
|
||||
.get("/api/roles", {
|
||||
headers: {
|
||||
Authorization:
|
||||
"Bearer w1rr6IsxZIud46dIrGIivNAroFpqN52sSpXhk3azpPq2ZTbUXhgKTOLheoRm",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
this.tableList = res.data.data;
|
||||
});
|
||||
},
|
||||
|
||||
//角色权限请求
|
||||
getJurisdiction() {
|
||||
axios
|
||||
.get("/api/permissions", {
|
||||
headers: {
|
||||
Authorization:
|
||||
"Bearer w1rr6IsxZIud46dIrGIivNAroFpqN52sSpXhk3azpPq2ZTbUXhgKTOLheoRm",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
this.Role_Permission = res.data.data;
|
||||
});
|
||||
},
|
||||
|
||||
// 点击新增
|
||||
onSubmit() {
|
||||
let roleName = {
|
||||
name: this.newrole,
|
||||
};
|
||||
axios
|
||||
.post("/api/roles", roleName, {
|
||||
headers: {
|
||||
Authorization:
|
||||
"Bearer w1rr6IsxZIud46dIrGIivNAroFpqN52sSpXhk3azpPq2ZTbUXhgKTOLheoRm",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
this.dialogVisible2 = false;
|
||||
this.getroleList();
|
||||
if (res.status == 201) {
|
||||
this.$message({
|
||||
message: "角色添加成功!",
|
||||
type: "success",
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 点击编辑
|
||||
onEdit(row) {
|
||||
this.dialogVisible = true;
|
||||
// console.log(row.id);
|
||||
this.id = row.id;
|
||||
},
|
||||
|
||||
//编辑权限确认
|
||||
getCheckedKeys() {
|
||||
let id = this.id; //选中角色的ID
|
||||
|
||||
this.permissionIds = this.$refs.tree.getCheckedKeys(); //选中权限的ID
|
||||
// console.log(this.permissionIds);
|
||||
this.allpermissionIds = {
|
||||
permissionIds: this.permissionIds,
|
||||
};
|
||||
// console.log(this.allpermissionIds);
|
||||
|
||||
axios
|
||||
.post(`/api/roles/${id}/permissions`, this.allpermissionIds, {
|
||||
headers: {
|
||||
Authorization:
|
||||
"Bearer w1rr6IsxZIud46dIrGIivNAroFpqN52sSpXhk3azpPq2ZTbUXhgKTOLheoRm",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.status === 200) {
|
||||
this.dialogVisible = false;
|
||||
this.$message({
|
||||
message: "权限修改成功!",
|
||||
type: "success",
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
@ -62,4 +193,10 @@ export default {
|
||||
.table {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.from-btn {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-content: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -91,7 +91,7 @@
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="current_page"
|
||||
:page-sizes="[15, 50, 100]"
|
||||
:page-size="15"
|
||||
:page-size="per_page"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="Paginationdata.total"
|
||||
>
|
||||
@ -114,7 +114,7 @@ export default {
|
||||
name: "",
|
||||
password: "",
|
||||
password_confirmation: "",
|
||||
role_name: "超级管理员",
|
||||
role_name: "",
|
||||
},
|
||||
edit_from: {
|
||||
// 编辑返回默认数据
|
||||
@ -125,7 +125,7 @@ export default {
|
||||
name: "",
|
||||
password: "",
|
||||
password_confirmation: "",
|
||||
role_name: "超级管理员",
|
||||
role_name: "",
|
||||
},
|
||||
Paginationdata: {}, //分页相关数据
|
||||
current_page: 1, //当前页
|
||||
@ -140,18 +140,17 @@ export default {
|
||||
//用户表单数据请求
|
||||
getList() {
|
||||
axios
|
||||
.get("api/users",{
|
||||
.get("api/users", {
|
||||
headers: {
|
||||
Authorization:
|
||||
"Bearer w1rr6IsxZIud46dIrGIivNAroFpqN52sSpXhk3azpPq2ZTbUXhgKTOLheoRm",
|
||||
},
|
||||
params:{
|
||||
page:this.current_page,
|
||||
per_page:this.per_page,
|
||||
}
|
||||
params: {
|
||||
page: this.current_page,
|
||||
per_page: this.per_page,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
this.tableList = res.data.data;
|
||||
this.Paginationdata = res.data.meta;
|
||||
});
|
||||
@ -180,7 +179,7 @@ export default {
|
||||
//点击编辑
|
||||
openEdit(e) {
|
||||
this.editVisible = true;
|
||||
console.log(e.id);
|
||||
// console.log(e.id);
|
||||
let id = e.id;
|
||||
this.id = e.id;
|
||||
// 请求id对应数据
|
||||
@ -192,7 +191,6 @@ export default {
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res.data.data);
|
||||
this.edit_from = res.data.data;
|
||||
});
|
||||
},
|
||||
@ -220,13 +218,15 @@ export default {
|
||||
},
|
||||
//分页功能
|
||||
handleSizeChange(val) {
|
||||
this.current_page = val;
|
||||
console.log(this.current_page);
|
||||
//当前条数
|
||||
this.per_page = val;
|
||||
// console.log(1111, val);
|
||||
this.getList();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.per_page = val;
|
||||
console.log(this.per_page);
|
||||
//当前页
|
||||
this.current_page = val;
|
||||
// console.log(2222, val);
|
||||
this.getList();
|
||||
},
|
||||
},
|
||||
|
||||
@ -1,22 +1,27 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card class="box-card">
|
||||
<div class="goods"
|
||||
style="margin:20px">
|
||||
<div class="add-item-info"
|
||||
style="margin-bottom:10px;margin-left:52px">
|
||||
<div class="goods" style="margin: 20px">
|
||||
<div
|
||||
class="add-item-info"
|
||||
style="margin-bottom: 10px; margin-left: 52px"
|
||||
>
|
||||
<div>
|
||||
<div style="font-size:14px;">商品列表:</div>
|
||||
<el-select v-model="lid"
|
||||
placeholder="选择商品">
|
||||
<el-option v-for="item in goodschoose"
|
||||
:key="item.id"
|
||||
:label="item.title"
|
||||
:value="item.id">
|
||||
<div style="font-size: 14px">商品列表:</div>
|
||||
<el-select v-model="lid" placeholder="选择商品">
|
||||
<el-option
|
||||
v-for="item in goodschoose"
|
||||
:key="item.id"
|
||||
:label="item.title"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<span style="font-size:14px;">商品图片:</span>
|
||||
<span style="font-size: 14px"
|
||||
>商品图片:
|
||||
<UploadTem />
|
||||
</span>
|
||||
<!-- <UploadTem @urlimg='hanleurlimg'
|
||||
:number="2"
|
||||
:file='file' /> -->
|
||||
@ -35,154 +40,150 @@
|
||||
class="el-icon-plus avatar-uploader-icon"></i>
|
||||
</el-upload> -->
|
||||
</div>
|
||||
<el-form ref="form"
|
||||
:inline="true"
|
||||
:model="form">
|
||||
<el-form ref="form" :inline="true" :model="form">
|
||||
<div>
|
||||
<el-form-item label="商品名称:">
|
||||
<el-input placeholder="商品名称"
|
||||
v-model="form.title"></el-input>
|
||||
<el-input placeholder="商品名称" v-model="form.title"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品编码:">
|
||||
<el-input placeholder="商品编码"
|
||||
v-model="form.goods_code"></el-input>
|
||||
<el-input
|
||||
placeholder="商品编码"
|
||||
v-model="form.goods_code"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品种类:">
|
||||
<el-select v-model="form.type_id"
|
||||
placeholder="商品种类">
|
||||
<el-option v-for="item in cate"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
<el-select v-model="form.type_id" placeholder="商品种类">
|
||||
<el-option
|
||||
v-for="item in cate"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品品牌:">
|
||||
<el-select v-model="form.brand_id"
|
||||
placeholder="商品品牌">
|
||||
<el-option v-for="item in brand"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
<el-select v-model="form.brand_id" placeholder="商品品牌">
|
||||
<el-option
|
||||
v-for="item in brand"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div v-for="(item,i) in skus"
|
||||
:key="i">
|
||||
<span style="margin-right:-15px">{{i+1}}.</span>
|
||||
<div v-for="(item, i) in skus" :key="i">
|
||||
<span style="margin-right: -15px">{{ i + 1 }}.</span>
|
||||
<el-form-item label="商品规格:">
|
||||
<el-input placeholder="商品规格"
|
||||
v-model="skus[i].title"></el-input>
|
||||
<el-input
|
||||
placeholder="商品规格"
|
||||
v-model="skus[i].title"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<span class="addto"
|
||||
v-if="!gid"
|
||||
@click="handleAdd()">+</span>
|
||||
<span class="addto" v-if="!gid" @click="handleAdd()">+</span>
|
||||
<el-form-item label="规格编码:">
|
||||
<el-input v-model="skus[i].sku_code"
|
||||
placeholder="商品编码">
|
||||
<el-input v-model="skus[i].sku_code" placeholder="商品编码">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品状态:">
|
||||
<el-select v-model="skus[i].status"
|
||||
placeholder="下架(默认)">
|
||||
<el-option v-for="item in options"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.id">
|
||||
<el-select v-model="skus[i].status" placeholder="下架(默认)">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<div>
|
||||
<el-form-item label="商品数量:">
|
||||
<el-input v-model="skus[i].num"
|
||||
placeholder="商品数量">
|
||||
<el-input v-model="skus[i].num" placeholder="商品数量">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品成本:">
|
||||
<el-input v-model="skus[i].cost"
|
||||
placeholder="商品成本">
|
||||
<el-input v-model="skus[i].cost" placeholder="商品成本">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-button type="primary"
|
||||
@click="handleDelete(i)">删除</el-button>
|
||||
<el-button type="primary" @click="handleDelete(i)"
|
||||
>删除</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn">
|
||||
<el-form-item>
|
||||
<el-button type="primary"
|
||||
@click="handleSave()">保存</el-button>
|
||||
<el-button type="primary" @click="handleSave()">保存</el-button>
|
||||
<el-button plain>取消</el-button>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
</el-form>
|
||||
|
||||
</div>
|
||||
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import UploadTem from '../../../components/upload/index.vue'
|
||||
import UploadTem from "../../../components/upload/index.vue";
|
||||
import {
|
||||
addGoods,
|
||||
checkGoods,
|
||||
goodsList,
|
||||
updateGoods,
|
||||
} from '../../../api/goods.js'
|
||||
import { goods_types, Brand_goods_types } from '../../../api/rankingData.js'
|
||||
} from "../../../api/goods.js";
|
||||
import { goods_types, Brand_goods_types } from "../../../api/rankingData.js";
|
||||
import axios from "axios";
|
||||
export default {
|
||||
components: {
|
||||
UploadTem,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
gallery: '',
|
||||
imageUrl: '',
|
||||
lid: '', // 选择的商品列表id
|
||||
gid: '', // 商品id
|
||||
gallery: "",
|
||||
imageUrl: "",
|
||||
lid: "", // 选择的商品列表id
|
||||
gid: "", // 商品id
|
||||
brand: [], // 品牌列表
|
||||
cate: [], // 种类列表
|
||||
goodschoose: [], // 商品列表
|
||||
// 规格列表
|
||||
skus: [
|
||||
{
|
||||
title: '',
|
||||
sku_code: '',
|
||||
status: '',
|
||||
num: '',
|
||||
cost: '',
|
||||
title: "",
|
||||
sku_code: "",
|
||||
status: "",
|
||||
num: "",
|
||||
cost: "",
|
||||
},
|
||||
],
|
||||
|
||||
// 增加商品表单
|
||||
form: {
|
||||
goods_id: '',
|
||||
title: '',
|
||||
img_url: 'abc.jpg',
|
||||
type_id: '',
|
||||
brand_id: '',
|
||||
goods_code: '',
|
||||
goods_id: "",
|
||||
title: "",
|
||||
img_url: "https://cn.vuejs.org/images/logo.svg",
|
||||
type_id: "",
|
||||
brand_id: "",
|
||||
goods_code: "",
|
||||
},
|
||||
// 商品状态
|
||||
options: [
|
||||
{
|
||||
id: '1',
|
||||
label: '在售',
|
||||
id: "1",
|
||||
label: "在售",
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
label: '预警',
|
||||
id: "2",
|
||||
label: "预警",
|
||||
},
|
||||
{
|
||||
id: '0',
|
||||
label: '下架',
|
||||
id: "0",
|
||||
label: "下架",
|
||||
},
|
||||
],
|
||||
file: [],
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
@ -191,9 +192,9 @@ export default {
|
||||
if (newVal) {
|
||||
this.goodschoose.forEach((item) => {
|
||||
if (item.id == newVal) {
|
||||
this.form = { ...item }
|
||||
this.form = { ...item };
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
},
|
||||
deep: true, // 深度监听
|
||||
@ -203,126 +204,162 @@ export default {
|
||||
methods: {
|
||||
// 查看一个商品
|
||||
handleUpdate() {
|
||||
this.gid = this.$route.query
|
||||
this.gid = this.$route.query;
|
||||
if (this.gid.id) {
|
||||
checkGoods(this.gid.id).then((res) => {
|
||||
console.log(res.data.data, 'oooppuu')
|
||||
const data = res.data.data
|
||||
const sku = this.skus[0]
|
||||
const list = {}
|
||||
console.log(res.data.data, "oooppuu");
|
||||
const data = res.data.data;
|
||||
const sku = this.skus[0];
|
||||
const list = {};
|
||||
Object.keys(data).map((key) => {
|
||||
Object.keys(sku).map((i) => {
|
||||
if (key == i) {
|
||||
list[i] = data[key]
|
||||
list[i] = data[key];
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
// 商品列表
|
||||
handleList() {
|
||||
goodsList().then((res) => {
|
||||
this.goodschoose = res.data.data
|
||||
})
|
||||
this.goodschoose = res.data.data;
|
||||
});
|
||||
},
|
||||
// 保存,增加一个商品
|
||||
handleSave() {
|
||||
if (this.gid) {
|
||||
const goods = this.form
|
||||
const sku = this.skus[0]
|
||||
const updata = {
|
||||
...goods,
|
||||
...sku,
|
||||
goods_id: this.lid,
|
||||
}
|
||||
console.log(updata, '24235345')
|
||||
// updateGoods(updata, this.gid).then((res) => {
|
||||
// console.log(res, '66666666')
|
||||
// })
|
||||
} else {
|
||||
const datas = {
|
||||
...this.form,
|
||||
skus: this.skus,
|
||||
}
|
||||
addGoods(datas)
|
||||
.then((res) => {
|
||||
if (res.data.httpCode == 200) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '添加成功',
|
||||
})
|
||||
this.updateForm()
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
const goods = this.form;
|
||||
const sku2 = this.skus[0];
|
||||
const skus = [];
|
||||
skus.push(sku2);
|
||||
// console.log(goods, skus);
|
||||
|
||||
const updata = {
|
||||
...goods,
|
||||
goods_id: this.lid,
|
||||
skus: skus,
|
||||
};
|
||||
// console.log(updata);
|
||||
|
||||
axios
|
||||
.post("/api/goods", updata, {
|
||||
headers: {
|
||||
Authorization:
|
||||
"Bearer w1rr6IsxZIud46dIrGIivNAroFpqN52sSpXhk3azpPq2ZTbUXhgKTOLheoRm",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.statusText === "OK") {
|
||||
this.$message({
|
||||
type: 'error',
|
||||
message: e.response.data.errorMessage.goods_code[0],
|
||||
})
|
||||
})
|
||||
}
|
||||
message: "商品添加成功!",
|
||||
type: "success",
|
||||
});
|
||||
this.updateForm();
|
||||
} else {
|
||||
this.$message({
|
||||
message: "商品添加失败!",
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// if (this.gid) {
|
||||
// const goods = this.form;
|
||||
// const sku = this.skus[0];
|
||||
// const updata = {
|
||||
// ...goods,
|
||||
// ...sku,
|
||||
// goods_id: this.lid,
|
||||
// };
|
||||
// console.log(updata);
|
||||
// } else {
|
||||
// console.log(1111);
|
||||
// const datas = {
|
||||
// ...this.form,
|
||||
// skus: this.skus,
|
||||
// };
|
||||
|
||||
// addGoods(datas)
|
||||
// .then((res) => {
|
||||
// console.log("请求发起");
|
||||
// if (res.data.httpCode == 200) {
|
||||
// this.$message({
|
||||
// type: "success",
|
||||
// message: "添加成功",
|
||||
// });
|
||||
// this.updateForm();
|
||||
// }
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// this.$message({
|
||||
// type: "error",
|
||||
// message: e.response.data.errorMessage.goods_code[0],
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
},
|
||||
|
||||
// 修改成功后重置表单
|
||||
updateForm() {
|
||||
this.form = {
|
||||
title: '',
|
||||
img_url: 'abc.jpg',
|
||||
type_id: '',
|
||||
brand_id: '',
|
||||
goods_code: '',
|
||||
}
|
||||
title: "",
|
||||
img_url: "abc.jpg",
|
||||
type_id: "",
|
||||
brand_id: "",
|
||||
goods_code: "",
|
||||
};
|
||||
this.skus = [
|
||||
{
|
||||
title: '',
|
||||
sku_code: '',
|
||||
status: '',
|
||||
num: '',
|
||||
cost: '',
|
||||
title: "",
|
||||
sku_code: "",
|
||||
status: "",
|
||||
num: "",
|
||||
cost: "",
|
||||
},
|
||||
]
|
||||
];
|
||||
},
|
||||
// 增加一个商品规格
|
||||
handleAdd() {
|
||||
this.skus.push({
|
||||
title: '',
|
||||
sku_code: '',
|
||||
status: '',
|
||||
num: '',
|
||||
cost: '',
|
||||
})
|
||||
title: "",
|
||||
sku_code: "",
|
||||
status: "",
|
||||
num: "",
|
||||
cost: "",
|
||||
});
|
||||
},
|
||||
// 删除一个商品规格
|
||||
handleDelete(index) {
|
||||
this.skus.splice(index, 1)
|
||||
this.skus.splice(index, 1);
|
||||
},
|
||||
hanleurlimg(val) {
|
||||
console.log(val, '=+++++++++')
|
||||
console.log(val, "=+++++++++");
|
||||
},
|
||||
// 上传商品图片
|
||||
successUpload(file, fileList) {
|
||||
console.log(file, fileList, 5555)
|
||||
console.log(file, fileList, 5555);
|
||||
},
|
||||
errorUpload(file, fileList) {
|
||||
console.log(file, fileList, 5555)
|
||||
console.log(file, fileList, 5555);
|
||||
},
|
||||
// 移除商品图片
|
||||
removeUpload() {},
|
||||
},
|
||||
mounted() {
|
||||
this.gid = this.$route.query
|
||||
this.gid = this.$route.query;
|
||||
// 获取商品种类
|
||||
goods_types().then((res) => {
|
||||
this.cate = res.data.data
|
||||
})
|
||||
this.cate = res.data.data;
|
||||
});
|
||||
// 获取商品品牌
|
||||
Brand_goods_types().then((res) => {
|
||||
this.brand = res.data.data
|
||||
})
|
||||
this.handleList()
|
||||
this.handleUpdate()
|
||||
this.brand = res.data.data;
|
||||
});
|
||||
this.handleList();
|
||||
this.handleUpdate();
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@ -1,192 +1,163 @@
|
||||
<template>
|
||||
<!-- 商品管理页面 -->
|
||||
<div>
|
||||
<!-- 条件筛选板块 -->
|
||||
<el-card class="box-card">
|
||||
<div class="goods"
|
||||
style="margin:20px">
|
||||
<el-form ref="form"
|
||||
:inline="true"
|
||||
:model="form">
|
||||
<div class="goods" style="margin: 20px">
|
||||
<el-form ref="form" :inline="true" :model="form">
|
||||
<el-form-item label="商品名称:">
|
||||
<el-input v-model="form.goods_title"
|
||||
placeholder="商品名称">
|
||||
<el-input v-model="form.goods_title" placeholder="商品名称">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品种类:">
|
||||
<el-select v-model="form.type_id"
|
||||
placeholder="商品种类">
|
||||
<el-option v-for="item in cate"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
<el-select v-model="form.type_id" placeholder="商品种类">
|
||||
<el-option
|
||||
v-for="item in cate"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品规格:">
|
||||
<el-input v-model="form.sku_title"
|
||||
placeholder="商品规格">
|
||||
|
||||
<el-input v-model="form.sku_title" placeholder="商品规格">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品品牌:">
|
||||
<el-select v-model="form.brand_id"
|
||||
placeholder="商品品牌">
|
||||
<el-option v-for="item in brand"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
<el-select v-model="form.brand_id" placeholder="商品品牌">
|
||||
<el-option
|
||||
v-for="item in brand"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品库存:">
|
||||
<el-input v-model="form.keyword_type"
|
||||
placeholder="商品库存">
|
||||
|
||||
<el-input v-model="form.keyword_type" placeholder="商品库存">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品状态:">
|
||||
<el-select v-model="form.status"
|
||||
placeholder="商品状态">
|
||||
<el-option v-for="item in options"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.id">
|
||||
<el-select v-model="form.status" placeholder="商品状态">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间:">
|
||||
<el-date-picker v-model="timer"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
align="right"
|
||||
value-format="yyyy-MM-DD hh:mm:ss">
|
||||
<el-date-picker
|
||||
v-model="timer"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
align="right"
|
||||
value-format="yyyy-MM-DD hh:mm:ss"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary"
|
||||
@click="handleChoose">筛选</el-button>
|
||||
<el-button plain
|
||||
@click="handleReChoose">重置筛选</el-button>
|
||||
<el-button type="primary" @click="handleChoose">筛选</el-button>
|
||||
<el-button plain @click="handleReChoose">重置筛选</el-button>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
|
||||
</div>
|
||||
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card1"
|
||||
style="margin-top:30px">
|
||||
<el-card class="box-card1" style="margin-top: 30px">
|
||||
<div>
|
||||
<!-- 表格头部操作 -->
|
||||
<div>
|
||||
<span>
|
||||
全部商品(共800条)
|
||||
</span>
|
||||
<span> 全部商品(共{{ total }}条) </span>
|
||||
<div class="btn">
|
||||
<el-button type="primary"
|
||||
plain
|
||||
@click="addNewgoods">新建商品</el-button>
|
||||
<el-button type="primary"
|
||||
@click="update()"
|
||||
plain>上新</el-button>
|
||||
<el-button type="primary"
|
||||
plain>库存盘点</el-button>
|
||||
<el-button type="primary"
|
||||
plain
|
||||
@click="handleImport">导入商品</el-button>
|
||||
<el-button type="primary"
|
||||
plain
|
||||
@click="handleExport">表格导出</el-button>
|
||||
<el-button type="primary" plain @click="addNewgoods"
|
||||
>新建商品</el-button
|
||||
>
|
||||
<el-button type="primary" @click="update()" plain>上新</el-button>
|
||||
<el-button type="primary" plain>库存盘点</el-button>
|
||||
<el-button type="primary" plain @click="handleImport"
|
||||
>导入商品</el-button
|
||||
>
|
||||
<el-button type="primary" plain @click="handleExport"
|
||||
>表格导出</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 表格 -->
|
||||
<el-table ref="multipleTable"
|
||||
:data="tableData"
|
||||
border
|
||||
class="table"
|
||||
tooltip-effect="dark"
|
||||
style="width: 100%"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection"
|
||||
width="55">
|
||||
</el-table-column>
|
||||
<el-table
|
||||
ref="multipleTable"
|
||||
:data="tableData"
|
||||
class="table"
|
||||
tooltip-effect="dark"
|
||||
style="width: 100%"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55"> </el-table-column>
|
||||
<el-table-column label="商品信息">
|
||||
<template slot-scope="scope">
|
||||
<div>{{ scope.row.goods.img_url}}</div>
|
||||
<div>{{ scope.row.goods.title}}</div>
|
||||
<div>{{ scope.row.goods.img_url }}</div>
|
||||
<div>{{ scope.row.goods.title }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="品类">
|
||||
<template slot-scope="scope">
|
||||
<div>{{ scope.row.goods.type?scope.row.goods.type.name:''}}</div>
|
||||
<div>
|
||||
{{ scope.row.goods.type ? scope.row.goods.type.name : "" }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格"
|
||||
prop="title">
|
||||
</el-table-column>
|
||||
<el-table-column label="规格" prop="title"> </el-table-column>
|
||||
<el-table-column label="品牌">
|
||||
<template slot-scope="scope">
|
||||
<div>{{ scope.row.goods.brand?scope.row.goods.brand.name:''}}</div>
|
||||
<div>
|
||||
{{ scope.row.goods.brand ? scope.row.goods.brand.name : "" }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="two_days_ago_num"
|
||||
sortable
|
||||
label="2天前库存">
|
||||
<el-table-column prop="two_days_ago_num" sortable label="2天前库存">
|
||||
</el-table-column>
|
||||
<el-table-column prop="yesterday_num"
|
||||
sortable
|
||||
label="1天前库存">
|
||||
<el-table-column prop="yesterday_num" sortable label="1天前库存">
|
||||
</el-table-column>
|
||||
<el-table-column sortable
|
||||
label="今日到货">
|
||||
<el-table-column sortable label="今日到货">
|
||||
<template slot-scope="scope">
|
||||
<div>
|
||||
<div v-if="true">
|
||||
<el-input v-model="input"></el-input>
|
||||
</div>
|
||||
<div>{{ scope.row.daily!=null?scope.row.daily.arrived_today_num:0}}</div>
|
||||
<div>
|
||||
{{
|
||||
scope.row.daily != null
|
||||
? scope.row.daily.arrived_today_num
|
||||
: 0
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column prop="cost"
|
||||
sortable
|
||||
label="成本">
|
||||
<el-table-column prop="cost" sortable label="成本">
|
||||
<template>
|
||||
<div v-if="isShow">
|
||||
<el-input v-model="input"></el-input>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column prop="reference_price"
|
||||
sortable
|
||||
label="参考售价">
|
||||
|
||||
<el-table-column prop="reference_price" sortable label="参考售价">
|
||||
</el-table-column>
|
||||
<el-table-column prop="num"
|
||||
sortable
|
||||
label="总量">
|
||||
<el-table-column prop="num" sortable label="总量"> </el-table-column>
|
||||
<el-table-column prop="reserve" sortable label="预留量">
|
||||
</el-table-column>
|
||||
<el-table-column prop="reserve"
|
||||
sortable
|
||||
label="预留量">
|
||||
<el-table-column prop="name" sortable label="店铺订单">
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="name"
|
||||
sortable
|
||||
label="店铺订单">
|
||||
</el-table-column> -->
|
||||
<el-table-column sortable
|
||||
label="损耗">
|
||||
|
||||
<el-table-column sortable label="损耗">
|
||||
<template slot-scope="scope">
|
||||
|
||||
<el-popover width="200"
|
||||
placement="right"
|
||||
trigger="hover">
|
||||
<el-popover width="200" placement="right" trigger="hover">
|
||||
<div class="detail">
|
||||
<span>损耗:</span>
|
||||
<el-input></el-input>
|
||||
@ -204,180 +175,170 @@
|
||||
<el-button type="primary">保存</el-button>
|
||||
<el-button>取消</el-button>
|
||||
</div>
|
||||
<div class="loss"
|
||||
slot="reference">{{ scope.row.daily?scope.row.daily.arrived_loss_num:0}}</div>
|
||||
<div class="loss" slot="reference">
|
||||
{{ scope.row.daily ? scope.row.daily.arrived_loss_num : 0 }}
|
||||
</div>
|
||||
</el-popover>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="stock"
|
||||
sortable
|
||||
label="库存">
|
||||
<el-table-column prop="stock" sortable label="库存">
|
||||
</el-table-column>
|
||||
<el-table-column prop="address"
|
||||
sortable
|
||||
label="库存盘点">
|
||||
<el-table-column prop="address" sortable label="库存盘点">
|
||||
<template slot-scope="scope">
|
||||
<div>{{ scope.row.daily?scope.row.daily.inventory:0}}</div>
|
||||
<div>{{ scope.row.daily ? scope.row.daily.inventory : 0 }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status"
|
||||
label="状态">
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" label="状态"> </el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
<div>
|
||||
<el-button type="text">库存</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="text"
|
||||
@click="handleEdit(scope.row.id)">编辑</el-button>
|
||||
<el-button type="text" @click="handleEdit(scope.row.id)"
|
||||
>编辑</el-button
|
||||
>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="text">记录</el-button>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<el-button type="primary">确定</el-button>
|
||||
</el-card>
|
||||
<div class="page-pagination">
|
||||
<el-pagination :total="total"
|
||||
class="mt-4"
|
||||
:current-page="form.page"
|
||||
:page-size="form.per_page"
|
||||
@current-change="handleCurrentChange"
|
||||
@size-change="handleSizeChange"
|
||||
layout="total, prev, pager, next, jumper">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { goods } from '../../api/goods'
|
||||
import { goods_types, Brand_goods_types } from '../../api/rankingData.js'
|
||||
import axios from "axios";
|
||||
import { goods } from "../../api/goods";
|
||||
import { goods_types, Brand_goods_types } from "../../api/rankingData.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
total: 0, // 总条数
|
||||
timer: '', // 筛选的时间
|
||||
radio: '', // 损耗选择的原因
|
||||
timer: "", // 筛选的时间
|
||||
radio: "", // 损耗选择的原因
|
||||
brand: [], // 品牌列表
|
||||
cate: [], // 种类列表
|
||||
isShow: false, // 点击上新显示输入框
|
||||
tableData: [], // 商品列表
|
||||
// 商品状态
|
||||
options: [
|
||||
{
|
||||
id: '1',
|
||||
label: '在售',
|
||||
id: "1",
|
||||
label: "在售",
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
label: '预警',
|
||||
id: "2",
|
||||
label: "预警",
|
||||
},
|
||||
{
|
||||
id: '0',
|
||||
label: '下架',
|
||||
id: "0",
|
||||
label: "下架",
|
||||
},
|
||||
],
|
||||
], // 商品状态
|
||||
|
||||
// 请求商品列表的参数
|
||||
form: {
|
||||
goods_title: '', // 商品名称
|
||||
type_id: '', // 商品种类id
|
||||
brand_id: '', // 商品品牌id
|
||||
sku_title: '', // 商品规格
|
||||
status: '', // 商品状态
|
||||
keyword_type: '', // 库存
|
||||
keyword_value: '',
|
||||
goods_title: "", // 商品名称
|
||||
type_id: "", // 商品种类id
|
||||
brand_id: "", // 商品品牌id
|
||||
sku_title: "", // 商品规格
|
||||
status: "", // 商品状态
|
||||
keyword_type: "", // 库存
|
||||
keyword_value: "",
|
||||
page: 1,
|
||||
per_page: 5,
|
||||
},
|
||||
input: '',
|
||||
value1: '',
|
||||
currentPage4: 4,
|
||||
}
|
||||
input: "",
|
||||
value1: "",
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
list() {
|
||||
axios.get("/api/goods").then((res) => {
|
||||
console.log("我是商品", res);
|
||||
});
|
||||
},
|
||||
|
||||
// 列表编辑
|
||||
handleEdit(id) {
|
||||
this.$router.push('/addgoods?id=' + id)
|
||||
this.$router.push("/addgoods?id=" + id);
|
||||
},
|
||||
// 获取商品列表
|
||||
getList() {
|
||||
this.form.keyword_value = this.timer[0] + '-' + this.timer[1]
|
||||
const forms = { ...this.form }
|
||||
console.log(forms, 'opopo')
|
||||
this.form.keyword_value = this.timer[0] + "-" + this.timer[1];
|
||||
const forms = { ...this.form };
|
||||
// console.log(forms, 'opopo')
|
||||
goods(forms).then((res) => {
|
||||
this.tableData = res.data.data
|
||||
console.log(res, 111)
|
||||
console.log(res);
|
||||
this.tableData = res.data.data;
|
||||
// console.log(res, 111)
|
||||
// console.log(this.tableData, 'ppp')
|
||||
})
|
||||
});
|
||||
},
|
||||
// 筛选
|
||||
handleChoose() {
|
||||
this.getList()
|
||||
this.getList();
|
||||
},
|
||||
// 分页-当前页改变
|
||||
handleCurrentChange(e) {
|
||||
this.form.page = e
|
||||
this.handleChoose()
|
||||
this.form.page = e;
|
||||
this.handleChoose();
|
||||
},
|
||||
// 分页
|
||||
handleSizeChange(e) {
|
||||
this.form.per_page = e
|
||||
this.getList()
|
||||
this.form.per_page = e;
|
||||
this.getList();
|
||||
},
|
||||
// 重置筛选
|
||||
handleReChoose() {
|
||||
this.form = {
|
||||
goods_title: '', // 商品名称
|
||||
type_id: '', // 商品种类id
|
||||
brand_id: '', // 商品品牌id
|
||||
sku_title: '', // 商品规格
|
||||
status: '', // 商品状态
|
||||
keyword_type: '',
|
||||
}
|
||||
this.timer = ''
|
||||
goods_title: "", // 商品名称
|
||||
type_id: "", // 商品种类id
|
||||
brand_id: "", // 商品品牌id
|
||||
sku_title: "", // 商品规格
|
||||
status: "", // 商品状态
|
||||
keyword_type: "",
|
||||
};
|
||||
this.timer = "";
|
||||
},
|
||||
|
||||
// 导入商品
|
||||
handleImport() {},
|
||||
// 导出商品
|
||||
handleExport() {},
|
||||
|
||||
// 点击上新
|
||||
update() {
|
||||
this.isShow = true
|
||||
console.log(this.isShow, 8888)
|
||||
this.isShow = true;
|
||||
console.log(this.isShow, 8888);
|
||||
},
|
||||
// 复选框按钮
|
||||
handleSelectionChange(val) {
|
||||
console.log(val)
|
||||
this.multipleSelection = val
|
||||
console.log(val);
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
// 新增商品
|
||||
// 新增商品跳转
|
||||
addNewgoods() {
|
||||
this.$router.push({ path: '/addgoods' })
|
||||
this.$router.push("/index/yingyeting/addgoods");
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
// 获取商品种类
|
||||
goods_types().then((res) => {
|
||||
this.cate = res.data.data
|
||||
})
|
||||
this.cate = res.data.data;
|
||||
});
|
||||
// 获取商品品牌
|
||||
Brand_goods_types().then((res) => {
|
||||
this.brand = res.data.data
|
||||
})
|
||||
this.brand = res.data.data;
|
||||
});
|
||||
// 获取商品列表
|
||||
this.getList()
|
||||
this.getList();
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="css" scoped>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user